Title: [184395] trunk
Revision
184395
Author
[email protected]
Date
2015-05-15 10:39:05 -0700 (Fri, 15 May 2015)

Log Message

White edge on animating panel on http://rokkosunnyvale.com
https://bugs.webkit.org/show_bug.cgi?id=144986
rdar://problem/20907683

Reviewed by Simon Fraser.

Background image geometry calculation needs to be based on the final painting size of the container
in order to accurately compute tile sizes, repeating positions etc.
The container's size is pixelsnapped at painting using absolute coordinates. This patch
ensures that we snap to the same size while computing background geometry.

Source/WebCore:

Test: fast/images/background-image-size-changes-fractional-position.html

* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::paintBoxDecorations):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::paintBoxDecorations):
(WebCore::RenderBox::paintBackground):
(WebCore::RenderBox::getBackgroundPaintedExtent):
(WebCore::RenderBox::computeBackgroundIsKnownToBeObscured):
(WebCore::RenderBox::maskClipRect):
(WebCore::RenderBox::repaintLayerRectsForImage): unable to get absolute coords.
* rendering/RenderBox.h:
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
(WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
(WebCore::RenderBoxModelObject::getGeometryForBackgroundImage):
(WebCore::RenderBoxModelObject::boxShadowShouldBeAppliedToBackground):
* rendering/RenderBoxModelObject.h:
* rendering/RenderFieldset.cpp:
(WebCore::RenderFieldset::paintBoxDecorations):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::boxShadowShouldBeAppliedToBackground):
(WebCore::RenderImage::computeBackgroundIsKnownToBeObscured):
* rendering/RenderImage.h:
* rendering/RenderLayer.cpp: unable to get absolute coords.
(WebCore::RenderLayer::calculateClipRects):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundImage): currently not used.
* rendering/RenderObject.h:
(WebCore::RenderObject::computeBackgroundIsKnownToBeObscured):
(WebCore::RenderObject::backgroundIsKnownToBeObscured):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::paintBoxDecorations):
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::boxShadowShouldBeAppliedToBackground):
* rendering/RenderTableCell.h:

LayoutTests:

* fast/backgrounds/hidpi-bitmap-background-repeat-on-subpixel-position-expected.html: progression.
* fast/images/background-image-size-changes-fractional-position-expected.html: Added.
* fast/images/background-image-size-changes-fractional-position.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (184394 => 184395)


--- trunk/LayoutTests/ChangeLog	2015-05-15 17:15:16 UTC (rev 184394)
+++ trunk/LayoutTests/ChangeLog	2015-05-15 17:39:05 UTC (rev 184395)
@@ -1,3 +1,20 @@
+2015-05-15  Zalan Bujtas  <[email protected]>
+
+        White edge on animating panel on http://rokkosunnyvale.com
+        https://bugs.webkit.org/show_bug.cgi?id=144986
+        rdar://problem/20907683
+
+        Reviewed by Simon Fraser.
+
+        Background image geometry calculation needs to be based on the final painting size of the container
+        in order to accurately compute tile sizes, repeating positions etc.
+        The container's size is pixelsnapped at painting using absolute coordinates. This patch
+        ensures that we snap to the same size while computing background geometry.
+
+        * fast/backgrounds/hidpi-bitmap-background-repeat-on-subpixel-position-expected.html: progression.
+        * fast/images/background-image-size-changes-fractional-position-expected.html: Added.
+        * fast/images/background-image-size-changes-fractional-position.html: Added.
+
 2015-05-15  Marcos Chavarría Teijeiro  <[email protected]>
 
         [GTK] Gardening 15th May.

Modified: trunk/LayoutTests/fast/backgrounds/hidpi-bitmap-background-repeat-on-subpixel-position-expected.html (184394 => 184395)


--- trunk/LayoutTests/fast/backgrounds/hidpi-bitmap-background-repeat-on-subpixel-position-expected.html	2015-05-15 17:15:16 UTC (rev 184394)
+++ trunk/LayoutTests/fast/backgrounds/hidpi-bitmap-background-repeat-on-subpixel-position-expected.html	2015-05-15 17:39:05 UTC (rev 184395)
@@ -51,14 +51,11 @@
 </script>
 <div class=thin style="left: 151px; top: 25px; width: 255px;"></div>
 <div class=thick style="left: 406px; top: 25px; width: 105px;"></div>
-<div class=thin style="left: 151px; top: 0px; height: 50px;"></div>
-<div class=thin style="left: 176.5px; top: 0px; height: 50px;"></div>
 <div class=thin style="left: 226.5px; top: 0px; height: 50px;"></div>
 <div class=thin style="left: 277.5px; top: 0px; height: 50px;"></div>
 <div class=thin style="left: 328.5px; top: 0px; height: 50px;"></div>
 <div class=thin style="left: 380px; top: 0px; height: 50px;"></div>
