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

Side by Side Diff: Source/core/rendering/RenderLayer.cpp

Issue 443773002: Delete UpdateLayerPositionsFlags (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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/rendering/RenderLayer.h ('k') | Source/core/rendering/RenderLayerModelObject.cpp » ('j') | 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) 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 LayoutSize RenderLayer::subpixelAccumulation() const 239 LayoutSize RenderLayer::subpixelAccumulation() const
240 { 240 {
241 return m_subpixelAccumulation; 241 return m_subpixelAccumulation;
242 } 242 }
243 243
244 void RenderLayer::setSubpixelAccumulation(const LayoutSize& size) 244 void RenderLayer::setSubpixelAccumulation(const LayoutSize& size)
245 { 245 {
246 m_subpixelAccumulation = size; 246 m_subpixelAccumulation = size;
247 } 247 }
248 248
249 void RenderLayer::updateLayerPositionsAfterLayout(UpdateLayerPositionsFlags flag s) 249 void RenderLayer::updateLayerPositionsAfterLayout()
250 { 250 {
251 TRACE_EVENT0("blink_rendering", "RenderLayer::updateLayerPositionsAfterLayou t"); 251 TRACE_EVENT0("blink_rendering", "RenderLayer::updateLayerPositionsAfterLayou t");
252 252
253 m_clipper.clearClipRectsIncludingDescendants(); 253 m_clipper.clearClipRectsIncludingDescendants();
254 updateLayerPositionRecursive();
254 255
255 // FIXME: Remove incremental compositing updates after fixing the chicken/eg g issues 256 {
256 // https://code.google.com/p/chromium/issues/detail?id=343756 257 // FIXME: Remove incremental compositing updates after fixing the chicke n/egg issues
257 DisableCompositingQueryAsserts disabler; 258 // https://code.google.com/p/chromium/issues/detail?id=343756
258 updateLayerPositionRecursive(flags); 259 DisableCompositingQueryAsserts disabler;
260 bool needsPaginationUpdate = isPaginated() || enclosingPaginationLayer() ;
261 updatePaginationRecursive(needsPaginationUpdate);
262 }
259 } 263 }
260 264
261 void RenderLayer::updateLayerPositionRecursive(UpdateLayerPositionsFlags flags) 265 void RenderLayer::updateLayerPositionRecursive()
262 { 266 {
263 updateLayerPosition(); 267 updateLayerPosition();
264 268
265 if (hasOverflowControls()) { 269 if (hasOverflowControls()) {
266 // FIXME: We should figure out the right time to position the overflow c ontrols. 270 // FIXME: We should figure out the right time to position the overflow c ontrols.
267 // This call appears to be necessary to pass some layout test that use E ventSender, 271 // This call appears to be necessary to pass some layout test that use E ventSender,
268 // presumably because the normal time to position the controls is during paint. We 272 // presumably because the normal time to position the controls is during paint. We
269 // probably shouldn't position the overflow controls during paint either ... 273 // probably shouldn't position the overflow controls during paint either ...
274 DisableCompositingQueryAsserts disabler;
270 scrollableArea()->positionOverflowControls(IntSize()); 275 scrollableArea()->positionOverflowControls(IntSize());
271 } 276 }
272 277
273 updateDescendantDependentFlags();
274
275 if (flags & UpdatePagination)
276 updatePagination();
277 else {
278 m_isPaginated = false;
279 m_enclosingPaginationLayer = 0;
280 }
281
282 // Go ahead and update the reflection's position and size.
283 if (m_reflectionInfo) 278 if (m_reflectionInfo)
284 m_reflectionInfo->reflection()->layout(); 279 m_reflectionInfo->reflection()->layout();
285 280
286 if (useRegionBasedColumns() && renderer()->isRenderFlowThread()) { 281 // FIXME: We should be able to remove this call because we don't care about
287 updatePagination(); 282 // any descendant-dependent flags, but code somewhere else is reading these
288 flags |= UpdatePagination; 283 // flags and depending on us to update them.
289 } 284 updateDescendantDependentFlags();
esprehn 2014/08/05 23:24:57 Note that this (in the worst case) walks the child
abarth-chromium 2014/08/05 23:28:54 By |this|, do you mean updateDescendantDependentFl
290
291 if (renderer()->hasColumns())
292 flags |= UpdatePagination;
293 285
294 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) 286 for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
295 child->updateLayerPositionRecursive(flags); 287 child->updateLayerPositionRecursive();
296 } 288 }
297 289
298 void RenderLayer::setAncestorChainHasSelfPaintingLayerDescendant() 290 void RenderLayer::setAncestorChainHasSelfPaintingLayerDescendant()
299 { 291 {
300 for (RenderLayer* layer = this; layer; layer = layer->parent()) { 292 for (RenderLayer* layer = this; layer; layer = layer->parent()) {
301 if (!layer->m_hasSelfPaintingLayerDescendantDirty && layer->hasSelfPaint ingLayerDescendant()) 293 if (!layer->m_hasSelfPaintingLayerDescendantDirty && layer->hasSelfPaint ingLayerDescendant())
302 break; 294 break;
303 295
304 layer->m_hasSelfPaintingLayerDescendantDirty = false; 296 layer->m_hasSelfPaintingLayerDescendantDirty = false;
305 layer->m_hasSelfPaintingLayerDescendant = true; 297 layer->m_hasSelfPaintingLayerDescendant = true;
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 461
470 // Otherwise we are paginated by the columns block. 462 // Otherwise we are paginated by the columns block.
471 return true; 463 return true;
472 } 464 }
473 465
474 bool RenderLayer::useRegionBasedColumns() const 466 bool RenderLayer::useRegionBasedColumns() const
475 { 467 {
476 return renderer()->document().regionBasedColumnsEnabled(); 468 return renderer()->document().regionBasedColumnsEnabled();
477 } 469 }
478 470
471 void RenderLayer::updatePaginationRecursive(bool needsPaginationUpdate)
472 {
473 m_isPaginated = false;
474 m_enclosingPaginationLayer = 0;
475
476 if (useRegionBasedColumns() && renderer()->isRenderFlowThread())
477 needsPaginationUpdate = true;
478
479 if (needsPaginationUpdate)
480 updatePagination();
481
482 if (renderer()->hasColumns())
483 needsPaginationUpdate = true;
484
485 for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
486 child->updatePaginationRecursive(needsPaginationUpdate);
487 }
488
479 void RenderLayer::updatePagination() 489 void RenderLayer::updatePagination()
480 { 490 {
481 m_isPaginated = false;
482 m_enclosingPaginationLayer = 0;
483
484 if (compositingState() != NotComposited || !parent()) 491 if (compositingState() != NotComposited || !parent())
485 return; // FIXME: We will have to deal with paginated compositing layers someday. 492 return; // FIXME: We will have to deal with paginated compositing layers someday.
486 // FIXME: For now the RenderView can't be paginated. Eventually printing will move to a model where it is though. 493 // FIXME: For now the RenderView can't be paginated. Eventually printing will move to a model where it is though.
487 494
488 // The main difference between the paginated booleans for the old column cod e and the new column code 495 // The main difference between the paginated booleans for the old column cod e and the new column code
489 // is that each paginated layer has to paint on its own with the new code. T here is no 496 // is that each paginated layer has to paint on its own with the new code. T here is no
490 // recurring into child layers. This means that the m_isPaginated bits for t he new column code can't just be set on 497 // recurring into child layers. This means that the m_isPaginated bits for t he new column code can't just be set on
491 // "roots" that get split and paint all their descendants. Instead each laye r has to be checked individually and 498 // "roots" that get split and paint all their descendants. Instead each laye r has to be checked individually and
492 // genuinely know if it is going to have to split itself up when painting on ly its contents (and not any other descendant 499 // genuinely know if it is going to have to split itself up when painting on ly its contents (and not any other descendant
493 // layers). We track an enclosingPaginationLayer instead of using a simple b it, since we want to be able to get back 500 // layers). We track an enclosingPaginationLayer instead of using a simple b it, since we want to be able to get back
494 // to that layer easily. 501 // to that layer easily.
495 bool regionBasedColumnsUsed = useRegionBasedColumns(); 502 bool regionBasedColumnsUsed = useRegionBasedColumns();
496 if (regionBasedColumnsUsed && renderer()->isRenderFlowThread()) { 503 if (regionBasedColumnsUsed && renderer()->isRenderFlowThread()) {
497 m_enclosingPaginationLayer = this; 504 m_enclosingPaginationLayer = this;
498 return; 505 return;
499 } 506 }
500 507
501 if (m_stackingNode->isNormalFlowOnly()) { 508 if (m_stackingNode->isNormalFlowOnly()) {
502 if (regionBasedColumnsUsed) { 509 if (regionBasedColumnsUsed) {
503 // Content inside a transform is not considered to be paginated, sin ce we simply 510 // Content inside a transform is not considered to be paginated, sin ce we simply
504 // paint the transform multiple times in each column, so we don't ha ve to use 511 // paint the transform multiple times in each column, so we don't ha ve to use
505 // fragments for the transformed content. 512 // fragments for the transformed content.
506 m_enclosingPaginationLayer = parent()->enclosingPaginationLayer(); 513 m_enclosingPaginationLayer = parent()->enclosingPaginationLayer();
507 if (m_enclosingPaginationLayer && m_enclosingPaginationLayer->hasTra nsform()) 514 if (m_enclosingPaginationLayer && m_enclosingPaginationLayer->hasTra nsform())
508 m_enclosingPaginationLayer = 0; 515 m_enclosingPaginationLayer = 0;
509 } else 516 } else {
510 m_isPaginated = parent()->renderer()->hasColumns(); 517 m_isPaginated = parent()->renderer()->hasColumns();
518 }
511 return; 519 return;
512 } 520 }
513 521
514 // For the new columns code, we want to walk up our containing block chain l ooking for an enclosing layer. Once 522 // For the new columns code, we want to walk up our containing block chain l ooking for an enclosing layer. Once
515 // we find one, then we just check its pagination status. 523 // we find one, then we just check its pagination status.
516 if (regionBasedColumnsUsed) { 524 if (regionBasedColumnsUsed) {
517 RenderView* view = renderer()->view(); 525 RenderView* view = renderer()->view();
518 RenderBlock* containingBlock; 526 RenderBlock* containingBlock;
519 for (containingBlock = renderer()->containingBlock(); 527 for (containingBlock = renderer()->containingBlock();
520 containingBlock && containingBlock != view; 528 containingBlock && containingBlock != view;
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 removeChild(m_reflectionInfo->reflectionLayer()); 1371 removeChild(m_reflectionInfo->reflectionLayer());
1364 1372
1365 // Now walk our kids and reattach them to our parent. 1373 // Now walk our kids and reattach them to our parent.
1366 RenderLayer* current = m_first; 1374 RenderLayer* current = m_first;
1367 while (current) { 1375 while (current) {
1368 RenderLayer* next = current->nextSibling(); 1376 RenderLayer* next = current->nextSibling();
1369 removeChild(current); 1377 removeChild(current);
1370 m_parent->addChild(current, nextSib); 1378 m_parent->addChild(current, nextSib);
1371 1379
1372 current->renderer()->setShouldDoFullPaintInvalidation(true); 1380 current->renderer()->setShouldDoFullPaintInvalidation(true);
1373 1381 // FIXME: We should call a specialized version of this function.
1374 // Hits in compositing/overflow/automatically-opt-into-composited-scroll ing-part-1.html 1382 current->updateLayerPositionsAfterLayout();
1375 DisableCompositingQueryAsserts disabler;
1376
1377 current->updateLayerPositionRecursive();
1378 current = next; 1383 current = next;
1379 } 1384 }
1380 1385
1381 // Remove us from the parent. 1386 // Remove us from the parent.
1382 m_parent->removeChild(this); 1387 m_parent->removeChild(this);
1383 m_renderer->destroyLayer(); 1388 m_renderer->destroyLayer();
1384 } 1389 }
1385 1390
1386 void RenderLayer::insertOnlyThisLayer() 1391 void RenderLayer::insertOnlyThisLayer()
1387 { 1392 {
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after
2356 Vector<RenderLayer*> columnLayers; 2361 Vector<RenderLayer*> columnLayers;
2357 RenderLayerStackingNode* ancestorNode = m_stackingNode->isNormalFlowOnly() ? parent()->stackingNode() : m_stackingNode->ancestorStackingContextNode(); 2362 RenderLayerStackingNode* ancestorNode = m_stackingNode->isNormalFlowOnly() ? parent()->stackingNode() : m_stackingNode->ancestorStackingContextNode();
2358 for (RenderLayer* curr = childLayer->parent(); curr; curr = curr->parent()) { 2363 for (RenderLayer* curr = childLayer->parent(); curr; curr = curr->parent()) {
2359 if (curr->renderer()->hasColumns() && checkContainingBlockChainForPagina tion(childLayer->renderer(), curr->renderBox())) 2364 if (curr->renderer()->hasColumns() && checkContainingBlockChainForPagina tion(childLayer->renderer(), curr->renderBox()))
2360 columnLayers.append(curr); 2365 columnLayers.append(curr);
2361 if (curr->stackingNode() == ancestorNode) 2366 if (curr->stackingNode() == ancestorNode)
2362 break; 2367 break;
2363 } 2368 }
2364 2369
2365 // It is possible for paintLayer() to be called after the child layer ceases to be paginated but before 2370 // It is possible for paintLayer() to be called after the child layer ceases to be paginated but before
2366 // updateLayerPositionRecursive() is called and resets the isPaginated() fla g, see <rdar://problem/10098679>. 2371 // updatePaginationRecusive() is called and resets the isPaginated() flag, s ee <rdar://problem/10098679>.
2367 // If this is the case, just bail out, since the upcoming call to updateLaye rPositionRecursive() will repaint the layer. 2372 // If this is the case, just bail out, since the upcoming call to updatePagi nationRecusive() will repaint the layer.
2373 // FIXME: Is this true anymore? This seems very suspicious.
2368 if (!columnLayers.size()) 2374 if (!columnLayers.size())
2369 return; 2375 return;
2370 2376
2371 paintChildLayerIntoColumns(childLayer, context, paintingInfo, paintFlags, co lumnLayers, columnLayers.size() - 1); 2377 paintChildLayerIntoColumns(childLayer, context, paintingInfo, paintFlags, co lumnLayers, columnLayers.size() - 1);
2372 } 2378 }
2373 2379
2374 void RenderLayer::paintChildLayerIntoColumns(RenderLayer* childLayer, GraphicsCo ntext* context, const LayerPaintingInfo& paintingInfo, 2380 void RenderLayer::paintChildLayerIntoColumns(RenderLayer* childLayer, GraphicsCo ntext* context, const LayerPaintingInfo& paintingInfo,
2375 PaintLayerFlags paintFlags, const Vector<RenderLayer*>& columnLayers, size_t colIndex) 2381 PaintLayerFlags paintFlags, const Vector<RenderLayer*>& columnLayers, size_t colIndex)
2376 { 2382 {
2377 RenderBlock* columnBlock = toRenderBlock(columnLayers[colIndex]->renderer()) ; 2383 RenderBlock* columnBlock = toRenderBlock(columnLayers[colIndex]->renderer()) ;
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after
3787 } 3793 }
3788 } 3794 }
3789 3795
3790 void showLayerTree(const blink::RenderObject* renderer) 3796 void showLayerTree(const blink::RenderObject* renderer)
3791 { 3797 {
3792 if (!renderer) 3798 if (!renderer)
3793 return; 3799 return;
3794 showLayerTree(renderer->enclosingLayer()); 3800 showLayerTree(renderer->enclosingLayer());
3795 } 3801 }
3796 #endif 3802 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | Source/core/rendering/RenderLayerModelObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698