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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp

Issue 2002153007: Refactor to simplify how layerType is stored on PaintLayers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2010 Google Inc. All rights reserved. 7 * Copyright (C) 2010 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 && (styleRef().originalDisplay() != oldStyle->originalDisplay()) 199 && (styleRef().originalDisplay() != oldStyle->originalDisplay())
200 && ((styleRef().originalDisplay() == BLOCK) || (styleRef().originalDispl ay() == INLINE_BLOCK)) 200 && ((styleRef().originalDisplay() == BLOCK) || (styleRef().originalDispl ay() == INLINE_BLOCK))
201 && ((oldStyle->originalDisplay() == BLOCK) || (oldStyle->originalDisplay () == INLINE_BLOCK))) 201 && ((oldStyle->originalDisplay() == BLOCK) || (oldStyle->originalDisplay () == INLINE_BLOCK)))
202 parent()->setNeedsLayout(LayoutInvalidationReason::ChildChanged, MarkCon tainerChain); 202 parent()->setNeedsLayout(LayoutInvalidationReason::ChildChanged, MarkCon tainerChain);
203 203
204 PaintLayerType type = layerTypeRequired(); 204 PaintLayerType type = layerTypeRequired();
205 if (type != NoPaintLayer) { 205 if (type != NoPaintLayer) {
206 if (!layer() && layerCreationAllowedForSubtree()) { 206 if (!layer() && layerCreationAllowedForSubtree()) {
207 if (wasFloatingBeforeStyleChanged && isFloating()) 207 if (wasFloatingBeforeStyleChanged && isFloating())
208 setChildNeedsLayout(); 208 setChildNeedsLayout();
209 createLayer(type); 209 createLayer();
210 if (parent() && !needsLayout()) { 210 if (parent() && !needsLayout()) {
211 // FIXME: We should call a specialized version of this function. 211 // FIXME: We should call a specialized version of this function.
212 layer()->updateLayerPositionsAfterLayout(); 212 layer()->updateLayerPositionsAfterLayout();
213 } 213 }
214 } 214 }
215 } else if (layer() && layer()->parent()) { 215 } else if (layer() && layer()->parent()) {
216 PaintLayer* parentLayer = layer()->parent(); 216 PaintLayer* parentLayer = layer()->parent();
217 setHasTransformRelatedProperty(false); // Either a transform wasn't spec ified or the object doesn't support transforms, so just null out the bit. 217 setHasTransformRelatedProperty(false); // Either a transform wasn't spec ified or the object doesn't support transforms, so just null out the bit.
218 setHasReflection(false); 218 setHasReflection(false);
219 layer()->removeOnlyThisLayerAfterStyleChange(); // calls destroyLayer() which clears m_layer 219 layer()->removeOnlyThisLayerAfterStyleChange(); // calls destroyLayer() which clears m_layer
220 if (wasFloatingBeforeStyleChanged && isFloating()) 220 if (wasFloatingBeforeStyleChanged && isFloating())
221 setChildNeedsLayout(); 221 setChildNeedsLayout();
222 if (hadTransform) 222 if (hadTransform)
223 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInva lidationReason::StyleChange); 223 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInva lidationReason::StyleChange);
224 if (!needsLayout()) { 224 if (!needsLayout()) {
225 // FIXME: We should call a specialized version of this function. 225 // FIXME: We should call a specialized version of this function.
226 parentLayer->updateLayerPositionsAfterLayout(); 226 parentLayer->updateLayerPositionsAfterLayout();
227 } 227 }
228 } 228 }
229 229
230 if (layer()) { 230 if (layer()) {
231 // FIXME: Ideally we shouldn't need this setter but we can't easily infe r an overflow-only layer
232 // from the style.
233 layer()->setLayerType(type);
234
235 layer()->styleDidChange(diff, oldStyle); 231 layer()->styleDidChange(diff, oldStyle);
236 if (hadLayer && layer()->isSelfPaintingLayer() != layerWasSelfPainting) 232 if (hadLayer && layer()->isSelfPaintingLayer() != layerWasSelfPainting)
237 setChildNeedsLayout(); 233 setChildNeedsLayout();
238 } 234 }
239 235
240 if (oldStyle && wasHorizontalWritingMode != isHorizontalWritingMode()) { 236 if (oldStyle && wasHorizontalWritingMode != isHorizontalWritingMode()) {
241 // Changing the getWritingMode() may change isOrthogonalWritingModeRoot( ) 237 // Changing the getWritingMode() may change isOrthogonalWritingModeRoot( )
242 // of children. Make sure all children are marked/unmarked as orthogonal 238 // of children. Make sure all children are marked/unmarked as orthogonal
243 // writing-mode roots. 239 // writing-mode roots.
244 bool newHorizontalWritingMode = isHorizontalWritingMode(); 240 bool newHorizontalWritingMode = isHorizontalWritingMode();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 return; 320 return;
325 321
326 // This intentionally uses the stale ancestor overflow layer compositing 322 // This intentionally uses the stale ancestor overflow layer compositing
327 // input as if we have saved constraints for this layer they were saved 323 // input as if we have saved constraints for this layer they were saved
328 // in the previous frame. 324 // in the previous frame.
329 DisableCompositingQueryAsserts disabler; 325 DisableCompositingQueryAsserts disabler;
330 if (const PaintLayer* ancestorOverflowLayer = layer()->ancestorOverflowLayer ()) 326 if (const PaintLayer* ancestorOverflowLayer = layer()->ancestorOverflowLayer ())
331 ancestorOverflowLayer->getScrollableArea()->invalidateAllStickyConstrain ts(); 327 ancestorOverflowLayer->getScrollableArea()->invalidateAllStickyConstrain ts();
332 } 328 }
333 329
334 void LayoutBoxModelObject::createLayer(PaintLayerType type) 330 void LayoutBoxModelObject::createLayer()
335 { 331 {
336 ASSERT(!m_layer); 332 ASSERT(!m_layer);
337 m_layer = adoptPtr(new PaintLayer(this, type)); 333 m_layer = adoptPtr(new PaintLayer(this));
338 setHasLayer(true); 334 setHasLayer(true);
339 m_layer->insertOnlyThisLayerAfterStyleChange(); 335 m_layer->insertOnlyThisLayerAfterStyleChange();
340 } 336 }
341 337
342 void LayoutBoxModelObject::destroyLayer() 338 void LayoutBoxModelObject::destroyLayer()
343 { 339 {
344 setHasLayer(false); 340 setHasLayer(false);
345 m_layer = nullptr; 341 m_layer = nullptr;
346 } 342 }
347 343
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 if (rootElementStyle->hasBackground()) 1114 if (rootElementStyle->hasBackground())
1119 return false; 1115 return false;
1120 1116
1121 if (node() != document().firstBodyElement()) 1117 if (node() != document().firstBodyElement())
1122 return false; 1118 return false;
1123 1119
1124 return true; 1120 return true;
1125 } 1121 }
1126 1122
1127 } // namespace blink 1123 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h ('k') | third_party/WebKit/Source/core/paint/PaintLayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698