-<div class=thick style="left: 406px; top: 0px; height: 50px;"></div>
-<div class=thick style="left: 432px; top: 0px; height: 50px;"></div>
+<div class=thin style="left: 431.5px; top: 0px; height: 50px;"></div>
 <div class=thick style="left: 483px; top: 0px; height: 50px;"></div>
 </body>
 </html>

Added: trunk/LayoutTests/fast/images/background-image-size-changes-fractional-position-expected.html (0 => 184395)


--- trunk/LayoutTests/fast/images/background-image-size-changes-fractional-position-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/images/background-image-size-changes-fractional-position-expected.html	2015-05-15 17:39:05 UTC (rev 184395)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that background image geometry is computed properly when size changes due to subpixel positioning.</title>
+<style>
+	body {
+		background-color: green;
+	}
+
+	div {
+		position: absolute;
+		top: 0px;
+		left: 0px;
+		width: 667px;
+		height: 100px;
+		background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAApoAAAAGCAYAAABjNz7uAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAI1JREFUeNrs1kEKwjAQBdDEbS7n/U8hYigiEgdX4i5towbfg0+7SMNPFmVyrbWlTjnntIc1+3zim9HrR/iFDjN2m7mrs/JtrTXn1XXafr0dRq/fci973WfvPqWUYzxOkXPkEqmRJXKN3CL3g18lAAAr5Jekt/cngyYAAEMYNAEAMGgCAGDQBADgzz0EGADSDSoT1JeLJQAAAABJRU5ErkJggg==);
+		background-position: 100% 0%;
+	}
+</style>
+</head>
+<body>
+	<div></div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/images/background-image-size-changes-fractional-position.html (0 => 184395)


--- trunk/LayoutTests/fast/images/background-image-size-changes-fractional-position.html	                        (rev 0)
+++ trunk/LayoutTests/fast/images/background-image-size-changes-fractional-position.html	2015-05-15 17:39:05 UTC (rev 184395)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that background image geometry is computed properly when size changes due to subpixel positioning.</title>
+<style>
+	body {
+		background-color: green;
+	}
+
+	div {
+		position: absolute;
+		top: 0px;
+		left: 0.4px;
+		width: 666.2px;
+		height: 100px;
+		background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAApoAAAAGCAYAAABjNz7uAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAI1JREFUeNrs1kEKwjAQBdDEbS7n/U8hYigiEgdX4i5towbfg0+7SMNPFmVyrbWlTjnntIc1+3zim9HrR/iFDjN2m7mrs/JtrTXn1XXafr0dRq/fci973WfvPqWUYzxOkXPkEqmRJXKN3CL3g18lAAAr5Jekt/cngyYAAEMYNAEAMGgCAGDQBADgzz0EGADSDSoT1JeLJQAAAABJRU5ErkJggg==);
+		background-position: 100% 0%;
+	}
+</style>
+</head>
+<body>
+	<div></div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (184394 => 184395)


--- trunk/Source/WebCore/ChangeLog	2015-05-15 17:15:16 UTC (rev 184394)
+++ trunk/Source/WebCore/ChangeLog	2015-05-15 17:39:05 UTC (rev 184395)
@@ -1,3 +1,53 @@
+2015-05-15  Zalan Bujtas  <[email protected]>
+
+        White edge on animating panel on http://rokkosunnyvale.com
+        https://bugs.webkit.org/show_bug.cgi?id=144986
+        rdar://problem/20907683
+
+        Reviewed by Simon Fraser.
+
+        Background image geometry calculation needs to be based on the final painting size of the container
+        in order to accurately compute tile sizes, repeating positions etc.
+        The container's size is pixelsnapped at painting using absolute coordinates. This patch
+        ensures that we snap to the same size while computing background geometry.
+
+        Test: fast/images/background-image-size-changes-fractional-position.html
+
+        * rendering/InlineFlowBox.cpp:
+        (WebCore::InlineFlowBox::paintBoxDecorations):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::paintBoxDecorations):
+        (WebCore::RenderBox::paintBackground):
+        (WebCore::RenderBox::getBackgroundPaintedExtent):
+        (WebCore::RenderBox::computeBackgroundIsKnownToBeObscured):
+        (WebCore::RenderBox::maskClipRect):
+        (WebCore::RenderBox::repaintLayerRectsForImage): unable to get absolute coords.
+        * rendering/RenderBox.h:
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
+        (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
+        (WebCore::RenderBoxModelObject::getGeometryForBackgroundImage):
+        (WebCore::RenderBoxModelObject::boxShadowShouldBeAppliedToBackground):
+        * rendering/RenderBoxModelObject.h:
+        * rendering/RenderFieldset.cpp:
+        (WebCore::RenderFieldset::paintBoxDecorations):
+        * rendering/RenderImage.cpp:
+        (WebCore::RenderImage::boxShadowShouldBeAppliedToBackground):
+        (WebCore::RenderImage::computeBackgroundIsKnownToBeObscured):
+        * rendering/RenderImage.h:
+        * rendering/RenderLayer.cpp: unable to get absolute coords.
+        (WebCore::RenderLayer::calculateClipRects):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundImage): currently not used.
+        * rendering/RenderObject.h:
+        (WebCore::RenderObject::computeBackgroundIsKnownToBeObscured):
+        (WebCore::RenderObject::backgroundIsKnownToBeObscured):
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::paintBoxDecorations):
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::boxShadowShouldBeAppliedToBackground):
+        * rendering/RenderTableCell.h:
+
 2015-05-15  Jer Noble  <[email protected]>
 
         Crash in RenderFlowThread::popFlowThreadLayoutState() due to mismatched push/pop count

