Changeset 215900 in webkit
- Timestamp:
- Apr 27, 2017 3:57:32 PM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r215893 r215900 1 2017-04-27 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 REGRESSION(r213764): Async decoding of animated images is disabled for ImageDocument 4 https://bugs.webkit.org/show_bug.cgi?id=170333 5 6 Reviewed by Simon Fraser. 7 8 The way the image drawing settings are transfered from the Settings to 9 BitmapImage is problematic. The drawing settings are retrieved from the 10 CachedImageObserver which store them in the constructor only if the 11 CachedImage as a loader. In the case of ImageDocument, there isn't loader 12 set in CachedImage so the settings of ImageDocument are not set. Also 13 the CachedImage can be used after loading by another document which may 14 have a different drawing settings. 15 16 The fix is to make BitmapImage reads the drawing settings every time it 17 is drawn as a foreground or background image in a RenderElement. 18 19 * html/canvas/CanvasRenderingContext2D.cpp: 20 (WebCore::CanvasRenderingContext2D::drawImage): 21 * loader/cache/CachedImage.cpp: 22 (WebCore::CachedImage::CachedImageObserver::CachedImageObserver): 23 * loader/cache/CachedImage.h: 24 * platform/graphics/BitmapImage.cpp: 25 (WebCore::BitmapImage::setDrawingSettings): 26 (WebCore::BitmapImage::draw): 27 (WebCore::BitmapImage::shouldUseAsyncDecodingForLargeImages): I was 28 trying to disable the async image decoding temporarily but this way will 29 even prevent testing it until it is enabled. Disable it through WK1 and 30 WK2 preferences. 31 (WebCore::BitmapImage::shouldUseAsyncDecodingForAnimatedImages): 32 (WebCore::BitmapImage::advanceAnimation): 33 * platform/graphics/BitmapImage.h: 34 * platform/graphics/ImageObserver.h: 35 * rendering/RenderBoxModelObject.cpp: 36 (WebCore::RenderBoxModelObject::paintFillLayerExtended): 37 * rendering/RenderImage.cpp: 38 (WebCore::RenderImage::paintIntoRect): 39 1 40 2017-04-27 Wenson Hsieh <wenson_hsieh@apple.com> 2 41 -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r215632 r215900 1432 1432 } 1433 1433 1434 if (image->isBitmapImage()) 1435 downcast<BitmapImage>(*image).updateFromSettings(imageElement.document().settings()); 1436 1434 1437 if (rectContainsCanvas(normalizedDstRect)) { 1435 1438 c->drawImage(*image, normalizedDstRect, normalizedSrcRect, ImagePaintingOptions(op, blendMode)); -
trunk/Source/WebCore/loader/cache/CachedImage.cpp
r215829 r215900 353 353 m_cachedImages.reserveInitialCapacity(1); 354 354 m_cachedImages.append(&image); 355 if (auto* loader = image.loader()) {356 m_allowSubsampling = loader->frameLoader()->frame().settings().imageSubsamplingEnabled();357 m_allowLargeImageAsyncDecoding = loader->frameLoader()->frame().settings().largeImageAsyncDecodingEnabled();358 m_allowAnimatedImageAsyncDecoding = loader->frameLoader()->frame().settings().animatedImageAsyncDecodingEnabled();359 m_showDebugBackground = loader->frameLoader()->frame().settings().showDebugBorders();360 }361 355 } 362 356 -
trunk/Source/WebCore/loader/cache/CachedImage.h
r215829 r215900 129 129 // ImageObserver API 130 130 URL sourceUrl() const override { return m_cachedImages[0]->url(); } 131 bool allowSubsampling() const final { return m_allowSubsampling; }132 bool allowLargeImageAsyncDecoding() const override { return m_allowLargeImageAsyncDecoding; }133 bool allowAnimatedImageAsyncDecoding() const override { return m_allowAnimatedImageAsyncDecoding; }134 bool showDebugBackground() const final { return m_showDebugBackground; }135 131 void decodedSizeChanged(const Image*, long long delta) final; 136 132 void didDraw(const Image*) final; … … 140 136 141 137 Vector<CachedImage*> m_cachedImages; 142 // The default value of m_allowSubsampling should be the same as defaultImageSubsamplingEnabled in Settings.cpp143 #if PLATFORM(IOS)144 bool m_allowSubsampling { true };145 #else146 bool m_allowSubsampling { false };147 #endif148 bool m_allowLargeImageAsyncDecoding { false };149 bool m_allowAnimatedImageAsyncDecoding { false };150 bool m_showDebugBackground { false };151 138 }; 152 139 -
trunk/Source/WebCore/platform/graphics/BitmapImage.cpp
r215804 r215900 34 34 #include "IntRect.h" 35 35 #include "Logging.h" 36 #include "Settings.h" 36 37 #include "TextStream.h" 37 38 #include "Timer.h" … … 62 63 invalidatePlatformData(); 63 64 stopAnimation(); 65 } 66 67 void BitmapImage::updateFromSettings(const Settings& settings) 68 { 69 m_allowSubsampling = settings.imageSubsamplingEnabled(); 70 m_allowLargeImageAsyncDecoding = settings.largeImageAsyncDecodingEnabled(); 71 m_allowAnimatedImageAsyncDecoding = settings.animatedImageAsyncDecodingEnabled(); 72 m_showDebugBackground = settings.showDebugBorders(); 64 73 } 65 74 … … 167 176 IntSize sizeForDrawing = expandedIntSize(size() * scaleFactorForDrawing); 168 177 169 m_currentSubsamplingLevel = allowSubsampling()? m_source.subsamplingLevelForScaleFactor(context, scaleFactorForDrawing) : SubsamplingLevel::Default;178 m_currentSubsamplingLevel = m_allowSubsampling ? m_source.subsamplingLevelForScaleFactor(context, scaleFactorForDrawing) : SubsamplingLevel::Default; 170 179 LOG(Images, "BitmapImage::%s - %p - url: %s [subsamplingLevel = %d scaleFactorForDrawing = (%.4f, %.4f)]", __FUNCTION__, this, sourceURL().string().utf8().data(), static_cast<int>(m_currentSubsamplingLevel), scaleFactorForDrawing.width(), scaleFactorForDrawing.height()); 171 180 … … 181 190 182 191 if (!frameHasDecodedNativeImageCompatibleWithOptionsAtIndex(m_currentFrame, m_currentSubsamplingLevel, DecodingMode::Asynchronous)) { 183 if ( showDebugBackground())192 if (m_showDebugBackground) 184 193 fillWithSolidColor(context, destRect, Color(Color::yellow).colorWithAlpha(0.5), op); 185 194 return; … … 192 201 ASSERT_IMPLIES(status == StartAnimationStatus::DecodingActive, frameHasFullSizeNativeImageAtIndex(m_currentFrame, m_currentSubsamplingLevel)); 193 202 194 if (status == StartAnimationStatus::DecodingActive && showDebugBackground()) {203 if (status == StartAnimationStatus::DecodingActive && m_showDebugBackground) { 195 204 fillWithSolidColor(context, destRect, Color(Color::yellow).colorWithAlpha(0.5), op); 196 205 return; … … 199 208 if (frameIsBeingDecodedAndIsCompatibleWithOptionsAtIndex(m_currentFrame, DecodingMode::Asynchronous)) { 200 209 // FIXME: instead of showing the yellow rectangle and returning we need to wait for this the frame to finish decoding. 201 if ( showDebugBackground()) {210 if (m_showDebugBackground) { 202 211 fillWithSolidColor(context, destRect, Color(Color::yellow).colorWithAlpha(0.5), op); 203 212 LOG(Images, "BitmapImage::%s - %p - url: %s [waiting for async decoding to finish]", __FUNCTION__, this, sourceURL().string().utf8().data()); … … 274 283 bool BitmapImage::shouldUseAsyncDecodingForLargeImages() 275 284 { 276 // FIXME: enable async image decoding after the flickering bug wk170640 is fixed. 277 // return !canAnimate() && allowLargeImageAsyncDecoding() && m_source.shouldUseAsyncDecoding(); 278 return false; 285 return !canAnimate() && m_allowLargeImageAsyncDecoding && m_source.shouldUseAsyncDecoding(); 279 286 } 280 287 281 288 bool BitmapImage::shouldUseAsyncDecodingForAnimatedImages() 282 289 { 283 return canAnimate() && allowAnimatedImageAsyncDecoding()&& (shouldUseAsyncDecodingForAnimatedImagesForTesting() || m_source.shouldUseAsyncDecoding());290 return canAnimate() && m_allowAnimatedImageAsyncDecoding && (shouldUseAsyncDecodingForAnimatedImagesForTesting() || m_source.shouldUseAsyncDecoding()); 284 291 } 285 292 … … 391 398 else { 392 399 // Force repaint if showDebugBackground() is on. 393 if ( showDebugBackground())400 if (m_showDebugBackground) 394 401 imageObserver()->changedInRect(this); 395 402 LOG(Images, "BitmapImage::%s - %p - url: %s [lateFrameCount = %ld nextFrame = %ld]", __FUNCTION__, this, sourceURL().string().utf8().data(), ++m_lateFrameCount, nextFrame); -
trunk/Source/WebCore/platform/graphics/BitmapImage.h
r215710 r215900 50 50 namespace WebCore { 51 51 52 class Settings; 52 53 class Timer; 53 54 … … 66 67 #endif 67 68 virtual ~BitmapImage(); 68 69 70 void updateFromSettings(const Settings&); 71 69 72 bool hasSingleSecurityOrigin() const override { return true; } 70 73 … … 137 140 NativeImagePtr frameImageAtIndex(size_t index) { return m_source.frameImageAtIndex(index); } 138 141 NativeImagePtr frameImageAtIndexCacheIfNeeded(size_t, SubsamplingLevel = SubsamplingLevel::Default, const GraphicsContext* = nullptr); 139 140 bool allowSubsampling() const { return imageObserver() && imageObserver()->allowSubsampling(); }141 bool allowLargeImageAsyncDecoding() const { return imageObserver() && imageObserver()->allowLargeImageAsyncDecoding(); }142 bool allowAnimatedImageAsyncDecoding() const { return imageObserver() && imageObserver()->allowAnimatedImageAsyncDecoding(); }143 bool showDebugBackground() const { return imageObserver() && imageObserver()->showDebugBackground(); }144 142 145 143 // Called to invalidate cached data. When |destroyAll| is true, we wipe out … … 206 204 RepetitionCount m_repetitionsComplete { RepetitionCountNone }; // How many repetitions we've finished. 207 205 MonotonicTime m_desiredFrameStartTime; // The system time at which we hope to see the next call to startAnimation(). 208 bool m_animationFinished { false };209 206 210 207 Seconds m_frameDecodingDurationForTesting; 211 208 MonotonicTime m_desiredFrameDecodeTimeForTesting; 209 210 bool m_animationFinished { false }; 211 212 // The default value of m_allowSubsampling should be the same as defaultImageSubsamplingEnabled in Settings.cpp 213 #if PLATFORM(IOS) 214 bool m_allowSubsampling { true }; 215 #else 216 bool m_allowSubsampling { false }; 217 #endif 218 bool m_allowLargeImageAsyncDecoding { false }; 219 bool m_allowAnimatedImageAsyncDecoding { false }; 220 bool m_showDebugBackground { false }; 221 212 222 bool m_clearDecoderAfterAsyncFrameRequestForTesting { false }; 223 213 224 #if !LOG_DISABLED 214 225 size_t m_lateFrameCount { 0 }; -
trunk/Source/WebCore/platform/graphics/ImageObserver.h
r213563 r215900 40 40 public: 41 41 virtual URL sourceUrl() const = 0; 42 virtual bool allowSubsampling() const = 0;43 virtual bool allowLargeImageAsyncDecoding() const = 0;44 virtual bool allowAnimatedImageAsyncDecoding() const = 0;45 virtual bool showDebugBackground() const = 0;46 42 virtual void decodedSizeChanged(const Image*, long long delta) = 0; 47 43 … … 49 45 50 46 virtual void animationAdvanced(const Image*) = 0; 51 52 47 virtual void changedInRect(const Image*, const IntRect* changeRect = nullptr) = 0; 53 48 }; -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r215613 r215900 27 27 #include "RenderBoxModelObject.h" 28 28 29 #include "BitmapImage.h" 29 30 #include "BorderEdge.h" 30 31 #include "FloatRoundedRect.h" … … 878 879 context.setDrawLuminanceMask(bgLayer.maskSourceType() == MaskLuminance); 879 880 881 if (is<BitmapImage>(image.get())) 882 downcast<BitmapImage>(*image).updateFromSettings(settings()); 883 880 884 auto interpolation = chooseInterpolationQuality(context, *image, &bgLayer, geometry.tileSize()); 881 885 context.drawTiledImage(*image, geometry.destRect(), toLayoutPoint(geometry.relativePhase()), geometry.tileSize(), geometry.spaceSize(), ImagePaintingOptions(compositeOp, bgLayer.blendMode(), DecodingMode::Asynchronous, ImageOrientationDescription(), interpolation)); -
trunk/Source/WebCore/rendering/RenderImage.cpp
r214450 r215900 581 581 #endif 582 582 583 if (is<BitmapImage>(image)) 584 downcast<BitmapImage>(*image).updateFromSettings(settings()); 585 583 586 ImageOrientationDescription orientationDescription(shouldRespectImageOrientation(), style().imageOrientation()); 584 587 context.drawImage(*img, rect, ImagePaintingOptions(compositeOperator, BlendModeNormal, DecodingMode::Asynchronous, orientationDescription, interpolation)); -
trunk/Source/WebKit/mac/ChangeLog
r215872 r215900 1 2017-04-27 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 REGRESSION(r213764): Async decoding of animated images is disabled for ImageDocument 4 https://bugs.webkit.org/show_bug.cgi?id=170333 5 6 Reviewed by Simon Fraser. 7 8 Disbale the async decoding for large images for now. 9 10 * WebView/WebView.mm: 11 (-[WebView _preferencesChanged:]): 12 1 13 2017-04-27 Alex Christensen <achristensen@webkit.org> 2 14 -
trunk/Source/WebKit/mac/WebView/WebView.mm
r215866 r215900 3085 3085 settings.setShouldConvertInvalidURLsToBlank(shouldConvertInvalidURLsToBlank()); 3086 3086 3087 settings.setLargeImageAsyncDecodingEnabled([preferences largeImageAsyncDecodingEnabled]); 3087 // FIXME: enable async image decoding after the flickering bug wk170640 is fixed. 3088 // settings.setLargeImageAsyncDecodingEnabled([preferences largeImageAsyncDecodingEnabled]); 3089 settings.setLargeImageAsyncDecodingEnabled(false); 3088 3090 settings.setAnimatedImageAsyncDecodingEnabled([preferences animatedImageAsyncDecodingEnabled]); 3089 3091 } -
trunk/Source/WebKit2/ChangeLog
r215899 r215900 1 2017-04-27 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 REGRESSION(r213764): Async decoding of animated images is disabled for ImageDocument 4 https://bugs.webkit.org/show_bug.cgi?id=170333 5 6 Reviewed by Simon Fraser. 7 8 Disbale the async decoding for large images for now. 9 10 * WebProcess/WebPage/WebPage.cpp: 11 (WebKit::WebPage::updatePreferences): 12 1 13 2017-04-27 Brent Fulgham <bfulgham@apple.com> 2 14 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r215872 r215900 3365 3365 setForceAlwaysUserScalable(m_forceAlwaysUserScalable || store.getBoolValueForKey(WebPreferencesKey::forceAlwaysUserScalableKey())); 3366 3366 #endif 3367 settings.setLargeImageAsyncDecodingEnabled(store.getBoolValueForKey(WebPreferencesKey::largeImageAsyncDecodingEnabledKey())); 3367 // FIXME: enable async image decoding after the flickering bug wk170640 is fixed. 3368 // settings.setLargeImageAsyncDecodingEnabled(store.getBoolValueForKey(WebPreferencesKey::largeImageAsyncDecodingEnabledKey())); 3369 settings.setLargeImageAsyncDecodingEnabled(false); 3368 3370 settings.setAnimatedImageAsyncDecodingEnabled(store.getBoolValueForKey(WebPreferencesKey::animatedImageAsyncDecodingEnabledKey())); 3369 3371 settings.setShouldSuppressKeyboardInputDuringProvisionalNavigation(store.getBoolValueForKey(WebPreferencesKey::shouldSuppressKeyboardInputDuringProvisionalNavigationKey()));
Note: See TracChangeset
for help on using the changeset viewer.