OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1673 Element* element = document().getElementById(referenceClipPathOperat
ion->fragment()); | 1673 Element* element = document().getElementById(referenceClipPathOperat
ion->fragment()); |
1674 if (isSVGClipPathElement(element) && element->layoutObject()) { | 1674 if (isSVGClipPathElement(element) && element->layoutObject()) { |
1675 LayoutSVGResourceClipper* clipper = toLayoutSVGResourceClipper(t
oLayoutSVGResourceContainer(element->layoutObject())); | 1675 LayoutSVGResourceClipper* clipper = toLayoutSVGResourceClipper(t
oLayoutSVGResourceContainer(element->layoutObject())); |
1676 if (!clipper->hitTestClipContent(FloatRect(borderBoxRect()), Flo
atPoint(locationInContainer.point() - localOffset))) | 1676 if (!clipper->hitTestClipContent(FloatRect(borderBoxRect()), Flo
atPoint(locationInContainer.point() - localOffset))) |
1677 return false; | 1677 return false; |
1678 } | 1678 } |
1679 break; | 1679 break; |
1680 } | 1680 } |
1681 } | 1681 } |
1682 | 1682 |
1683 // If we have clipping, then we can't have any spillout. | 1683 bool checkChildren = true; |
1684 bool useOverflowClip = hasOverflowClip() && !hasSelfPaintingLayer(); | 1684 |
1685 bool useClip = (hasControlClip() || useOverflowClip); | 1685 // Self painting layers will handle overflow clip in most cases, but without
one we need to |
1686 bool checkChildren = !useClip; | 1686 // check if overflip clip will affect child hit testing. |
1687 if (!checkChildren) { | 1687 if (hasOverflowClip() && !hasSelfPaintingLayer()) { |
1688 if (hasControlClip()) { | 1688 if (style()->hasBorderRadius()) { |
1689 checkChildren = locationInContainer.intersects(controlClipRect(adjus
tedLocation)); | 1689 LayoutRect borderRect = borderBoxRect(); |
| 1690 borderRect.moveBy(adjustedLocation); |
| 1691 checkChildren = locationInContainer.intersects(style()->getRoundedIn
nerBorderFor(borderRect)); |
1690 } else { | 1692 } else { |
1691 LayoutRect clipRect = overflowClipRect(adjustedLocation, IncludeOver
layScrollbarSize); | 1693 checkChildren = locationInContainer.intersects(overflowClipRect(adju
stedLocation, IncludeOverlayScrollbarSize)); |
1692 if (style()->hasBorderRadius()) | |
1693 checkChildren = locationInContainer.intersects(style()->getRound
edBorderFor(clipRect)); | |
1694 else | |
1695 checkChildren = locationInContainer.intersects(clipRect); | |
1696 } | 1694 } |
1697 } | 1695 } |
| 1696 |
| 1697 // A control clip can also clip out child hit testing. |
| 1698 if (checkChildren && hasControlClip()) |
| 1699 checkChildren = locationInContainer.intersects(controlClipRect(adjustedL
ocation)); |
| 1700 |
1698 if (checkChildren) { | 1701 if (checkChildren) { |
1699 // Hit test descendants first. | 1702 // Hit test descendants first. |
1700 LayoutSize scrolledOffset(localOffset); | 1703 LayoutSize scrolledOffset(localOffset); |
1701 if (hasOverflowClip()) | 1704 if (hasOverflowClip()) |
1702 scrolledOffset -= scrolledContentOffset(); | 1705 scrolledOffset -= scrolledContentOffset(); |
1703 | 1706 |
1704 // Hit test contents | 1707 // Hit test contents |
1705 if (hitTestContents(result, locationInContainer, toLayoutPoint(scrolledO
ffset), hitTestAction)) { | 1708 if (hitTestContents(result, locationInContainer, toLayoutPoint(scrolledO
ffset), hitTestAction)) { |
1706 updateHitTestResult(result, flipForWritingMode(locationInContainer.p
oint() - localOffset)); | 1709 updateHitTestResult(result, flipForWritingMode(locationInContainer.p
oint() - localOffset)); |
1707 return true; | 1710 return true; |
1708 } | 1711 } |
1709 if (hitTestAction == HitTestFloat && hitTestFloats(result, locationInCon
tainer, toLayoutPoint(scrolledOffset))) | 1712 if (hitTestAction == HitTestFloat && hitTestFloats(result, locationInCon
tainer, toLayoutPoint(scrolledOffset))) |
1710 return true; | 1713 return true; |
1711 } | 1714 } |
1712 | 1715 |
1713 // Check if the point is outside radii. | 1716 // Check if the point is outside radii. |
1714 if (style()->hasBorderRadius()) { | 1717 if (style()->hasBorderRadius()) { |
1715 LayoutRect borderRect = borderBoxRect(); | 1718 LayoutRect borderRect = borderBoxRect(); |
1716 borderRect.moveBy(adjustedLocation); | 1719 borderRect.moveBy(adjustedLocation); |
1717 FloatRoundedRect border = style()->getRoundedBorderFor(borderRect); | 1720 if (!locationInContainer.intersects(style()->getRoundedBorderFor(borderR
ect))) |
1718 if (!locationInContainer.intersects(border)) | |
1719 return false; | 1721 return false; |
1720 } | 1722 } |
1721 | 1723 |
1722 // Now hit test our background | 1724 // Now hit test our background |
1723 if (hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChild
BlockBackground) { | 1725 if (hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChild
BlockBackground) { |
1724 LayoutRect boundsRect(adjustedLocation, size()); | 1726 LayoutRect boundsRect(adjustedLocation, size()); |
1725 if (visibleToHitTestRequest(result.hitTestRequest()) && locationInContai
ner.intersects(boundsRect)) { | 1727 if (visibleToHitTestRequest(result.hitTestRequest()) && locationInContai
ner.intersects(boundsRect)) { |
1726 updateHitTestResult(result, flipForWritingMode(locationInContainer.p
oint() - localOffset)); | 1728 updateHitTestResult(result, flipForWritingMode(locationInContainer.p
oint() - localOffset)); |
1727 if (!result.addNodeToListBasedTestResult(nodeForHitTest(), locationI
nContainer, boundsRect)) | 1729 if (!result.addNodeToListBasedTestResult(nodeForHitTest(), locationI
nContainer, boundsRect)) |
1728 return true; | 1730 return true; |
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2912 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const | 2914 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const |
2913 { | 2915 { |
2914 showLayoutObject(); | 2916 showLayoutObject(); |
2915 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 2917 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
2916 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 2918 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
2917 } | 2919 } |
2918 | 2920 |
2919 #endif | 2921 #endif |
2920 | 2922 |
2921 } // namespace blink | 2923 } // namespace blink |
OLD | NEW |