Modified: trunk/Source/WebCore/rendering/InlineFlowBox.cpp (184394 => 184395)


--- trunk/Source/WebCore/rendering/InlineFlowBox.cpp	2015-05-15 17:15:16 UTC (rev 184394)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.cpp	2015-05-15 17:39:05 UTC (rev 184395)
@@ -1340,7 +1340,7 @@
     GraphicsContext* context = paintInfo.context;
     LayoutRect paintRect = LayoutRect(adjustedPaintoffset, frameRect.size());
     // Shadow comes first and is behind the background and border.
-    if (!renderer().boxShadowShouldBeAppliedToBackground(BackgroundBleedNone, this))
+    if (!renderer().boxShadowShouldBeAppliedToBackground(adjustedPaintoffset, BackgroundBleedNone, this))
         paintBoxShadow(paintInfo, lineStyle, Normal, paintRect);
 
     Color c = lineStyle.visitedDependentColor(CSSPropertyBackgroundColor);

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (184394 => 184395)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2015-05-15 17:15:16 UTC (rev 184394)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2015-05-15 17:39:05 UTC (rev 184395)
@@ -1284,7 +1284,7 @@
 
     // FIXME: Should eventually give the theme control over whether the box shadow should paint, since controls could have
     // custom shadows of their own.
-    if (!boxShadowShouldBeAppliedToBackground(bleedAvoidance))
+    if (!boxShadowShouldBeAppliedToBackground(paintRect.location(), bleedAvoidance))
         paintBoxShadow(paintInfo, paintRect, style(), Normal);
 
     GraphicsContextStateSaver stateSaver(*paintInfo.context, false);
@@ -1341,12 +1341,12 @@
     }
     if (isBody() && skipBodyBackground(this))
         return;
-    if (backgroundIsKnownToBeObscured() && !boxShadowShouldBeAppliedToBackground(bleedAvoidance))
+    if (backgroundIsKnownToBeObscured(paintRect.location()) && !boxShadowShouldBeAppliedToBackground(paintRect.location(), bleedAvoidance))
         return;
     paintFillLayers(paintInfo, style().visitedDependentColor(CSSPropertyBackgroundColor), style().backgroundLayers(), paintRect, bleedAvoidance);
 }
 
-bool RenderBox::getBackgroundPaintedExtent(LayoutRect& paintedExtent) const
+bool RenderBox::getBackgroundPaintedExtent(const LayoutPoint& paintOffset, LayoutRect& paintedExtent) const
 {
     ASSERT(hasBackground());
     LayoutRect backgroundRect = snappedIntRect(borderBoxRect());
@@ -1362,7 +1362,7 @@
         return true;
     }
 
-    BackgroundImageGeometry geometry = calculateBackgroundImageGeometry(nullptr, *style().backgroundLayers(), backgroundRect);
+    BackgroundImageGeometry geometry = calculateBackgroundImageGeometry(nullptr, *style().backgroundLayers(), paintOffset, backgroundRect);
     paintedExtent = geometry.destRect();
     return !geometry.hasNonLocalGeometry();
 }
@@ -1466,7 +1466,7 @@
     return false;
 }
 
-bool RenderBox::computeBackgroundIsKnownToBeObscured()
+bool RenderBox::computeBackgroundIsKnownToBeObscured(const LayoutPoint& paintOffset)
 {
     // Test to see if the children trivially obscure the background.
     // FIXME: This test can be much more comprehensive.
@@ -1477,7 +1477,7 @@
         return false;
 
     LayoutRect backgroundRect;
-    if (!getBackgroundPaintedExtent(backgroundRect))
+    if (!getBackgroundPaintedExtent(paintOffset, backgroundRect))
         return false;
     return foregroundIsKnownToBeOpaqueInRect(backgroundRect, backgroundObscurationTestMaxDepth);
 }
