| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 186 |
| 187 bool LineBoxList::lineIntersectsDirtyRect(LayoutBoxModelObject* renderer, Inline
FlowBox* box, const PaintInfo& paintInfo, const LayoutPoint& offset) const | 187 bool LineBoxList::lineIntersectsDirtyRect(LayoutBoxModelObject* renderer, Inline
FlowBox* box, const PaintInfo& paintInfo, const LayoutPoint& offset) const |
| 188 { | 188 { |
| 189 RootInlineBox& root = box->root(); | 189 RootInlineBox& root = box->root(); |
| 190 LayoutUnit logicalTop = std::min<LayoutUnit>(box->logicalTopVisualOverflow(r
oot.lineTop()), root.selectionTop()); | 190 LayoutUnit logicalTop = std::min<LayoutUnit>(box->logicalTopVisualOverflow(r
oot.lineTop()), root.selectionTop()); |
| 191 LayoutUnit logicalBottom = box->logicalBottomVisualOverflow(root.lineBottom(
)); | 191 LayoutUnit logicalBottom = box->logicalBottomVisualOverflow(root.lineBottom(
)); |
| 192 | 192 |
| 193 return rangeIntersectsRect(renderer, logicalTop, logicalBottom, LayoutRect(p
aintInfo.rect), offset); | 193 return rangeIntersectsRect(renderer, logicalTop, logicalBottom, LayoutRect(p
aintInfo.rect), offset); |
| 194 } | 194 } |
| 195 | 195 |
| 196 bool LineBoxList::hitTest(LayoutBoxModelObject* renderer, const HitTestRequest&
request, HitTestResult& result, const HitTestLocation& locationInContainer, cons
t LayoutPoint& accumulatedOffset, HitTestAction hitTestAction) const | 196 bool LineBoxList::hitTest(LayoutBoxModelObject* renderer, HitTestResult& result,
const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffse
t, HitTestAction hitTestAction) const |
| 197 { | 197 { |
| 198 if (hitTestAction != HitTestForeground) | 198 if (hitTestAction != HitTestForeground) |
| 199 return false; | 199 return false; |
| 200 | 200 |
| 201 ASSERT(renderer->isLayoutBlock() || (renderer->isLayoutInline() && renderer-
>hasLayer())); // The only way an inline could hit test like this is if it has a
layer. | 201 ASSERT(renderer->isLayoutBlock() || (renderer->isLayoutInline() && renderer-
>hasLayer())); // The only way an inline could hit test like this is if it has a
layer. |
| 202 | 202 |
| 203 // If we have no lines then we have no work to do. | 203 // If we have no lines then we have no work to do. |
| 204 if (!firstLineBox()) | 204 if (!firstLineBox()) |
| 205 return false; | 205 return false; |
| 206 | 206 |
| 207 LayoutPoint point = locationInContainer.point(); | 207 LayoutPoint point = locationInContainer.point(); |
| 208 LayoutRect rect(firstLineBox()->isHorizontal() ? | 208 LayoutRect rect(firstLineBox()->isHorizontal() ? |
| 209 IntRect(point.x(), point.y() - locationInContainer.topPadding(), 1, loca
tionInContainer.topPadding() + locationInContainer.bottomPadding() + 1) : | 209 IntRect(point.x(), point.y() - locationInContainer.topPadding(), 1, loca
tionInContainer.topPadding() + locationInContainer.bottomPadding() + 1) : |
| 210 IntRect(point.x() - locationInContainer.leftPadding(), point.y(), locati
onInContainer.rightPadding() + locationInContainer.leftPadding() + 1, 1)); | 210 IntRect(point.x() - locationInContainer.leftPadding(), point.y(), locati
onInContainer.rightPadding() + locationInContainer.leftPadding() + 1, 1)); |
| 211 | 211 |
| 212 if (!anyLineIntersectsRect(renderer, rect, accumulatedOffset)) | 212 if (!anyLineIntersectsRect(renderer, rect, accumulatedOffset)) |
| 213 return false; | 213 return false; |
| 214 | 214 |
| 215 // See if our root lines contain the point. If so, then we hit test | 215 // See if our root lines contain the point. If so, then we hit test |
| 216 // them further. Note that boxes can easily overlap, so we can't make any a
ssumptions | 216 // them further. Note that boxes can easily overlap, so we can't make any a
ssumptions |
| 217 // based off positions of our first line box or our last line box. | 217 // based off positions of our first line box or our last line box. |
| 218 for (InlineFlowBox* curr = lastLineBox(); curr; curr = curr->prevLineBox())
{ | 218 for (InlineFlowBox* curr = lastLineBox(); curr; curr = curr->prevLineBox())
{ |
| 219 RootInlineBox& root = curr->root(); | 219 RootInlineBox& root = curr->root(); |
| 220 if (rangeIntersectsRect(renderer, curr->logicalTopVisualOverflow(root.li
neTop()), curr->logicalBottomVisualOverflow(root.lineBottom()), rect, accumulate
dOffset)) { | 220 if (rangeIntersectsRect(renderer, curr->logicalTopVisualOverflow(root.li
neTop()), curr->logicalBottomVisualOverflow(root.lineBottom()), rect, accumulate
dOffset)) { |
| 221 bool inside = curr->nodeAtPoint(request, result, locationInContainer
, accumulatedOffset, root.lineTop(), root.lineBottom()); | 221 bool inside = curr->nodeAtPoint(result, locationInContainer, accumul
atedOffset, root.lineTop(), root.lineBottom()); |
| 222 if (inside) { | 222 if (inside) { |
| 223 renderer->updateHitTestResult(result, locationInContainer.point(
) - toLayoutSize(accumulatedOffset)); | 223 renderer->updateHitTestResult(result, locationInContainer.point(
) - toLayoutSize(accumulatedOffset)); |
| 224 return true; | 224 return true; |
| 225 } | 225 } |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 | 228 |
| 229 return false; | 229 return false; |
| 230 } | 230 } |
| 231 | 231 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 ASSERT(child->prevLineBox() == prev); | 327 ASSERT(child->prevLineBox() == prev); |
| 328 prev = child; | 328 prev = child; |
| 329 } | 329 } |
| 330 ASSERT(prev == m_lastLineBox); | 330 ASSERT(prev == m_lastLineBox); |
| 331 #endif | 331 #endif |
| 332 } | 332 } |
| 333 | 333 |
| 334 #endif | 334 #endif |
| 335 | 335 |
| 336 } | 336 } |
| OLD | NEW |