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

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

Issue 2025093002: Refactor to simplify how layerType is stored on PaintLayers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 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
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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 && (styleRef().originalDisplay() != oldStyle->originalDisplay()) 200 && (styleRef().originalDisplay() != oldStyle->originalDisplay())
201 && ((styleRef().originalDisplay() == BLOCK) || (styleRef().originalDispl ay() == INLINE_BLOCK)) 201 && ((styleRef().originalDisplay() == BLOCK) || (styleRef().originalDispl ay() == INLINE_BLOCK))
202 && ((oldStyle->originalDisplay() == BLOCK) || (oldStyle->originalDisplay () == INLINE_BLOCK))) 202 && ((oldStyle->originalDisplay() == BLOCK) || (oldStyle->originalDisplay () == INLINE_BLOCK)))
203 parent()->setNeedsLayout(LayoutInvalidationReason::ChildChanged, MarkCon tainerChain); 203 parent()->setNeedsLayout(LayoutInvalidationReason::ChildChanged, MarkCon tainerChain);
204 204
205 PaintLayerType type = layerTypeRequired(); 205 PaintLayerType type = layerTypeRequired();
206 if (type != NoPaintLayer) { 206 if (type != NoPaintLayer) {
207 if (!layer() && layerCreationAllowedForSubtree()) { 207 if (!layer() && layerCreationAllowedForSubtree()) {
208 if (wasFloatingBeforeStyleChanged && isFloating()) 208 if (wasFloatingBeforeStyleChanged && isFloating())
209 setChildNeedsLayout(); 209 setChildNeedsLayout();
210 createLayer(type); 210 createLayer();
211 if (parent() && !needsLayout()) { 211 if (parent() && !needsLayout()) {
212 // FIXME: We should call a specialized version of this function. 212 // FIXME: We should call a specialized version of this function.
213 layer()->updateLayerPositionsAfterLayout(); 213 layer()->updateLayerPositionsAfterLayout();
214 } 214 }
215 } 215 }
216 } else if (layer() && layer()->parent()) { 216 } else if (layer() && layer()->parent()) {
217 PaintLayer* parentLayer = layer()->parent(); 217 PaintLayer* parentLayer = layer()->parent();
218 setHasTransformRelatedProperty(false); // Either a transform wasn't spec ified or the object doesn't support transforms, so just null out the bit. 218 setHasTransformRelatedProperty(false); // Either a transform wasn't spec ified or the object doesn't support transforms, so just null out the bit.
219 setHasReflection(false); 219 setHasReflection(false);
220 layer()->removeOnlyThisLayerAfterStyleChange(); // calls destroyLayer() which clears m_layer 220 layer()->removeOnlyThisLayerAfterStyleChange(); // calls destroyLayer() which clears m_layer
221 if (wasFloatingBeforeStyleChanged && isFloating()) 221 if (wasFloatingBeforeStyleChanged && isFloating())
222 setChildNeedsLayout(); 222 setChildNeedsLayout();
223 if (hadTransform) 223 if (hadTransform)
224 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInva lidationReason::StyleChange); 224 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInva lidationReason::StyleChange);
225 if (!needsLayout()) { 225 if (!needsLayout()) {
226 // FIXME: We should call a specialized version of this function. 226 // FIXME: We should call a specialized version of this function.
227 parentLayer->updateLayerPositionsAfterLayout(); 227 parentLayer->updateLayerPositionsAfterLayout();
228 } 228 }
229 } 229 }
230 230
231 if (layer()) { 231 if (layer()) {
232 // FIXME: Ideally we shouldn't need this setter but we can't easily infe r an overflow-only layer
233 // from the style.
234 layer()->setLayerType(type);
235
236 layer()->styleDidChange(diff, oldStyle); 232 layer()->styleDidChange(diff, oldStyle);
237 if (hadLayer && layer()->isSelfPaintingLayer() != layerWasSelfPainting) 233 if (hadLayer && layer()->isSelfPaintingLayer() != layerWasSelfPainting)
238 setChildNeedsLayout(); 234 setChildNeedsLayout();
239 } 235 }
240 236
241 if (oldStyle && wasHorizontalWritingMode != isHorizontalWritingMode()) { 237 if (oldStyle && wasHorizontalWritingMode != isHorizontalWritingMode()) {
242 // Changing the getWritingMode() may change isOrthogonalWritingModeRoot( ) 238 // Changing the getWritingMode() may change isOrthogonalWritingModeRoot( )
243 // of children. Make sure all children are marked/unmarked as orthogonal 239 // of children. Make sure all children are marked/unmarked as orthogonal
244 // writing-mode roots. 240 // writing-mode roots.
245 bool newHorizontalWritingMode = isHorizontalWritingMode(); 241 bool newHorizontalWritingMode = isHorizontalWritingMode();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 return; 321 return;
326 322
327 // This intentionally uses the stale ancestor overflow layer compositing 323 // This intentionally uses the stale ancestor overflow layer compositing
328 // input as if we have saved constraints for this layer they were saved 324 // input as if we have saved constraints for this layer they were saved
329 // in the previous frame. 325 // in the previous frame.
330 DisableCompositingQueryAsserts disabler; 326 DisableCompositingQueryAsserts disabler;
331 if (const PaintLayer* ancestorOverflowLayer = layer()->ancestorOverflowLayer ()) 327 if (const PaintLayer* ancestorOverflowLayer = layer()->ancestorOverflowLayer ())
332 ancestorOverflowLayer->getScrollableArea()->invalidateAllStickyConstrain ts(); 328 ancestorOverflowLayer->getScrollableArea()->invalidateAllStickyConstrain ts();
333 } 329 }
334 330
335 void LayoutBoxModelObject::createLayer(PaintLayerType type) 331 void LayoutBoxModelObject::createLayer()
336 { 332 {
337 ASSERT(!m_layer); 333 ASSERT(!m_layer);
338 m_layer = adoptPtr(new PaintLayer(this, type)); 334 m_layer = adoptPtr(new PaintLayer(this));
339 setHasLayer(true); 335 setHasLayer(true);
340 m_layer->insertOnlyThisLayerAfterStyleChange(); 336 m_layer->insertOnlyThisLayerAfterStyleChange();
341 } 337 }
342 338
343 void LayoutBoxModelObject::destroyLayer() 339 void LayoutBoxModelObject::destroyLayer()
344 { 340 {
345 setHasLayer(false); 341 setHasLayer(false);
346 m_layer = nullptr; 342 m_layer = nullptr;
347 } 343 }
348 344
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 if (rootElementStyle->hasBackground()) 1115 if (rootElementStyle->hasBackground())
1120 return false; 1116 return false;
1121 1117
1122 if (node() != document().firstBodyElement()) 1118 if (node() != document().firstBodyElement())
1123 return false; 1119 return false;
1124 1120
1125 return true; 1121 return true;
1126 } 1122 }
1127 1123
1128 } // namespace blink 1124 } // 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