@@ -1559,7 +1559,7 @@
         paintInfo.context->endTransparencyLayer();
 }
 
-LayoutRect RenderBox::maskClipRect()
+LayoutRect RenderBox::maskClipRect(const LayoutPoint& paintOffset)
 {
     const NinePieceImage& maskBoxImage = style().maskBoxImage();
     if (maskBoxImage.image()) {
@@ -1575,7 +1575,7 @@
     for (const FillLayer* maskLayer = style().maskLayers(); maskLayer; maskLayer = maskLayer->next()) {
         if (maskLayer->maskImage()) {
             // Masks should never have fixed attachment, so it's OK for paintContainer to be null.
-            BackgroundImageGeometry geometry = calculateBackgroundImageGeometry(nullptr, *maskLayer, borderBox);
+            BackgroundImageGeometry geometry = calculateBackgroundImageGeometry(nullptr, *maskLayer, paintOffset, borderBox);
             result.unite(geometry.destRect());
         }
     }
@@ -1700,8 +1700,8 @@
                     rendererRect = borderBoxRect();
                 }
             }
-
-            BackgroundImageGeometry geometry = layerRenderer->calculateBackgroundImageGeometry(nullptr, *curLayer, rendererRect);
+            // FIXME: Figure out how to pass absolute position to calculateBackgroundImageGeometry (for pixel snapping)
+            BackgroundImageGeometry geometry = layerRenderer->calculateBackgroundImageGeometry(nullptr, *curLayer, LayoutPoint(), rendererRect);
             if (geometry.hasNonLocalGeometry()) {
                 // Rather than incur the costs of computing the paintContainer for renderers with fixed backgrounds
                 // in order to get the right destRect, just repaint the entire renderer.

Modified: trunk/Source/WebCore/rendering/RenderBox.h (184394 => 184395)


--- trunk/Source/WebCore/rendering/RenderBox.h	2015-05-15 17:15:16 UTC (rev 184394)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2015-05-15 17:39:05 UTC (rev 184395)
@@ -514,7 +514,7 @@
         return true;
     }
 
-    LayoutRect maskClipRect();
+    LayoutRect maskClipRect(const LayoutPoint& paintOffset);
 
     virtual VisiblePosition positionForPoint(const LayoutPoint&, const RenderRegion*) override;
 
@@ -638,9 +638,9 @@
     bool createsNewFormattingContext() const;
 
     // Returns false if it could not cheaply compute the extent (e.g. fixed background), in which case the returned rect may be incorrect.
-    bool getBackgroundPaintedExtent(LayoutRect&) const;
+    bool getBackgroundPaintedExtent(const LayoutPoint& paintOffset, LayoutRect&) const;
     virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, unsigned maxDepthToTest) const;
-    virtual bool computeBackgroundIsKnownToBeObscured() override;
+    virtual bool computeBackgroundIsKnownToBeObscured(const LayoutPoint& paintOffset) override;
 
     void paintBackground(const PaintInfo&, const LayoutRect&, BackgroundBleedAvoidance = BackgroundBleedNone);
     

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (184394 => 184395)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2015-05-15 17:15:16 UTC (rev 184394)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2015-05-15 17:39:05 UTC (rev 184395)
@@ -688,7 +688,7 @@
         if (!colorVisible)
             return;
 
-        bool boxShadowShouldBeAppliedToBackground = this->boxShadowShouldBeAppliedToBackground(bleedAvoidance, box);
+        bool boxShadowShouldBeAppliedToBackground = this->boxShadowShouldBeAppliedToBackground(rect.location(), bleedAvoidance, box);
         GraphicsContextStateSaver shadowStateSaver(*context, boxShadowShouldBeAppliedToBackground);
         if (boxShadowShouldBeAppliedToBackground)
             applyBoxShadowForBackground(context, &style());
