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 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1470 ASSERT(!m_scrollableArea); | 1470 ASSERT(!m_scrollableArea); |
1471 if (requiresScrollableArea()) | 1471 if (requiresScrollableArea()) |
1472 m_scrollableArea = PaintLayerScrollableArea::create(*this); | 1472 m_scrollableArea = PaintLayerScrollableArea::create(*this); |
1473 } | 1473 } |
1474 | 1474 |
1475 bool PaintLayer::hasOverflowControls() const | 1475 bool PaintLayer::hasOverflowControls() const |
1476 { | 1476 { |
1477 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || m_scrollable
Area->scrollCorner() || layoutObject()->style()->resize() != RESIZE_NONE); | 1477 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || m_scrollable
Area->scrollCorner() || layoutObject()->style()->resize() != RESIZE_NONE); |
1478 } | 1478 } |
1479 | 1479 |
1480 void PaintLayer::appendSingleFragmentIgnoringPagination(PaintLayerFragments& fra
gments, const PaintLayer* rootLayer, const LayoutRect& dirtyRect, ClipRectsCache
Slot clipRectsCacheSlot, OverlayScrollbarClipBehavior overlayScrollbarClipBehavi
or, ShouldRespectOverflowClipType respectOverflowClip, const LayoutPoint* offset
FromRoot, const LayoutSize& subPixelAccumulation) | 1480 void PaintLayer::appendSingleFragmentIgnoringPagination(PaintLayerFragments& fra
gments, const PaintLayer* rootLayer, const LayoutRect& dirtyRect, |
| 1481 ClipRectsCacheSlot clipRectsCacheSlot, OverlayScrollbarClipBehavior overlayS
crollbarClipBehavior, ShouldRespectOverflowClipType respectOverflowClip, |
| 1482 bool paintingAncestorClippingMask, const LayoutPoint* offsetFromRoot, const
LayoutSize& subPixelAccumulation) |
1481 { | 1483 { |
1482 PaintLayerFragment fragment; | 1484 PaintLayerFragment fragment; |
1483 ClipRectsContext clipRectsContext(rootLayer, clipRectsCacheSlot, overlayScro
llbarClipBehavior, subPixelAccumulation); | 1485 ClipRectsContext clipRectsContext(rootLayer, clipRectsCacheSlot, overlayScro
llbarClipBehavior, subPixelAccumulation); |
1484 if (respectOverflowClip == IgnoreOverflowClip) | 1486 if (respectOverflowClip == IgnoreOverflowClip) |
1485 clipRectsContext.setIgnoreOverflowClip(); | 1487 clipRectsContext.setIgnoreOverflowClip(); |
1486 clipper().calculateRects(clipRectsContext, dirtyRect, fragment.layerBounds,
fragment.backgroundRect, fragment.foregroundRect, offsetFromRoot); | 1488 clipper().calculateRects(clipRectsContext, dirtyRect, fragment.layerBounds,
fragment.backgroundRect, fragment.foregroundRect, offsetFromRoot, paintingAncest
orClippingMask); |
1487 fragments.append(fragment); | 1489 fragments.append(fragment); |
1488 } | 1490 } |
1489 | 1491 |
1490 bool PaintLayer::shouldFragmentCompositedBounds(const PaintLayer* compositingLay
er) const | 1492 bool PaintLayer::shouldFragmentCompositedBounds(const PaintLayer* compositingLay
er) const |
1491 { | 1493 { |
1492 // Composited layers may not be fragmented. | 1494 // Composited layers may not be fragmented. |
1493 return enclosingPaginationLayer() && !compositingLayer->enclosingPaginationL
ayer(); | 1495 return enclosingPaginationLayer() && !compositingLayer->enclosingPaginationL
ayer(); |
1494 } | 1496 } |
1495 | 1497 |
1496 void PaintLayer::collectFragments(PaintLayerFragments& fragments, const PaintLay
er* rootLayer, const LayoutRect& dirtyRect, | 1498 void PaintLayer::collectFragments(PaintLayerFragments& fragments, const PaintLay
er* rootLayer, const LayoutRect& dirtyRect, |
1497 ClipRectsCacheSlot clipRectsCacheSlot, OverlayScrollbarClipBehavior overlayS
crollbarClipBehavior, ShouldRespectOverflowClipType respectOverflowClip, const L
ayoutPoint* offsetFromRoot, | 1499 ClipRectsCacheSlot clipRectsCacheSlot, OverlayScrollbarClipBehavior overlayS
crollbarClipBehavior, ShouldRespectOverflowClipType respectOverflowClip, |
1498 const LayoutSize& subPixelAccumulation, const LayoutRect* layerBoundingBox) | 1500 bool paintingAncestorClippingMask, const LayoutPoint* offsetFromRoot, const
LayoutSize& subPixelAccumulation, const LayoutRect* layerBoundingBox) |
1499 { | 1501 { |
1500 if (!enclosingPaginationLayer()) { | 1502 if (!enclosingPaginationLayer()) { |
1501 // For unpaginated layers, there is only one fragment. | 1503 // For unpaginated layers, there is only one fragment. |
1502 appendSingleFragmentIgnoringPagination(fragments, rootLayer, dirtyRect,
clipRectsCacheSlot, overlayScrollbarClipBehavior, respectOverflowClip, offsetFro
mRoot, subPixelAccumulation); | 1504 appendSingleFragmentIgnoringPagination(fragments, rootLayer, dirtyRect,
clipRectsCacheSlot, overlayScrollbarClipBehavior, respectOverflowClip, |
| 1505 paintingAncestorClippingMask, offsetFromRoot, subPixelAccumulation); |
1503 return; | 1506 return; |
1504 } | 1507 } |
1505 | 1508 |
1506 if (!shouldFragmentCompositedBounds(rootLayer)) { | 1509 if (!shouldFragmentCompositedBounds(rootLayer)) { |
1507 appendSingleFragmentIgnoringPagination(fragments, rootLayer, dirtyRect,
clipRectsCacheSlot, overlayScrollbarClipBehavior, respectOverflowClip, offsetFro
mRoot, subPixelAccumulation); | 1510 appendSingleFragmentIgnoringPagination(fragments, rootLayer, dirtyRect,
clipRectsCacheSlot, overlayScrollbarClipBehavior, respectOverflowClip, |
| 1511 paintingAncestorClippingMask, offsetFromRoot, subPixelAccumulation); |
1508 return; | 1512 return; |
1509 } | 1513 } |
1510 | 1514 |
1511 // Compute our offset within the enclosing pagination layer. | 1515 // Compute our offset within the enclosing pagination layer. |
1512 LayoutPoint offsetWithinPaginatedLayer; | 1516 LayoutPoint offsetWithinPaginatedLayer; |
1513 convertToLayerCoords(enclosingPaginationLayer(), offsetWithinPaginatedLayer)
; | 1517 convertToLayerCoords(enclosingPaginationLayer(), offsetWithinPaginatedLayer)
; |
1514 | 1518 |
1515 // Calculate clip rects relative to the enclosingPaginationLayer. The purpos
e of this call is to determine our bounds clipped to intermediate | 1519 // Calculate clip rects relative to the enclosingPaginationLayer. The purpos
e of this call is to determine our bounds clipped to intermediate |
1516 // layers between us and the pagination context. It's important to minimize
the number of fragments we need to create and this helps with that. | 1520 // layers between us and the pagination context. It's important to minimize
the number of fragments we need to create and this helps with that. |
1517 ClipRectsContext paginationClipRectsContext(enclosingPaginationLayer(), clip
RectsCacheSlot, overlayScrollbarClipBehavior); | 1521 ClipRectsContext paginationClipRectsContext(enclosingPaginationLayer(), clip
RectsCacheSlot, overlayScrollbarClipBehavior); |
1518 if (respectOverflowClip == IgnoreOverflowClip) | 1522 if (respectOverflowClip == IgnoreOverflowClip) |
1519 paginationClipRectsContext.setIgnoreOverflowClip(); | 1523 paginationClipRectsContext.setIgnoreOverflowClip(); |
1520 LayoutRect layerBoundsInFlowThread; | 1524 LayoutRect layerBoundsInFlowThread; |
1521 ClipRect backgroundRectInFlowThread; | 1525 ClipRect backgroundRectInFlowThread; |
1522 ClipRect foregroundRectInFlowThread; | 1526 ClipRect foregroundRectInFlowThread; |
1523 clipper().calculateRects(paginationClipRectsContext, LayoutRect(LayoutRect::
infiniteIntRect()), layerBoundsInFlowThread, | 1527 clipper().calculateRects(paginationClipRectsContext, LayoutRect(LayoutRect::
infiniteIntRect()), layerBoundsInFlowThread, |
1524 backgroundRectInFlowThread, foregroundRectInFlowThread, &offsetWithinPag
inatedLayer); | 1528 backgroundRectInFlowThread, foregroundRectInFlowThread, &offsetWithinPag
inatedLayer, paintingAncestorClippingMask); |
1525 | 1529 |
1526 // Take our bounding box within the flow thread and clip it. | 1530 // Take our bounding box within the flow thread and clip it. |
1527 LayoutRect layerBoundingBoxInFlowThread = layerBoundingBox ? *layerBoundingB
ox : physicalBoundingBox(offsetWithinPaginatedLayer); | 1531 LayoutRect layerBoundingBoxInFlowThread = layerBoundingBox ? *layerBoundingB
ox : physicalBoundingBox(offsetWithinPaginatedLayer); |
1528 layerBoundingBoxInFlowThread.intersect(backgroundRectInFlowThread.rect()); | 1532 layerBoundingBoxInFlowThread.intersect(backgroundRectInFlowThread.rect()); |
1529 | 1533 |
1530 LayoutFlowThread* enclosingFlowThread = toLayoutFlowThread(enclosingPaginati
onLayer()->layoutObject()); | 1534 LayoutFlowThread* enclosingFlowThread = toLayoutFlowThread(enclosingPaginati
onLayer()->layoutObject()); |
1531 LayoutPoint offsetOfPaginationLayerFromRoot; // Visual offset from the root
layer to the nearest fragmentation context. | 1535 LayoutPoint offsetOfPaginationLayerFromRoot; // Visual offset from the root
layer to the nearest fragmentation context. |
1532 bool rootLayerIsInsidePaginationLayer = rootLayer->enclosingPaginationLayer(
) == enclosingPaginationLayer(); | 1536 bool rootLayerIsInsidePaginationLayer = rootLayer->enclosingPaginationLayer(
) == enclosingPaginationLayer(); |
1533 if (rootLayerIsInsidePaginationLayer) { | 1537 if (rootLayerIsInsidePaginationLayer) { |
1534 // The root layer is in the same fragmentation context as this layer, so
we need to look | 1538 // The root layer is in the same fragmentation context as this layer, so
we need to look |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1936 } | 1940 } |
1937 | 1941 |
1938 PaintLayer* PaintLayer::hitTestTransformedLayerInFragments(PaintLayer* rootLayer
, PaintLayer* containerLayer, HitTestResult& result, | 1942 PaintLayer* PaintLayer::hitTestTransformedLayerInFragments(PaintLayer* rootLayer
, PaintLayer* containerLayer, HitTestResult& result, |
1939 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const
HitTestingTransformState* transformState, double* zOffset, ClipRectsCacheSlot c
lipRectsCacheSlot) | 1943 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const
HitTestingTransformState* transformState, double* zOffset, ClipRectsCacheSlot c
lipRectsCacheSlot) |
1940 { | 1944 { |
1941 PaintLayerFragments enclosingPaginationFragments; | 1945 PaintLayerFragments enclosingPaginationFragments; |
1942 LayoutPoint offsetOfPaginationLayerFromRoot; | 1946 LayoutPoint offsetOfPaginationLayerFromRoot; |
1943 // FIXME: We're missing a sub-pixel offset here crbug.com/348728 | 1947 // FIXME: We're missing a sub-pixel offset here crbug.com/348728 |
1944 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination
Layer(), HitTestingTransparencyClipBox, PaintLayer::RootOfTransparencyClipBox, L
ayoutSize()); | 1948 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination
Layer(), HitTestingTransparencyClipBox, PaintLayer::RootOfTransparencyClipBox, L
ayoutSize()); |
1945 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, r
ootLayer, hitTestRect, | 1949 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, r
ootLayer, hitTestRect, |
1946 clipRectsCacheSlot, ExcludeOverlayScrollbarSizeForHitTesting, RespectOve
rflowClip, &offsetOfPaginationLayerFromRoot, LayoutSize(), &transformedExtent); | 1950 clipRectsCacheSlot, ExcludeOverlayScrollbarSizeForHitTesting, RespectOve
rflowClip, false, &offsetOfPaginationLayerFromRoot, LayoutSize(), &transformedEx
tent); |
1947 | 1951 |
1948 for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) { | 1952 for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) { |
1949 const PaintLayerFragment& fragment = enclosingPaginationFragments.at(i); | 1953 const PaintLayerFragment& fragment = enclosingPaginationFragments.at(i); |
1950 | 1954 |
1951 // Apply the page/column clip for this fragment, as well as any clips es
tablished by layers in between us and | 1955 // Apply the page/column clip for this fragment, as well as any clips es
tablished by layers in between us and |
1952 // the enclosing pagination layer. | 1956 // the enclosing pagination layer. |
1953 LayoutRect clipRect = fragment.backgroundRect.rect(); | 1957 LayoutRect clipRect = fragment.backgroundRect.rect(); |
1954 | 1958 |
1955 // Now compute the clips within a given fragment | 1959 // Now compute the clips within a given fragment |
1956 if (parent() != enclosingPaginationLayer()) { | 1960 if (parent() != enclosingPaginationLayer()) { |
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3007 | 3011 |
3008 void showLayerTree(const blink::LayoutObject* layoutObject) | 3012 void showLayerTree(const blink::LayoutObject* layoutObject) |
3009 { | 3013 { |
3010 if (!layoutObject) { | 3014 if (!layoutObject) { |
3011 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 3015 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
3012 return; | 3016 return; |
3013 } | 3017 } |
3014 showLayerTree(layoutObject->enclosingLayer()); | 3018 showLayerTree(layoutObject->enclosingLayer()); |
3015 } | 3019 } |
3016 #endif | 3020 #endif |
OLD | NEW |