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

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

Issue 1643663002: Conditionally create PaintLayer's scrollable area object (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@PaintLayerClipper
Patch Set: Created 4 years, 10 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/LayoutBlock.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
index 9793a7e6714b61b6a6e07379afc26ae23cf00e83..597235f810dec3ea1ef63ce0f4f632b19a60f45a 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -287,6 +287,28 @@ void LayoutBlock::styleDidChange(StyleDifference diff, const ComputedStyle* oldS
m_heightAvailableToChildrenChanged |= oldStyle && diff.needsFullLayout() && needsLayout() && borderOrPaddingLogicalDimensionChanged(*oldStyle, newStyle, LogicalHeight);
}
+void LayoutBlock::updateFromStyle()
+{
+ LayoutBox::updateFromStyle();
+
+ bool shouldClipOverflow = !styleRef().isOverflowVisible() && allowsOverflowClip();
Xianzhu 2016/02/25 19:57:51 Moved from LayoutBox::updateFromStyle().
+ if (shouldClipOverflow != hasOverflowClip()) {
+ // FIXME: This shouldn't be required if we tracked the visual overflow
+ // generated by positioned children or self painting layers. crbug.com/345403
+ for (LayoutObject* child = firstChild(); child; child = child->nextSibling())
+ child->setMayNeedPaintInvalidation();
+ }
+ setHasOverflowClip(shouldClipOverflow);
+}
+
+bool LayoutBlock::allowsOverflowClip() const
+{
+ bool rootLayerScrolls = document().settings() && document().settings()->rootLayerScrolls();
+ return (rootLayerScrolls || !isLayoutView())
+ // If overflow has been propagated to the viewport, it has no effect here.
+ && node() != document().viewportDefiningElement();
chrishtr 2016/02/26 19:42:16 It seems it would be slightly faster to write: if
Xianzhu 2016/02/26 20:12:57 Separated out root scroll logic into LayoutView::a
+}
+
void LayoutBlock::invalidatePaintOfSubtreesIfNeeded(PaintInvalidationState& childPaintInvalidationState)
{
LayoutBox::invalidatePaintOfSubtreesIfNeeded(childPaintInvalidationState);

Powered by Google App Engine
This is Rietveld 408576698