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

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 bfa8daeabf98e24ca0b10994f63097df39737ca2..b2de1e362e42e9f920416ac90784ba2b85107034 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -1011,19 +1011,35 @@ 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());
+ // This won't work fully correctly for fixed-position elements, who should receive CSS clip but for whom the current object
+ // is not in the containing block chain.
+ LayoutRect clipRect = clippingRect();
bool doesIntersect;
if (visualRectFlags & EdgeInclusive) {
@@ -1032,6 +1048,7 @@ bool LayoutBox::mapScrollingContentsRectToBoxSpace(LayoutRect& rect, ApplyOverfl
rect.intersect(clipRect);
doesIntersect = !rect.isEmpty();
}
+
return doesIntersect;
}
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.h ('k') | third_party/WebKit/Source/core/layout/LayoutObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698