| 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 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1658 | 1658 |
| 1659 static inline LayoutRect frameVisibleRect(LayoutObject* renderer) | 1659 static inline LayoutRect frameVisibleRect(LayoutObject* renderer) |
| 1660 { | 1660 { |
| 1661 FrameView* frameView = renderer->document().view(); | 1661 FrameView* frameView = renderer->document().view(); |
| 1662 if (!frameView) | 1662 if (!frameView) |
| 1663 return LayoutRect(); | 1663 return LayoutRect(); |
| 1664 | 1664 |
| 1665 return LayoutRect(frameView->visibleContentRect()); | 1665 return LayoutRect(frameView->visibleContentRect()); |
| 1666 } | 1666 } |
| 1667 | 1667 |
| 1668 bool DeprecatedPaintLayer::hitTest(const HitTestRequest& request, HitTestResult&
result) | 1668 bool DeprecatedPaintLayer::hitTest(HitTestResult& result) |
| 1669 { | 1669 { |
| 1670 return hitTest(request, result.hitTestLocation(), result); | 1670 return hitTest(result.hitTestRequest(), result.hitTestLocation(), result); |
| 1671 } | 1671 } |
| 1672 | 1672 |
| 1673 bool DeprecatedPaintLayer::hitTest(const HitTestRequest& request, const HitTestL
ocation& hitTestLocation, HitTestResult& result) | 1673 bool DeprecatedPaintLayer::hitTest(const HitTestRequest& request, const HitTestL
ocation& hitTestLocation, HitTestResult& result) |
| 1674 { | 1674 { |
| 1675 ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()); | 1675 ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()); |
| 1676 | 1676 |
| 1677 // LayoutView should make sure to update layout before entering hit testing | 1677 // LayoutView should make sure to update layout before entering hit testing |
| 1678 ASSERT(!layoutObject()->frame()->view()->layoutPending()); | 1678 ASSERT(!layoutObject()->frame()->view()->layoutPending()); |
| 1679 ASSERT(!layoutObject()->document().layoutView()->needsLayout()); | 1679 ASSERT(!layoutObject()->document().layoutView()->needsLayout()); |
| 1680 | 1680 |
| 1681 // Start with frameVisibleRect to ensure we include the scrollbars. | 1681 // Start with frameVisibleRect to ensure we include the scrollbars. |
| 1682 LayoutRect hitTestArea = frameVisibleRect(layoutObject()); | 1682 LayoutRect hitTestArea = frameVisibleRect(layoutObject()); |
| 1683 if (request.ignoreClipping()) | 1683 if (request.ignoreClipping()) |
| 1684 hitTestArea.unite(LayoutRect(layoutObject()->view()->documentRect())); | 1684 hitTestArea.unite(LayoutRect(layoutObject()->view()->documentRect())); |
| 1685 | 1685 |
| 1686 DeprecatedPaintLayer* insideLayer = hitTestLayer(this, 0, request, result, h
itTestArea, hitTestLocation, false); | 1686 DeprecatedPaintLayer* insideLayer = hitTestLayer(this, 0, result, hitTestAre
a, hitTestLocation, false); |
| 1687 if (!insideLayer) { | 1687 if (!insideLayer) { |
| 1688 // We didn't hit any layer. If we are the root layer and the mouse is --
or just was -- down, | 1688 // We didn't hit any layer. If we are the root layer and the mouse is --
or just was -- down, |
| 1689 // return ourselves. We do this so mouse events continue getting deliver
ed after a drag has | 1689 // return ourselves. We do this so mouse events continue getting deliver
ed after a drag has |
| 1690 // exited the WebView, and so hit testing over a scrollbar hits the cont
ent document. | 1690 // exited the WebView, and so hit testing over a scrollbar hits the cont
ent document. |
| 1691 // In addtion, it is possible for the mouse to stay in the document but
there is no element. | 1691 // In addtion, it is possible for the mouse to stay in the document but
there is no element. |
| 1692 // At that time, the events of the mouse should be fired. | 1692 // At that time, the events of the mouse should be fired. |
| 1693 LayoutPoint hitPoint = hitTestLocation.point(); | 1693 LayoutPoint hitPoint = hitTestLocation.point(); |
| 1694 if (!request.isChildFrameHitTest() && ((request.active() || request.rele
ase()) || (request.move() && hitTestArea.contains(hitPoint.x(), hitPoint.y())))
&& isRootLayer()) { | 1694 if (!request.isChildFrameHitTest() && ((request.active() || request.rele
ase()) || (request.move() && hitTestArea.contains(hitPoint.x(), hitPoint.y())))
&& isRootLayer()) { |
| 1695 layoutObject()->updateHitTestResult(result, toLayoutView(layoutObjec
t())->flipForWritingMode(hitTestLocation.point())); | 1695 layoutObject()->updateHitTestResult(result, toLayoutView(layoutObjec
t())->flipForWritingMode(hitTestLocation.point())); |
| 1696 insideLayer = this; | 1696 insideLayer = this; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1797 } | 1797 } |
| 1798 | 1798 |
| 1799 // hitTestLocation and hitTestRect are relative to rootLayer. | 1799 // hitTestLocation and hitTestRect are relative to rootLayer. |
| 1800 // A 'flattening' layer is one preserves3D() == false. | 1800 // A 'flattening' layer is one preserves3D() == false. |
| 1801 // transformState.m_accumulatedTransform holds the transform from the containing
flattening layer. | 1801 // transformState.m_accumulatedTransform holds the transform from the containing
flattening layer. |
| 1802 // transformState.m_lastPlanarPoint is the hitTestLocation in the plane of the c
ontaining flattening layer. | 1802 // transformState.m_lastPlanarPoint is the hitTestLocation in the plane of the c
ontaining flattening layer. |
| 1803 // transformState.m_lastPlanarQuad is the hitTestRect as a quad in the plane of
the containing flattening layer. | 1803 // transformState.m_lastPlanarQuad is the hitTestRect as a quad in the plane of
the containing flattening layer. |
| 1804 // | 1804 // |
| 1805 // If zOffset is non-null (which indicates that the caller wants z offset inform
ation), | 1805 // If zOffset is non-null (which indicates that the caller wants z offset inform
ation), |
| 1806 // *zOffset on return is the z offset of the hit point relative to the containi
ng flattening layer. | 1806 // *zOffset on return is the z offset of the hit point relative to the containi
ng flattening layer. |
| 1807 DeprecatedPaintLayer* DeprecatedPaintLayer::hitTestLayer(DeprecatedPaintLayer* r
ootLayer, DeprecatedPaintLayer* containerLayer, const HitTestRequest& request, H
itTestResult& result, | 1807 DeprecatedPaintLayer* DeprecatedPaintLayer::hitTestLayer(DeprecatedPaintLayer* r
ootLayer, DeprecatedPaintLayer* containerLayer, HitTestResult& result, |
| 1808 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, bool
appliedTransform, | 1808 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, bool
appliedTransform, |
| 1809 const HitTestingTransformState* transformState, double* zOffset) | 1809 const HitTestingTransformState* transformState, double* zOffset) |
| 1810 { | 1810 { |
| 1811 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) | 1811 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) |
| 1812 return 0; | 1812 return 0; |
| 1813 | 1813 |
| 1814 // The natural thing would be to keep HitTestingTransformState on the stack,
but it's big, so we heap-allocate. | 1814 // The natural thing would be to keep HitTestingTransformState on the stack,
but it's big, so we heap-allocate. |
| 1815 | 1815 |
| 1816 // Apply a transform if we have one. | 1816 // Apply a transform if we have one. |
| 1817 if (transform() && !appliedTransform) { | 1817 if (transform() && !appliedTransform) { |
| 1818 if (enclosingPaginationLayer()) | 1818 if (enclosingPaginationLayer()) |
| 1819 return hitTestTransformedLayerInFragments(rootLayer, containerLayer,
request, result, hitTestRect, hitTestLocation, transformState, zOffset); | 1819 return hitTestTransformedLayerInFragments(rootLayer, containerLayer,
result, hitTestRect, hitTestLocation, transformState, zOffset); |
| 1820 | 1820 |
| 1821 // Make sure the parent's clip rects have been calculated. | 1821 // Make sure the parent's clip rects have been calculated. |
| 1822 if (parent()) { | 1822 if (parent()) { |
| 1823 ClipRect clipRect = clipper().backgroundClipRect(ClipRectsContext(ro
otLayer, RootRelativeClipRects, IncludeOverlayScrollbarSize)); | 1823 ClipRect clipRect = clipper().backgroundClipRect(ClipRectsContext(ro
otLayer, RootRelativeClipRects, IncludeOverlayScrollbarSize)); |
| 1824 // Go ahead and test the enclosing clip now. | 1824 // Go ahead and test the enclosing clip now. |
| 1825 if (!clipRect.intersects(hitTestLocation)) | 1825 if (!clipRect.intersects(hitTestLocation)) |
| 1826 return 0; | 1826 return 0; |
| 1827 } | 1827 } |
| 1828 | 1828 |
| 1829 return hitTestLayerByApplyingTransform(rootLayer, containerLayer, reques
t, result, hitTestRect, hitTestLocation, transformState, zOffset); | 1829 return hitTestLayerByApplyingTransform(rootLayer, containerLayer, result
, hitTestRect, hitTestLocation, transformState, zOffset); |
| 1830 } | 1830 } |
| 1831 | 1831 |
| 1832 // Ensure our lists and 3d status are up-to-date. | 1832 // Ensure our lists and 3d status are up-to-date. |
| 1833 m_stackingNode->updateLayerListsIfNeeded(); | 1833 m_stackingNode->updateLayerListsIfNeeded(); |
| 1834 update3DTransformedDescendantStatus(); | 1834 update3DTransformedDescendantStatus(); |
| 1835 | 1835 |
| 1836 RefPtr<HitTestingTransformState> localTransformState; | 1836 RefPtr<HitTestingTransformState> localTransformState; |
| 1837 if (appliedTransform) { | 1837 if (appliedTransform) { |
| 1838 // We computed the correct state in the caller (above code), so just ref
erence it. | 1838 // We computed the correct state in the caller (above code), so just ref
erence it. |
| 1839 ASSERT(transformState); | 1839 ASSERT(transformState); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1874 } else if (zOffset) { | 1874 } else if (zOffset) { |
| 1875 zOffsetForDescendantsPtr = 0; | 1875 zOffsetForDescendantsPtr = 0; |
| 1876 // Container needs us to give back a z offset for the hit layer. | 1876 // Container needs us to give back a z offset for the hit layer. |
| 1877 zOffsetForContentsPtr = zOffset; | 1877 zOffsetForContentsPtr = zOffset; |
| 1878 } | 1878 } |
| 1879 | 1879 |
| 1880 // This variable tracks which layer the mouse ends up being inside. | 1880 // This variable tracks which layer the mouse ends up being inside. |
| 1881 DeprecatedPaintLayer* candidateLayer = 0; | 1881 DeprecatedPaintLayer* candidateLayer = 0; |
| 1882 | 1882 |
| 1883 // Begin by walking our list of positive layers from highest z-index down to
the lowest z-index. | 1883 // Begin by walking our list of positive layers from highest z-index down to
the lowest z-index. |
| 1884 DeprecatedPaintLayer* hitLayer = hitTestChildren(PositiveZOrderChildren, roo
tLayer, request, result, hitTestRect, hitTestLocation, | 1884 DeprecatedPaintLayer* hitLayer = hitTestChildren(PositiveZOrderChildren, roo
tLayer, result, hitTestRect, hitTestLocation, |
| 1885 localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattene
dTransformState.get(), depthSortDescendants); | 1885 localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattene
dTransformState.get(), depthSortDescendants); |
| 1886 if (hitLayer) { | 1886 if (hitLayer) { |
| 1887 if (!depthSortDescendants) | 1887 if (!depthSortDescendants) |
| 1888 return hitLayer; | 1888 return hitLayer; |
| 1889 candidateLayer = hitLayer; | 1889 candidateLayer = hitLayer; |
| 1890 } | 1890 } |
| 1891 | 1891 |
| 1892 // Now check our overflow objects. | 1892 // Now check our overflow objects. |
| 1893 hitLayer = hitTestChildren(NormalFlowChildren, rootLayer, request, result, h
itTestRect, hitTestLocation, | 1893 hitLayer = hitTestChildren(NormalFlowChildren, rootLayer, result, hitTestRec
t, hitTestLocation, |
| 1894 localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattene
dTransformState.get(), depthSortDescendants); | 1894 localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattene
dTransformState.get(), depthSortDescendants); |
| 1895 if (hitLayer) { | 1895 if (hitLayer) { |
| 1896 if (!depthSortDescendants) | 1896 if (!depthSortDescendants) |
| 1897 return hitLayer; | 1897 return hitLayer; |
| 1898 candidateLayer = hitLayer; | 1898 candidateLayer = hitLayer; |
| 1899 } | 1899 } |
| 1900 | 1900 |
| 1901 // Collect the fragments. This will compute the clip rectangles for each lay
er fragment. | 1901 // Collect the fragments. This will compute the clip rectangles for each lay
er fragment. |
| 1902 DeprecatedPaintLayerFragments layerFragments; | 1902 DeprecatedPaintLayerFragments layerFragments; |
| 1903 if (appliedTransform) | 1903 if (appliedTransform) |
| 1904 appendSingleFragmentIgnoringPagination(layerFragments, rootLayer, hitTes
tRect, RootRelativeClipRects, IncludeOverlayScrollbarSize); | 1904 appendSingleFragmentIgnoringPagination(layerFragments, rootLayer, hitTes
tRect, RootRelativeClipRects, IncludeOverlayScrollbarSize); |
| 1905 else | 1905 else |
| 1906 collectFragments(layerFragments, rootLayer, hitTestRect, RootRelativeCli
pRects, IncludeOverlayScrollbarSize); | 1906 collectFragments(layerFragments, rootLayer, hitTestRect, RootRelativeCli
pRects, IncludeOverlayScrollbarSize); |
| 1907 | 1907 |
| 1908 if (m_scrollableArea && m_scrollableArea->hitTestResizerInFragments(layerFra
gments, hitTestLocation)) { | 1908 if (m_scrollableArea && m_scrollableArea->hitTestResizerInFragments(layerFra
gments, hitTestLocation)) { |
| 1909 layoutObject()->updateHitTestResult(result, hitTestLocation.point()); | 1909 layoutObject()->updateHitTestResult(result, hitTestLocation.point()); |
| 1910 return this; | 1910 return this; |
| 1911 } | 1911 } |
| 1912 | 1912 |
| 1913 // Next we want to see if the mouse pos is inside the child LayoutObjects of
the layer. Check | 1913 // Next we want to see if the mouse pos is inside the child LayoutObjects of
the layer. Check |
| 1914 // every fragment in reverse order. | 1914 // every fragment in reverse order. |
| 1915 if (isSelfPaintingLayer()) { | 1915 if (isSelfPaintingLayer()) { |
| 1916 // Hit test with a temporary HitTestResult, because we only want to comm
it to 'result' if we know we're frontmost. | 1916 // Hit test with a temporary HitTestResult, because we only want to comm
it to 'result' if we know we're frontmost. |
| 1917 HitTestResult tempResult(result.hitTestLocation()); | 1917 HitTestResult tempResult(result.hitTestRequest(), result.hitTestLocation
()); |
| 1918 bool insideFragmentForegroundRect = false; | 1918 bool insideFragmentForegroundRect = false; |
| 1919 if (hitTestContentsForFragments(layerFragments, request, tempResult, hit
TestLocation, HitTestDescendants, insideFragmentForegroundRect) | 1919 if (hitTestContentsForFragments(layerFragments, tempResult, hitTestLocat
ion, HitTestDescendants, insideFragmentForegroundRect) |
| 1920 && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTra
nsformState.get())) { | 1920 && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTra
nsformState.get())) { |
| 1921 if (request.listBased()) | 1921 if (result.hitTestRequest().listBased()) |
| 1922 result.append(tempResult, request); | 1922 result.append(tempResult); |
| 1923 else | 1923 else |
| 1924 result = tempResult; | 1924 result = tempResult; |
| 1925 if (!depthSortDescendants) | 1925 if (!depthSortDescendants) |
| 1926 return this; | 1926 return this; |
| 1927 // Foreground can depth-sort with descendant layers, so keep this as
a candidate. | 1927 // Foreground can depth-sort with descendant layers, so keep this as
a candidate. |
| 1928 candidateLayer = this; | 1928 candidateLayer = this; |
| 1929 } else if (insideFragmentForegroundRect && request.listBased()) { | 1929 } else if (insideFragmentForegroundRect && result.hitTestRequest().listB
ased()) { |
| 1930 result.append(tempResult, request); | 1930 result.append(tempResult); |
| 1931 } | 1931 } |
| 1932 } | 1932 } |
| 1933 | 1933 |
| 1934 // Now check our negative z-index children. | 1934 // Now check our negative z-index children. |
| 1935 hitLayer = hitTestChildren(NegativeZOrderChildren, rootLayer, request, resul
t, hitTestRect, hitTestLocation, | 1935 hitLayer = hitTestChildren(NegativeZOrderChildren, rootLayer, result, hitTes
tRect, hitTestLocation, |
| 1936 localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattene
dTransformState.get(), depthSortDescendants); | 1936 localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattene
dTransformState.get(), depthSortDescendants); |
| 1937 if (hitLayer) { | 1937 if (hitLayer) { |
| 1938 if (!depthSortDescendants) | 1938 if (!depthSortDescendants) |
| 1939 return hitLayer; | 1939 return hitLayer; |
| 1940 candidateLayer = hitLayer; | 1940 candidateLayer = hitLayer; |
| 1941 } | 1941 } |
| 1942 | 1942 |
| 1943 // If we found a layer, return. Child layers, and foreground always render i
n front of background. | 1943 // If we found a layer, return. Child layers, and foreground always render i
n front of background. |
| 1944 if (candidateLayer) | 1944 if (candidateLayer) |
| 1945 return candidateLayer; | 1945 return candidateLayer; |
| 1946 | 1946 |
| 1947 if (isSelfPaintingLayer()) { | 1947 if (isSelfPaintingLayer()) { |
| 1948 HitTestResult tempResult(result.hitTestLocation()); | 1948 HitTestResult tempResult(result.hitTestRequest(), result.hitTestLocation
()); |
| 1949 bool insideFragmentBackgroundRect = false; | 1949 bool insideFragmentBackgroundRect = false; |
| 1950 if (hitTestContentsForFragments(layerFragments, request, tempResult, hit
TestLocation, HitTestSelf, insideFragmentBackgroundRect) | 1950 if (hitTestContentsForFragments(layerFragments, tempResult, hitTestLocat
ion, HitTestSelf, insideFragmentBackgroundRect) |
| 1951 && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTra
nsformState.get())) { | 1951 && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTra
nsformState.get())) { |
| 1952 if (result.isRectBasedTest()) | 1952 if (result.isRectBasedTest()) |
| 1953 result.append(tempResult, request); | 1953 result.append(tempResult); |
| 1954 else | 1954 else |
| 1955 result = tempResult; | 1955 result = tempResult; |
| 1956 return this; | 1956 return this; |
| 1957 } | 1957 } |
| 1958 if (insideFragmentBackgroundRect && request.listBased()) | 1958 if (insideFragmentBackgroundRect && result.hitTestRequest().listBased()) |
| 1959 result.append(tempResult, request); | 1959 result.append(tempResult); |
| 1960 } | 1960 } |
| 1961 | 1961 |
| 1962 return 0; | 1962 return 0; |
| 1963 } | 1963 } |
| 1964 | 1964 |
| 1965 bool DeprecatedPaintLayer::hitTestContentsForFragments(const DeprecatedPaintLaye
rFragments& layerFragments, const HitTestRequest& request, HitTestResult& result
, | 1965 bool DeprecatedPaintLayer::hitTestContentsForFragments(const DeprecatedPaintLaye
rFragments& layerFragments, HitTestResult& result, |
| 1966 const HitTestLocation& hitTestLocation, HitTestFilter hitTestFilter, bool& i
nsideClipRect) const | 1966 const HitTestLocation& hitTestLocation, HitTestFilter hitTestFilter, bool& i
nsideClipRect) const |
| 1967 { | 1967 { |
| 1968 if (layerFragments.isEmpty()) | 1968 if (layerFragments.isEmpty()) |
| 1969 return false; | 1969 return false; |
| 1970 | 1970 |
| 1971 for (int i = layerFragments.size() - 1; i >= 0; --i) { | 1971 for (int i = layerFragments.size() - 1; i >= 0; --i) { |
| 1972 const DeprecatedPaintLayerFragment& fragment = layerFragments.at(i); | 1972 const DeprecatedPaintLayerFragment& fragment = layerFragments.at(i); |
| 1973 if ((hitTestFilter == HitTestSelf && !fragment.backgroundRect.intersects
(hitTestLocation)) | 1973 if ((hitTestFilter == HitTestSelf && !fragment.backgroundRect.intersects
(hitTestLocation)) |
| 1974 || (hitTestFilter == HitTestDescendants && !fragment.foregroundRect.
intersects(hitTestLocation))) | 1974 || (hitTestFilter == HitTestDescendants && !fragment.foregroundRect.
intersects(hitTestLocation))) |
| 1975 continue; | 1975 continue; |
| 1976 insideClipRect = true; | 1976 insideClipRect = true; |
| 1977 if (hitTestContents(request, result, fragment.layerBounds, hitTestLocati
on, hitTestFilter)) | 1977 if (hitTestContents(result, fragment.layerBounds, hitTestLocation, hitTe
stFilter)) |
| 1978 return true; | 1978 return true; |
| 1979 } | 1979 } |
| 1980 | 1980 |
| 1981 return false; | 1981 return false; |
| 1982 } | 1982 } |
| 1983 | 1983 |
| 1984 DeprecatedPaintLayer* DeprecatedPaintLayer::hitTestTransformedLayerInFragments(D
eprecatedPaintLayer* rootLayer, DeprecatedPaintLayer* containerLayer, const HitT
estRequest& request, HitTestResult& result, | 1984 DeprecatedPaintLayer* DeprecatedPaintLayer::hitTestTransformedLayerInFragments(D
eprecatedPaintLayer* rootLayer, DeprecatedPaintLayer* containerLayer, HitTestRes
ult& result, |
| 1985 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const
HitTestingTransformState* transformState, double* zOffset) | 1985 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const
HitTestingTransformState* transformState, double* zOffset) |
| 1986 { | 1986 { |
| 1987 DeprecatedPaintLayerFragments enclosingPaginationFragments; | 1987 DeprecatedPaintLayerFragments enclosingPaginationFragments; |
| 1988 LayoutPoint offsetOfPaginationLayerFromRoot; | 1988 LayoutPoint offsetOfPaginationLayerFromRoot; |
| 1989 // FIXME: We're missing a sub-pixel offset here crbug.com/348728 | 1989 // FIXME: We're missing a sub-pixel offset here crbug.com/348728 |
| 1990 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination
Layer(), HitTestingTransparencyClipBox, DeprecatedPaintLayer::RootOfTransparency
ClipBox, LayoutSize()); | 1990 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination
Layer(), HitTestingTransparencyClipBox, DeprecatedPaintLayer::RootOfTransparency
ClipBox, LayoutSize()); |
| 1991 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, r
ootLayer, hitTestRect, | 1991 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, r
ootLayer, hitTestRect, |
| 1992 RootRelativeClipRects, IncludeOverlayScrollbarSize, RespectOverflowClip,
&offsetOfPaginationLayerFromRoot, LayoutSize(), &transformedExtent); | 1992 RootRelativeClipRects, IncludeOverlayScrollbarSize, RespectOverflowClip,
&offsetOfPaginationLayerFromRoot, LayoutSize(), &transformedExtent); |
| 1993 | 1993 |
| 1994 for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) { | 1994 for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) { |
| 1995 const DeprecatedPaintLayerFragment& fragment = enclosingPaginationFragme
nts.at(i); | 1995 const DeprecatedPaintLayerFragment& fragment = enclosingPaginationFragme
nts.at(i); |
| 1996 | 1996 |
| 1997 // Apply the page/column clip for this fragment, as well as any clips es
tablished by layers in between us and | 1997 // Apply the page/column clip for this fragment, as well as any clips es
tablished by layers in between us and |
| 1998 // the enclosing pagination layer. | 1998 // the enclosing pagination layer. |
| 1999 LayoutRect clipRect = fragment.backgroundRect.rect(); | 1999 LayoutRect clipRect = fragment.backgroundRect.rect(); |
| 2000 | 2000 |
| 2001 // Now compute the clips within a given fragment | 2001 // Now compute the clips within a given fragment |
| 2002 if (parent() != enclosingPaginationLayer()) { | 2002 if (parent() != enclosingPaginationLayer()) { |
| 2003 enclosingPaginationLayer()->convertToLayerCoords(rootLayer, offsetOf
PaginationLayerFromRoot); | 2003 enclosingPaginationLayer()->convertToLayerCoords(rootLayer, offsetOf
PaginationLayerFromRoot); |
| 2004 LayoutRect parentClipRect = clipper().backgroundClipRect(ClipRectsCo
ntext(enclosingPaginationLayer(), RootRelativeClipRects, IncludeOverlayScrollbar
Size)).rect(); | 2004 LayoutRect parentClipRect = clipper().backgroundClipRect(ClipRectsCo
ntext(enclosingPaginationLayer(), RootRelativeClipRects, IncludeOverlayScrollbar
Size)).rect(); |
| 2005 parentClipRect.moveBy(fragment.paginationOffset + offsetOfPagination
LayerFromRoot); | 2005 parentClipRect.moveBy(fragment.paginationOffset + offsetOfPagination
LayerFromRoot); |
| 2006 clipRect.intersect(parentClipRect); | 2006 clipRect.intersect(parentClipRect); |
| 2007 } | 2007 } |
| 2008 | 2008 |
| 2009 if (!hitTestLocation.intersects(clipRect)) | 2009 if (!hitTestLocation.intersects(clipRect)) |
| 2010 continue; | 2010 continue; |
| 2011 | 2011 |
| 2012 DeprecatedPaintLayer* hitLayer = hitTestLayerByApplyingTransform(rootLay
er, containerLayer, request, result, hitTestRect, hitTestLocation, | 2012 DeprecatedPaintLayer* hitLayer = hitTestLayerByApplyingTransform(rootLay
er, containerLayer, result, hitTestRect, hitTestLocation, |
| 2013 transformState, zOffset, fragment.paginationOffset); | 2013 transformState, zOffset, fragment.paginationOffset); |
| 2014 if (hitLayer) | 2014 if (hitLayer) |
| 2015 return hitLayer; | 2015 return hitLayer; |
| 2016 } | 2016 } |
| 2017 | 2017 |
| 2018 return 0; | 2018 return 0; |
| 2019 } | 2019 } |
| 2020 | 2020 |
| 2021 DeprecatedPaintLayer* DeprecatedPaintLayer::hitTestLayerByApplyingTransform(Depr
ecatedPaintLayer* rootLayer, DeprecatedPaintLayer* containerLayer, const HitTest
Request& request, HitTestResult& result, | 2021 DeprecatedPaintLayer* DeprecatedPaintLayer::hitTestLayerByApplyingTransform(Depr
ecatedPaintLayer* rootLayer, DeprecatedPaintLayer* containerLayer, HitTestResult
& result, |
| 2022 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const
HitTestingTransformState* transformState, double* zOffset, | 2022 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const
HitTestingTransformState* transformState, double* zOffset, |
| 2023 const LayoutPoint& translationOffset) | 2023 const LayoutPoint& translationOffset) |
| 2024 { | 2024 { |
| 2025 // Create a transform state to accumulate this transform. | 2025 // Create a transform state to accumulate this transform. |
| 2026 RefPtr<HitTestingTransformState> newTransformState = createLocalTransformSta
te(rootLayer, containerLayer, hitTestRect, hitTestLocation, transformState, tran
slationOffset); | 2026 RefPtr<HitTestingTransformState> newTransformState = createLocalTransformSta
te(rootLayer, containerLayer, hitTestRect, hitTestLocation, transformState, tran
slationOffset); |
| 2027 | 2027 |
| 2028 // If the transform can't be inverted, then don't hit test this layer at all
. | 2028 // If the transform can't be inverted, then don't hit test this layer at all
. |
| 2029 if (!newTransformState->m_accumulatedTransform.isInvertible()) | 2029 if (!newTransformState->m_accumulatedTransform.isInvertible()) |
| 2030 return 0; | 2030 return 0; |
| 2031 | 2031 |
| 2032 // Compute the point and the hit test rect in the coords of this layer by us
ing the values | 2032 // Compute the point and the hit test rect in the coords of this layer by us
ing the values |
| 2033 // from the transformState, which store the point and quad in the coords of
the last flattened | 2033 // from the transformState, which store the point and quad in the coords of
the last flattened |
| 2034 // layer, and the accumulated transform which lets up map through preserve-3
d layers. | 2034 // layer, and the accumulated transform which lets up map through preserve-3
d layers. |
| 2035 // | 2035 // |
| 2036 // We can't just map hitTestLocation and hitTestRect because they may have b
een flattened (losing z) | 2036 // We can't just map hitTestLocation and hitTestRect because they may have b
een flattened (losing z) |
| 2037 // by our container. | 2037 // by our container. |
| 2038 FloatPoint localPoint = newTransformState->mappedPoint(); | 2038 FloatPoint localPoint = newTransformState->mappedPoint(); |
| 2039 FloatQuad localPointQuad = newTransformState->mappedQuad(); | 2039 FloatQuad localPointQuad = newTransformState->mappedQuad(); |
| 2040 LayoutRect localHitTestRect = newTransformState->boundsOfMappedArea(); | 2040 LayoutRect localHitTestRect = newTransformState->boundsOfMappedArea(); |
| 2041 HitTestLocation newHitTestLocation; | 2041 HitTestLocation newHitTestLocation; |
| 2042 if (hitTestLocation.isRectBasedTest()) | 2042 if (hitTestLocation.isRectBasedTest()) |
| 2043 newHitTestLocation = HitTestLocation(localPoint, localPointQuad); | 2043 newHitTestLocation = HitTestLocation(localPoint, localPointQuad); |
| 2044 else | 2044 else |
| 2045 newHitTestLocation = HitTestLocation(localPoint); | 2045 newHitTestLocation = HitTestLocation(localPoint); |
| 2046 | 2046 |
| 2047 // Now do a hit test with the root layer shifted to be us. | 2047 // Now do a hit test with the root layer shifted to be us. |
| 2048 return hitTestLayer(this, containerLayer, request, result, localHitTestRect,
newHitTestLocation, true, newTransformState.get(), zOffset); | 2048 return hitTestLayer(this, containerLayer, result, localHitTestRect, newHitTe
stLocation, true, newTransformState.get(), zOffset); |
| 2049 } | 2049 } |
| 2050 | 2050 |
| 2051 bool DeprecatedPaintLayer::hitTestContents(const HitTestRequest& request, HitTes
tResult& result, const LayoutRect& layerBounds, const HitTestLocation& hitTestLo
cation, HitTestFilter hitTestFilter) const | 2051 bool DeprecatedPaintLayer::hitTestContents(HitTestResult& result, const LayoutRe
ct& layerBounds, const HitTestLocation& hitTestLocation, HitTestFilter hitTestFi
lter) const |
| 2052 { | 2052 { |
| 2053 ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()); | 2053 ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()); |
| 2054 | 2054 |
| 2055 if (!layoutObject()->hitTest(request, result, hitTestLocation, toLayoutPoint
(layerBounds.location() - layoutBoxLocation()), hitTestFilter)) { | 2055 if (!layoutObject()->hitTest(result, hitTestLocation, toLayoutPoint(layerBou
nds.location() - layoutBoxLocation()), hitTestFilter)) { |
| 2056 // It's wrong to set innerNode, but then claim that you didn't hit anyth
ing, unless it is | 2056 // It's wrong to set innerNode, but then claim that you didn't hit anyth
ing, unless it is |
| 2057 // a rect-based test. | 2057 // a rect-based test. |
| 2058 ASSERT(!result.innerNode() || (request.listBased() && result.listBasedTe
stResult().size())); | 2058 ASSERT(!result.innerNode() || (result.hitTestRequest().listBased() && re
sult.listBasedTestResult().size())); |
| 2059 return false; | 2059 return false; |
| 2060 } | 2060 } |
| 2061 | 2061 |
| 2062 if (!result.innerNode() || !result.innerNonSharedNode()) { | 2062 if (!result.innerNode() || !result.innerNonSharedNode()) { |
| 2063 // We hit something anonymous, and we didn't find a DOM node ancestor in
this layer. | 2063 // We hit something anonymous, and we didn't find a DOM node ancestor in
this layer. |
| 2064 | 2064 |
| 2065 if (layoutObject()->isLayoutFlowThread()) { | 2065 if (layoutObject()->isLayoutFlowThread()) { |
| 2066 // For a flow thread it's safe to just say that we didn't hit anythi
ng. That means that | 2066 // For a flow thread it's safe to just say that we didn't hit anythi
ng. That means that |
| 2067 // we'll continue as normally, and eventually hit a column set sibli
ng instead. Column | 2067 // we'll continue as normally, and eventually hit a column set sibli
ng instead. Column |
| 2068 // sets are also anonymous, but, unlike flow threads, they don't est
ablish layers, so | 2068 // sets are also anonymous, but, unlike flow threads, they don't est
ablish layers, so |
| 2069 // we'll fall back and hit the multicol container parent (which shou
ld have a DOM node). | 2069 // we'll fall back and hit the multicol container parent (which shou
ld have a DOM node). |
| 2070 return false; | 2070 return false; |
| 2071 } | 2071 } |
| 2072 | 2072 |
| 2073 Node* e = enclosingElement(); | 2073 Node* e = enclosingElement(); |
| 2074 if (!result.innerNode()) | 2074 if (!result.innerNode()) |
| 2075 result.setInnerNode(e); | 2075 result.setInnerNode(e); |
| 2076 if (!result.innerNonSharedNode()) | 2076 if (!result.innerNonSharedNode()) |
| 2077 result.setInnerNonSharedNode(e); | 2077 result.setInnerNonSharedNode(e); |
| 2078 // FIXME: missing call to result.setLocalPoint(). What we would really w
ant to do here is to | 2078 // FIXME: missing call to result.setLocalPoint(). What we would really w
ant to do here is to |
| 2079 // return and look for the nearest non-anonymous ancestor, and ignore au
nts and uncles on | 2079 // return and look for the nearest non-anonymous ancestor, and ignore au
nts and uncles on |
| 2080 // our way. It's bad to look for it manually like we do here, and give u
p on setting a local | 2080 // our way. It's bad to look for it manually like we do here, and give u
p on setting a local |
| 2081 // point in the result, because that has bad implications for text selec
tion and | 2081 // point in the result, because that has bad implications for text selec
tion and |
| 2082 // caretRangeFromPoint(). See crbug.com/461791 | 2082 // caretRangeFromPoint(). See crbug.com/461791 |
| 2083 } | 2083 } |
| 2084 return true; | 2084 return true; |
| 2085 } | 2085 } |
| 2086 | 2086 |
| 2087 DeprecatedPaintLayer* DeprecatedPaintLayer::hitTestChildren(ChildrenIteration ch
ildrentoVisit, DeprecatedPaintLayer* rootLayer, | 2087 DeprecatedPaintLayer* DeprecatedPaintLayer::hitTestChildren(ChildrenIteration ch
ildrentoVisit, DeprecatedPaintLayer* rootLayer, |
| 2088 const HitTestRequest& request, HitTestResult& result, | 2088 HitTestResult& result, |
| 2089 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, | 2089 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, |
| 2090 const HitTestingTransformState* transformState, | 2090 const HitTestingTransformState* transformState, |
| 2091 double* zOffsetForDescendants, double* zOffset, | 2091 double* zOffsetForDescendants, double* zOffset, |
| 2092 const HitTestingTransformState* unflattenedTransformState, | 2092 const HitTestingTransformState* unflattenedTransformState, |
| 2093 bool depthSortDescendants) | 2093 bool depthSortDescendants) |
| 2094 { | 2094 { |
| 2095 if (!hasSelfPaintingLayerDescendant()) | 2095 if (!hasSelfPaintingLayerDescendant()) |
| 2096 return 0; | 2096 return 0; |
| 2097 | 2097 |
| 2098 DeprecatedPaintLayer* resultLayer = 0; | 2098 DeprecatedPaintLayer* resultLayer = 0; |
| 2099 DeprecatedPaintLayerStackingNodeReverseIterator iterator(*m_stackingNode, ch
ildrentoVisit); | 2099 DeprecatedPaintLayerStackingNodeReverseIterator iterator(*m_stackingNode, ch
ildrentoVisit); |
| 2100 while (DeprecatedPaintLayerStackingNode* child = iterator.next()) { | 2100 while (DeprecatedPaintLayerStackingNode* child = iterator.next()) { |
| 2101 DeprecatedPaintLayer* childLayer = child->layer(); | 2101 DeprecatedPaintLayer* childLayer = child->layer(); |
| 2102 DeprecatedPaintLayer* hitLayer = 0; | 2102 DeprecatedPaintLayer* hitLayer = 0; |
| 2103 HitTestResult tempResult(result.hitTestLocation()); | 2103 HitTestResult tempResult(result.hitTestRequest(), result.hitTestLocation
()); |
| 2104 if (childLayer->isPaginated()) | 2104 if (childLayer->isPaginated()) |
| 2105 hitLayer = hitTestPaginatedChildLayer(childLayer, rootLayer, request
, tempResult, hitTestRect, hitTestLocation, transformState, zOffsetForDescendant
s); | 2105 hitLayer = hitTestPaginatedChildLayer(childLayer, rootLayer, tempRes
ult, hitTestRect, hitTestLocation, transformState, zOffsetForDescendants); |
| 2106 else | 2106 else |
| 2107 hitLayer = childLayer->hitTestLayer(rootLayer, this, request, tempRe
sult, hitTestRect, hitTestLocation, false, transformState, zOffsetForDescendants
); | 2107 hitLayer = childLayer->hitTestLayer(rootLayer, this, tempResult, hit
TestRect, hitTestLocation, false, transformState, zOffsetForDescendants); |
| 2108 | 2108 |
| 2109 // If it is a list-based test, we can safely append the temporary result
since it might had hit | 2109 // If it is a list-based test, we can safely append the temporary result
since it might had hit |
| 2110 // nodes but not necesserily had hitLayer set. | 2110 // nodes but not necesserily had hitLayer set. |
| 2111 ASSERT(!result.isRectBasedTest() || request.listBased()); | 2111 ASSERT(!result.isRectBasedTest() || result.hitTestRequest().listBased())
; |
| 2112 if (request.listBased()) | 2112 if (result.hitTestRequest().listBased()) |
| 2113 result.append(tempResult, request); | 2113 result.append(tempResult); |
| 2114 | 2114 |
| 2115 if (isHitCandidate(hitLayer, depthSortDescendants, zOffset, unflattenedT
ransformState)) { | 2115 if (isHitCandidate(hitLayer, depthSortDescendants, zOffset, unflattenedT
ransformState)) { |
| 2116 resultLayer = hitLayer; | 2116 resultLayer = hitLayer; |
| 2117 if (!request.listBased()) | 2117 if (!result.hitTestRequest().listBased()) |
| 2118 result = tempResult; | 2118 result = tempResult; |
| 2119 if (!depthSortDescendants) | 2119 if (!depthSortDescendants) |
| 2120 break; | 2120 break; |
| 2121 } | 2121 } |
| 2122 } | 2122 } |
| 2123 | 2123 |
| 2124 return resultLayer; | 2124 return resultLayer; |
| 2125 } | 2125 } |
| 2126 | 2126 |
| 2127 DeprecatedPaintLayer* DeprecatedPaintLayer::hitTestPaginatedChildLayer(Deprecate
dPaintLayer* childLayer, DeprecatedPaintLayer* rootLayer, const HitTestRequest&
request, HitTestResult& result, | 2127 DeprecatedPaintLayer* DeprecatedPaintLayer::hitTestPaginatedChildLayer(Deprecate
dPaintLayer* childLayer, DeprecatedPaintLayer* rootLayer, HitTestResult& result, |
| 2128 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const
HitTestingTransformState* transformState, double* zOffset) | 2128 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const
HitTestingTransformState* transformState, double* zOffset) |
| 2129 { | 2129 { |
| 2130 Vector<DeprecatedPaintLayer*> columnLayers; | 2130 Vector<DeprecatedPaintLayer*> columnLayers; |
| 2131 DeprecatedPaintLayerStackingNode* ancestorNode = m_stackingNode->isNormalFlo
wOnly() ? parent()->stackingNode() : m_stackingNode->ancestorStackingContextNode
(); | 2131 DeprecatedPaintLayerStackingNode* ancestorNode = m_stackingNode->isNormalFlo
wOnly() ? parent()->stackingNode() : m_stackingNode->ancestorStackingContextNode
(); |
| 2132 for (DeprecatedPaintLayer* curr = childLayer->parent(); curr; curr = curr->p
arent()) { | 2132 for (DeprecatedPaintLayer* curr = childLayer->parent(); curr; curr = curr->p
arent()) { |
| 2133 if (curr->layoutObject()->hasColumns() && checkContainingBlockChainForPa
gination(childLayer->layoutObject(), curr->layoutBox())) | 2133 if (curr->layoutObject()->hasColumns() && checkContainingBlockChainForPa
gination(childLayer->layoutObject(), curr->layoutBox())) |
| 2134 columnLayers.append(curr); | 2134 columnLayers.append(curr); |
| 2135 if (curr->stackingNode() == ancestorNode) | 2135 if (curr->stackingNode() == ancestorNode) |
| 2136 break; | 2136 break; |
| 2137 } | 2137 } |
| 2138 | 2138 |
| 2139 ASSERT(columnLayers.size()); | 2139 ASSERT(columnLayers.size()); |
| 2140 return hitTestChildLayerColumns(childLayer, rootLayer, request, result, hitT
estRect, hitTestLocation, transformState, zOffset, | 2140 return hitTestChildLayerColumns(childLayer, rootLayer, result, hitTestRect,
hitTestLocation, transformState, zOffset, |
| 2141 columnLayers, columnLayers.size() - 1); | 2141 columnLayers, columnLayers.size() - 1); |
| 2142 } | 2142 } |
| 2143 | 2143 |
| 2144 DeprecatedPaintLayer* DeprecatedPaintLayer::hitTestChildLayerColumns(DeprecatedP
aintLayer* childLayer, DeprecatedPaintLayer* rootLayer, const HitTestRequest& re
quest, HitTestResult& result, | 2144 DeprecatedPaintLayer* DeprecatedPaintLayer::hitTestChildLayerColumns(DeprecatedP
aintLayer* childLayer, DeprecatedPaintLayer* rootLayer, HitTestResult& result, |
| 2145 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const
HitTestingTransformState* transformState, double* zOffset, | 2145 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const
HitTestingTransformState* transformState, double* zOffset, |
| 2146 const Vector<DeprecatedPaintLayer*>& columnLayers, size_t columnIndex) | 2146 const Vector<DeprecatedPaintLayer*>& columnLayers, size_t columnIndex) |
| 2147 { | 2147 { |
| 2148 LayoutBlock* columnBlock = toLayoutBlock(columnLayers[columnIndex]->layoutOb
ject()); | 2148 LayoutBlock* columnBlock = toLayoutBlock(columnLayers[columnIndex]->layoutOb
ject()); |
| 2149 | 2149 |
| 2150 ASSERT(columnBlock && columnBlock->hasColumns()); | 2150 ASSERT(columnBlock && columnBlock->hasColumns()); |
| 2151 if (!columnBlock || !columnBlock->hasColumns()) | 2151 if (!columnBlock || !columnBlock->hasColumns()) |
| 2152 return 0; | 2152 return 0; |
| 2153 | 2153 |
| 2154 LayoutPoint layerOffset; | 2154 LayoutPoint layerOffset; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2204 if (!columnIndex) { | 2204 if (!columnIndex) { |
| 2205 // Apply a translation transform to change where the layer paint
s. | 2205 // Apply a translation transform to change where the layer paint
s. |
| 2206 TransformationMatrix oldTransform; | 2206 TransformationMatrix oldTransform; |
| 2207 bool oldHasTransform = childLayer->transform(); | 2207 bool oldHasTransform = childLayer->transform(); |
| 2208 if (oldHasTransform) | 2208 if (oldHasTransform) |
| 2209 oldTransform = *childLayer->transform(); | 2209 oldTransform = *childLayer->transform(); |
| 2210 TransformationMatrix newTransform(oldTransform); | 2210 TransformationMatrix newTransform(oldTransform); |
| 2211 newTransform.translateRight(offset.width(), offset.height()); | 2211 newTransform.translateRight(offset.width(), offset.height()); |
| 2212 | 2212 |
| 2213 childLayer->m_transform = adoptPtr(new TransformationMatrix(newT
ransform)); | 2213 childLayer->m_transform = adoptPtr(new TransformationMatrix(newT
ransform)); |
| 2214 hitLayer = childLayer->hitTestLayer(rootLayer, columnLayers[0],
request, result, localClipRect, hitTestLocation, false, transformState, zOffset)
; | 2214 hitLayer = childLayer->hitTestLayer(rootLayer, columnLayers[0],
result, localClipRect, hitTestLocation, false, transformState, zOffset); |
| 2215 if (oldHasTransform) | 2215 if (oldHasTransform) |
| 2216 childLayer->m_transform = adoptPtr(new TransformationMatrix(
oldTransform)); | 2216 childLayer->m_transform = adoptPtr(new TransformationMatrix(
oldTransform)); |
| 2217 else | 2217 else |
| 2218 childLayer->m_transform.clear(); | 2218 childLayer->m_transform.clear(); |
| 2219 } else { | 2219 } else { |
| 2220 // Adjust the transform such that the renderer's upper left corn
er will be at (0,0) in user space. | 2220 // Adjust the transform such that the renderer's upper left corn
er will be at (0,0) in user space. |
| 2221 // This involves subtracting out the position of the layer in ou
r current coordinate space. | 2221 // This involves subtracting out the position of the layer in ou
r current coordinate space. |
| 2222 DeprecatedPaintLayer* nextLayer = columnLayers[columnIndex - 1]; | 2222 DeprecatedPaintLayer* nextLayer = columnLayers[columnIndex - 1]; |
| 2223 RefPtr<HitTestingTransformState> newTransformState = nextLayer->
createLocalTransformState(rootLayer, nextLayer, localClipRect, hitTestLocation,
transformState); | 2223 RefPtr<HitTestingTransformState> newTransformState = nextLayer->
createLocalTransformState(rootLayer, nextLayer, localClipRect, hitTestLocation,
transformState); |
| 2224 newTransformState->translate(offset.width(), offset.height(), Hi
tTestingTransformState::AccumulateTransform); | 2224 newTransformState->translate(offset.width(), offset.height(), Hi
tTestingTransformState::AccumulateTransform); |
| 2225 FloatPoint localPoint = newTransformState->mappedPoint(); | 2225 FloatPoint localPoint = newTransformState->mappedPoint(); |
| 2226 FloatQuad localPointQuad = newTransformState->mappedQuad(); | 2226 FloatQuad localPointQuad = newTransformState->mappedQuad(); |
| 2227 LayoutRect localHitTestRect(newTransformState->mappedArea().encl
osingBoundingBox()); | 2227 LayoutRect localHitTestRect(newTransformState->mappedArea().encl
osingBoundingBox()); |
| 2228 HitTestLocation newHitTestLocation; | 2228 HitTestLocation newHitTestLocation; |
| 2229 if (hitTestLocation.isRectBasedTest()) | 2229 if (hitTestLocation.isRectBasedTest()) |
| 2230 newHitTestLocation = HitTestLocation(localPoint, localPointQ
uad); | 2230 newHitTestLocation = HitTestLocation(localPoint, localPointQ
uad); |
| 2231 else | 2231 else |
| 2232 newHitTestLocation = HitTestLocation(localPoint); | 2232 newHitTestLocation = HitTestLocation(localPoint); |
| 2233 newTransformState->flatten(); | 2233 newTransformState->flatten(); |
| 2234 | 2234 |
| 2235 hitLayer = hitTestChildLayerColumns(childLayer, columnLayers[col
umnIndex - 1], request, result, localHitTestRect, newHitTestLocation, | 2235 hitLayer = hitTestChildLayerColumns(childLayer, columnLayers[col
umnIndex - 1], result, localHitTestRect, newHitTestLocation, |
| 2236 newTransformState.get(), zOffset, columnLayers, columnIndex
- 1); | 2236 newTransformState.get(), zOffset, columnLayers, columnIndex
- 1); |
| 2237 } | 2237 } |
| 2238 | 2238 |
| 2239 if (hitLayer) | 2239 if (hitLayer) |
| 2240 return hitLayer; | 2240 return hitLayer; |
| 2241 } | 2241 } |
| 2242 } | 2242 } |
| 2243 | 2243 |
| 2244 return 0; | 2244 return 0; |
| 2245 } | 2245 } |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2973 } | 2973 } |
| 2974 } | 2974 } |
| 2975 | 2975 |
| 2976 void showLayerTree(const blink::LayoutObject* renderer) | 2976 void showLayerTree(const blink::LayoutObject* renderer) |
| 2977 { | 2977 { |
| 2978 if (!renderer) | 2978 if (!renderer) |
| 2979 return; | 2979 return; |
| 2980 showLayerTree(renderer->enclosingLayer()); | 2980 showLayerTree(renderer->enclosingLayer()); |
| 2981 } | 2981 } |
| 2982 #endif | 2982 #endif |
| OLD | NEW |