OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
992 // We need to hit test both our inline children (Inline Boxes) and culled in
lines | 992 // We need to hit test both our inline children (Inline Boxes) and culled in
lines |
993 // (LayoutObjects). We check our inlines in the same order as line layout bu
t | 993 // (LayoutObjects). We check our inlines in the same order as line layout bu
t |
994 // for each inline we additionally need to hit test its culled inline parent
s. | 994 // for each inline we additionally need to hit test its culled inline parent
s. |
995 // While hit testing culled inline parents, we can stop once we reach | 995 // While hit testing culled inline parents, we can stop once we reach |
996 // a non-inline parent or a culled inline associated with a different inline
box. | 996 // a non-inline parent or a culled inline associated with a different inline
box. |
997 InlineBox* prev; | 997 InlineBox* prev; |
998 for (InlineBox* curr = lastChild(); curr; curr = prev) { | 998 for (InlineBox* curr = lastChild(); curr; curr = prev) { |
999 prev = curr->prevOnLine(); | 999 prev = curr->prevOnLine(); |
1000 | 1000 |
1001 // Layers will handle hit testing themselves. | 1001 // Layers will handle hit testing themselves. |
1002 if (curr->boxModelObject() && curr->boxModelObject().hasSelfPaintingLaye
r()) | 1002 if (!curr->boxModelObject() || !curr->boxModelObject().hasSelfPaintingLa
yer()) { |
1003 continue; | 1003 if (curr->nodeAtPoint(result, locationInContainer, accumulatedOffset
, lineTop, lineBottom)) { |
1004 | 1004 lineLayoutItem().updateHitTestResult(result, locationInContainer
.point() - toLayoutSize(accumulatedOffset)); |
1005 if (curr->nodeAtPoint(result, locationInContainer, accumulatedOffset, li
neTop, lineBottom)) { | 1005 return true; |
1006 lineLayoutItem().updateHitTestResult(result, locationInContainer.poi
nt() - toLayoutSize(accumulatedOffset)); | 1006 } |
1007 return true; | |
1008 } | 1007 } |
1009 | 1008 |
1010 // If the current inline box's layout object and the previous inline box
's layout object are same, | 1009 // If the current inline box's layout object and the previous inline box
's layout object are same, |
1011 // we should yield the hit-test to the previous inline box. | 1010 // we should yield the hit-test to the previous inline box. |
1012 if (prev && curr->lineLayoutItem() == prev->lineLayoutItem()) | 1011 if (prev && curr->lineLayoutItem() == prev->lineLayoutItem()) |
1013 continue; | 1012 continue; |
1014 | 1013 |
1015 // If a parent of the current inline box is a culled inline, | 1014 // Hit test the culled inline if necessary. |
1016 // we hit test it before we move the previous inline box. | |
1017 LineLayoutItem currLayoutItem = curr->lineLayoutItem(); | 1015 LineLayoutItem currLayoutItem = curr->lineLayoutItem(); |
1018 while (true) { | 1016 while (true) { |
1019 // If the previous inline box is not a descendant of a current inlin
e's parent, | 1017 // If the previous inline box is not a descendant of a current inlin
e's parent, |
1020 // the parent is a culled inline and we hit test it. | 1018 // the parent is a culled inline and we hit test it. |
1021 // Otherwise, move to the previous inline box because we hit test fi
rst all | 1019 // Otherwise, move to the previous inline box because we hit test fi
rst all |
1022 // candidate inline boxes under the parent to take a pre-order tree
traversal in reverse. | 1020 // candidate inline boxes under the parent to take a pre-order tree
traversal in reverse. |
1023 bool hasSibling = currLayoutItem.previousSibling() || currLayoutItem
.nextSibling(); | 1021 bool hasSibling = currLayoutItem.previousSibling() || currLayoutItem
.nextSibling(); |
1024 LineLayoutItem culledParent = currLayoutItem.parent(); | 1022 LineLayoutItem culledParent = currLayoutItem.parent(); |
1025 ASSERT(culledParent); | 1023 ASSERT(culledParent); |
1026 | 1024 |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1314 ASSERT(child->prevOnLine() == prev); | 1312 ASSERT(child->prevOnLine() == prev); |
1315 prev = child; | 1313 prev = child; |
1316 } | 1314 } |
1317 ASSERT(prev == m_lastChild); | 1315 ASSERT(prev == m_lastChild); |
1318 #endif | 1316 #endif |
1319 } | 1317 } |
1320 | 1318 |
1321 #endif | 1319 #endif |
1322 | 1320 |
1323 } // namespace blink | 1321 } // namespace blink |
OLD | NEW |