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 18 matching lines...) Expand all Loading... |
29 #include "config.h" | 29 #include "config.h" |
30 #include "core/rendering/RenderLineBoxList.h" | 30 #include "core/rendering/RenderLineBoxList.h" |
31 | 31 |
32 #include "core/rendering/HitTestResult.h" | 32 #include "core/rendering/HitTestResult.h" |
33 #include "core/rendering/InlineTextBox.h" | 33 #include "core/rendering/InlineTextBox.h" |
34 #include "core/rendering/PaintInfo.h" | 34 #include "core/rendering/PaintInfo.h" |
35 #include "core/rendering/RenderInline.h" | 35 #include "core/rendering/RenderInline.h" |
36 #include "core/rendering/RenderView.h" | 36 #include "core/rendering/RenderView.h" |
37 #include "core/rendering/RootInlineBox.h" | 37 #include "core/rendering/RootInlineBox.h" |
38 | 38 |
39 using namespace std; | |
40 | |
41 namespace WebCore { | 39 namespace WebCore { |
42 | 40 |
43 #ifndef NDEBUG | 41 #ifndef NDEBUG |
44 RenderLineBoxList::~RenderLineBoxList() | 42 RenderLineBoxList::~RenderLineBoxList() |
45 { | 43 { |
46 ASSERT(!m_firstLineBox); | 44 ASSERT(!m_firstLineBox); |
47 ASSERT(!m_lastLineBox); | 45 ASSERT(!m_lastLineBox); |
48 } | 46 } |
49 #endif | 47 #endif |
50 | 48 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 bool RenderLineBoxList::rangeIntersectsRect(RenderBoxModelObject* renderer, Layo
utUnit logicalTop, LayoutUnit logicalBottom, const LayoutRect& rect, const Layou
tPoint& offset) const | 146 bool RenderLineBoxList::rangeIntersectsRect(RenderBoxModelObject* renderer, Layo
utUnit logicalTop, LayoutUnit logicalBottom, const LayoutRect& rect, const Layou
tPoint& offset) const |
149 { | 147 { |
150 RenderBox* block; | 148 RenderBox* block; |
151 if (renderer->isBox()) | 149 if (renderer->isBox()) |
152 block = toRenderBox(renderer); | 150 block = toRenderBox(renderer); |
153 else | 151 else |
154 block = renderer->containingBlock(); | 152 block = renderer->containingBlock(); |
155 LayoutUnit physicalStart = block->flipForWritingMode(logicalTop); | 153 LayoutUnit physicalStart = block->flipForWritingMode(logicalTop); |
156 LayoutUnit physicalEnd = block->flipForWritingMode(logicalBottom); | 154 LayoutUnit physicalEnd = block->flipForWritingMode(logicalBottom); |
157 LayoutUnit physicalExtent = absoluteValue(physicalEnd - physicalStart); | 155 LayoutUnit physicalExtent = absoluteValue(physicalEnd - physicalStart); |
158 physicalStart = min(physicalStart, physicalEnd); | 156 physicalStart = std::min(physicalStart, physicalEnd); |
159 | 157 |
160 if (renderer->style()->isHorizontalWritingMode()) { | 158 if (renderer->style()->isHorizontalWritingMode()) { |
161 physicalStart += offset.y(); | 159 physicalStart += offset.y(); |
162 if (physicalStart >= rect.maxY() || physicalStart + physicalExtent <= re
ct.y()) | 160 if (physicalStart >= rect.maxY() || physicalStart + physicalExtent <= re
ct.y()) |
163 return false; | 161 return false; |
164 } else { | 162 } else { |
165 physicalStart += offset.x(); | 163 physicalStart += offset.x(); |
166 if (physicalStart >= rect.maxX() || physicalStart + physicalExtent <= re
ct.x()) | 164 if (physicalStart >= rect.maxX() || physicalStart + physicalExtent <= re
ct.x()) |
167 return false; | 165 return false; |
168 } | 166 } |
(...skipping 11 matching lines...) Expand all Loading... |
180 RootInlineBox& lastRootBox = lastLineBox()->root(); | 178 RootInlineBox& lastRootBox = lastLineBox()->root(); |
181 LayoutUnit firstLineTop = firstLineBox()->logicalTopVisualOverflow(firstRoot
Box.lineTop()); | 179 LayoutUnit firstLineTop = firstLineBox()->logicalTopVisualOverflow(firstRoot
Box.lineTop()); |
182 LayoutUnit lastLineBottom = lastLineBox()->logicalBottomVisualOverflow(lastR
ootBox.lineBottom()); | 180 LayoutUnit lastLineBottom = lastLineBox()->logicalBottomVisualOverflow(lastR
ootBox.lineBottom()); |
183 | 181 |
184 return rangeIntersectsRect(renderer, firstLineTop, lastLineBottom, rect, off
set); | 182 return rangeIntersectsRect(renderer, firstLineTop, lastLineBottom, rect, off
set); |
185 } | 183 } |
186 | 184 |
187 bool RenderLineBoxList::lineIntersectsDirtyRect(RenderBoxModelObject* renderer,
InlineFlowBox* box, const PaintInfo& paintInfo, const LayoutPoint& offset) const | 185 bool RenderLineBoxList::lineIntersectsDirtyRect(RenderBoxModelObject* renderer,
InlineFlowBox* box, const PaintInfo& paintInfo, const LayoutPoint& offset) const |
188 { | 186 { |
189 RootInlineBox& root = box->root(); | 187 RootInlineBox& root = box->root(); |
190 LayoutUnit logicalTop = min<LayoutUnit>(box->logicalTopVisualOverflow(root.l
ineTop()), root.selectionTop()); | 188 LayoutUnit logicalTop = std::min<LayoutUnit>(box->logicalTopVisualOverflow(r
oot.lineTop()), root.selectionTop()); |
191 LayoutUnit logicalBottom = box->logicalBottomVisualOverflow(root.lineBottom(
)); | 189 LayoutUnit logicalBottom = box->logicalBottomVisualOverflow(root.lineBottom(
)); |
192 | 190 |
193 return rangeIntersectsRect(renderer, logicalTop, logicalBottom, paintInfo.re
ct, offset); | 191 return rangeIntersectsRect(renderer, logicalTop, logicalBottom, paintInfo.re
ct, offset); |
194 } | 192 } |
195 | 193 |
196 void RenderLineBoxList::paint(RenderBoxModelObject* renderer, PaintInfo& paintIn
fo, const LayoutPoint& paintOffset) const | 194 void RenderLineBoxList::paint(RenderBoxModelObject* renderer, PaintInfo& paintIn
fo, const LayoutPoint& paintOffset) const |
197 { | 195 { |
198 // Only paint during the foreground/selection phases. | 196 // Only paint during the foreground/selection phases. |
199 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Selection && paintInfo.phase != PaintPhaseOutline | 197 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Selection && paintInfo.phase != PaintPhaseOutline |
200 && paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintP
haseChildOutlines && paintInfo.phase != PaintPhaseTextClip | 198 && paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintP
haseChildOutlines && paintInfo.phase != PaintPhaseTextClip |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 ASSERT(child->prevLineBox() == prev); | 366 ASSERT(child->prevLineBox() == prev); |
369 prev = child; | 367 prev = child; |
370 } | 368 } |
371 ASSERT(prev == m_lastLineBox); | 369 ASSERT(prev == m_lastLineBox); |
372 #endif | 370 #endif |
373 } | 371 } |
374 | 372 |
375 #endif | 373 #endif |
376 | 374 |
377 } | 375 } |
OLD | NEW |