Index: third_party/WebKit/Source/core/layout/LayoutBox.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
index 4fc4b88d0b30ee3b40066ef8b3237f68d14340cc..1a2512e5633eca3f65632ba96fa230c142849819 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
@@ -704,6 +704,29 @@ FloatQuad LayoutBox::absoluteContentQuad() const |
return localToAbsoluteQuad(FloatRect(rect)); |
} |
+LayoutRect LayoutBox::backgroundClipRect() const |
+{ |
+ // TODO(flackr): Check for the maximum background clip rect. |
+ switch (style()->backgroundClip()) { |
+ case BorderFillBox: |
+ // A 'border-box' clip on scrollable elements local attachment is treated as 'padding-box'. |
+ // https://www.w3.org/TR/css3-background/#the-background-attachment |
+ if (!style()->isOverflowVisible() && style()->backgroundLayers().attachment() == LocalBackgroundAttachment) |
+ return paddingBoxRect(); |
+ return borderBoxRect(); |
+ break; |
+ case PaddingFillBox: |
+ return paddingBoxRect(); |
+ break; |
+ case ContentFillBox: |
+ return contentBoxRect(); |
+ break; |
+ default: |
+ break; |
+ } |
+ return LayoutRect(); |
+} |
+ |
void LayoutBox::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset, IncludeBlockVisualOverflowOrNot) const |
{ |
rects.append(LayoutRect(additionalOffset, size())); |
@@ -1358,21 +1381,7 @@ bool LayoutBox::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) c |
// FIXME: The background color clip is defined by the last layer. |
if (style()->backgroundLayers().next()) |
return false; |
- LayoutRect backgroundRect; |
- switch (style()->backgroundClip()) { |
- case BorderFillBox: |
- backgroundRect = borderBoxRect(); |
- break; |
- case PaddingFillBox: |
- backgroundRect = paddingBoxRect(); |
- break; |
- case ContentFillBox: |
- backgroundRect = contentBoxRect(); |
- break; |
- default: |
- break; |
- } |
- return backgroundRect.contains(localRect); |
+ return backgroundClipRect().contains(localRect); |
} |
static bool isCandidateForOpaquenessTest(const LayoutBox& childBox) |