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

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

Issue 1119293002: Enable new multicol for testing and experimental web platform features. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/paint/DeprecatedPaintLayer.h ('k') | Source/core/paint/ViewPainter.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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 // Finally, make the visual rectangle relative to |ancestorLayer|. 472 // Finally, make the visual rectangle relative to |ancestorLayer|.
473 if (ancestorLayer->enclosingPaginationLayer() != paginationLayer) { 473 if (ancestorLayer->enclosingPaginationLayer() != paginationLayer) {
474 rect.moveBy(paginationLayer->visualOffsetFromAncestor(ancestorLayer)); 474 rect.moveBy(paginationLayer->visualOffsetFromAncestor(ancestorLayer));
475 return; 475 return;
476 } 476 }
477 // The ancestor layer is inside the same pagination layer as |layer|, so we need to subtract 477 // The ancestor layer is inside the same pagination layer as |layer|, so we need to subtract
478 // the visual distance from the ancestor layer to the pagination layer. 478 // the visual distance from the ancestor layer to the pagination layer.
479 rect.moveBy(-ancestorLayer->visualOffsetFromAncestor(paginationLayer)); 479 rect.moveBy(-ancestorLayer->visualOffsetFromAncestor(paginationLayer));
480 } 480 }
481 481
482 bool DeprecatedPaintLayer::useRegionBasedColumns() const
483 {
484 return layoutObject()->document().regionBasedColumnsEnabled();
485 }
486
487 void DeprecatedPaintLayer::updatePaginationRecursive(bool needsPaginationUpdate) 482 void DeprecatedPaintLayer::updatePaginationRecursive(bool needsPaginationUpdate)
488 { 483 {
489 m_isPaginated = false; 484 m_isPaginated = false;
490 m_enclosingPaginationLayer = 0; 485 m_enclosingPaginationLayer = 0;
491 486
492 if (useRegionBasedColumns() && layoutObject()->isLayoutFlowThread()) 487 if (RuntimeEnabledFeatures::regionBasedColumnsEnabled() && layoutObject()->i sLayoutFlowThread())
493 needsPaginationUpdate = true; 488 needsPaginationUpdate = true;
494 489
495 if (needsPaginationUpdate) 490 if (needsPaginationUpdate)
496 updatePagination(); 491 updatePagination();
497 492
498 if (layoutObject()->hasColumns()) 493 if (layoutObject()->hasColumns())
499 needsPaginationUpdate = true; 494 needsPaginationUpdate = true;
500 495
501 for (DeprecatedPaintLayer* child = firstChild(); child; child = child->nextS ibling()) 496 for (DeprecatedPaintLayer* child = firstChild(); child; child = child->nextS ibling())
502 child->updatePaginationRecursive(needsPaginationUpdate); 497 child->updatePaginationRecursive(needsPaginationUpdate);
503 } 498 }
504 499
505 void DeprecatedPaintLayer::updatePagination() 500 void DeprecatedPaintLayer::updatePagination()
506 { 501 {
507 bool usesRegionBasedColumns = useRegionBasedColumns(); 502 bool usesRegionBasedColumns = RuntimeEnabledFeatures::regionBasedColumnsEnab led();
508 if ((!usesRegionBasedColumns && compositingState() != NotComposited) || !par ent()) 503 if ((!usesRegionBasedColumns && compositingState() != NotComposited) || !par ent())
509 return; // FIXME: For now the LayoutView can't be paginated. Eventually printing will move to a model where it is though. 504 return; // FIXME: For now the LayoutView can't be paginated. Eventually printing will move to a model where it is though.
510 505
511 // The main difference between the paginated booleans for the old column cod e and the new column code 506 // The main difference between the paginated booleans for the old column cod e and the new column code
512 // is that each paginated layer has to paint on its own with the new code. T here is no 507 // is that each paginated layer has to paint on its own with the new code. T here is no
513 // recurring into child layers. This means that the m_isPaginated bits for t he new column code can't just be set on 508 // recurring into child layers. This means that the m_isPaginated bits for t he new column code can't just be set on
514 // "roots" that get split and paint all their descendants. Instead each laye r has to be checked individually and 509 // "roots" that get split and paint all their descendants. Instead each laye r has to be checked individually and
515 // genuinely know if it is going to have to split itself up when painting on ly its contents (and not any other descendant 510 // genuinely know if it is going to have to split itself up when painting on ly its contents (and not any other descendant
516 // layers). We track an enclosingPaginationLayer instead of using a simple b it, since we want to be able to get back 511 // layers). We track an enclosingPaginationLayer instead of using a simple b it, since we want to be able to get back
517 // to that layer easily. 512 // to that layer easily.
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 859
865 if (positionedParent->layoutObject()->isRelPositioned() && positionedPar ent->layoutObject()->isLayoutInline()) { 860 if (positionedParent->layoutObject()->isRelPositioned() && positionedPar ent->layoutObject()->isLayoutInline()) {
866 LayoutSize offset = toLayoutInline(positionedParent->layoutObject()) ->offsetForInFlowPositionedInline(*toLayoutBox(layoutObject())); 861 LayoutSize offset = toLayoutInline(positionedParent->layoutObject()) ->offsetForInFlowPositionedInline(*toLayoutBox(layoutObject()));
867 localPoint += offset; 862 localPoint += offset;
868 } 863 }
869 } else if (parent()) { 864 } else if (parent()) {
870 // FIXME: This code is very wrong, but luckily only needed in the old/cu rrent multicol 865 // FIXME: This code is very wrong, but luckily only needed in the old/cu rrent multicol
871 // implementation. The compositing system doesn't understand columns and we're hacking 866 // implementation. The compositing system doesn't understand columns and we're hacking
872 // around that fact by faking the position of the Layers when we think w e'll end up 867 // around that fact by faking the position of the Layers when we think w e'll end up
873 // being composited. 868 // being composited.
874 if (hasStyleDeterminedDirectCompositingReasons() && !useRegionBasedColum ns()) { 869 if (hasStyleDeterminedDirectCompositingReasons() && !RuntimeEnabledFeatu res::regionBasedColumnsEnabled()) {
875 // FIXME: Composited layers ignore pagination, so about the best we can do is make sure they're offset into the appropriate column. 870 // FIXME: Composited layers ignore pagination, so about the best we can do is make sure they're offset into the appropriate column.
876 // They won't split across columns properly. 871 // They won't split across columns properly.
877 if (!parent()->layoutObject()->hasColumns() && parent()->layoutObjec t()->isDocumentElement() && layoutObject()->view()->hasColumns()) 872 if (!parent()->layoutObject()->hasColumns() && parent()->layoutObjec t()->isDocumentElement() && layoutObject()->view()->hasColumns())
878 localPoint += layoutObject()->view()->columnOffset(localPoint); 873 localPoint += layoutObject()->view()->columnOffset(localPoint);
879 else 874 else
880 localPoint += parent()->layoutObject()->columnOffset(localPoint) ; 875 localPoint += parent()->layoutObject()->columnOffset(localPoint) ;
881 } 876 }
882 877
883 if (parent()->layoutObject()->hasOverflowClip()) { 878 if (parent()->layoutObject()->hasOverflowClip()) {
884 IntSize scrollOffset = parent()->layoutBox()->scrolledContentOffset( ); 879 IntSize scrollOffset = parent()->layoutBox()->scrolledContentOffset( );
(...skipping 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after
2456 if (this != ancestorLayer && !hasVisibleContent() && !hasVisibleDescendant() ) 2451 if (this != ancestorLayer && !hasVisibleContent() && !hasVisibleDescendant() )
2457 return LayoutRect(); 2452 return LayoutRect();
2458 2453
2459 // The root layer is always just the size of the document. 2454 // The root layer is always just the size of the document.
2460 if (isRootLayer()) 2455 if (isRootLayer())
2461 return LayoutRect(m_layoutObject->view()->unscaledDocumentRect()); 2456 return LayoutRect(m_layoutObject->view()->unscaledDocumentRect());
2462 2457
2463 // The layer created for the LayoutFlowThread is just a helper for painting and hit-testing, 2458 // The layer created for the LayoutFlowThread is just a helper for painting and hit-testing,
2464 // and should not contribute to the bounding box. The LayoutMultiColumnSets will contribute 2459 // and should not contribute to the bounding box. The LayoutMultiColumnSets will contribute
2465 // the correct size for the layout content of the multicol container. 2460 // the correct size for the layout content of the multicol container.
2466 if (useRegionBasedColumns() && layoutObject()->isLayoutFlowThread()) 2461 if (RuntimeEnabledFeatures::regionBasedColumnsEnabled() && layoutObject()->i sLayoutFlowThread())
2467 return LayoutRect(); 2462 return LayoutRect();
2468 2463
2469 LayoutRect result = clipper().localClipRect(); 2464 LayoutRect result = clipper().localClipRect();
2470 if (result == LayoutRect::infiniteIntRect()) { 2465 if (result == LayoutRect::infiniteIntRect()) {
2471 LayoutPoint origin; 2466 LayoutPoint origin;
2472 result = physicalBoundingBox(ancestorLayer, &origin); 2467 result = physicalBoundingBox(ancestorLayer, &origin);
2473 2468
2474 const_cast<DeprecatedPaintLayer*>(this)->stackingNode()->updateLayerList sIfNeeded(); 2469 const_cast<DeprecatedPaintLayer*>(this)->stackingNode()->updateLayerList sIfNeeded();
2475 2470
2476 // Reflections are implemented with Layers that hang off of the reflecte d layer. However, 2471 // Reflections are implemented with Layers that hang off of the reflecte d layer. However,
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
2982 } 2977 }
2983 } 2978 }
2984 2979
2985 void showLayerTree(const blink::LayoutObject* layoutObject) 2980 void showLayerTree(const blink::LayoutObject* layoutObject)
2986 { 2981 {
2987 if (!layoutObject) 2982 if (!layoutObject)
2988 return; 2983 return;
2989 showLayerTree(layoutObject->enclosingLayer()); 2984 showLayerTree(layoutObject->enclosingLayer());
2990 } 2985 }
2991 #endif 2986 #endif
OLDNEW
« no previous file with comments | « Source/core/paint/DeprecatedPaintLayer.h ('k') | Source/core/paint/ViewPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698