OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 * Library General Public License for more details. | 12 * Library General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU Library General Public License | 14 * You should have received a copy of the GNU Library General Public License |
15 * along with this library; see the file COPYING.LIB. If not, write to | 15 * along with this library; see the file COPYING.LIB. If not, write to |
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 * Boston, MA 02110-1301, USA. | 17 * Boston, MA 02110-1301, USA. |
18 * | 18 * |
19 */ | 19 */ |
20 | 20 |
21 #ifndef InlineFlowBox_h | 21 #ifndef InlineFlowBox_h |
22 #define InlineFlowBox_h | 22 #define InlineFlowBox_h |
23 | 23 |
| 24 #include "core/rendering/FloatToLayoutUnit.h" |
24 #include "core/rendering/InlineBox.h" | 25 #include "core/rendering/InlineBox.h" |
25 #include "core/rendering/RenderObjectInlines.h" | 26 #include "core/rendering/RenderObjectInlines.h" |
26 #include "core/rendering/RenderOverflow.h" | 27 #include "core/rendering/RenderOverflow.h" |
27 #include "core/rendering/style/ShadowData.h" | 28 #include "core/rendering/style/ShadowData.h" |
28 | 29 |
29 namespace blink { | 30 namespace blink { |
30 | 31 |
31 class HitTestRequest; | 32 class HitTestRequest; |
32 class HitTestResult; | 33 class HitTestResult; |
33 class InlineTextBox; | 34 class InlineTextBox; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 { | 100 { |
100 InlineBox::setConstructed(); | 101 InlineBox::setConstructed(); |
101 for (InlineBox* child = firstChild(); child; child = child->nextOnLine()
) | 102 for (InlineBox* child = firstChild(); child; child = child->nextOnLine()
) |
102 child->setConstructed(); | 103 child->setConstructed(); |
103 } | 104 } |
104 | 105 |
105 void addToLine(InlineBox* child); | 106 void addToLine(InlineBox* child); |
106 virtual void deleteLine() override final; | 107 virtual void deleteLine() override final; |
107 virtual void extractLine() override final; | 108 virtual void extractLine() override final; |
108 virtual void attachLine() override final; | 109 virtual void attachLine() override final; |
109 virtual void adjustPosition(float dx, float dy) override; | 110 virtual void adjustPosition(FloatWillBeLayoutUnit dx, FloatWillBeLayoutUnit
dy) override; |
110 | 111 |
111 virtual void extractLineBoxFromRenderObject(); | 112 virtual void extractLineBoxFromRenderObject(); |
112 virtual void attachLineBoxToRenderObject(); | 113 virtual void attachLineBoxToRenderObject(); |
113 virtual void removeLineBoxFromRenderObject(); | 114 virtual void removeLineBoxFromRenderObject(); |
114 | 115 |
115 virtual void clearTruncation() override; | 116 virtual void clearTruncation() override; |
116 | 117 |
117 IntRect roundedFrameRect() const; | 118 IntRect roundedFrameRect() const; |
118 | 119 |
119 virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, Layou
tUnit lineBottom) override; | 120 virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, Layou
tUnit lineBottom) override; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 bool includeLogicalRightEdge() const { return m_includeLogicalRightEdge; } | 168 bool includeLogicalRightEdge() const { return m_includeLogicalRightEdge; } |
168 void setEdges(bool includeLeft, bool includeRight) | 169 void setEdges(bool includeLeft, bool includeRight) |
169 { | 170 { |
170 m_includeLogicalLeftEdge = includeLeft; | 171 m_includeLogicalLeftEdge = includeLeft; |
171 m_includeLogicalRightEdge = includeRight; | 172 m_includeLogicalRightEdge = includeRight; |
172 } | 173 } |
173 | 174 |
174 // Helper functions used during line construction and placement. | 175 // Helper functions used during line construction and placement. |
175 void determineSpacingForFlowBoxes(bool lastLine, bool isLogicallyLastRunWrap
ped, RenderObject* logicallyLastRunRenderer); | 176 void determineSpacingForFlowBoxes(bool lastLine, bool isLogicallyLastRunWrap
ped, RenderObject* logicallyLastRunRenderer); |
176 LayoutUnit getFlowSpacingLogicalWidth(); | 177 LayoutUnit getFlowSpacingLogicalWidth(); |
177 float placeBoxesInInlineDirection(float logicalLeft, bool& needsWordSpacing)
; | 178 FloatWillBeLayoutUnit placeBoxesInInlineDirection(FloatWillBeLayoutUnit logi
calLeft, bool& needsWordSpacing); |
178 float placeBoxRangeInInlineDirection(InlineBox* firstChild, InlineBox* lastC
hild, | 179 FloatWillBeLayoutUnit placeBoxRangeInInlineDirection(InlineBox* firstChild,
InlineBox* lastChild, |
179 float& logicalLeft, float& minLogicalLeft, float& maxLogicalRight, bool&
needsWordSpacing); | 180 FloatWillBeLayoutUnit& logicalLeft, FloatWillBeLayoutUnit& minLogicalLef
t, FloatWillBeLayoutUnit& maxLogicalRight, bool& needsWordSpacing); |
180 void beginPlacingBoxRangesInInlineDirection(float logicalLeft) { setLogicalL
eft(logicalLeft); } | 181 void beginPlacingBoxRangesInInlineDirection(FloatWillBeLayoutUnit logicalLef
t) { setLogicalLeft(logicalLeft); } |
181 void endPlacingBoxRangesInInlineDirection(float logicalLeft, float logicalRi
ght, float minLogicalLeft, float maxLogicalRight) | 182 void endPlacingBoxRangesInInlineDirection(FloatWillBeLayoutUnit logicalLeft,
FloatWillBeLayoutUnit logicalRight, FloatWillBeLayoutUnit minLogicalLeft, Float
WillBeLayoutUnit maxLogicalRight) |
182 { | 183 { |
183 setLogicalWidth(logicalRight - logicalLeft); | 184 setLogicalWidth(logicalRight - logicalLeft); |
184 if (knownToHaveNoOverflow() && (minLogicalLeft < logicalLeft || maxLogic
alRight > logicalRight)) | 185 if (knownToHaveNoOverflow() && (minLogicalLeft < logicalLeft || maxLogic
alRight > logicalRight)) |
185 clearKnownToHaveNoOverflow(); | 186 clearKnownToHaveNoOverflow(); |
186 } | 187 } |
187 | 188 |
188 void computeLogicalBoxHeights(RootInlineBox*, LayoutUnit& maxPositionTop, La
youtUnit& maxPositionBottom, | 189 void computeLogicalBoxHeights(RootInlineBox*, LayoutUnit& maxPositionTop, La
youtUnit& maxPositionBottom, |
189 int& maxAscent, int& maxDescent, bool& setMaxA
scent, bool& setMaxDescent, | 190 int& maxAscent, int& maxDescent, bool& setMaxA
scent, bool& setMaxDescent, |
190 bool strictMode, GlyphOverflowAndFallbackFonts
Map&, FontBaseline, VerticalPositionCache&); | 191 bool strictMode, GlyphOverflowAndFallbackFonts
Map&, FontBaseline, VerticalPositionCache&); |
191 void adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent, | 192 void adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent, |
192 int maxPositionTop, int maxPositionBottom); | 193 int maxPositionTop, int maxPositionBottom); |
193 void placeBoxesInBlockDirection(LayoutUnit logicalTop, LayoutUnit maxHeight,
int maxAscent, bool strictMode, LayoutUnit& lineTop, LayoutUnit& lineBottom, La
youtUnit& selectionBottom, bool& setLineTop, | 194 void placeBoxesInBlockDirection(LayoutUnit logicalTop, LayoutUnit maxHeight,
int maxAscent, bool strictMode, LayoutUnit& lineTop, LayoutUnit& lineBottom, La
youtUnit& selectionBottom, bool& setLineTop, |
194 LayoutUnit& lineTopIncludingMargins, LayoutU
nit& lineBottomIncludingMargins, bool& hasAnnotationsBefore, bool& hasAnnotation
sAfter, FontBaseline); | 195 LayoutUnit& lineTopIncludingMargins, LayoutU
nit& lineBottomIncludingMargins, bool& hasAnnotationsBefore, bool& hasAnnotation
sAfter, FontBaseline); |
195 void flipLinesInBlockDirection(LayoutUnit lineTop, LayoutUnit lineBottom); | 196 void flipLinesInBlockDirection(LayoutUnit lineTop, LayoutUnit lineBottom); |
196 bool requiresIdeographicBaseline(const GlyphOverflowAndFallbackFontsMap&) co
nst; | 197 bool requiresIdeographicBaseline(const GlyphOverflowAndFallbackFontsMap&) co
nst; |
197 | 198 |
198 LayoutUnit computeOverAnnotationAdjustment(LayoutUnit allowedPosition) const
; | 199 LayoutUnit computeOverAnnotationAdjustment(LayoutUnit allowedPosition) const
; |
199 LayoutUnit computeUnderAnnotationAdjustment(LayoutUnit allowedPosition) cons
t; | 200 LayoutUnit computeUnderAnnotationAdjustment(LayoutUnit allowedPosition) cons
t; |
200 | 201 |
201 void computeOverflow(LayoutUnit lineTop, LayoutUnit lineBottom, GlyphOverflo
wAndFallbackFontsMap&); | 202 void computeOverflow(LayoutUnit lineTop, LayoutUnit lineBottom, GlyphOverflo
wAndFallbackFontsMap&); |
202 | 203 |
203 void removeChild(InlineBox* child, MarkLineBoxes); | 204 void removeChild(InlineBox* child, MarkLineBoxes); |
204 | 205 |
205 virtual RenderObject::SelectionState selectionState() const override; | 206 virtual RenderObject::SelectionState selectionState() const override; |
206 | 207 |
207 virtual bool canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWid
th) const override final; | 208 virtual bool canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWid
th) const override final; |
208 virtual float placeEllipsisBox(bool ltr, float blockLeftEdge, float blockRig
htEdge, float ellipsisWidth, float &truncatedWidth, bool&) override; | 209 virtual FloatWillBeLayoutUnit placeEllipsisBox(bool ltr, FloatWillBeLayoutUn
it blockLeftEdge, FloatWillBeLayoutUnit blockRightEdge, FloatWillBeLayoutUnit el
lipsisWidth, FloatWillBeLayoutUnit &truncatedWidth, bool&) override; |
209 | 210 |
210 bool hasTextChildren() const { return m_hasTextChildren; } | 211 bool hasTextChildren() const { return m_hasTextChildren; } |
211 bool hasTextDescendants() const { return m_hasTextDescendants; } | 212 bool hasTextDescendants() const { return m_hasTextDescendants; } |
212 void setHasTextDescendants() { m_hasTextDescendants = true; } | 213 void setHasTextDescendants() { m_hasTextDescendants = true; } |
213 | 214 |
214 void checkConsistency() const; | 215 void checkConsistency() const; |
215 void setHasBadChildList(); | 216 void setHasBadChildList(); |
216 | 217 |
217 // Line visual and layout overflow are in the coordinate space of the block.
This means that they aren't purely physical directions. | 218 // Line visual and layout overflow are in the coordinate space of the block.
This means that they aren't purely physical directions. |
218 // For horizontal-tb and vertical-lr they will match physical directions, bu
t for horizontal-bt and vertical-rl, the top/bottom and left/right | 219 // For horizontal-tb and vertical-lr they will match physical directions, bu
t for horizontal-bt and vertical-rl, the top/bottom and left/right |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 LayoutRect logicalVisualOverflowRect(LayoutUnit lineTop, LayoutUnit lineBott
om) const | 263 LayoutRect logicalVisualOverflowRect(LayoutUnit lineTop, LayoutUnit lineBott
om) const |
263 { | 264 { |
264 LayoutRect result = visualOverflowRect(lineTop, lineBottom); | 265 LayoutRect result = visualOverflowRect(lineTop, lineBottom); |
265 if (!renderer().isHorizontalWritingMode()) | 266 if (!renderer().isHorizontalWritingMode()) |
266 result = result.transposedRect(); | 267 result = result.transposedRect(); |
267 return result; | 268 return result; |
268 } | 269 } |
269 | 270 |
270 void setOverflowFromLogicalRects(const LayoutRect& logicalLayoutOverflow, co
nst LayoutRect& logicalVisualOverflow, LayoutUnit lineTop, LayoutUnit lineBottom
); | 271 void setOverflowFromLogicalRects(const LayoutRect& logicalLayoutOverflow, co
nst LayoutRect& logicalVisualOverflow, LayoutUnit lineTop, LayoutUnit lineBottom
); |
271 | 272 |
272 FloatRect frameRectIncludingLineHeight(LayoutUnit lineTop, LayoutUnit lineBo
ttom) const | 273 FloatRectWillBeLayoutRect frameRectIncludingLineHeight(LayoutUnit lineTop, L
ayoutUnit lineBottom) const |
273 { | 274 { |
274 if (isHorizontal()) | 275 if (isHorizontal()) |
275 return FloatRect(m_topLeft.x(), lineTop.toFloat(), width(), (lineBot
tom - lineTop).toFloat()); | 276 return FloatRectWillBeLayoutRect(m_topLeft.x(), lineTop.toFloat(), w
idth(), (lineBottom - lineTop).toFloat()); |
276 return FloatRect(lineTop.toFloat(), m_topLeft.y(), (lineBottom - lineTop
).toFloat(), height()); | 277 return FloatRectWillBeLayoutRect(lineTop.toFloat(), m_topLeft.y(), (line
Bottom - lineTop).toFloat(), height()); |
277 } | 278 } |
278 | 279 |
279 FloatRect logicalFrameRectIncludingLineHeight(LayoutUnit lineTop, LayoutUnit
lineBottom) const | 280 FloatRectWillBeLayoutRect logicalFrameRectIncludingLineHeight(LayoutUnit lin
eTop, LayoutUnit lineBottom) const |
280 { | 281 { |
281 return FloatRect(logicalLeft(), lineTop.toFloat(), logicalWidth(), (line
Bottom - lineTop).toFloat()); | 282 return FloatRectWillBeLayoutRect(logicalLeft(), lineTop.toFloat(), logic
alWidth(), (lineBottom - lineTop).toFloat()); |
282 } | 283 } |
283 | 284 |
284 bool descendantsHaveSameLineHeightAndBaseline() const { return m_descendants
HaveSameLineHeightAndBaseline; } | 285 bool descendantsHaveSameLineHeightAndBaseline() const { return m_descendants
HaveSameLineHeightAndBaseline; } |
285 void clearDescendantsHaveSameLineHeightAndBaseline() | 286 void clearDescendantsHaveSameLineHeightAndBaseline() |
286 { | 287 { |
287 m_descendantsHaveSameLineHeightAndBaseline = false; | 288 m_descendantsHaveSameLineHeightAndBaseline = false; |
288 if (parent() && parent()->descendantsHaveSameLineHeightAndBaseline()) | 289 if (parent() && parent()->descendantsHaveSameLineHeightAndBaseline()) |
289 parent()->clearDescendantsHaveSameLineHeightAndBaseline(); | 290 parent()->clearDescendantsHaveSameLineHeightAndBaseline(); |
290 } | 291 } |
291 | 292 |
(...skipping 16 matching lines...) Expand all Loading... |
308 virtual bool isInlineFlowBox() const override final { return true; } | 309 virtual bool isInlineFlowBox() const override final { return true; } |
309 | 310 |
310 InlineBox* m_firstChild; | 311 InlineBox* m_firstChild; |
311 InlineBox* m_lastChild; | 312 InlineBox* m_lastChild; |
312 | 313 |
313 InlineFlowBox* m_prevLineBox; // The previous box that also uses our RenderO
bject | 314 InlineFlowBox* m_prevLineBox; // The previous box that also uses our RenderO
bject |
314 InlineFlowBox* m_nextLineBox; // The next box that also uses our RenderObjec
t | 315 InlineFlowBox* m_nextLineBox; // The next box that also uses our RenderObjec
t |
315 | 316 |
316 // Maximum logicalTop among all children of an InlineFlowBox. Used to | 317 // Maximum logicalTop among all children of an InlineFlowBox. Used to |
317 // calculate the offset for TextUnderlinePositionUnder. | 318 // calculate the offset for TextUnderlinePositionUnder. |
318 void computeMaxLogicalTop(float& maxLogicalTop) const; | 319 void computeMaxLogicalTop(FloatWillBeLayoutUnit& maxLogicalTop) const; |
319 | 320 |
320 private: | 321 private: |
321 unsigned m_includeLogicalLeftEdge : 1; | 322 unsigned m_includeLogicalLeftEdge : 1; |
322 unsigned m_includeLogicalRightEdge : 1; | 323 unsigned m_includeLogicalRightEdge : 1; |
323 unsigned m_hasTextChildren : 1; | 324 unsigned m_hasTextChildren : 1; |
324 unsigned m_hasTextDescendants : 1; | 325 unsigned m_hasTextDescendants : 1; |
325 unsigned m_descendantsHaveSameLineHeightAndBaseline : 1; | 326 unsigned m_descendantsHaveSameLineHeightAndBaseline : 1; |
326 | 327 |
327 protected: | 328 protected: |
328 // The following members are only used by RootInlineBox but moved here to ke
ep the bits packed. | 329 // The following members are only used by RootInlineBox but moved here to ke
ep the bits packed. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 } | 365 } |
365 | 366 |
366 } // namespace blink | 367 } // namespace blink |
367 | 368 |
368 #ifndef NDEBUG | 369 #ifndef NDEBUG |
369 // Outside the WebCore namespace for ease of invocation from gdb. | 370 // Outside the WebCore namespace for ease of invocation from gdb. |
370 void showTree(const blink::InlineFlowBox*); | 371 void showTree(const blink::InlineFlowBox*); |
371 #endif | 372 #endif |
372 | 373 |
373 #endif // InlineFlowBox_h | 374 #endif // InlineFlowBox_h |
OLD | NEW |