Title: [219360] trunk/Source/WebCore
Revision
219360
Author
[email protected]
Date
2017-07-11 13:56:26 -0700 (Tue, 11 Jul 2017)

Log Message

RenderImage should not add itself as a RelevantRepaintedObject if its image frame is being decoded
https://bugs.webkit.org/show_bug.cgi?id=174336

Patch by Said Abou-Hallawa <[email protected]> on 2017-07-11
Reviewed by Simon Fraser.

Since nothing will be drawn till the image frame finishes decoding we should
treat returning ImageDrawResult::DidRequestDecoding from BitmapImage::draw
the same as we do when the image is still loading.

* rendering/RenderImage.cpp:
(WebCore::RenderImage::paintReplaced):
(WebCore::RenderImage::paintIntoRect):
* rendering/RenderImage.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (219359 => 219360)


--- trunk/Source/WebCore/ChangeLog	2017-07-11 20:46:24 UTC (rev 219359)
+++ trunk/Source/WebCore/ChangeLog	2017-07-11 20:56:26 UTC (rev 219360)
@@ -1,3 +1,19 @@
+2017-07-11  Said Abou-Hallawa  <[email protected]>
+
+        RenderImage should not add itself as a RelevantRepaintedObject if its image frame is being decoded
+        https://bugs.webkit.org/show_bug.cgi?id=174336
+
+        Reviewed by Simon Fraser.
+
+        Since nothing will be drawn till the image frame finishes decoding we should
+        treat returning ImageDrawResult::DidRequestDecoding from BitmapImage::draw
+        the same as we do when the image is still loading.
+
+        * rendering/RenderImage.cpp:
+        (WebCore::RenderImage::paintReplaced):
+        (WebCore::RenderImage::paintIntoRect):
+        * rendering/RenderImage.h:
+
 2017-07-11  Youenn Fablet  <[email protected]>
 
         [WebRTC] Hanging under LibWebRTCMediaEndpoint::getStats

Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (219359 => 219360)


--- trunk/Source/WebCore/rendering/RenderImage.cpp	2017-07-11 20:46:24 UTC (rev 219359)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp	2017-07-11 20:56:26 UTC (rev 219360)
@@ -475,13 +475,13 @@
     if (clip)
         context.clip(contentBoxRect);
 
-    paintIntoRect(paintInfo, snapRectToDevicePixels(replacedContentRect, deviceScaleFactor));
+    ImageDrawResult result = paintIntoRect(paintInfo, snapRectToDevicePixels(replacedContentRect, deviceScaleFactor));
     
     if (cachedImage() && paintInfo.phase == PaintPhaseForeground) {
         // For now, count images as unpainted if they are still progressively loading. We may want 
         // to refine this in the future to account for the portion of the image that has painted.
         LayoutRect visibleRect = intersection(replacedContentRect, contentBoxRect);
-        if (cachedImage()->isLoading())
+        if (cachedImage()->isLoading() || result == ImageDrawResult::DidRequestDecoding)
             page().addRelevantUnpaintedObject(this, visibleRect);
         else
             page().addRelevantRepaintedObject(this, visibleRect);
@@ -559,14 +559,14 @@
     repaint();
 }
 
-void RenderImage::paintIntoRect(PaintInfo& paintInfo, const FloatRect& rect)
+ImageDrawResult RenderImage::paintIntoRect(PaintInfo& paintInfo, const FloatRect& rect)
 {
     if (!imageResource().cachedImage() || imageResource().errorOccurred() || rect.width() <= 0 || rect.height() <= 0)
-        return;
+        return ImageDrawResult::DidNothing;
 
     RefPtr<Image> img = imageResource().image(flooredIntSize(rect.size()));
     if (!img || img->isNull())
-        return;
+        return ImageDrawResult::DidNothing;
 
     HTMLImageElement* imageElement = is<HTMLImageElement>(element()) ? downcast<HTMLImageElement>(element()) : nullptr;
     CompositeOperator compositeOperator = imageElement ? imageElement->compositeOperator() : CompositeSourceOver;
@@ -589,6 +589,7 @@
     auto drawResult = paintInfo.context().drawImage(*img, rect, ImagePaintingOptions(compositeOperator, BlendModeNormal, decodingMode, orientationDescription, interpolation));
     if (drawResult == ImageDrawResult::DidRequestDecoding)
         imageResource().cachedImage()->addPendingImageDrawingClient(*this);
+    return drawResult;
 }
 
 bool RenderImage::boxShadowShouldBeAppliedToBackground(const LayoutPoint& paintOffset, BackgroundBleedAvoidance bleedAvoidance, InlineFlowBox*) const

Modified: trunk/Source/WebCore/rendering/RenderImage.h (219359 => 219360)


--- trunk/Source/WebCore/rendering/RenderImage.h	2017-07-11 20:46:24 UTC (rev 219359)
+++ trunk/Source/WebCore/rendering/RenderImage.h	2017-07-11 20:56:26 UTC (rev 219360)
@@ -88,7 +88,7 @@
 
     void imageChanged(WrappedImagePtr, const IntRect* = nullptr) override;
 
-    void paintIntoRect(PaintInfo&, const FloatRect&);
+    ImageDrawResult paintIntoRect(PaintInfo&, const FloatRect&);
     void paint(PaintInfo&, const LayoutPoint&) final;
     void layout() override;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to