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 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1772 if (m_scrollableArea && m_scrollableArea->hitTestResizerInFragments(layerFra
gments, hitTestLocation)) { | 1772 if (m_scrollableArea && m_scrollableArea->hitTestResizerInFragments(layerFra
gments, hitTestLocation)) { |
1773 layoutObject()->updateHitTestResult(result, hitTestLocation.point()); | 1773 layoutObject()->updateHitTestResult(result, hitTestLocation.point()); |
1774 return this; | 1774 return this; |
1775 } | 1775 } |
1776 | 1776 |
1777 // Next we want to see if the mouse pos is inside the child LayoutObjects of
the layer. Check | 1777 // Next we want to see if the mouse pos is inside the child LayoutObjects of
the layer. Check |
1778 // every fragment in reverse order. | 1778 // every fragment in reverse order. |
1779 if (isSelfPaintingLayer()) { | 1779 if (isSelfPaintingLayer()) { |
1780 // Hit test with a temporary HitTestResult, because we only want to comm
it to 'result' if we know we're frontmost. | 1780 // Hit test with a temporary HitTestResult, because we only want to comm
it to 'result' if we know we're frontmost. |
1781 HitTestResult tempResult(result.hitTestRequest(), result.hitTestLocation
()); | 1781 HitTestResult tempResult(result.hitTestRequest(), result.hitTestLocation
()); |
| 1782 tempResult.setValidityRect(result.validityRect()); |
1782 bool insideFragmentForegroundRect = false; | 1783 bool insideFragmentForegroundRect = false; |
1783 if (hitTestContentsForFragments(layerFragments, tempResult, hitTestLocat
ion, HitTestDescendants, insideFragmentForegroundRect) | 1784 if (hitTestContentsForFragments(layerFragments, tempResult, hitTestLocat
ion, HitTestDescendants, insideFragmentForegroundRect) |
1784 && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTra
nsformState.get())) { | 1785 && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTra
nsformState.get())) { |
1785 if (result.hitTestRequest().listBased()) | 1786 if (result.hitTestRequest().listBased()) |
1786 result.append(tempResult); | 1787 result.append(tempResult); |
1787 else | 1788 else |
1788 result = tempResult; | 1789 result = tempResult; |
1789 if (!depthSortDescendants) | 1790 if (!depthSortDescendants) |
1790 return this; | 1791 return this; |
1791 // Foreground can depth-sort with descendant layers, so keep this as
a candidate. | 1792 // Foreground can depth-sort with descendant layers, so keep this as
a candidate. |
(...skipping 11 matching lines...) Expand all Loading... |
1803 return hitLayer; | 1804 return hitLayer; |
1804 candidateLayer = hitLayer; | 1805 candidateLayer = hitLayer; |
1805 } | 1806 } |
1806 | 1807 |
1807 // If we found a layer, return. Child layers, and foreground always render i
n front of background. | 1808 // If we found a layer, return. Child layers, and foreground always render i
n front of background. |
1808 if (candidateLayer) | 1809 if (candidateLayer) |
1809 return candidateLayer; | 1810 return candidateLayer; |
1810 | 1811 |
1811 if (isSelfPaintingLayer()) { | 1812 if (isSelfPaintingLayer()) { |
1812 HitTestResult tempResult(result.hitTestRequest(), result.hitTestLocation
()); | 1813 HitTestResult tempResult(result.hitTestRequest(), result.hitTestLocation
()); |
| 1814 tempResult.setValidityRect(result.validityRect()); |
1813 bool insideFragmentBackgroundRect = false; | 1815 bool insideFragmentBackgroundRect = false; |
1814 if (hitTestContentsForFragments(layerFragments, tempResult, hitTestLocat
ion, HitTestSelf, insideFragmentBackgroundRect) | 1816 if (hitTestContentsForFragments(layerFragments, tempResult, hitTestLocat
ion, HitTestSelf, insideFragmentBackgroundRect) |
1815 && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTra
nsformState.get())) { | 1817 && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTra
nsformState.get())) { |
1816 if (result.isRectBasedTest()) | 1818 if (result.isRectBasedTest()) |
1817 result.append(tempResult); | 1819 result.append(tempResult); |
1818 else | 1820 else |
1819 result = tempResult; | 1821 result = tempResult; |
1820 return this; | 1822 return this; |
1821 } | 1823 } |
1822 if (insideFragmentBackgroundRect && result.hitTestRequest().listBased()) | 1824 if (insideFragmentBackgroundRect && result.hitTestRequest().listBased()) |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1957 { | 1959 { |
1958 if (!hasSelfPaintingLayerDescendant()) | 1960 if (!hasSelfPaintingLayerDescendant()) |
1959 return 0; | 1961 return 0; |
1960 | 1962 |
1961 DeprecatedPaintLayer* resultLayer = 0; | 1963 DeprecatedPaintLayer* resultLayer = 0; |
1962 DeprecatedPaintLayerStackingNodeReverseIterator iterator(*m_stackingNode, ch
ildrentoVisit); | 1964 DeprecatedPaintLayerStackingNodeReverseIterator iterator(*m_stackingNode, ch
ildrentoVisit); |
1963 while (DeprecatedPaintLayerStackingNode* child = iterator.next()) { | 1965 while (DeprecatedPaintLayerStackingNode* child = iterator.next()) { |
1964 DeprecatedPaintLayer* childLayer = child->layer(); | 1966 DeprecatedPaintLayer* childLayer = child->layer(); |
1965 DeprecatedPaintLayer* hitLayer = 0; | 1967 DeprecatedPaintLayer* hitLayer = 0; |
1966 HitTestResult tempResult(result.hitTestRequest(), result.hitTestLocation
()); | 1968 HitTestResult tempResult(result.hitTestRequest(), result.hitTestLocation
()); |
| 1969 tempResult.setValidityRect(result.validityRect()); |
1967 hitLayer = childLayer->hitTestLayer(rootLayer, this, tempResult, hitTest
Rect, hitTestLocation, false, transformState, zOffsetForDescendants); | 1970 hitLayer = childLayer->hitTestLayer(rootLayer, this, tempResult, hitTest
Rect, hitTestLocation, false, transformState, zOffsetForDescendants); |
1968 | 1971 |
1969 // If it is a list-based test, we can safely append the temporary result
since it might had hit | 1972 // If it is a list-based test, we can safely append the temporary result
since it might had hit |
1970 // nodes but not necesserily had hitLayer set. | 1973 // nodes but not necesserily had hitLayer set. |
1971 ASSERT(!result.isRectBasedTest() || result.hitTestRequest().listBased())
; | 1974 ASSERT(!result.isRectBasedTest() || result.hitTestRequest().listBased())
; |
1972 if (result.hitTestRequest().listBased()) | 1975 if (result.hitTestRequest().listBased()) |
1973 result.append(tempResult); | 1976 result.append(tempResult); |
1974 | 1977 |
1975 if (isHitCandidate(hitLayer, depthSortDescendants, zOffset, unflattenedT
ransformState)) { | 1978 if (isHitCandidate(hitLayer, depthSortDescendants, zOffset, unflattenedT
ransformState)) { |
1976 resultLayer = hitLayer; | 1979 resultLayer = hitLayer; |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2712 | 2715 |
2713 void showLayerTree(const blink::LayoutObject* layoutObject) | 2716 void showLayerTree(const blink::LayoutObject* layoutObject) |
2714 { | 2717 { |
2715 if (!layoutObject) { | 2718 if (!layoutObject) { |
2716 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 2719 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
2717 return; | 2720 return; |
2718 } | 2721 } |
2719 showLayerTree(layoutObject->enclosingLayer()); | 2722 showLayerTree(layoutObject->enclosingLayer()); |
2720 } | 2723 } |
2721 #endif | 2724 #endif |
OLD | NEW |