OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights |
3 * reserved. | 3 * reserved. |
4 * | 4 * |
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
6 * | 6 * |
7 * Other contributors: | 7 * Other contributors: |
8 * Robert O'Callahan <roc+@cs.cmu.edu> | 8 * Robert O'Callahan <roc+@cs.cmu.edu> |
9 * David Baron <dbaron@fas.harvard.edu> | 9 * David Baron <dbaron@fas.harvard.edu> |
10 * Christian Biesinger <cbiesinger@web.de> | 10 * Christian Biesinger <cbiesinger@web.de> |
(...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1558 layoutObject()->style()->resize() != RESIZE_NONE); | 1558 layoutObject()->style()->resize() != RESIZE_NONE); |
1559 } | 1559 } |
1560 | 1560 |
1561 void PaintLayer::appendSingleFragmentIgnoringPagination( | 1561 void PaintLayer::appendSingleFragmentIgnoringPagination( |
1562 PaintLayerFragments& fragments, | 1562 PaintLayerFragments& fragments, |
1563 const PaintLayer* rootLayer, | 1563 const PaintLayer* rootLayer, |
1564 const LayoutRect& dirtyRect, | 1564 const LayoutRect& dirtyRect, |
1565 ClipRectsCacheSlot clipRectsCacheSlot, | 1565 ClipRectsCacheSlot clipRectsCacheSlot, |
1566 OverlayScrollbarClipBehavior overlayScrollbarClipBehavior, | 1566 OverlayScrollbarClipBehavior overlayScrollbarClipBehavior, |
1567 ShouldRespectOverflowClipType respectOverflowClip, | 1567 ShouldRespectOverflowClipType respectOverflowClip, |
1568 bool paintingAncestorClippingMask, | |
1568 const LayoutPoint* offsetFromRoot, | 1569 const LayoutPoint* offsetFromRoot, |
1569 const LayoutSize& subPixelAccumulation) { | 1570 const LayoutSize& subPixelAccumulation) { |
1570 PaintLayerFragment fragment; | 1571 PaintLayerFragment fragment; |
1571 ClipRectsContext clipRectsContext(rootLayer, clipRectsCacheSlot, | 1572 ClipRectsContext clipRectsContext(rootLayer, clipRectsCacheSlot, |
1572 overlayScrollbarClipBehavior, | 1573 overlayScrollbarClipBehavior, |
1573 subPixelAccumulation); | 1574 subPixelAccumulation); |
1574 if (respectOverflowClip == IgnoreOverflowClip) | 1575 if (respectOverflowClip == IgnoreOverflowClip) |
1575 clipRectsContext.setIgnoreOverflowClip(); | 1576 clipRectsContext.setIgnoreOverflowClip(); |
1576 clipper().calculateRects(clipRectsContext, dirtyRect, fragment.layerBounds, | 1577 clipper().calculateRects(clipRectsContext, dirtyRect, fragment.layerBounds, |
1577 fragment.backgroundRect, fragment.foregroundRect, | 1578 fragment.backgroundRect, fragment.foregroundRect, |
1578 offsetFromRoot); | 1579 offsetFromRoot, paintingAncestorClippingMask); |
Stephen Chennney
2016/11/08 21:42:51
Here we can create a clipper (PaintLayerClipper) w
| |
1579 fragments.append(fragment); | 1580 fragments.append(fragment); |
1580 } | 1581 } |
1581 | 1582 |
1582 bool PaintLayer::shouldFragmentCompositedBounds( | 1583 bool PaintLayer::shouldFragmentCompositedBounds( |
1583 const PaintLayer* compositingLayer) const { | 1584 const PaintLayer* compositingLayer) const { |
1584 // Composited layers may not be fragmented. | 1585 // Composited layers may not be fragmented. |
1585 return enclosingPaginationLayer() && | 1586 return enclosingPaginationLayer() && |
1586 !compositingLayer->enclosingPaginationLayer(); | 1587 !compositingLayer->enclosingPaginationLayer(); |
1587 } | 1588 } |
1588 | 1589 |
1589 void PaintLayer::collectFragments( | 1590 void PaintLayer::collectFragments( |
1590 PaintLayerFragments& fragments, | 1591 PaintLayerFragments& fragments, |
1591 const PaintLayer* rootLayer, | 1592 const PaintLayer* rootLayer, |
1592 const LayoutRect& dirtyRect, | 1593 const LayoutRect& dirtyRect, |
1593 ClipRectsCacheSlot clipRectsCacheSlot, | 1594 ClipRectsCacheSlot clipRectsCacheSlot, |
1594 OverlayScrollbarClipBehavior overlayScrollbarClipBehavior, | 1595 OverlayScrollbarClipBehavior overlayScrollbarClipBehavior, |
1595 ShouldRespectOverflowClipType respectOverflowClip, | 1596 ShouldRespectOverflowClipType respectOverflowClip, |
1597 bool paintingAncestorClippingMask, | |
1596 const LayoutPoint* offsetFromRoot, | 1598 const LayoutPoint* offsetFromRoot, |
1597 const LayoutSize& subPixelAccumulation, | 1599 const LayoutSize& subPixelAccumulation, |
1598 const LayoutRect* layerBoundingBox) { | 1600 const LayoutRect* layerBoundingBox) { |
1599 if (!enclosingPaginationLayer()) { | 1601 if (!enclosingPaginationLayer()) { |
1600 // For unpaginated layers, there is only one fragment. | 1602 // For unpaginated layers, there is only one fragment. |
1601 appendSingleFragmentIgnoringPagination( | 1603 appendSingleFragmentIgnoringPagination( |
1602 fragments, rootLayer, dirtyRect, clipRectsCacheSlot, | 1604 fragments, rootLayer, dirtyRect, clipRectsCacheSlot, |
1603 overlayScrollbarClipBehavior, respectOverflowClip, offsetFromRoot, | 1605 overlayScrollbarClipBehavior, respectOverflowClip, |
1604 subPixelAccumulation); | 1606 paintingAncestorClippingMask, offsetFromRoot, subPixelAccumulation); |
1605 return; | 1607 return; |
1606 } | 1608 } |
1607 | 1609 |
1608 if (!shouldFragmentCompositedBounds(rootLayer)) { | 1610 if (!shouldFragmentCompositedBounds(rootLayer)) { |
1609 appendSingleFragmentIgnoringPagination( | 1611 appendSingleFragmentIgnoringPagination( |
1610 fragments, rootLayer, dirtyRect, clipRectsCacheSlot, | 1612 fragments, rootLayer, dirtyRect, clipRectsCacheSlot, |
1611 overlayScrollbarClipBehavior, respectOverflowClip, offsetFromRoot, | 1613 overlayScrollbarClipBehavior, respectOverflowClip, |
1612 subPixelAccumulation); | 1614 paintingAncestorClippingMask, offsetFromRoot, subPixelAccumulation); |
1613 return; | 1615 return; |
1614 } | 1616 } |
1615 | 1617 |
1616 // Compute our offset within the enclosing pagination layer. | 1618 // Compute our offset within the enclosing pagination layer. |
1617 LayoutPoint offsetWithinPaginatedLayer; | 1619 LayoutPoint offsetWithinPaginatedLayer; |
1618 convertToLayerCoords(enclosingPaginationLayer(), offsetWithinPaginatedLayer); | 1620 convertToLayerCoords(enclosingPaginationLayer(), offsetWithinPaginatedLayer); |
1619 | 1621 |
1620 // Calculate clip rects relative to the enclosingPaginationLayer. The purpose | 1622 // Calculate clip rects relative to the enclosingPaginationLayer. The purpose |
1621 // of this call is to determine our bounds clipped to intermediate layers | 1623 // of this call is to determine our bounds clipped to intermediate layers |
1622 // between us and the pagination context. It's important to minimize the | 1624 // between us and the pagination context. It's important to minimize the |
1623 // number of fragments we need to create and this helps with that. | 1625 // number of fragments we need to create and this helps with that. |
1624 ClipRectsContext paginationClipRectsContext(enclosingPaginationLayer(), | 1626 ClipRectsContext paginationClipRectsContext(enclosingPaginationLayer(), |
1625 clipRectsCacheSlot, | 1627 clipRectsCacheSlot, |
1626 overlayScrollbarClipBehavior); | 1628 overlayScrollbarClipBehavior); |
1627 if (respectOverflowClip == IgnoreOverflowClip) | 1629 if (respectOverflowClip == IgnoreOverflowClip) |
1628 paginationClipRectsContext.setIgnoreOverflowClip(); | 1630 paginationClipRectsContext.setIgnoreOverflowClip(); |
1629 LayoutRect layerBoundsInFlowThread; | 1631 LayoutRect layerBoundsInFlowThread; |
1630 ClipRect backgroundRectInFlowThread; | 1632 ClipRect backgroundRectInFlowThread; |
1631 ClipRect foregroundRectInFlowThread; | 1633 ClipRect foregroundRectInFlowThread; |
1632 clipper().calculateRects( | 1634 clipper().calculateRects( |
1633 paginationClipRectsContext, LayoutRect(LayoutRect::infiniteIntRect()), | 1635 paginationClipRectsContext, LayoutRect(LayoutRect::infiniteIntRect()), |
1634 layerBoundsInFlowThread, backgroundRectInFlowThread, | 1636 layerBoundsInFlowThread, backgroundRectInFlowThread, |
1635 foregroundRectInFlowThread, &offsetWithinPaginatedLayer); | 1637 foregroundRectInFlowThread, &offsetWithinPaginatedLayer, |
1638 paintingAncestorClippingMask); | |
1636 | 1639 |
1637 // Take our bounding box within the flow thread and clip it. | 1640 // Take our bounding box within the flow thread and clip it. |
1638 LayoutRect layerBoundingBoxInFlowThread = | 1641 LayoutRect layerBoundingBoxInFlowThread = |
1639 layerBoundingBox ? *layerBoundingBox | 1642 layerBoundingBox ? *layerBoundingBox |
1640 : physicalBoundingBox(offsetWithinPaginatedLayer); | 1643 : physicalBoundingBox(offsetWithinPaginatedLayer); |
1641 layerBoundingBoxInFlowThread.intersect(backgroundRectInFlowThread.rect()); | 1644 layerBoundingBoxInFlowThread.intersect(backgroundRectInFlowThread.rect()); |
1642 | 1645 |
1643 LayoutFlowThread* enclosingFlowThread = | 1646 LayoutFlowThread* enclosingFlowThread = |
1644 toLayoutFlowThread(enclosingPaginationLayer()->layoutObject()); | 1647 toLayoutFlowThread(enclosingPaginationLayer()->layoutObject()); |
1645 // Visual offset from the root layer to the nearest fragmentation context. | 1648 // Visual offset from the root layer to the nearest fragmentation context. |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2156 double* zOffset, | 2159 double* zOffset, |
2157 ClipRectsCacheSlot clipRectsCacheSlot) { | 2160 ClipRectsCacheSlot clipRectsCacheSlot) { |
2158 PaintLayerFragments enclosingPaginationFragments; | 2161 PaintLayerFragments enclosingPaginationFragments; |
2159 LayoutPoint offsetOfPaginationLayerFromRoot; | 2162 LayoutPoint offsetOfPaginationLayerFromRoot; |
2160 // FIXME: We're missing a sub-pixel offset here crbug.com/348728 | 2163 // FIXME: We're missing a sub-pixel offset here crbug.com/348728 |
2161 LayoutRect transformedExtent = transparencyClipBox( | 2164 LayoutRect transformedExtent = transparencyClipBox( |
2162 this, enclosingPaginationLayer(), HitTestingTransparencyClipBox, | 2165 this, enclosingPaginationLayer(), HitTestingTransparencyClipBox, |
2163 PaintLayer::RootOfTransparencyClipBox, LayoutSize()); | 2166 PaintLayer::RootOfTransparencyClipBox, LayoutSize()); |
2164 enclosingPaginationLayer()->collectFragments( | 2167 enclosingPaginationLayer()->collectFragments( |
2165 enclosingPaginationFragments, rootLayer, hitTestRect, clipRectsCacheSlot, | 2168 enclosingPaginationFragments, rootLayer, hitTestRect, clipRectsCacheSlot, |
2166 ExcludeOverlayScrollbarSizeForHitTesting, RespectOverflowClip, | 2169 ExcludeOverlayScrollbarSizeForHitTesting, RespectOverflowClip, false, |
2167 &offsetOfPaginationLayerFromRoot, LayoutSize(), &transformedExtent); | 2170 &offsetOfPaginationLayerFromRoot, LayoutSize(), &transformedExtent); |
2168 | 2171 |
2169 for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) { | 2172 for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) { |
2170 const PaintLayerFragment& fragment = enclosingPaginationFragments.at(i); | 2173 const PaintLayerFragment& fragment = enclosingPaginationFragments.at(i); |
2171 | 2174 |
2172 // Apply the page/column clip for this fragment, as well as any clips | 2175 // Apply the page/column clip for this fragment, as well as any clips |
2173 // established by layers in between us and the enclosing pagination layer. | 2176 // established by layers in between us and the enclosing pagination layer. |
2174 LayoutRect clipRect = fragment.backgroundRect.rect(); | 2177 LayoutRect clipRect = fragment.backgroundRect.rect(); |
2175 | 2178 |
2176 // Now compute the clips within a given fragment | 2179 // Now compute the clips within a given fragment |
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3229 } | 3232 } |
3230 | 3233 |
3231 void showLayerTree(const blink::LayoutObject* layoutObject) { | 3234 void showLayerTree(const blink::LayoutObject* layoutObject) { |
3232 if (!layoutObject) { | 3235 if (!layoutObject) { |
3233 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 3236 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
3234 return; | 3237 return; |
3235 } | 3238 } |
3236 showLayerTree(layoutObject->enclosingLayer()); | 3239 showLayerTree(layoutObject->enclosingLayer()); |
3237 } | 3240 } |
3238 #endif | 3241 #endif |
OLD | NEW |