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

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

Issue 1856993004: Let mapToVisualRectInAncestorSpace apply ancestor clip if not scrollsOverflow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Saturated
Patch Set: Created 4 years, 8 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 9655aac8a07ee74ede97abbb5aa82cc18d1b38e5..631059e578ff2f8987be9c0c6ac3c8264426b808 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -958,21 +958,18 @@ IntSize LayoutBox::scrolledContentOffset() const
return flooredIntSize(getScrollableArea()->scrollOffset());
}
-void LayoutBox::mapScrollingContentsRectToBoxSpace(LayoutRect& rect) const
+bool LayoutBox::mapScrollingContentsRectToBoxSpace(LayoutRect& rect, ApplyOverflowClipFlag applyOverflowClip, VisualRectFlags visualRectFlags) const
{
- ASSERT(hasLayer());
- ASSERT(hasOverflowClip());
+ if (!hasOverflowClip())
+ return true;
LayoutSize offset = LayoutSize(-scrolledContentOffset());
if (UNLIKELY(hasFlippedBlocksWritingMode()))
offset.setWidth(-offset.width());
rect.move(offset);
-}
-bool LayoutBox::applyOverflowClip(LayoutRect& rect, VisualRectFlags visualRectFlags) const
-{
- ASSERT(hasLayer());
- ASSERT(hasOverflowClip());
+ if (applyOverflowClip == ApplyNonScrollOverflowClip && scrollsOverflow())
+ return true;
flipForWritingMode(rect);
@@ -1986,12 +1983,9 @@ bool LayoutBox::mapToVisualRectInAncestorSpace(const LayoutBoxModelObject* ances
// FIXME: We ignore the lightweight clipping rect that controls use, since if |o| is in mid-layout,
// its controlClipRect will be wrong. For overflow clip we use the values cached by the layer.
rect.setLocation(topLeft);
- if (container->hasOverflowClip()) {
- LayoutBox* containerBox = toLayoutBox(container);
- containerBox->mapScrollingContentsRectToBoxSpace(rect);
- if (container != ancestor && !containerBox->applyOverflowClip(rect, visualRectFlags))
- return false;
- }
+
+ if (container->isBox() && !toLayoutBox(container)->mapScrollingContentsRectToBoxSpace(rect, container == ancestor ? ApplyNonScrollOverflowClip : ApplyOverflowClip, visualRectFlags))
+ return false;
if (ancestorSkipped) {
// If the ancestor is below o, then we need to map the rect into ancestor's coordinates.
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.h ('k') | third_party/WebKit/Source/core/layout/LayoutInline.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698