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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/LayoutView.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 void LayoutView::layout() 212 void LayoutView::layout()
213 { 213 {
214 if (!document().paginated()) 214 if (!document().paginated())
215 setPageLogicalHeight(0); 215 setPageLogicalHeight(0);
216 216
217 if (shouldUsePrintingLayout()) 217 if (shouldUsePrintingLayout())
218 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth() ; 218 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth() ;
219 219
220 SubtreeLayoutScope layoutScope(*this); 220 SubtreeLayoutScope layoutScope(*this);
221 221
222 LayoutRect oldLayoutOverflowRect = layoutOverflowRect();
223
224 // Use calcWidth/Height to get the new width/height, since this will take th e full page zoom factor into account. 222 // Use calcWidth/Height to get the new width/height, since this will take th e full page zoom factor into account.
225 bool relayoutChildren = !shouldUsePrintingLayout() && (!m_frameView 223 bool relayoutChildren = !shouldUsePrintingLayout() && (!m_frameView
226 || logicalWidth() != viewLogicalWidthForBoxSizing() 224 || logicalWidth() != viewLogicalWidthForBoxSizing()
227 || logicalHeight() != viewLogicalHeightForBoxSizing()); 225 || logicalHeight() != viewLogicalHeightForBoxSizing());
228 if (relayoutChildren) { 226 if (relayoutChildren) {
229 layoutScope.setChildNeedsLayout(this); 227 layoutScope.setChildNeedsLayout(this);
230 for (LayoutObject* child = firstChild(); child; child = child->nextSibli ng()) { 228 for (LayoutObject* child = firstChild(); child; child = child->nextSibli ng()) {
231 if (child->isSVGRoot()) 229 if (child->isSVGRoot())
232 continue; 230 continue;
233 231
(...skipping 11 matching lines...) Expand all
245 ASSERT(!m_layoutState); 243 ASSERT(!m_layoutState);
246 if (!needsLayout()) 244 if (!needsLayout())
247 return; 245 return;
248 246
249 LayoutState rootLayoutState(pageLogicalHeight(), pageLogicalHeightChanged(), *this); 247 LayoutState rootLayoutState(pageLogicalHeight(), pageLogicalHeightChanged(), *this);
250 248
251 m_pageLogicalHeightChanged = false; 249 m_pageLogicalHeightChanged = false;
252 250
253 layoutContent(); 251 layoutContent();
254 252
255 if (RuntimeEnabledFeatures::slimmingPaintEnabled() && layoutOverflowRect() ! = oldLayoutOverflowRect) {
256 // The document element paints the viewport background, so we need to in validate it when
257 // layout overflow changes.
258 // FIXME: Improve viewport background styling/invalidation/painting. crb ug.com/475115
259 if (Element* documentElement = document().documentElement()) {
260 if (LayoutObject* rootObject = documentElement->layoutObject())
261 rootObject->setShouldDoFullPaintInvalidation();
262 }
263 }
264
265 #if ENABLE(ASSERT) 253 #if ENABLE(ASSERT)
266 checkLayoutState(); 254 checkLayoutState();
267 #endif 255 #endif
268 clearNeedsLayout(); 256 clearNeedsLayout();
269 } 257 }
270 258
259 void LayoutView::styleDidChange(StyleDifference diff, const ComputedStyle* oldSt yle)
260 {
261 const ComputedStyle& newStyle = styleRef();
262
263 if (oldStyle && oldStyle->hasEntirelyFixedBackground() != newStyle.hasEntire lyFixedBackground())
264 compositor()->setNeedsUpdateFixedBackground();
265
266 LayoutBlockFlow::styleDidChange(diff, oldStyle);
267 }
268
269 PaintInvalidationReason LayoutView::invalidatePaintIfNeeded(PaintInvalidationSta te& paintInvalidationState, const LayoutBoxModelObject& newPaintInvalidationCont ainer)
270 {
271 const LayoutObject* rootObject = document().documentElement() ? document().d ocumentElement()->layoutObject() : nullptr;
272 TransformationMatrix newTransform;
273 LayoutSize newBorderBoxSize;
274 LayoutRect newPaddingBoxRect;
275 LayoutRect newContentBoxRect;
276
277 if (rootObject && rootObject->isBox()) {
278 const LayoutBox& rootBox = toLayoutBox(*rootObject);
279 if (rootBox.hasLayer()) {
280 const DeprecatedPaintLayer& rootLayer = *rootBox.layer();
281 LayoutPoint offset;
282 rootLayer.convertToLayerCoords(nullptr, offset);
283 newTransform.translate(offset.x(), offset.y());
284 newTransform.multiply(rootLayer.currentTransform());
285 }
286 newBorderBoxSize = rootBox.size();
287 newPaddingBoxRect = rootBox.paddingBoxRect();
288 newContentBoxRect = rootBox.contentBoxRect();
289 }
290
291 if (m_previousRootBackgroundPositioning.transform != newTransform)
292 setShouldDoFullPaintInvalidation(PaintInvalidationLocationChange);
293
294 const FillLayer& backgroundLayers = style()->backgroundLayers();
295 if (mustInvalidateFillLayersPaintOnWidthChange(backgroundLayers) || mustInva lidateFillLayersPaintOnHeightChange(backgroundLayers)) {
296 if (m_previousRootBackgroundPositioning.borderBoxSize != newBorderBoxSiz e
297 || m_previousRootBackgroundPositioning.paddingBoxRect != newPaddingB oxRect
298 || m_previousRootBackgroundPositioning.contentBoxRect != newContentB oxRect) {
299 setShouldDoFullPaintInvalidation(PaintInvalidationBorderBoxChange);
300 }
301 }
302
303 m_previousRootBackgroundPositioning.transform = newTransform;
304 m_previousRootBackgroundPositioning.borderBoxSize = newBorderBoxSize;
305 m_previousRootBackgroundPositioning.paddingBoxRect = newPaddingBoxRect;
306 m_previousRootBackgroundPositioning.contentBoxRect = newContentBoxRect;
307
308 return LayoutBox::invalidatePaintIfNeeded(paintInvalidationState, newPaintIn validationContainer);
309 }
310
271 void LayoutView::mapLocalToContainer(const LayoutBoxModelObject* paintInvalidati onContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* was Fixed, const PaintInvalidationState* paintInvalidationState) const 311 void LayoutView::mapLocalToContainer(const LayoutBoxModelObject* paintInvalidati onContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* was Fixed, const PaintInvalidationState* paintInvalidationState) const
272 { 312 {
273 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I sFixed)); 313 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I sFixed));
274 314
275 if (!paintInvalidationContainer && mode & UseTransforms && shouldUseTransfor mFromContainer(0)) { 315 if (!paintInvalidationContainer && mode & UseTransforms && shouldUseTransfor mFromContainer(0)) {
276 TransformationMatrix t; 316 TransformationMatrix t;
277 getTransformFromContainer(0, LayoutSize(), t); 317 getTransformFromContainer(0, LayoutSize(), t);
278 transformState.applyTransform(t); 318 transformState.applyTransform(t);
279 } 319 }
280 320
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 return viewHeight(IncludeScrollbars) / scale; 1001 return viewHeight(IncludeScrollbars) / scale;
962 } 1002 }
963 1003
964 void LayoutView::willBeDestroyed() 1004 void LayoutView::willBeDestroyed()
965 { 1005 {
966 LayoutBlockFlow::willBeDestroyed(); 1006 LayoutBlockFlow::willBeDestroyed();
967 m_compositor.clear(); 1007 m_compositor.clear();
968 } 1008 }
969 1009
970 } // namespace blink 1010 } // namespace blink
OLDNEW
« 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