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

Side by Side Diff: Source/core/paint/DeprecatedPaintLayer.cpp

Issue 1235133004: Use LayoutObject to locate the flow thread. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fold updatePagination() into updatePaginationRecursive() Created 5 years, 5 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/paint/DeprecatedPaintLayer.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) 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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 rect.moveBy(-ancestorLayer->visualOffsetFromAncestor(paginationLayer)); 447 rect.moveBy(-ancestorLayer->visualOffsetFromAncestor(paginationLayer));
448 } 448 }
449 449
450 void DeprecatedPaintLayer::updatePaginationRecursive(bool needsPaginationUpdate) 450 void DeprecatedPaintLayer::updatePaginationRecursive(bool needsPaginationUpdate)
451 { 451 {
452 m_enclosingPaginationLayer = 0; 452 m_enclosingPaginationLayer = 0;
453 453
454 if (layoutObject()->isLayoutFlowThread()) 454 if (layoutObject()->isLayoutFlowThread())
455 needsPaginationUpdate = true; 455 needsPaginationUpdate = true;
456 456
457 if (needsPaginationUpdate) 457 if (needsPaginationUpdate) {
458 updatePagination(); 458 // Each paginated layer has to paint on its own. There is no recurring i nto child layers. Each
459 // layer has to be checked individually and genuinely know if it is goin g to have to split
460 // itself up when painting only its contents (and not any other descenda nt layers). We track an
461 // enclosingPaginationLayer instead of using a simple bit, since we want to be able to get back
462 // to that layer easily.
463 if (LayoutFlowThread* containingFlowThread = layoutObject()->flowThreadC ontainingBlock())
464 m_enclosingPaginationLayer = containingFlowThread->layer();
465 }
459 466
460 for (DeprecatedPaintLayer* child = firstChild(); child; child = child->nextS ibling()) 467 for (DeprecatedPaintLayer* child = firstChild(); child; child = child->nextS ibling())
461 child->updatePaginationRecursive(needsPaginationUpdate); 468 child->updatePaginationRecursive(needsPaginationUpdate);
462 } 469 }
463 470
464 void DeprecatedPaintLayer::updatePagination()
465 {
466 if (!parent())
467 return; // FIXME: For now the LayoutView can't be paginated. Eventually printing will move to a model where it is though.
468
469 // Each paginated layer has to paint on its own. There is no recurring into child layers. Each
470 // layer has to be checked individually and genuinely know if it is going to have to split
471 // itself up when painting only its contents (and not any other descendant l ayers). We track an
472 // enclosingPaginationLayer instead of using a simple bit, since we want to be able to get back
473 // to that layer easily.
474 if (layoutObject()->isLayoutFlowThread()) {
475 m_enclosingPaginationLayer = this;
476 return;
477 }
478
479 if (!m_stackingNode->isTreatedAsStackingContextForPainting()) {
480 // We cannot take the fast path for spanners, as they do not have their nearest ancestor
481 // pagination layer (flow thread) in their containing block chain.
482 if (!layoutObject()->isColumnSpanAll()) {
483 // Content inside a transform is not considered to be paginated, sin ce we simply
484 // paint the transform multiple times in each column, so we don't ha ve to use
485 // fragments for the transformed content.
486 m_enclosingPaginationLayer = parent()->enclosingPaginationLayer();
487 if (m_enclosingPaginationLayer && m_enclosingPaginationLayer->hasTra nsformRelatedProperty())
488 m_enclosingPaginationLayer = 0;
489 return;
490 }
491 }
492
493 // Walk up our containing block chain looking for an enclosing layer. Once w e find one, then we
494 // just check its pagination status.
495 LayoutView* view = layoutObject()->view();
496 LayoutBlock* containingBlock;
497 for (containingBlock = layoutObject()->containingBlock();
498 containingBlock && containingBlock != view;
499 containingBlock = containingBlock->containingBlock()) {
500 if (containingBlock->hasLayer()) {
501 // Content inside a transform is not considered to be paginated, sin ce we simply
502 // paint the transform multiple times in each column, so we don't ha ve to use
503 // fragments for the transformed content.
504 m_enclosingPaginationLayer = containingBlock->layer()->enclosingPagi nationLayer();
505 if (m_enclosingPaginationLayer && m_enclosingPaginationLayer->hasTra nsformRelatedProperty())
506 m_enclosingPaginationLayer = 0;
507 return;
508 }
509 }
510 }
511
512 void DeprecatedPaintLayer::clearPaginationRecursive() 471 void DeprecatedPaintLayer::clearPaginationRecursive()
513 { 472 {
514 m_enclosingPaginationLayer = 0; 473 m_enclosingPaginationLayer = 0;
515 for (DeprecatedPaintLayer* child = firstChild(); child; child = child->nextS ibling()) 474 for (DeprecatedPaintLayer* child = firstChild(); child; child = child->nextS ibling())
516 child->clearPaginationRecursive(); 475 child->clearPaginationRecursive();
517 } 476 }
518 477
519 LayoutPoint DeprecatedPaintLayer::positionFromPaintInvalidationBacking(const Lay outObject* layoutObject, const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationState) 478 LayoutPoint DeprecatedPaintLayer::positionFromPaintInvalidationBacking(const Lay outObject* layoutObject, const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationState)
520 { 479 {
521 FloatPoint point = layoutObject->localToContainerPoint(FloatPoint(), paintIn validationContainer, 0, 0, paintInvalidationState); 480 FloatPoint point = layoutObject->localToContainerPoint(FloatPoint(), paintIn validationContainer, 0, 0, paintInvalidationState);
(...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2741 2700
2742 void showLayerTree(const blink::LayoutObject* layoutObject) 2701 void showLayerTree(const blink::LayoutObject* layoutObject)
2743 { 2702 {
2744 if (!layoutObject) { 2703 if (!layoutObject) {
2745 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); 2704 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n");
2746 return; 2705 return;
2747 } 2706 }
2748 showLayerTree(layoutObject->enclosingLayer()); 2707 showLayerTree(layoutObject->enclosingLayer());
2749 } 2708 }
2750 #endif 2709 #endif
OLDNEW
« no previous file with comments | « Source/core/paint/DeprecatedPaintLayer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698