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 1659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1670 Element* element = document().getElementById(referenceClipPathOperat
ion->fragment()); | 1670 Element* element = document().getElementById(referenceClipPathOperat
ion->fragment()); |
1671 if (isSVGClipPathElement(element) && element->layoutObject()) { | 1671 if (isSVGClipPathElement(element) && element->layoutObject()) { |
1672 LayoutSVGResourceClipper* clipper = toLayoutSVGResourceClipper(t
oLayoutSVGResourceContainer(element->layoutObject())); | 1672 LayoutSVGResourceClipper* clipper = toLayoutSVGResourceClipper(t
oLayoutSVGResourceContainer(element->layoutObject())); |
1673 if (!clipper->hitTestClipContent(FloatRect(borderBoxRect()), Flo
atPoint(locationInContainer.point() - localOffset))) | 1673 if (!clipper->hitTestClipContent(FloatRect(borderBoxRect()), Flo
atPoint(locationInContainer.point() - localOffset))) |
1674 return false; | 1674 return false; |
1675 } | 1675 } |
1676 break; | 1676 break; |
1677 } | 1677 } |
1678 } | 1678 } |
1679 | 1679 |
1680 // If we have clipping, then we can't have any spillout. | 1680 bool checkChildren = true; |
1681 bool useOverflowClip = hasOverflowClip() && !hasSelfPaintingLayer(); | 1681 |
1682 bool useClip = (hasControlClip() || useOverflowClip); | 1682 // Self painting layers will handle overflow clip in most cases, but without
one we need to |
1683 bool checkChildren = !useClip; | 1683 // check if overflip clip will affect child hit testing. |
1684 if (!checkChildren) { | 1684 if (hasOverflowClip() && !hasSelfPaintingLayer()) { |
1685 if (hasControlClip()) { | 1685 if (style()->hasBorderRadius()) { |
1686 checkChildren = locationInContainer.intersects(controlClipRect(adjus
tedLocation)); | 1686 LayoutRect borderRect = borderBoxRect(); |
| 1687 borderRect.moveBy(adjustedLocation); |
| 1688 checkChildren = locationInContainer.intersects(style()->getRoundedIn
nerBorderFor(borderRect)); |
1687 } else { | 1689 } else { |
1688 LayoutRect clipRect = overflowClipRect(adjustedLocation, IncludeOver
layScrollbarSize); | 1690 checkChildren = locationInContainer.intersects(overflowClipRect(adju
stedLocation, IncludeOverlayScrollbarSize)); |
1689 if (style()->hasBorderRadius()) | |
1690 checkChildren = locationInContainer.intersects(style()->getRound
edBorderFor(clipRect)); | |
1691 else | |
1692 checkChildren = locationInContainer.intersects(clipRect); | |
1693 } | 1691 } |
1694 } | 1692 } |
| 1693 |
| 1694 // A control clip can also clip out child hit testing. |
| 1695 if (checkChildren && hasControlClip()) |
| 1696 checkChildren = locationInContainer.intersects(controlClipRect(adjustedL
ocation)); |
| 1697 |
1695 if (checkChildren) { | 1698 if (checkChildren) { |
1696 // Hit test descendants first. | 1699 // Hit test descendants first. |
1697 LayoutSize scrolledOffset(localOffset); | 1700 LayoutSize scrolledOffset(localOffset); |
1698 if (hasOverflowClip()) | 1701 if (hasOverflowClip()) |
1699 scrolledOffset -= scrolledContentOffset(); | 1702 scrolledOffset -= scrolledContentOffset(); |
1700 | 1703 |
1701 // Hit test contents | 1704 // Hit test contents |
1702 if (hitTestContents(result, locationInContainer, toLayoutPoint(scrolledO
ffset), hitTestAction)) { | 1705 if (hitTestContents(result, locationInContainer, toLayoutPoint(scrolledO
ffset), hitTestAction)) { |
1703 updateHitTestResult(result, flipForWritingMode(locationInContainer.p
oint() - localOffset)); | 1706 updateHitTestResult(result, flipForWritingMode(locationInContainer.p
oint() - localOffset)); |
1704 return true; | 1707 return true; |
1705 } | 1708 } |
1706 if (hitTestAction == HitTestFloat && hitTestFloats(result, locationInCon
tainer, toLayoutPoint(scrolledOffset))) | 1709 if (hitTestAction == HitTestFloat && hitTestFloats(result, locationInCon
tainer, toLayoutPoint(scrolledOffset))) |
1707 return true; | 1710 return true; |
1708 } | 1711 } |
1709 | 1712 |
1710 // Check if the point is outside radii. | 1713 // Check if the point is outside radii. |
1711 if (style()->hasBorderRadius()) { | 1714 if (style()->hasBorderRadius()) { |
1712 LayoutRect borderRect = borderBoxRect(); | 1715 LayoutRect borderRect = borderBoxRect(); |
1713 borderRect.moveBy(adjustedLocation); | 1716 borderRect.moveBy(adjustedLocation); |
1714 FloatRoundedRect border = style()->getRoundedBorderFor(borderRect); | 1717 if (!locationInContainer.intersects(style()->getRoundedBorderFor(borderR
ect))) |
1715 if (!locationInContainer.intersects(border)) | |
1716 return false; | 1718 return false; |
1717 } | 1719 } |
1718 | 1720 |
1719 // Now hit test our background | 1721 // Now hit test our background |
1720 if (hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChild
BlockBackground) { | 1722 if (hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChild
BlockBackground) { |
1721 LayoutRect boundsRect(adjustedLocation, size()); | 1723 LayoutRect boundsRect(adjustedLocation, size()); |
1722 if (visibleToHitTestRequest(result.hitTestRequest()) && locationInContai
ner.intersects(boundsRect)) { | 1724 if (visibleToHitTestRequest(result.hitTestRequest()) && locationInContai
ner.intersects(boundsRect)) { |
1723 updateHitTestResult(result, flipForWritingMode(locationInContainer.p
oint() - localOffset)); | 1725 updateHitTestResult(result, flipForWritingMode(locationInContainer.p
oint() - localOffset)); |
1724 if (!result.addNodeToListBasedTestResult(nodeForHitTest(), locationI
nContainer, boundsRect)) | 1726 if (!result.addNodeToListBasedTestResult(nodeForHitTest(), locationI
nContainer, boundsRect)) |
1725 return true; | 1727 return true; |
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2909 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const | 2911 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const |
2910 { | 2912 { |
2911 showLayoutObject(); | 2913 showLayoutObject(); |
2912 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 2914 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
2913 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 2915 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
2914 } | 2916 } |
2915 | 2917 |
2916 #endif | 2918 #endif |
2917 | 2919 |
2918 } // namespace blink | 2920 } // namespace blink |
OLD | NEW |