Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Side by Side Diff: Source/core/paint/DeprecatedPaintLayer.cpp

Issue 1184303003: Ignore overflow clip on root layer if HitTestRequest::IgnoreClipping is set. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after
1719 // *zOffset on return is the z offset of the hit point relative to the containi ng flattening layer. 1719 // *zOffset on return is the z offset of the hit point relative to the containi ng flattening layer.
1720 DeprecatedPaintLayer* DeprecatedPaintLayer::hitTestLayer(DeprecatedPaintLayer* r ootLayer, DeprecatedPaintLayer* containerLayer, HitTestResult& result, 1720 DeprecatedPaintLayer* DeprecatedPaintLayer::hitTestLayer(DeprecatedPaintLayer* r ootLayer, DeprecatedPaintLayer* containerLayer, HitTestResult& result,
1721 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, bool appliedTransform, 1721 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, bool appliedTransform,
1722 const HitTestingTransformState* transformState, double* zOffset) 1722 const HitTestingTransformState* transformState, double* zOffset)
1723 { 1723 {
1724 ASSERT(layoutObject()->document().lifecycle().state() >= DocumentLifecycle:: CompositingClean); 1724 ASSERT(layoutObject()->document().lifecycle().state() >= DocumentLifecycle:: CompositingClean);
1725 1725
1726 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) 1726 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant())
1727 return 0; 1727 return 0;
1728 1728
1729 // The natural thing would be to keep HitTestingTransformState on the stack, but it's big, so we heap-allocate. 1729 ClipRectsCacheSlot clipRectsCacheSlot = result.hitTestRequest().ignoreClippi ng() ? RootRelativeClipRectsIgnoringViewportClip : RootRelativeClipRects;
1730 1730
1731 // Apply a transform if we have one. 1731 // Apply a transform if we have one.
1732 if (transform() && !appliedTransform) { 1732 if (transform() && !appliedTransform) {
1733 if (enclosingPaginationLayer()) 1733 if (enclosingPaginationLayer())
1734 return hitTestTransformedLayerInFragments(rootLayer, containerLayer, result, hitTestRect, hitTestLocation, transformState, zOffset); 1734 return hitTestTransformedLayerInFragments(rootLayer, containerLayer, result, hitTestRect, hitTestLocation, transformState, zOffset, clipRectsCacheSl ot);
1735 1735
1736 // Make sure the parent's clip rects have been calculated. 1736 // Make sure the parent's clip rects have been calculated.
1737 if (parent()) { 1737 if (parent()) {
1738 ClipRect clipRect = clipper().backgroundClipRect(ClipRectsContext(ro otLayer, RootRelativeClipRects, IncludeOverlayScrollbarSize)); 1738 ClipRect clipRect = clipper().backgroundClipRect(ClipRectsContext(ro otLayer, clipRectsCacheSlot, IncludeOverlayScrollbarSize));
1739 // Go ahead and test the enclosing clip now. 1739 // Go ahead and test the enclosing clip now.
1740 if (!clipRect.intersects(hitTestLocation)) 1740 if (!clipRect.intersects(hitTestLocation))
1741 return 0; 1741 return 0;
1742 } 1742 }
1743 1743
1744 return hitTestLayerByApplyingTransform(rootLayer, containerLayer, result , hitTestRect, hitTestLocation, transformState, zOffset); 1744 return hitTestLayerByApplyingTransform(rootLayer, containerLayer, result , hitTestRect, hitTestLocation, transformState, zOffset);
1745 } 1745 }
1746 1746
1747 // Ensure our lists and 3d status are up-to-date. 1747 // Ensure our lists and 3d status are up-to-date.
1748 m_stackingNode->updateLayerListsIfNeeded(); 1748 m_stackingNode->updateLayerListsIfNeeded();
1749 update3DTransformedDescendantStatus(); 1749 update3DTransformedDescendantStatus();
1750 1750
1751 // The natural thing would be to keep HitTestingTransformState on the stack, but it's big, so we heap-allocate.
1751 RefPtr<HitTestingTransformState> localTransformState; 1752 RefPtr<HitTestingTransformState> localTransformState;
1752 if (appliedTransform) { 1753 if (appliedTransform) {
1753 // We computed the correct state in the caller (above code), so just ref erence it. 1754 // We computed the correct state in the caller (above code), so just ref erence it.
1754 ASSERT(transformState); 1755 ASSERT(transformState);
1755 localTransformState = const_cast<HitTestingTransformState*>(transformSta te); 1756 localTransformState = const_cast<HitTestingTransformState*>(transformSta te);
1756 } else if (transformState || m_has3DTransformedDescendant || preserves3D()) { 1757 } else if (transformState || m_has3DTransformedDescendant || preserves3D()) {
1757 // We need transform state for the first time, or to offset the containe r state, so create it here. 1758 // We need transform state for the first time, or to offset the containe r state, so create it here.
1758 localTransformState = createLocalTransformState(rootLayer, containerLaye r, hitTestRect, hitTestLocation, transformState); 1759 localTransformState = createLocalTransformState(rootLayer, containerLaye r, hitTestRect, hitTestLocation, transformState);
1759 } 1760 }
1760 1761
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1809 localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattene dTransformState.get(), depthSortDescendants); 1810 localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattene dTransformState.get(), depthSortDescendants);
1810 if (hitLayer) { 1811 if (hitLayer) {
1811 if (!depthSortDescendants) 1812 if (!depthSortDescendants)
1812 return hitLayer; 1813 return hitLayer;
1813 candidateLayer = hitLayer; 1814 candidateLayer = hitLayer;
1814 } 1815 }
1815 1816
1816 // Collect the fragments. This will compute the clip rectangles for each lay er fragment. 1817 // Collect the fragments. This will compute the clip rectangles for each lay er fragment.
1817 DeprecatedPaintLayerFragments layerFragments; 1818 DeprecatedPaintLayerFragments layerFragments;
1818 if (appliedTransform) 1819 if (appliedTransform)
1819 appendSingleFragmentIgnoringPagination(layerFragments, rootLayer, hitTes tRect, RootRelativeClipRects, IncludeOverlayScrollbarSize); 1820 appendSingleFragmentIgnoringPagination(layerFragments, rootLayer, hitTes tRect, clipRectsCacheSlot, IncludeOverlayScrollbarSize);
1820 else 1821 else
1821 collectFragments(layerFragments, rootLayer, hitTestRect, RootRelativeCli pRects, IncludeOverlayScrollbarSize); 1822 collectFragments(layerFragments, rootLayer, hitTestRect, clipRectsCacheS lot, IncludeOverlayScrollbarSize);
1822 1823
1823 if (m_scrollableArea && m_scrollableArea->hitTestResizerInFragments(layerFra gments, hitTestLocation)) { 1824 if (m_scrollableArea && m_scrollableArea->hitTestResizerInFragments(layerFra gments, hitTestLocation)) {
1824 layoutObject()->updateHitTestResult(result, hitTestLocation.point()); 1825 layoutObject()->updateHitTestResult(result, hitTestLocation.point());
1825 return this; 1826 return this;
1826 } 1827 }
1827 1828
1828 // Next we want to see if the mouse pos is inside the child LayoutObjects of the layer. Check 1829 // Next we want to see if the mouse pos is inside the child LayoutObjects of the layer. Check
1829 // every fragment in reverse order. 1830 // every fragment in reverse order.
1830 if (isSelfPaintingLayer()) { 1831 if (isSelfPaintingLayer()) {
1831 // Hit test with a temporary HitTestResult, because we only want to comm it to 'result' if we know we're frontmost. 1832 // Hit test with a temporary HitTestResult, because we only want to comm it to 'result' if we know we're frontmost.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1890 continue; 1891 continue;
1891 insideClipRect = true; 1892 insideClipRect = true;
1892 if (hitTestContents(result, fragment.layerBounds, hitTestLocation, hitTe stFilter)) 1893 if (hitTestContents(result, fragment.layerBounds, hitTestLocation, hitTe stFilter))
1893 return true; 1894 return true;
1894 } 1895 }
1895 1896
1896 return false; 1897 return false;
1897 } 1898 }
1898 1899
1899 DeprecatedPaintLayer* DeprecatedPaintLayer::hitTestTransformedLayerInFragments(D eprecatedPaintLayer* rootLayer, DeprecatedPaintLayer* containerLayer, HitTestRes ult& result, 1900 DeprecatedPaintLayer* DeprecatedPaintLayer::hitTestTransformedLayerInFragments(D eprecatedPaintLayer* rootLayer, DeprecatedPaintLayer* containerLayer, HitTestRes ult& result,
1900 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const HitTestingTransformState* transformState, double* zOffset) 1901 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const HitTestingTransformState* transformState, double* zOffset, ClipRectsCacheSlot c lipRectsCacheSlot)
1901 { 1902 {
1902 DeprecatedPaintLayerFragments enclosingPaginationFragments; 1903 DeprecatedPaintLayerFragments enclosingPaginationFragments;
1903 LayoutPoint offsetOfPaginationLayerFromRoot; 1904 LayoutPoint offsetOfPaginationLayerFromRoot;
1904 // FIXME: We're missing a sub-pixel offset here crbug.com/348728 1905 // FIXME: We're missing a sub-pixel offset here crbug.com/348728
1905 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination Layer(), HitTestingTransparencyClipBox, DeprecatedPaintLayer::RootOfTransparency ClipBox, LayoutSize()); 1906 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination Layer(), HitTestingTransparencyClipBox, DeprecatedPaintLayer::RootOfTransparency ClipBox, LayoutSize());
1906 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, r ootLayer, hitTestRect, 1907 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, r ootLayer, hitTestRect,
1907 RootRelativeClipRects, IncludeOverlayScrollbarSize, RespectOverflowClip, &offsetOfPaginationLayerFromRoot, LayoutSize(), &transformedExtent); 1908 clipRectsCacheSlot, IncludeOverlayScrollbarSize, RespectOverflowClip, &o ffsetOfPaginationLayerFromRoot, LayoutSize(), &transformedExtent);
1908 1909
1909 for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) { 1910 for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) {
1910 const DeprecatedPaintLayerFragment& fragment = enclosingPaginationFragme nts.at(i); 1911 const DeprecatedPaintLayerFragment& fragment = enclosingPaginationFragme nts.at(i);
1911 1912
1912 // Apply the page/column clip for this fragment, as well as any clips es tablished by layers in between us and 1913 // Apply the page/column clip for this fragment, as well as any clips es tablished by layers in between us and
1913 // the enclosing pagination layer. 1914 // the enclosing pagination layer.
1914 LayoutRect clipRect = fragment.backgroundRect.rect(); 1915 LayoutRect clipRect = fragment.backgroundRect.rect();
1915 1916
1916 // Now compute the clips within a given fragment 1917 // Now compute the clips within a given fragment
1917 if (parent() != enclosingPaginationLayer()) { 1918 if (parent() != enclosingPaginationLayer()) {
1918 enclosingPaginationLayer()->convertToLayerCoords(rootLayer, offsetOf PaginationLayerFromRoot); 1919 enclosingPaginationLayer()->convertToLayerCoords(rootLayer, offsetOf PaginationLayerFromRoot);
1919 LayoutRect parentClipRect = clipper().backgroundClipRect(ClipRectsCo ntext(enclosingPaginationLayer(), RootRelativeClipRects, IncludeOverlayScrollbar Size)).rect(); 1920 LayoutRect parentClipRect = clipper().backgroundClipRect(ClipRectsCo ntext(enclosingPaginationLayer(), clipRectsCacheSlot, IncludeOverlayScrollbarSiz e)).rect();
1920 parentClipRect.moveBy(fragment.paginationOffset + offsetOfPagination LayerFromRoot); 1921 parentClipRect.moveBy(fragment.paginationOffset + offsetOfPagination LayerFromRoot);
1921 clipRect.intersect(parentClipRect); 1922 clipRect.intersect(parentClipRect);
1922 } 1923 }
1923 1924
1924 if (!hitTestLocation.intersects(clipRect)) 1925 if (!hitTestLocation.intersects(clipRect))
1925 continue; 1926 continue;
1926 1927
1927 DeprecatedPaintLayer* hitLayer = hitTestLayerByApplyingTransform(rootLay er, containerLayer, result, hitTestRect, hitTestLocation, 1928 DeprecatedPaintLayer* hitLayer = hitTestLayerByApplyingTransform(rootLay er, containerLayer, result, hitTestRect, hitTestLocation,
1928 transformState, zOffset, fragment.paginationOffset); 1929 transformState, zOffset, fragment.paginationOffset);
1929 if (hitLayer) 1930 if (hitLayer)
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
2763 2764
2764 void showLayerTree(const blink::LayoutObject* layoutObject) 2765 void showLayerTree(const blink::LayoutObject* layoutObject)
2765 { 2766 {
2766 if (!layoutObject) { 2767 if (!layoutObject) {
2767 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); 2768 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n");
2768 return; 2769 return;
2769 } 2770 }
2770 showLayerTree(layoutObject->enclosingLayer()); 2771 showLayerTree(layoutObject->enclosingLayer());
2771 } 2772 }
2772 #endif 2773 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698