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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 185 |
186 bool RenderLineBoxList::lineIntersectsDirtyRect(RenderBoxModelObject* renderer,
InlineFlowBox* box, const PaintInfo& paintInfo, const LayoutPoint& offset) const | 186 bool RenderLineBoxList::lineIntersectsDirtyRect(RenderBoxModelObject* renderer,
InlineFlowBox* box, const PaintInfo& paintInfo, const LayoutPoint& offset) const |
187 { | 187 { |
188 RootInlineBox& root = box->root(); | 188 RootInlineBox& root = box->root(); |
189 LayoutUnit logicalTop = std::min<LayoutUnit>(box->logicalTopVisualOverflow(r
oot.lineTop()), root.selectionTop()); | 189 LayoutUnit logicalTop = std::min<LayoutUnit>(box->logicalTopVisualOverflow(r
oot.lineTop()), root.selectionTop()); |
190 LayoutUnit logicalBottom = box->logicalBottomVisualOverflow(root.lineBottom(
)); | 190 LayoutUnit logicalBottom = box->logicalBottomVisualOverflow(root.lineBottom(
)); |
191 | 191 |
192 return rangeIntersectsRect(renderer, logicalTop, logicalBottom, paintInfo.re
ct, offset); | 192 return rangeIntersectsRect(renderer, logicalTop, logicalBottom, paintInfo.re
ct, offset); |
193 } | 193 } |
194 | 194 |
195 void RenderLineBoxList::paint(RenderBoxModelObject* renderer, PaintInfo& paintIn
fo, const LayoutPoint& paintOffset) const | |
196 { | |
197 // Only paint during the foreground/selection phases. | |
198 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Selection && paintInfo.phase != PaintPhaseOutline | |
199 && paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintP
haseChildOutlines && paintInfo.phase != PaintPhaseTextClip | |
200 && paintInfo.phase != PaintPhaseMask) | |
201 return; | |
202 | |
203 ASSERT(renderer->isRenderBlock() || (renderer->isRenderInline() && renderer-
>hasLayer())); // The only way an inline could paint like this is if it has a la
yer. | |
204 | |
205 // If we have no lines then we have no work to do. | |
206 if (!firstLineBox()) | |
207 return; | |
208 | |
209 if (!anyLineIntersectsRect(renderer, paintInfo.rect, paintOffset)) | |
210 return; | |
211 | |
212 PaintInfo info(paintInfo); | |
213 ListHashSet<RenderInline*> outlineObjects; | |
214 info.setOutlineObjects(&outlineObjects); | |
215 | |
216 // See if our root lines intersect with the dirty rect. If so, then we pain
t | |
217 // them. Note that boxes can easily overlap, so we can't make any assumptio
ns | |
218 // based off positions of our first line box or our last line box. | |
219 for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox())
{ | |
220 if (lineIntersectsDirtyRect(renderer, curr, info, paintOffset)) { | |
221 RootInlineBox& root = curr->root(); | |
222 curr->paint(info, paintOffset, root.lineTop(), root.lineBottom()); | |
223 } | |
224 } | |
225 | |
226 if (info.phase == PaintPhaseOutline || info.phase == PaintPhaseSelfOutline |
| info.phase == PaintPhaseChildOutlines) { | |
227 ListHashSet<RenderInline*>::iterator end = info.outlineObjects()->end(); | |
228 for (ListHashSet<RenderInline*>::iterator it = info.outlineObjects()->be
gin(); it != end; ++it) { | |
229 RenderInline* flow = *it; | |
230 InlinePainter(*flow).paintOutline(info, paintOffset); | |
231 } | |
232 info.outlineObjects()->clear(); | |
233 } | |
234 } | |
235 | |
236 bool RenderLineBoxList::hitTest(RenderBoxModelObject* renderer, const HitTestReq
uest& request, HitTestResult& result, const HitTestLocation& locationInContainer
, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction) const | 195 bool RenderLineBoxList::hitTest(RenderBoxModelObject* renderer, const HitTestReq
uest& request, HitTestResult& result, const HitTestLocation& locationInContainer
, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction) const |
237 { | 196 { |
238 if (hitTestAction != HitTestForeground) | 197 if (hitTestAction != HitTestForeground) |
239 return false; | 198 return false; |
240 | 199 |
241 ASSERT(renderer->isRenderBlock() || (renderer->isRenderInline() && renderer-
>hasLayer())); // The only way an inline could hit test like this is if it has a
layer. | 200 ASSERT(renderer->isRenderBlock() || (renderer->isRenderInline() && renderer-
>hasLayer())); // The only way an inline could hit test like this is if it has a
layer. |
242 | 201 |
243 // If we have no lines then we have no work to do. | 202 // If we have no lines then we have no work to do. |
244 if (!firstLineBox()) | 203 if (!firstLineBox()) |
245 return false; | 204 return false; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 ASSERT(child->prevLineBox() == prev); | 326 ASSERT(child->prevLineBox() == prev); |
368 prev = child; | 327 prev = child; |
369 } | 328 } |
370 ASSERT(prev == m_lastLineBox); | 329 ASSERT(prev == m_lastLineBox); |
371 #endif | 330 #endif |
372 } | 331 } |
373 | 332 |
374 #endif | 333 #endif |
375 | 334 |
376 } | 335 } |
OLD | NEW |