@@ -811,7 +811,7 @@
     // by verifying whether the background image covers the entire layout rect.
     if (!bgLayer->next()) {
         LayoutRect backgroundRect(scrolledPaintRect);
-        bool boxShadowShouldBeAppliedToBackground = this->boxShadowShouldBeAppliedToBackground(bleedAvoidance, box);
+        bool boxShadowShouldBeAppliedToBackground = this->boxShadowShouldBeAppliedToBackground(rect.location(), bleedAvoidance, box);
         if (boxShadowShouldBeAppliedToBackground || !shouldPaintBackgroundImage || !bgLayer->hasOpaqueImage(*this) || !bgLayer->hasRepeatXY()) {
             if (!boxShadowShouldBeAppliedToBackground)
                 backgroundRect.intersect(paintInfo.rect);
@@ -845,7 +845,7 @@
 
     // no progressive loading of the background image
     if (!baseBgColorOnly && (shouldPaintBackgroundImage || bgLayer->hasMaskImage())) {
-        BackgroundImageGeometry geometry = calculateBackgroundImageGeometry(paintInfo.paintContainer, *bgLayer, scrolledPaintRect, backgroundObject);
+        BackgroundImageGeometry geometry = calculateBackgroundImageGeometry(paintInfo.paintContainer, *bgLayer, rect.location(), scrolledPaintRect, backgroundObject);
         geometry.clip(LayoutRect(pixelSnappedRect));
 
         if (!geometry.destRect().isEmpty()) {
@@ -1069,8 +1069,8 @@
     return space;
 }
 
-BackgroundImageGeometry RenderBoxModelObject::calculateBackgroundImageGeometry(const RenderLayerModelObject* paintContainer, const FillLayer& fillLayer, const LayoutRect& paintRect,
-    RenderElement* backgroundObject) const
+BackgroundImageGeometry RenderBoxModelObject::calculateBackgroundImageGeometry(const RenderLayerModelObject* paintContainer, const FillLayer& fillLayer, const LayoutPoint& paintOffset,
+    const LayoutRect& borderBoxRect, RenderElement* backgroundObject) const
 {
     LayoutUnit left = 0;
     LayoutUnit top = 0;
@@ -1078,8 +1078,9 @@
     // Determine the background positioning area and set destination rect to the background painting area.
     // Destination rect will be adjusted later if the background is non-repeating.
     // FIXME: transforms spec says that fixed backgrounds behave like scroll inside transforms. https://bugs.webkit.org/show_bug.cgi?id=15679
-    LayoutRect destinationRect(paintRect);
+    LayoutRect destinationRect(borderBoxRect);
     bool fixedAttachment = fillLayer.attachment() == FixedBackgroundAttachment;
+    float deviceScaleFactor = document().deviceScaleFactor();
     if (!fixedAttachment) {
         LayoutUnit right = 0;
         LayoutUnit bottom = 0;
@@ -1102,13 +1103,16 @@
         // the background positioning area.
         if (isRoot()) {
             positioningAreaSize = downcast<RenderBox>(*this).size() - LayoutSize(left + right, top + bottom);
+            positioningAreaSize = LayoutSize(snapSizeToDevicePixel(positioningAreaSize, LayoutPoint(), deviceScaleFactor));
             if (view().frameView().hasExtendedBackgroundRectForPainting()) {
                 LayoutRect extendedBackgroundRect = view().frameView().extendedBackgroundRectForPainting();
                 left += (marginLeft() - extendedBackgroundRect.x());
                 top += (marginTop() - extendedBackgroundRect.y());
             }
-        } else
-            positioningAreaSize = paintRect.size() - LayoutSize(left + right, top + bottom);
+        } else {
+            positioningAreaSize = borderBoxRect.size() - LayoutSize(left + right, top + bottom);
+            positioningAreaSize = LayoutSize(snapRectToDevicePixels(LayoutRect(paintOffset, positioningAreaSize), deviceScaleFactor).size());
+        }
     } else {
         LayoutRect viewportRect;
         float topContentInset = 0;
@@ -1133,6 +1137,7 @@
         destinationRect = viewportRect;
         positioningAreaSize = destinationRect.size();
         positioningAreaSize.setHeight(positioningAreaSize.height() - topContentInset);
+        positioningAreaSize = LayoutSize(snapRectToDevicePixels(LayoutRect(destinationRect.location(), positioningAreaSize), deviceScaleFactor).size());
     }
 
     auto clientForBackgroundImage = backgroundObject ? backgroundObject : this;
@@ -1216,18 +1221,18 @@
         spaceSize.setHeight(0);
     }
     if (fixedAttachment) {
-        LayoutPoint attachmentPoint = paintRect.location();
+        LayoutPoint attachmentPoint = borderBoxRect.location();
         phase.expand(std::max<LayoutUnit>(attachmentPoint.x() - destinationRect.x(), 0), std::max<LayoutUnit>(attachmentPoint.y() - destinationRect.y(), 0));
     }
-    destinationRect.intersect(paintRect);
-    pixelSnapBackgroundImageGeometryForPainting(destinationRect, tileSize, phase, spaceSize, document().deviceScaleFactor());
+    destinationRect.intersect(borderBoxRect);
+    pixelSnapBackgroundImageGeometryForPainting(destinationRect, tileSize, phase, spaceSize, deviceScaleFactor);
     return BackgroundImageGeometry(destinationRect, tileSize, phase, spaceSize, fixedAttachment);
 }
 
-void RenderBoxModelObject::getGeometryForBackgroundImage(const RenderLayerModelObject* paintContainer, FloatRect& destRect, FloatSize& phase, FloatSize& tileSize) const
+void RenderBoxModelObject::getGeometryForBackgroundImage(const RenderLayerModelObject* paintContainer, const LayoutPoint& paintOffset, FloatRect& destRect, FloatSize& phase, FloatSize& tileSize) const
 {
     LayoutRect paintRect(destRect);
-    BackgroundImageGeometry geometry = calculateBackgroundImageGeometry(paintContainer, *style().backgroundLayers(), paintRect);
+    BackgroundImageGeometry geometry = calculateBackgroundImageGeometry(paintContainer, *style().backgroundLayers(), paintOffset, paintRect);
     phase = geometry.phase();
     tileSize = geometry.tileSize();
     destRect = geometry.destRect();
@@ -2301,7 +2306,7 @@
     return true;
 }
 
-bool RenderBoxModelObject::boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance bleedAvoidance, InlineFlowBox* inlineFlowBox) const
+bool RenderBoxModelObject::boxShadowShouldBeAppliedToBackground(const LayoutPoint&, BackgroundBleedAvoidance bleedAvoidance, InlineFlowBox* inlineFlowBox) const
 {
     if (bleedAvoidance != BackgroundBleedNone)
         return false;

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.h (184394 => 184395)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.h	2015-05-15 17:15:16 UTC (rev 184394)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.h	2015-05-15 17:39:05 UTC (rev 184395)
@@ -205,7 +205,7 @@
     void paintBoxShadow(const PaintInfo&, const LayoutRect&, const RenderStyle&, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
     void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox* = nullptr, const LayoutSize& = LayoutSize(), CompositeOperator = CompositeSourceOver, RenderElement* backgroundObject = nullptr, BaseBackgroundColorUsage = BaseBackgroundColorUse);
 
-    virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance, InlineFlowBox* = nullptr) const;
+    virtual bool boxShadowShouldBeAppliedToBackground(const LayoutPoint& absolutePaintPostion, BackgroundBleedAvoidance, InlineFlowBox* = nullptr) const;
 
     // Overridden by subclasses to determine line height and baseline position.
     virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const = 0;
