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

Unified Diff: Source/core/layout/LayoutView.cpp

Issue 1164933003: Split-out change for https://codereview.chromium.org/1145993002/ patch set 11 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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
« no previous file with comments | « Source/core/layout/LayoutView.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutView.cpp
diff --git a/Source/core/layout/LayoutView.cpp b/Source/core/layout/LayoutView.cpp
index 66e7c764e20d271e8b2f3a9db35012cc709631ed..71f8f06ac67bdc4125aee779cacd12112b3299b3 100644
--- a/Source/core/layout/LayoutView.cpp
+++ b/Source/core/layout/LayoutView.cpp
@@ -219,8 +219,6 @@ void LayoutView::layout()
SubtreeLayoutScope layoutScope(*this);
- LayoutRect oldLayoutOverflowRect = layoutOverflowRect();
-
// Use calcWidth/Height to get the new width/height, since this will take the full page zoom factor into account.
bool relayoutChildren = !shouldUsePrintingLayout() && (!m_frameView
|| logicalWidth() != viewLogicalWidthForBoxSizing()
@@ -252,22 +250,64 @@ void LayoutView::layout()
layoutContent();
- if (RuntimeEnabledFeatures::slimmingPaintEnabled() && layoutOverflowRect() != oldLayoutOverflowRect) {
- // The document element paints the viewport background, so we need to invalidate it when
- // layout overflow changes.
- // FIXME: Improve viewport background styling/invalidation/painting. crbug.com/475115
- if (Element* documentElement = document().documentElement()) {
- if (LayoutObject* rootObject = documentElement->layoutObject())
- rootObject->setShouldDoFullPaintInvalidation();
- }
- }
-
#if ENABLE(ASSERT)
checkLayoutState();
#endif
clearNeedsLayout();
}
+void LayoutView::styleDidChange(StyleDifference diff, const ComputedStyle* oldStyle)
+{
+ const ComputedStyle& newStyle = styleRef();
+
+ if (oldStyle && oldStyle->hasEntirelyFixedBackground() != newStyle.hasEntirelyFixedBackground())
+ compositor()->setNeedsUpdateFixedBackground();
+
+ LayoutBlockFlow::styleDidChange(diff, oldStyle);
+}
+
+PaintInvalidationReason LayoutView::invalidatePaintIfNeeded(PaintInvalidationState& paintInvalidationState, const LayoutBoxModelObject& newPaintInvalidationContainer)
+{
+ const LayoutObject* rootObject = document().documentElement() ? document().documentElement()->layoutObject() : nullptr;
+ TransformationMatrix newTransform;
+ LayoutSize newBorderBoxSize;
+ LayoutRect newPaddingBoxRect;
+ LayoutRect newContentBoxRect;
+
+ if (rootObject && rootObject->isBox()) {
+ const LayoutBox& rootBox = toLayoutBox(*rootObject);
+ if (rootBox.hasLayer()) {
+ const DeprecatedPaintLayer& rootLayer = *rootBox.layer();
+ LayoutPoint offset;
+ rootLayer.convertToLayerCoords(nullptr, offset);
+ newTransform.translate(offset.x(), offset.y());
+ newTransform.multiply(rootLayer.currentTransform());
+ }
+ newBorderBoxSize = rootBox.size();
+ newPaddingBoxRect = rootBox.paddingBoxRect();
+ newContentBoxRect = rootBox.contentBoxRect();
+ }
+
+ if (m_previousRootBackgroundPositioning.transform != newTransform)
+ setShouldDoFullPaintInvalidation(PaintInvalidationLocationChange);
+
+ const FillLayer& backgroundLayers = style()->backgroundLayers();
+ if (mustInvalidateFillLayersPaintOnWidthChange(backgroundLayers) || mustInvalidateFillLayersPaintOnHeightChange(backgroundLayers)) {
+ if (m_previousRootBackgroundPositioning.borderBoxSize != newBorderBoxSize
+ || m_previousRootBackgroundPositioning.paddingBoxRect != newPaddingBoxRect
+ || m_previousRootBackgroundPositioning.contentBoxRect != newContentBoxRect) {
+ setShouldDoFullPaintInvalidation(PaintInvalidationBorderBoxChange);
+ }
+ }
+
+ m_previousRootBackgroundPositioning.transform = newTransform;
+ m_previousRootBackgroundPositioning.borderBoxSize = newBorderBoxSize;
+ m_previousRootBackgroundPositioning.paddingBoxRect = newPaddingBoxRect;
+ m_previousRootBackgroundPositioning.contentBoxRect = newContentBoxRect;
+
+ return LayoutBox::invalidatePaintIfNeeded(paintInvalidationState, newPaintInvalidationContainer);
+}
+
void LayoutView::mapLocalToContainer(const LayoutBoxModelObject* paintInvalidationContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed, const PaintInvalidationState* paintInvalidationState) const
{
ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & IsFixed));
« no previous file with comments | « Source/core/layout/LayoutView.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698