OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 if (hitTestAction != HitTestForeground) | 195 if (hitTestAction != HitTestForeground) |
196 return false; | 196 return false; |
197 | 197 |
198 ASSERT(layoutObject.isLayoutBlock() || (layoutObject.isLayoutInline() && lay
outObject.hasLayer())); // The only way an inline could hit test like this is if
it has a layer. | 198 ASSERT(layoutObject.isLayoutBlock() || (layoutObject.isLayoutInline() && lay
outObject.hasLayer())); // The only way an inline could hit test like this is if
it has a layer. |
199 | 199 |
200 // If we have no lines then we have no work to do. | 200 // If we have no lines then we have no work to do. |
201 if (!firstLineBox()) | 201 if (!firstLineBox()) |
202 return false; | 202 return false; |
203 | 203 |
204 LayoutPoint point = locationInContainer.point(); | 204 LayoutPoint point = locationInContainer.point(); |
| 205 IntRect hitSearchBoundingBox = locationInContainer.boundingBox(); |
205 | 206 |
206 CullRect cullRect(firstLineBox()->isHorizontal() ? | 207 CullRect cullRect(firstLineBox()->isHorizontal() ? |
207 IntRect(point.x(), point.y() - locationInContainer.topPadding(), 1, loca
tionInContainer.topPadding() + locationInContainer.bottomPadding() + 1) : | 208 IntRect(point.x(), hitSearchBoundingBox.y(), 1, hitSearchBoundingBox.hei
ght()) : |
208 IntRect(point.x() - locationInContainer.leftPadding(), point.y(), locati
onInContainer.rightPadding() + locationInContainer.leftPadding() + 1, 1)); | 209 IntRect(hitSearchBoundingBox.x(), point.y(), hitSearchBoundingBox.width(
), 1)); |
209 | 210 |
210 if (!anyLineIntersectsRect(layoutObject, cullRect, accumulatedOffset)) | 211 if (!anyLineIntersectsRect(layoutObject, cullRect, accumulatedOffset)) |
211 return false; | 212 return false; |
212 | 213 |
213 // See if our root lines contain the point. If so, then we hit test | 214 // See if our root lines contain the point. If so, then we hit test |
214 // them further. Note that boxes can easily overlap, so we can't make any a
ssumptions | 215 // them further. Note that boxes can easily overlap, so we can't make any a
ssumptions |
215 // based off positions of our first line box or our last line box. | 216 // based off positions of our first line box or our last line box. |
216 for (InlineFlowBox* curr = lastLineBox(); curr; curr = curr->prevLineBox())
{ | 217 for (InlineFlowBox* curr = lastLineBox(); curr; curr = curr->prevLineBox())
{ |
217 RootInlineBox& root = curr->root(); | 218 RootInlineBox& root = curr->root(); |
218 if (rangeIntersectsRect(layoutObject, curr->logicalTopVisualOverflow(roo
t.lineTop()), curr->logicalBottomVisualOverflow(root.lineBottom()), cullRect, ac
cumulatedOffset)) { | 219 if (rangeIntersectsRect(layoutObject, curr->logicalTopVisualOverflow(roo
t.lineTop()), curr->logicalBottomVisualOverflow(root.lineBottom()), cullRect, ac
cumulatedOffset)) { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 ASSERT(child->prevLineBox() == prev); | 318 ASSERT(child->prevLineBox() == prev); |
318 prev = child; | 319 prev = child; |
319 } | 320 } |
320 ASSERT(prev == m_lastLineBox); | 321 ASSERT(prev == m_lastLineBox); |
321 #endif | 322 #endif |
322 } | 323 } |
323 | 324 |
324 #endif | 325 #endif |
325 | 326 |
326 } // namespace blink | 327 } // namespace blink |
OLD | NEW |