@@ -217,7 +217,7 @@
 
     bool canHaveBoxInfoInRegion() const { return !isFloating() && !isReplaced() && !isInline() && !isTableCell() && isRenderBlock() && !isRenderSVGBlock(); }
 
-    void getGeometryForBackgroundImage(const RenderLayerModelObject* paintContainer, FloatRect& destRect, FloatSize& phase, FloatSize& tileSize) const;
+    void getGeometryForBackgroundImage(const RenderLayerModelObject* paintContainer, const LayoutPoint& paintOffset, FloatRect& destRect, FloatSize& phase, FloatSize& tileSize) const;
     void contentChanged(ContentChangeType);
     bool hasAcceleratedCompositing() const;
 
@@ -240,7 +240,8 @@
     LayoutPoint adjustedPositionRelativeToOffsetParent(const LayoutPoint&) const;
 
     bool hasBoxDecorationStyle() const;
-    BackgroundImageGeometry calculateBackgroundImageGeometry(const RenderLayerModelObject* paintContainer, const FillLayer&, const LayoutRect& paintRect, RenderElement* = nullptr) const;
+    BackgroundImageGeometry calculateBackgroundImageGeometry(const RenderLayerModelObject* paintContainer, const FillLayer&, const LayoutPoint& paintOffset,
+        const LayoutRect& paintRect, RenderElement* = nullptr) const;
     bool borderObscuresBackgroundEdge(const FloatSize& contextScale) const;
     bool borderObscuresBackground() const;
     RoundedRect backgroundRoundedRectAdjustedForBleedAvoidance(const GraphicsContext&, const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox*, const LayoutSize&, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const;

Modified: trunk/Source/WebCore/rendering/RenderFieldset.cpp (184394 => 184395)


--- trunk/Source/WebCore/rendering/RenderFieldset.cpp	2015-05-15 17:15:16 UTC (rev 184394)
+++ trunk/Source/WebCore/rendering/RenderFieldset.cpp	2015-05-15 17:39:05 UTC (rev 184395)
@@ -159,7 +159,7 @@
         paintRect.setX(paintRect.x() + xOff);
     }
 
-    if (!boxShadowShouldBeAppliedToBackground(determineBackgroundBleedAvoidance(paintInfo.context)))
+    if (!boxShadowShouldBeAppliedToBackground(paintRect.location(), determineBackgroundBleedAvoidance(paintInfo.context)))
         paintBoxShadow(paintInfo, paintRect, style(), Normal);
     paintFillLayers(paintInfo, style().visitedDependentColor(CSSPropertyBackgroundColor), style().backgroundLayers(), paintRect);
     paintBoxShadow(paintInfo, paintRect, style(), Inset);

Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (184394 => 184395)


