| 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 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1628 // Intersect the fragment with our ancestor's background clip so that e.
g., columns in an overflow:hidden block are | 1628 // Intersect the fragment with our ancestor's background clip so that e.
g., columns in an overflow:hidden block are |
| 1629 // properly clipped by the overflow. | 1629 // properly clipped by the overflow. |
| 1630 fragment.intersect(ancestorClipRect.rect()); | 1630 fragment.intersect(ancestorClipRect.rect()); |
| 1631 | 1631 |
| 1632 // Now intersect with our pagination clip. This will typically mean we'r
e just intersecting the dirty rect with the column | 1632 // Now intersect with our pagination clip. This will typically mean we'r
e just intersecting the dirty rect with the column |
| 1633 // clip, so the column clip ends up being all we apply. | 1633 // clip, so the column clip ends up being all we apply. |
| 1634 fragment.intersect(fragment.paginationClip); | 1634 fragment.intersect(fragment.paginationClip); |
| 1635 } | 1635 } |
| 1636 } | 1636 } |
| 1637 | 1637 |
| 1638 static inline LayoutRect frameVisibleRect(LayoutObject* layoutObject) |
| 1639 { |
| 1640 FrameView* frameView = layoutObject->document().view(); |
| 1641 if (!frameView) |
| 1642 return LayoutRect(); |
| 1643 |
| 1644 return LayoutRect(frameView->visibleContentRect()); |
| 1645 } |
| 1646 |
| 1647 bool DeprecatedPaintLayer::hitTest(HitTestResult& result) |
| 1648 { |
| 1649 return hitTest(result.hitTestRequest(), result.hitTestLocation(), result); |
| 1650 } |
| 1651 |
| 1652 bool DeprecatedPaintLayer::hitTest(const HitTestRequest& request, const HitTestL
ocation& hitTestLocation, HitTestResult& result) |
| 1653 { |
| 1654 ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()); |
| 1655 |
| 1656 // LayoutView should make sure to update layout before entering hit testing |
| 1657 ASSERT(!layoutObject()->frame()->view()->layoutPending()); |
| 1658 ASSERT(!layoutObject()->document().layoutView()->needsLayout()); |
| 1659 |
| 1660 // Start with frameVisibleRect to ensure we include the scrollbars. |
| 1661 LayoutRect hitTestArea = frameVisibleRect(layoutObject()); |
| 1662 if (request.ignoreClipping()) |
| 1663 hitTestArea.unite(LayoutRect(layoutObject()->view()->documentRect())); |
| 1664 |
| 1665 DeprecatedPaintLayer* insideLayer = hitTestLayer(this, 0, result, hitTestAre
a, hitTestLocation, false); |
| 1666 if (!insideLayer) { |
| 1667 // We didn't hit any layer. If we are the root layer and the mouse is --
or just was -- down, |
| 1668 // return ourselves. We do this so mouse events continue getting deliver
ed after a drag has |
| 1669 // exited the WebView, and so hit testing over a scrollbar hits the cont
ent document. |
| 1670 // In addtion, it is possible for the mouse to stay in the document but
there is no element. |
| 1671 // At that time, the events of the mouse should be fired. |
| 1672 LayoutPoint hitPoint = hitTestLocation.point(); |
| 1673 if (!request.isChildFrameHitTest() && ((request.active() || request.rele
ase()) || (request.move() && hitTestArea.contains(hitPoint.x(), hitPoint.y())))
&& isRootLayer()) { |
| 1674 layoutObject()->updateHitTestResult(result, toLayoutView(layoutObjec
t())->flipForWritingMode(hitTestLocation.point())); |
| 1675 insideLayer = this; |
| 1676 } |
| 1677 } |
| 1678 |
| 1679 // Now determine if the result is inside an anchor - if the urlElement isn't
already set. |
| 1680 Node* node = result.innerNode(); |
| 1681 if (node && !result.URLElement()) |
| 1682 result.setURLElement(node->enclosingLinkEventParentOrSelf()); |
| 1683 |
| 1684 // Now return whether we were inside this layer (this will always be true fo
r the root |
| 1685 // layer). |
| 1686 return insideLayer; |
| 1687 } |
| 1688 |
| 1638 Node* DeprecatedPaintLayer::enclosingElement() const | 1689 Node* DeprecatedPaintLayer::enclosingElement() const |
| 1639 { | 1690 { |
| 1640 for (LayoutObject* r = layoutObject(); r; r = r->parent()) { | 1691 for (LayoutObject* r = layoutObject(); r; r = r->parent()) { |
| 1641 if (Node* e = r->node()) | 1692 if (Node* e = r->node()) |
| 1642 return e; | 1693 return e; |
| 1643 } | 1694 } |
| 1644 ASSERT_NOT_REACHED(); | 1695 ASSERT_NOT_REACHED(); |
| 1645 return 0; | 1696 return 0; |
| 1646 } | 1697 } |
| 1647 | 1698 |
| (...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2914 | 2965 |
| 2915 void showLayerTree(const blink::LayoutObject* layoutObject) | 2966 void showLayerTree(const blink::LayoutObject* layoutObject) |
| 2916 { | 2967 { |
| 2917 if (!layoutObject) { | 2968 if (!layoutObject) { |
| 2918 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 2969 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
| 2919 return; | 2970 return; |
| 2920 } | 2971 } |
| 2921 showLayerTree(layoutObject->enclosingLayer()); | 2972 showLayerTree(layoutObject->enclosingLayer()); |
| 2922 } | 2973 } |
| 2923 #endif | 2974 #endif |
| OLD | NEW |