Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2127663002: Adjust background clip when local attachment is used with non-visible overflow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restrict to the padding box rect when attachment is local on scrollable element. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)

Powered by Google App Engine
This is Rietveld 408576698