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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayer.cpp

Issue 1640843003: Make PaintLayerClipper objects transient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@PaintLayerRareData
Patch Set: Inline PaintLayerClipper ctor 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 namespace blink { 93 namespace blink {
94 94
95 namespace { 95 namespace {
96 96
97 static CompositingQueryMode gCompositingQueryMode = 97 static CompositingQueryMode gCompositingQueryMode =
98 CompositingQueriesAreOnlyAllowedInCertainDocumentLifecyclePhases; 98 CompositingQueriesAreOnlyAllowedInCertainDocumentLifecyclePhases;
99 99
100 struct SameSizeAsPaintLayer : DisplayItemClient { 100 struct SameSizeAsPaintLayer : DisplayItemClient {
101 int bitFields; 101 int bitFields;
102 void* pointers[8]; 102 void* pointers[9];
103 LayoutUnit layoutUnits[4]; 103 LayoutUnit layoutUnits[4];
104 IntSize size; 104 IntSize size;
105 OwnPtrWillBePersistent<PaintLayerScrollableArea> scrollableArea; 105 OwnPtrWillBePersistent<PaintLayerScrollableArea> scrollableArea;
106 struct { 106 struct {
107 IntRect rect; 107 IntRect rect;
108 void* pointers[2]; 108 void* pointers[2];
109 } ancestorCompositingInputs; 109 } ancestorCompositingInputs;
110 struct { 110 struct {
111 void* pointers[2];
112 } clipper;
113 struct {
114 IntSize size; 111 IntSize size;
115 void* pointer; 112 void* pointer;
116 LayoutRect rect; 113 LayoutRect rect;
117 } previousPaintStatus; 114 } previousPaintStatus;
118 }; 115 };
119 116
120 static_assert(sizeof(PaintLayer) == sizeof(SameSizeAsPaintLayer), "PaintLayer sh ould stay small"); 117 static_assert(sizeof(PaintLayer) == sizeof(SameSizeAsPaintLayer), "PaintLayer sh ould stay small");
121 118
122 } // namespace 119 } // namespace
123 120
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 , m_hasNonIsolatedDescendantWithBlendMode(false) 163 , m_hasNonIsolatedDescendantWithBlendMode(false)
167 , m_hasAncestorWithClipPath(false) 164 , m_hasAncestorWithClipPath(false)
168 , m_layoutObject(layoutObject) 165 , m_layoutObject(layoutObject)
169 , m_parent(0) 166 , m_parent(0)
170 , m_previous(0) 167 , m_previous(0)
171 , m_next(0) 168 , m_next(0)
172 , m_first(0) 169 , m_first(0)
173 , m_last(0) 170 , m_last(0)
174 , m_staticInlinePosition(0) 171 , m_staticInlinePosition(0)
175 , m_staticBlockPosition(0) 172 , m_staticBlockPosition(0)
176 , m_clipper(*layoutObject)
177 { 173 {
178 updateStackingNode(); 174 updateStackingNode();
179 175
180 m_isSelfPaintingLayer = shouldBeSelfPaintingLayer(); 176 m_isSelfPaintingLayer = shouldBeSelfPaintingLayer();
181 177
182 if (!layoutObject->slowFirstChild() && layoutObject->style()) { 178 if (!layoutObject->slowFirstChild() && layoutObject->style()) {
183 m_visibleContentStatusDirty = false; 179 m_visibleContentStatusDirty = false;
184 m_hasVisibleContent = layoutObject->style()->visibility() == VISIBLE; 180 m_hasVisibleContent = layoutObject->style()->visibility() == VISIBLE;
185 } 181 }
186 182
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 void PaintLayer::setSubpixelAccumulation(const LayoutSize& size) 280 void PaintLayer::setSubpixelAccumulation(const LayoutSize& size)
285 { 281 {
286 if (m_rareData || !size.isZero()) 282 if (m_rareData || !size.isZero())
287 ensureRareData().subpixelAccumulation = size; 283 ensureRareData().subpixelAccumulation = size;
288 } 284 }
289 285
290 void PaintLayer::updateLayerPositionsAfterLayout() 286 void PaintLayer::updateLayerPositionsAfterLayout()
291 { 287 {
292 TRACE_EVENT0("blink,benchmark", "PaintLayer::updateLayerPositionsAfterLayout "); 288 TRACE_EVENT0("blink,benchmark", "PaintLayer::updateLayerPositionsAfterLayout ");
293 289
294 m_clipper.clearClipRectsIncludingDescendants(); 290 clipper().clearClipRectsIncludingDescendants();
295 updateLayerPositionRecursive(); 291 updateLayerPositionRecursive();
296 292
297 { 293 {
298 // FIXME: Remove incremental compositing updates after fixing the chicke n/egg issues 294 // FIXME: Remove incremental compositing updates after fixing the chicke n/egg issues
299 // https://code.google.com/p/chromium/issues/detail?id=343756 295 // https://code.google.com/p/chromium/issues/detail?id=343756
300 DisableCompositingQueryAsserts disabler; 296 DisableCompositingQueryAsserts disabler;
301 updatePaginationRecursive(enclosingPaginationLayer()); 297 updatePaginationRecursive(enclosingPaginationLayer());
302 } 298 }
303 } 299 }
304 300
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 357
362 bool PaintLayer::scrollsWithRespectTo(const PaintLayer* other) const 358 bool PaintLayer::scrollsWithRespectTo(const PaintLayer* other) const
363 { 359 {
364 if (scrollsWithViewport() != other->scrollsWithViewport()) 360 if (scrollsWithViewport() != other->scrollsWithViewport())
365 return true; 361 return true;
366 return ancestorScrollingLayer() != other->ancestorScrollingLayer(); 362 return ancestorScrollingLayer() != other->ancestorScrollingLayer();
367 } 363 }
368 364
369 void PaintLayer::updateLayerPositionsAfterOverflowScroll(const DoubleSize& scrol lDelta) 365 void PaintLayer::updateLayerPositionsAfterOverflowScroll(const DoubleSize& scrol lDelta)
370 { 366 {
371 m_clipper.clearClipRectsIncludingDescendants(); 367 clipper().clearClipRectsIncludingDescendants();
372 updateLayerPositionsAfterScrollRecursive(scrollDelta, isPaintInvalidationCon tainer()); 368 updateLayerPositionsAfterScrollRecursive(scrollDelta, isPaintInvalidationCon tainer());
373 } 369 }
374 370
375 void PaintLayer::updateLayerPositionsAfterScrollRecursive(const DoubleSize& scro llDelta, bool paintInvalidationContainerWasScrolled) 371 void PaintLayer::updateLayerPositionsAfterScrollRecursive(const DoubleSize& scro llDelta, bool paintInvalidationContainerWasScrolled)
376 { 372 {
377 updateLayerPosition(); 373 updateLayerPosition();
378 if (paintInvalidationContainerWasScrolled && !isPaintInvalidationContainer() ) { 374 if (paintInvalidationContainerWasScrolled && !isPaintInvalidationContainer() ) {
379 // Paint invalidation rects are in the coordinate space of the paint inv alidation container. 375 // Paint invalidation rects are in the coordinate space of the paint inv alidation container.
380 // If it has scrolled, the rect must be adjusted. Note that it is not sa fe to reset it to 376 // If it has scrolled, the rect must be adjusted. Note that it is not sa fe to reset it to
381 // the current bounds rect, as the LayoutObject may have moved since the last invalidation. 377 // the current bounds rect, as the LayoutObject may have moved since the last invalidation.
(...skipping 29 matching lines...) Expand all
411 bool had3DTransform = has3DTransform(); 407 bool had3DTransform = has3DTransform();
412 408
413 bool hadTransform = transform(); 409 bool hadTransform = transform();
414 if (hasTransform != hadTransform) { 410 if (hasTransform != hadTransform) {
415 if (hasTransform) 411 if (hasTransform)
416 ensureRareData().transform = adoptPtr(new TransformationMatrix); 412 ensureRareData().transform = adoptPtr(new TransformationMatrix);
417 else 413 else
418 m_rareData->transform.clear(); 414 m_rareData->transform.clear();
419 415
420 // PaintLayers with transforms act as clip rects roots, so clear the cac hed clip rects here. 416 // PaintLayers with transforms act as clip rects roots, so clear the cac hed clip rects here.
421 m_clipper.clearClipRectsIncludingDescendants(); 417 clipper().clearClipRectsIncludingDescendants();
422 } else if (hasTransform) { 418 } else if (hasTransform) {
423 m_clipper.clearClipRectsIncludingDescendants(AbsoluteClipRects); 419 clipper().clearClipRectsIncludingDescendants(AbsoluteClipRects);
424 } 420 }
425 421
426 updateTransformationMatrix(); 422 updateTransformationMatrix();
427 423
428 if (had3DTransform != has3DTransform()) 424 if (had3DTransform != has3DTransform())
429 dirty3DTransformedDescendantStatus(); 425 dirty3DTransformedDescendantStatus();
430 } 426 }
431 427
432 static PaintLayer* enclosingLayerForContainingBlock(PaintLayer* layer) 428 static PaintLayer* enclosingLayerForContainingBlock(PaintLayer* layer)
433 { 429 {
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 if (isPaintInvalidationContainer()) { 1258 if (isPaintInvalidationContainer()) {
1263 // Our children will be reparented and contained by a new paint inva lidation container, 1259 // Our children will be reparented and contained by a new paint inva lidation container,
1264 // so need paint invalidation. CompositingUpdate can't see this laye r (which has been 1260 // so need paint invalidation. CompositingUpdate can't see this laye r (which has been
1265 // removed) so won't do this for us. 1261 // removed) so won't do this for us.
1266 DisablePaintInvalidationStateAsserts disabler; 1262 DisablePaintInvalidationStateAsserts disabler;
1267 layoutObject()->invalidatePaintIncludingNonCompositingDescendants(); 1263 layoutObject()->invalidatePaintIncludingNonCompositingDescendants();
1268 layoutObject()->setShouldDoFullPaintInvalidationIncludingNonComposit ingDescendants(); 1264 layoutObject()->setShouldDoFullPaintInvalidationIncludingNonComposit ingDescendants();
1269 } 1265 }
1270 } 1266 }
1271 1267
1272 m_clipper.clearClipRectsIncludingDescendants(); 1268 clipper().clearClipRectsIncludingDescendants();
1273 1269
1274 PaintLayer* nextSib = nextSibling(); 1270 PaintLayer* nextSib = nextSibling();
1275 1271
1276 // Remove the child reflection layer before moving other child layers. 1272 // Remove the child reflection layer before moving other child layers.
1277 // The reflection layer should not be moved to the parent. 1273 // The reflection layer should not be moved to the parent.
1278 if (PaintLayerReflectionInfo* reflectionInfo = this->reflectionInfo()) 1274 if (PaintLayerReflectionInfo* reflectionInfo = this->reflectionInfo())
1279 removeChild(reflectionInfo->reflectionLayer()); 1275 removeChild(reflectionInfo->reflectionLayer());
1280 1276
1281 // Now walk our kids and reattach them to our parent. 1277 // Now walk our kids and reattach them to our parent.
1282 PaintLayer* current = m_first; 1278 PaintLayer* current = m_first;
(...skipping 21 matching lines...) Expand all
1304 ASSERT(parentLayer); 1300 ASSERT(parentLayer);
1305 PaintLayer* beforeChild = !parentLayer->reflectionInfo() || parentLayer- >reflectionInfo()->reflectionLayer() != this ? layoutObject()->parent()->findNex tLayer(parentLayer, layoutObject()) : 0; 1301 PaintLayer* beforeChild = !parentLayer->reflectionInfo() || parentLayer- >reflectionInfo()->reflectionLayer() != this ? layoutObject()->parent()->findNex tLayer(parentLayer, layoutObject()) : 0;
1306 parentLayer->addChild(this, beforeChild); 1302 parentLayer->addChild(this, beforeChild);
1307 } 1303 }
1308 1304
1309 // Remove all descendant layers from the hierarchy and add them to the new p osition. 1305 // Remove all descendant layers from the hierarchy and add them to the new p osition.
1310 for (LayoutObject* curr = layoutObject()->slowFirstChild(); curr; curr = cur r->nextSibling()) 1306 for (LayoutObject* curr = layoutObject()->slowFirstChild(); curr; curr = cur r->nextSibling())
1311 curr->moveLayers(m_parent, this); 1307 curr->moveLayers(m_parent, this);
1312 1308
1313 // Clear out all the clip rects. 1309 // Clear out all the clip rects.
1314 m_clipper.clearClipRectsIncludingDescendants(); 1310 clipper().clearClipRectsIncludingDescendants();
1315 } 1311 }
1316 1312
1317 // Returns the layer reached on the walk up towards the ancestor. 1313 // Returns the layer reached on the walk up towards the ancestor.
1318 static inline const PaintLayer* accumulateOffsetTowardsAncestor(const PaintLayer * layer, const PaintLayer* ancestorLayer, LayoutPoint& location) 1314 static inline const PaintLayer* accumulateOffsetTowardsAncestor(const PaintLayer * layer, const PaintLayer* ancestorLayer, LayoutPoint& location)
1319 { 1315 {
1320 ASSERT(ancestorLayer != layer); 1316 ASSERT(ancestorLayer != layer);
1321 1317
1322 const LayoutBoxModelObject* layoutObject = layer->layoutObject(); 1318 const LayoutBoxModelObject* layoutObject = layer->layoutObject();
1323 EPosition position = layoutObject->style()->position(); 1319 EPosition position = layoutObject->style()->position();
1324 1320
(...skipping 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after
2880 2876
2881 void showLayerTree(const blink::LayoutObject* layoutObject) 2877 void showLayerTree(const blink::LayoutObject* layoutObject)
2882 { 2878 {
2883 if (!layoutObject) { 2879 if (!layoutObject) {
2884 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); 2880 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n");
2885 return; 2881 return;
2886 } 2882 }
2887 showLayerTree(layoutObject->enclosingLayer()); 2883 showLayerTree(layoutObject->enclosingLayer());
2888 } 2884 }
2889 #endif 2885 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.h ('k') | third_party/WebKit/Source/core/paint/PaintLayerClipper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698