OLD | NEW |
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 Loading... |
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 |
482 void DeprecatedPaintLayer::updatePaginationRecursive(bool needsPaginationUpdate) | 487 void DeprecatedPaintLayer::updatePaginationRecursive(bool needsPaginationUpdate) |
483 { | 488 { |
484 m_isPaginated = false; | 489 m_isPaginated = false; |
485 m_enclosingPaginationLayer = 0; | 490 m_enclosingPaginationLayer = 0; |
486 | 491 |
487 if (RuntimeEnabledFeatures::regionBasedColumnsEnabled() && layoutObject()->i
sLayoutFlowThread()) | 492 if (useRegionBasedColumns() && layoutObject()->isLayoutFlowThread()) |
488 needsPaginationUpdate = true; | 493 needsPaginationUpdate = true; |
489 | 494 |
490 if (needsPaginationUpdate) | 495 if (needsPaginationUpdate) |
491 updatePagination(); | 496 updatePagination(); |
492 | 497 |
493 if (layoutObject()->hasColumns()) | 498 if (layoutObject()->hasColumns()) |
494 needsPaginationUpdate = true; | 499 needsPaginationUpdate = true; |
495 | 500 |
496 for (DeprecatedPaintLayer* child = firstChild(); child; child = child->nextS
ibling()) | 501 for (DeprecatedPaintLayer* child = firstChild(); child; child = child->nextS
ibling()) |
497 child->updatePaginationRecursive(needsPaginationUpdate); | 502 child->updatePaginationRecursive(needsPaginationUpdate); |
498 } | 503 } |
499 | 504 |
500 void DeprecatedPaintLayer::updatePagination() | 505 void DeprecatedPaintLayer::updatePagination() |
501 { | 506 { |
502 bool usesRegionBasedColumns = RuntimeEnabledFeatures::regionBasedColumnsEnab
led(); | 507 bool usesRegionBasedColumns = useRegionBasedColumns(); |
503 if ((!usesRegionBasedColumns && compositingState() != NotComposited) || !par
ent()) | 508 if ((!usesRegionBasedColumns && compositingState() != NotComposited) || !par
ent()) |
504 return; // FIXME: For now the LayoutView can't be paginated. Eventually
printing will move to a model where it is though. | 509 return; // FIXME: For now the LayoutView can't be paginated. Eventually
printing will move to a model where it is though. |
505 | 510 |
506 // The main difference between the paginated booleans for the old column cod
e and the new column code | 511 // The main difference between the paginated booleans for the old column cod
e and the new column code |
507 // is that each paginated layer has to paint on its own with the new code. T
here is no | 512 // is that each paginated layer has to paint on its own with the new code. T
here is no |
508 // recurring into child layers. This means that the m_isPaginated bits for t
he new column code can't just be set on | 513 // recurring into child layers. This means that the m_isPaginated bits for t
he new column code can't just be set on |
509 // "roots" that get split and paint all their descendants. Instead each laye
r has to be checked individually and | 514 // "roots" that get split and paint all their descendants. Instead each laye
r has to be checked individually and |
510 // genuinely know if it is going to have to split itself up when painting on
ly its contents (and not any other descendant | 515 // genuinely know if it is going to have to split itself up when painting on
ly its contents (and not any other descendant |
511 // layers). We track an enclosingPaginationLayer instead of using a simple b
it, since we want to be able to get back | 516 // layers). We track an enclosingPaginationLayer instead of using a simple b
it, since we want to be able to get back |
512 // to that layer easily. | 517 // to that layer easily. |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 | 859 |
855 if (positionedParent->layoutObject()->isRelPositioned() && positionedPar
ent->layoutObject()->isLayoutInline()) { | 860 if (positionedParent->layoutObject()->isRelPositioned() && positionedPar
ent->layoutObject()->isLayoutInline()) { |
856 LayoutSize offset = toLayoutInline(positionedParent->layoutObject())
->offsetForInFlowPositionedInline(*toLayoutBox(layoutObject())); | 861 LayoutSize offset = toLayoutInline(positionedParent->layoutObject())
->offsetForInFlowPositionedInline(*toLayoutBox(layoutObject())); |
857 localPoint += offset; | 862 localPoint += offset; |
858 } | 863 } |
859 } else if (parent()) { | 864 } else if (parent()) { |
860 // 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 |
861 // 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 |
862 // 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 |
863 // being composited. | 868 // being composited. |
864 if (hasStyleDeterminedDirectCompositingReasons() && !RuntimeEnabledFeatu
res::regionBasedColumnsEnabled()) { | 869 if (hasStyleDeterminedDirectCompositingReasons() && !useRegionBasedColum
ns()) { |
865 // 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. |
866 // They won't split across columns properly. | 871 // They won't split across columns properly. |
867 if (!parent()->layoutObject()->hasColumns() && parent()->layoutObjec
t()->isDocumentElement() && layoutObject()->view()->hasColumns()) | 872 if (!parent()->layoutObject()->hasColumns() && parent()->layoutObjec
t()->isDocumentElement() && layoutObject()->view()->hasColumns()) |
868 localPoint += layoutObject()->view()->columnOffset(localPoint); | 873 localPoint += layoutObject()->view()->columnOffset(localPoint); |
869 else | 874 else |
870 localPoint += parent()->layoutObject()->columnOffset(localPoint)
; | 875 localPoint += parent()->layoutObject()->columnOffset(localPoint)
; |
871 } | 876 } |
872 | 877 |
873 if (parent()->layoutObject()->hasOverflowClip()) { | 878 if (parent()->layoutObject()->hasOverflowClip()) { |
874 IntSize scrollOffset = parent()->layoutBox()->scrolledContentOffset(
); | 879 IntSize scrollOffset = parent()->layoutBox()->scrolledContentOffset(
); |
(...skipping 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2450 if (this != ancestorLayer && !hasVisibleContent() && !hasVisibleDescendant()
) | 2455 if (this != ancestorLayer && !hasVisibleContent() && !hasVisibleDescendant()
) |
2451 return LayoutRect(); | 2456 return LayoutRect(); |
2452 | 2457 |
2453 // The root layer is always just the size of the document. | 2458 // The root layer is always just the size of the document. |
2454 if (isRootLayer()) | 2459 if (isRootLayer()) |
2455 return LayoutRect(m_renderer->view()->unscaledDocumentRect()); | 2460 return LayoutRect(m_renderer->view()->unscaledDocumentRect()); |
2456 | 2461 |
2457 // The layer created for the LayoutFlowThread is just a helper for painting
and hit-testing, | 2462 // The layer created for the LayoutFlowThread is just a helper for painting
and hit-testing, |
2458 // and should not contribute to the bounding box. The LayoutMultiColumnSets
will contribute | 2463 // and should not contribute to the bounding box. The LayoutMultiColumnSets
will contribute |
2459 // the correct size for the rendered content of the multicol container. | 2464 // the correct size for the rendered content of the multicol container. |
2460 if (RuntimeEnabledFeatures::regionBasedColumnsEnabled() && layoutObject()->i
sLayoutFlowThread()) | 2465 if (useRegionBasedColumns() && layoutObject()->isLayoutFlowThread()) |
2461 return LayoutRect(); | 2466 return LayoutRect(); |
2462 | 2467 |
2463 LayoutRect result = clipper().localClipRect(); | 2468 LayoutRect result = clipper().localClipRect(); |
2464 if (result == LayoutRect::infiniteIntRect()) { | 2469 if (result == LayoutRect::infiniteIntRect()) { |
2465 LayoutPoint origin; | 2470 LayoutPoint origin; |
2466 result = physicalBoundingBox(ancestorLayer, &origin); | 2471 result = physicalBoundingBox(ancestorLayer, &origin); |
2467 | 2472 |
2468 const_cast<DeprecatedPaintLayer*>(this)->stackingNode()->updateLayerList
sIfNeeded(); | 2473 const_cast<DeprecatedPaintLayer*>(this)->stackingNode()->updateLayerList
sIfNeeded(); |
2469 | 2474 |
2470 // Reflections are implemented with Layers that hang off of the reflecte
d layer. However, | 2475 // Reflections are implemented with Layers that hang off of the reflecte
d layer. However, |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2968 } | 2973 } |
2969 } | 2974 } |
2970 | 2975 |
2971 void showLayerTree(const blink::LayoutObject* renderer) | 2976 void showLayerTree(const blink::LayoutObject* renderer) |
2972 { | 2977 { |
2973 if (!renderer) | 2978 if (!renderer) |
2974 return; | 2979 return; |
2975 showLayerTree(renderer->enclosingLayer()); | 2980 showLayerTree(renderer->enclosingLayer()); |
2976 } | 2981 } |
2977 #endif | 2982 #endif |
OLD | NEW |