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

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

Issue 2241663002: Take CSS Clip and contain: paint into account when computing visual rects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: none Created 4 years, 4 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 7e2b702a73f1ba5aaa67065078c5f0207003e606..5b8deff1daa4e99639f810d86ae8191f8e71825b 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -1008,19 +1008,33 @@ IntSize LayoutBox::scrolledContentOffset() const
return result;
}
+
+LayoutRect LayoutBox::clippingRect() const
+{
+ LayoutRect result = LayoutRect(LayoutRect::infiniteIntRect());
+ if (hasOverflowClip() || style()->containsPaint())
+ result = overflowClipRect(LayoutPoint());
+
+ if (hasClip())
+ result.intersect(clipRect(LayoutPoint()));
+
+ return result;
+}
+
bool LayoutBox::mapScrollingContentsRectToBoxSpace(LayoutRect& rect, ApplyOverflowClipFlag applyOverflowClip, VisualRectFlags visualRectFlags) const
{
- if (!hasOverflowClip())
+ if (!hasClipRelatedProperty())
return true;
- if (applyOverflowClip == ApplyNonScrollOverflowClip && scrollsOverflow()) {
+ if (applyOverflowClip == ApplyNonScrollOverflowClip && scrollsOverflow())
return true;
- }
- LayoutSize offset = LayoutSize(-scrolledContentOffset());
- rect.move(offset);
+ if (hasOverflowClip()) {
+ LayoutSize offset = LayoutSize(-scrolledContentOffset());
+ rect.move(offset);
+ }
- LayoutRect clipRect = overflowClipRect(LayoutPoint());
+ LayoutRect clipRect = clippingRect();
bool doesIntersect;
if (visualRectFlags & EdgeInclusive) {
@@ -1029,6 +1043,7 @@ bool LayoutBox::mapScrollingContentsRectToBoxSpace(LayoutRect& rect, ApplyOverfl
rect.intersect(clipRect);
doesIntersect = !rect.isEmpty();
}
+
return doesIntersect;
}

Powered by Google App Engine
This is Rietveld 408576698