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 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1545 m_scrollableArea = adoptPtr(new LayerScrollableArea(*this)); | 1545 m_scrollableArea = adoptPtr(new LayerScrollableArea(*this)); |
1546 else | 1546 else |
1547 m_scrollableArea = nullptr; | 1547 m_scrollableArea = nullptr; |
1548 } | 1548 } |
1549 | 1549 |
1550 bool Layer::hasOverflowControls() const | 1550 bool Layer::hasOverflowControls() const |
1551 { | 1551 { |
1552 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || m_scrollable
Area->scrollCorner() || renderer()->style()->resize() != RESIZE_NONE); | 1552 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || m_scrollable
Area->scrollCorner() || renderer()->style()->resize() != RESIZE_NONE); |
1553 } | 1553 } |
1554 | 1554 |
| 1555 void Layer::appendSingleFragmentIgnoringPagination(LayerFragments& fragments, co
nst Layer* rootLayer, const LayoutRect& dirtyRect, ClipRectsCacheSlot clipRectsC
acheSlot, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy, ShouldR
espectOverflowClip respectOverflowClip, const LayoutPoint* offsetFromRoot, const
LayoutSize& subPixelAccumulation) |
| 1556 { |
| 1557 LayerFragment fragment; |
| 1558 ClipRectsContext clipRectsContext(rootLayer, clipRectsCacheSlot, inOverlaySc
rollbarSizeRelevancy, subPixelAccumulation); |
| 1559 if (respectOverflowClip == IgnoreOverflowClip) |
| 1560 clipRectsContext.setIgnoreOverflowClip(); |
| 1561 clipper().calculateRects(clipRectsContext, dirtyRect, fragment.layerBounds,
fragment.backgroundRect, fragment.foregroundRect, fragment.outlineRect, offsetFr
omRoot); |
| 1562 fragments.append(fragment); |
| 1563 } |
| 1564 |
1555 void Layer::collectFragments(LayerFragments& fragments, const Layer* rootLayer,
const LayoutRect& dirtyRect, | 1565 void Layer::collectFragments(LayerFragments& fragments, const Layer* rootLayer,
const LayoutRect& dirtyRect, |
1556 ClipRectsCacheSlot clipRectsCacheSlot, OverlayScrollbarSizeRelevancy inOverl
ayScrollbarSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const L
ayoutPoint* offsetFromRoot, | 1566 ClipRectsCacheSlot clipRectsCacheSlot, OverlayScrollbarSizeRelevancy inOverl
ayScrollbarSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const L
ayoutPoint* offsetFromRoot, |
1557 const LayoutSize& subPixelAccumulation, const LayoutRect* layerBoundingBox) | 1567 const LayoutSize& subPixelAccumulation, const LayoutRect* layerBoundingBox) |
1558 { | 1568 { |
1559 if (!enclosingPaginationLayer() || hasTransformRelatedProperty()) { | 1569 if (!enclosingPaginationLayer()) { |
1560 // For unpaginated layers, there is only one fragment. | 1570 // For unpaginated layers, there is only one fragment. |
1561 LayerFragment fragment; | 1571 appendSingleFragmentIgnoringPagination(fragments, rootLayer, dirtyRect,
clipRectsCacheSlot, inOverlayScrollbarSizeRelevancy, respectOverflowClip, offset
FromRoot, subPixelAccumulation); |
1562 ClipRectsContext clipRectsContext(rootLayer, clipRectsCacheSlot, inOverl
ayScrollbarSizeRelevancy, subPixelAccumulation); | |
1563 if (respectOverflowClip == IgnoreOverflowClip) | |
1564 clipRectsContext.setIgnoreOverflowClip(); | |
1565 clipper().calculateRects(clipRectsContext, dirtyRect, fragment.layerBoun
ds, fragment.backgroundRect, fragment.foregroundRect, fragment.outlineRect, offs
etFromRoot); | |
1566 fragments.append(fragment); | |
1567 return; | 1572 return; |
1568 } | 1573 } |
1569 | 1574 |
1570 // Compute our offset within the enclosing pagination layer. | 1575 // Compute our offset within the enclosing pagination layer. |
1571 LayoutPoint offsetWithinPaginatedLayer; | 1576 LayoutPoint offsetWithinPaginatedLayer; |
1572 convertToLayerCoords(enclosingPaginationLayer(), offsetWithinPaginatedLayer)
; | 1577 convertToLayerCoords(enclosingPaginationLayer(), offsetWithinPaginatedLayer)
; |
1573 | 1578 |
1574 // Calculate clip rects relative to the enclosingPaginationLayer. The purpos
e of this call is to determine our bounds clipped to intermediate | 1579 // Calculate clip rects relative to the enclosingPaginationLayer. The purpos
e of this call is to determine our bounds clipped to intermediate |
1575 // 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. | 1580 // 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. |
1576 ClipRectsContext paginationClipRectsContext(enclosingPaginationLayer(), clip
RectsCacheSlot, inOverlayScrollbarSizeRelevancy); | 1581 ClipRectsContext paginationClipRectsContext(enclosingPaginationLayer(), clip
RectsCacheSlot, inOverlayScrollbarSizeRelevancy); |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1877 hitLayer = hitTestChildren(NormalFlowChildren, rootLayer, request, result, h
itTestRect, hitTestLocation, | 1882 hitLayer = hitTestChildren(NormalFlowChildren, rootLayer, request, result, h
itTestRect, hitTestLocation, |
1878 localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattene
dTransformState.get(), depthSortDescendants); | 1883 localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattene
dTransformState.get(), depthSortDescendants); |
1879 if (hitLayer) { | 1884 if (hitLayer) { |
1880 if (!depthSortDescendants) | 1885 if (!depthSortDescendants) |
1881 return hitLayer; | 1886 return hitLayer; |
1882 candidateLayer = hitLayer; | 1887 candidateLayer = hitLayer; |
1883 } | 1888 } |
1884 | 1889 |
1885 // Collect the fragments. This will compute the clip rectangles for each lay
er fragment. | 1890 // Collect the fragments. This will compute the clip rectangles for each lay
er fragment. |
1886 LayerFragments layerFragments; | 1891 LayerFragments layerFragments; |
1887 collectFragments(layerFragments, rootLayer, hitTestRect, RootRelativeClipRec
ts, IncludeOverlayScrollbarSize); | 1892 if (appliedTransform) |
| 1893 appendSingleFragmentIgnoringPagination(layerFragments, rootLayer, hitTes
tRect, RootRelativeClipRects, IncludeOverlayScrollbarSize); |
| 1894 else |
| 1895 collectFragments(layerFragments, rootLayer, hitTestRect, RootRelativeCli
pRects, IncludeOverlayScrollbarSize); |
1888 | 1896 |
1889 if (m_scrollableArea && m_scrollableArea->hitTestResizerInFragments(layerFra
gments, hitTestLocation)) { | 1897 if (m_scrollableArea && m_scrollableArea->hitTestResizerInFragments(layerFra
gments, hitTestLocation)) { |
1890 renderer()->updateHitTestResult(result, hitTestLocation.point()); | 1898 renderer()->updateHitTestResult(result, hitTestLocation.point()); |
1891 return this; | 1899 return this; |
1892 } | 1900 } |
1893 | 1901 |
1894 // Next we want to see if the mouse pos is inside the child LayoutObjects of
the layer. Check | 1902 // Next we want to see if the mouse pos is inside the child LayoutObjects of
the layer. Check |
1895 // every fragment in reverse order. | 1903 // every fragment in reverse order. |
1896 if (isSelfPaintingLayer()) { | 1904 if (isSelfPaintingLayer()) { |
1897 // Hit test with a temporary HitTestResult, because we only want to comm
it to 'result' if we know we're frontmost. | 1905 // Hit test with a temporary HitTestResult, because we only want to comm
it to 'result' if we know we're frontmost. |
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2936 } | 2944 } |
2937 } | 2945 } |
2938 | 2946 |
2939 void showLayerTree(const blink::LayoutObject* renderer) | 2947 void showLayerTree(const blink::LayoutObject* renderer) |
2940 { | 2948 { |
2941 if (!renderer) | 2949 if (!renderer) |
2942 return; | 2950 return; |
2943 showLayerTree(renderer->enclosingLayer()); | 2951 showLayerTree(renderer->enclosingLayer()); |
2944 } | 2952 } |
2945 #endif | 2953 #endif |
OLD | NEW |