--- trunk/Source/WebCore/rendering/RenderImage.cpp	2015-05-15 17:15:16 UTC (rev 184394)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp	2015-05-15 17:39:05 UTC (rev 184395)
@@ -555,12 +555,12 @@
         ImagePaintingOptions(compositeOperator, BlendModeNormal, orientationDescription, useLowQualityScaling));
 }
 
-bool RenderImage::boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance bleedAvoidance, InlineFlowBox*) const
+bool RenderImage::boxShadowShouldBeAppliedToBackground(const LayoutPoint& paintOffset, BackgroundBleedAvoidance bleedAvoidance, InlineFlowBox*) const
 {
-    if (!RenderBoxModelObject::boxShadowShouldBeAppliedToBackground(bleedAvoidance))
+    if (!RenderBoxModelObject::boxShadowShouldBeAppliedToBackground(paintOffset, bleedAvoidance))
         return false;
 
-    return !const_cast<RenderImage*>(this)->backgroundIsKnownToBeObscured();
+    return !const_cast<RenderImage*>(this)->backgroundIsKnownToBeObscured(paintOffset);
 }
 
 bool RenderImage::foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, unsigned maxDepthToTest) const
@@ -587,13 +587,13 @@
     return imageResource().cachedImage() && imageResource().cachedImage()->currentFrameKnownToBeOpaque(this);
 }
 
-bool RenderImage::computeBackgroundIsKnownToBeObscured()
+bool RenderImage::computeBackgroundIsKnownToBeObscured(const LayoutPoint& paintOffset)
 {
     if (!hasBackground())
         return false;
     
     LayoutRect paintedExtent;
-    if (!getBackgroundPaintedExtent(paintedExtent))
+    if (!getBackgroundPaintedExtent(paintOffset, paintedExtent))
         return false;
     return foregroundIsKnownToBeOpaqueInRect(paintedExtent, 0);
 }

Modified: trunk/Source/WebCore/rendering/RenderImage.h (184394 => 184395)


--- trunk/Source/WebCore/rendering/RenderImage.h	2015-05-15 17:15:16 UTC (rev 184394)
+++ trunk/Source/WebCore/rendering/RenderImage.h	2015-05-15 17:39:05 UTC (rev 184395)
@@ -100,14 +100,14 @@
 
     virtual void paintReplaced(PaintInfo&, const LayoutPoint&) override;
 
-    virtual bool computeBackgroundIsKnownToBeObscured() override final;
+    virtual bool computeBackgroundIsKnownToBeObscured(const LayoutPoint& paintOffset) override final;
 
     virtual LayoutUnit minimumReplacedHeight() const override;
 
     virtual void notifyFinished(CachedResource*) override final;
     virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override final;
 
-    virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance, InlineFlowBox*) const override final;
+    virtual bool boxShadowShouldBeAppliedToBackground(const LayoutPoint& paintOffset, BackgroundBleedAvoidance, InlineFlowBox*) const override final;
 
     virtual bool shadowControlsNeedCustomLayoutMetrics() const { return false; }
 

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (184394 => 184395)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2015-05-15 17:15:16 UTC (rev 184394)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2015-05-15 17:39:05 UTC (rev 184395)
@@ -5800,7 +5800,7 @@
         RenderBox* box = renderBox();
         ASSERT(box);
         if (!(flags & DontConstrainForMask) && box->hasMask()) {
-            result = box->maskClipRect();
+            result = box->maskClipRect(LayoutPoint());
             box->flipForWritingMode(result); // The mask clip rect is in physical coordinates, so we have to flip, since localBoundingBox is not.
         } else {
             LayoutRect bbox = box->borderBoxRect();

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (184394 => 184395)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2015-05-15 17:15:16 UTC (rev 184394)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2015-05-15 17:39:05 UTC (rev 184395)
@@ -1709,7 +1709,8 @@
     FloatSize tileSize;
 
     RefPtr<Image> image = style.backgroundLayers()->image()->cachedImage()->image();
-    downcast<RenderBox>(renderer()).getGeometryForBackgroundImage(&renderer(), destRect, phase, tileSize);
+    // FIXME: absolute paint location is required here.
+    downcast<RenderBox>(renderer()).getGeometryForBackgroundImage(&renderer(), LayoutPoint(), destRect, phase, tileSize);
     m_graphicsLayer->setContentsTileSize(tileSize);
     m_graphicsLayer->setContentsTilePhase(phase);
     m_graphicsLayer->setContentsRect(destRect);

Modified: trunk/Source/WebCore/rendering/RenderObject.h (184394 => 184395)


--- trunk/Source/WebCore/rendering/RenderObject.h	2015-05-15 17:15:16 UTC (rev 184394)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2015-05-15 17:39:05 UTC (rev 184395)
@@ -530,7 +530,7 @@
         HasBoxDecorationsAndBackgroundMayBeVisible,
     };
     bool hasBoxDecorations() const { return m_bitfields.boxDecorationState() != NoBoxDecorations; }
