| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 if (hitTestAction != HitTestForeground) | 231 if (hitTestAction != HitTestForeground) |
| 232 return false; | 232 return false; |
| 233 | 233 |
| 234 ASSERT(renderer->isRenderBlock() || (renderer->isRenderInline() && renderer-
>hasLayer())); // The only way an inline could hit test like this is if it has a
layer. | 234 ASSERT(renderer->isRenderBlock() || (renderer->isRenderInline() && renderer-
>hasLayer())); // The only way an inline could hit test like this is if it has a
layer. |
| 235 | 235 |
| 236 // If we have no lines then we have no work to do. | 236 // If we have no lines then we have no work to do. |
| 237 if (!firstLineBox()) | 237 if (!firstLineBox()) |
| 238 return false; | 238 return false; |
| 239 | 239 |
| 240 LayoutPoint point = locationInContainer.point(); | 240 LayoutPoint point = locationInContainer.point(); |
| 241 LayoutRect rect = firstLineBox()->isHorizontal() ? | 241 LayoutRect rect = IntRect(point.x(), point.y() - locationInContainer.topPadd
ing(), 1, locationInContainer.topPadding() + locationInContainer.bottomPadding()
+ 1); |
| 242 IntRect(point.x(), point.y() - locationInContainer.topPadding(), 1, loca
tionInContainer.topPadding() + locationInContainer.bottomPadding() + 1) : | |
| 243 IntRect(point.x() - locationInContainer.leftPadding(), point.y(), locati
onInContainer.rightPadding() + locationInContainer.leftPadding() + 1, 1); | |
| 244 | 242 |
| 245 if (!anyLineIntersectsRect(renderer, rect, accumulatedOffset)) | 243 if (!anyLineIntersectsRect(renderer, rect, accumulatedOffset)) |
| 246 return false; | 244 return false; |
| 247 | 245 |
| 248 // See if our root lines contain the point. If so, then we hit test | 246 // See if our root lines contain the point. If so, then we hit test |
| 249 // them further. Note that boxes can easily overlap, so we can't make any a
ssumptions | 247 // them further. Note that boxes can easily overlap, so we can't make any a
ssumptions |
| 250 // based off positions of our first line box or our last line box. | 248 // based off positions of our first line box or our last line box. |
| 251 for (InlineFlowBox* curr = lastLineBox(); curr; curr = curr->prevLineBox())
{ | 249 for (InlineFlowBox* curr = lastLineBox(); curr; curr = curr->prevLineBox())
{ |
| 252 RootInlineBox& root = curr->root(); | 250 RootInlineBox& root = curr->root(); |
| 253 if (rangeIntersectsRect(renderer, curr->logicalTopVisualOverflow(root.li
neTop()), curr->logicalBottomVisualOverflow(root.lineBottom()), rect, accumulate
dOffset)) { | 251 if (rangeIntersectsRect(renderer, curr->logicalTopVisualOverflow(root.li
neTop()), curr->logicalBottomVisualOverflow(root.lineBottom()), rect, accumulate
dOffset)) { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 ASSERT(child->prevLineBox() == prev); | 358 ASSERT(child->prevLineBox() == prev); |
| 361 prev = child; | 359 prev = child; |
| 362 } | 360 } |
| 363 ASSERT(prev == m_lastLineBox); | 361 ASSERT(prev == m_lastLineBox); |
| 364 #endif | 362 #endif |
| 365 } | 363 } |
| 366 | 364 |
| 367 #endif | 365 #endif |
| 368 | 366 |
| 369 } | 367 } |
| OLD | NEW |