-    bool backgroundIsKnownToBeObscured();
+    bool backgroundIsKnownToBeObscured(const LayoutPoint& paintOffset);
     bool hasEntirelyFixedBackground() const;
 
     bool needsLayout() const
@@ -614,7 +614,7 @@
 
     void setHasBoxDecorations(bool = true);
     void invalidateBackgroundObscurationStatus();
-    virtual bool computeBackgroundIsKnownToBeObscured() { return false; }
+    virtual bool computeBackgroundIsKnownToBeObscured(const LayoutPoint&) { return false; }
 
     void setIsText() { ASSERT(!isBox()); m_bitfields.setIsTextOrRenderView(true); }
     void setIsLineBreak() { m_bitfields.setIsLineBreak(true); }
@@ -1123,10 +1123,10 @@
     m_bitfields.setBoxDecorationState(HasBoxDecorationsAndBackgroundObscurationStatusInvalid);
 }
 
-inline bool RenderObject::backgroundIsKnownToBeObscured()
+inline bool RenderObject::backgroundIsKnownToBeObscured(const LayoutPoint& paintOffset)
 {
     if (m_bitfields.boxDecorationState() == HasBoxDecorationsAndBackgroundObscurationStatusInvalid) {
-        BoxDecorationState boxDecorationState = computeBackgroundIsKnownToBeObscured() ? HasBoxDecorationsAndBackgroundIsKnownToBeObscured : HasBoxDecorationsAndBackgroundMayBeVisible;
+        BoxDecorationState boxDecorationState = computeBackgroundIsKnownToBeObscured(paintOffset) ? HasBoxDecorationsAndBackgroundIsKnownToBeObscured : HasBoxDecorationsAndBackgroundMayBeVisible;
         m_bitfields.setBoxDecorationState(boxDecorationState);
     }
     return m_bitfields.boxDecorationState() == HasBoxDecorationsAndBackgroundIsKnownToBeObscured;

Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (184394 => 184395)


--- trunk/Source/WebCore/rendering/RenderTable.cpp	2015-05-15 17:15:16 UTC (rev 184394)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp	2015-05-15 17:39:05 UTC (rev 184395)
@@ -748,7 +748,7 @@
     subtractCaptionRect(rect);
 
     BackgroundBleedAvoidance bleedAvoidance = determineBackgroundBleedAvoidance(paintInfo.context);
-    if (!boxShadowShouldBeAppliedToBackground(bleedAvoidance))
+    if (!boxShadowShouldBeAppliedToBackground(rect.location(), bleedAvoidance))
         paintBoxShadow(paintInfo, rect, style(), Normal);
     paintBackground(paintInfo, rect, bleedAvoidance);
     paintBoxShadow(paintInfo, rect, style(), Inset);

Modified: trunk/Source/WebCore/rendering/RenderTableCell.cpp (184394 => 184395)


--- trunk/Source/WebCore/rendering/RenderTableCell.cpp	2015-05-15 17:15:16 UTC (rev 184394)
+++ trunk/Source/WebCore/rendering/RenderTableCell.cpp	2015-05-15 17:39:05 UTC (rev 184395)
@@ -1320,7 +1320,7 @@
     paintMaskImages(paintInfo, LayoutRect(paintOffset, pixelSnappedSize()));
 }
 
-bool RenderTableCell::boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance, InlineFlowBox*) const
+bool RenderTableCell::boxShadowShouldBeAppliedToBackground(const LayoutPoint&, BackgroundBleedAvoidance, InlineFlowBox*) const
 {
     return false;
 }

Modified: trunk/Source/WebCore/rendering/RenderTableCell.h (184394 => 184395)


--- trunk/Source/WebCore/rendering/RenderTableCell.h	2015-05-15 17:15:16 UTC (rev 184394)
+++ trunk/Source/WebCore/rendering/RenderTableCell.h	2015-05-15 17:39:05 UTC (rev 184395)
@@ -150,7 +150,7 @@
     virtual void paintBoxDecorations(PaintInfo&, const LayoutPoint&) override;
     virtual void paintMask(PaintInfo&, const LayoutPoint&) override;
 
-    virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance, InlineFlowBox*) const override;
+    virtual bool boxShadowShouldBeAppliedToBackground(const LayoutPoint& paintOffset, BackgroundBleedAvoidance, InlineFlowBox*) const override;
 
     virtual LayoutSize offsetFromContainer(RenderElement&, const LayoutPoint&, bool* offsetDependsOnPoint = 0) const override;
     virtual void computeRectForRepaint(const RenderLayerModelObject* repaintContainer, LayoutRect&, bool fixed = false) const override;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to