OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
5 * Copyright (C) 2003-2013 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003-2013 Apple Inc. All rights reserved. |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
7 * Copyright (C) 2013 Google Inc. All rights reserved. | 7 * Copyright (C) 2013 Google Inc. All rights reserved. |
8 * | 8 * |
9 * Redistribution and use in source and binary forms, with or without | 9 * Redistribution and use in source and binary forms, with or without |
10 * modification, are permitted provided that the following conditions are | 10 * modification, are permitted provided that the following conditions are |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 bool containsFloat(LayoutBox*) const; | 112 bool containsFloat(LayoutBox*) const; |
113 | 113 |
114 void removeFloatingObjects(); | 114 void removeFloatingObjects(); |
115 | 115 |
116 virtual void addChild(LayoutObject* newChild, LayoutObject* beforeChild = nu
llptr) override; | 116 virtual void addChild(LayoutObject* newChild, LayoutObject* beforeChild = nu
llptr) override; |
117 | 117 |
118 void moveAllChildrenIncludingFloatsTo(LayoutBlock* toBlock, bool fullRemoveI
nsert); | 118 void moveAllChildrenIncludingFloatsTo(LayoutBlock* toBlock, bool fullRemoveI
nsert); |
119 | 119 |
120 bool generatesLineBoxesForInlineChild(LayoutObject*); | 120 bool generatesLineBoxesForInlineChild(LayoutObject*); |
121 | 121 |
122 LayoutUnit logicalTopForFloat(const FloatingObject* floatingObject) const {
return isHorizontalWritingMode() ? floatingObject->y() : floatingObject->x(); } | 122 LayoutUnit logicalTopForFloat(const FloatingObject& floatingObject) const {
return isHorizontalWritingMode() ? floatingObject.y() : floatingObject.x(); } |
123 LayoutUnit logicalBottomForFloat(const FloatingObject* floatingObject) const
{ return isHorizontalWritingMode() ? floatingObject->maxY() : floatingObject->m
axX(); } | 123 LayoutUnit logicalBottomForFloat(const FloatingObject& floatingObject) const
{ return isHorizontalWritingMode() ? floatingObject.maxY() : floatingObject.max
X(); } |
124 LayoutUnit logicalLeftForFloat(const FloatingObject* floatingObject) const {
return isHorizontalWritingMode() ? floatingObject->x() : floatingObject->y(); } | 124 LayoutUnit logicalLeftForFloat(const FloatingObject& floatingObject) const {
return isHorizontalWritingMode() ? floatingObject.x() : floatingObject.y(); } |
125 LayoutUnit logicalRightForFloat(const FloatingObject* floatingObject) const
{ return isHorizontalWritingMode() ? floatingObject->maxX() : floatingObject->ma
xY(); } | 125 LayoutUnit logicalRightForFloat(const FloatingObject& floatingObject) const
{ return isHorizontalWritingMode() ? floatingObject.maxX() : floatingObject.maxY
(); } |
126 LayoutUnit logicalWidthForFloat(const FloatingObject* floatingObject) const
{ return isHorizontalWritingMode() ? floatingObject->width() : floatingObject->h
eight(); } | 126 LayoutUnit logicalWidthForFloat(const FloatingObject& floatingObject) const
{ return isHorizontalWritingMode() ? floatingObject.width() : floatingObject.hei
ght(); } |
127 | 127 |
128 int pixelSnappedLogicalTopForFloat(const FloatingObject* floatingObject) con
st { return isHorizontalWritingMode() ? floatingObject->frameRect().pixelSnapped
Y() : floatingObject->frameRect().pixelSnappedX(); } | 128 int pixelSnappedLogicalTopForFloat(const FloatingObject& floatingObject) con
st { return isHorizontalWritingMode() ? floatingObject.frameRect().pixelSnappedY
() : floatingObject.frameRect().pixelSnappedX(); } |
129 int pixelSnappedLogicalBottomForFloat(const FloatingObject* floatingObject)
const { return isHorizontalWritingMode() ? floatingObject->frameRect().pixelSnap
pedMaxY() : floatingObject->frameRect().pixelSnappedMaxX(); } | 129 int pixelSnappedLogicalBottomForFloat(const FloatingObject& floatingObject)
const { return isHorizontalWritingMode() ? floatingObject.frameRect().pixelSnapp
edMaxY() : floatingObject.frameRect().pixelSnappedMaxX(); } |
130 | 130 |
131 void setLogicalTopForFloat(FloatingObject* floatingObject, LayoutUnit logica
lTop) | 131 void setLogicalTopForFloat(FloatingObject& floatingObject, LayoutUnit logica
lTop) |
132 { | 132 { |
133 if (isHorizontalWritingMode()) | 133 if (isHorizontalWritingMode()) |
134 floatingObject->setY(logicalTop); | 134 floatingObject.setY(logicalTop); |
135 else | 135 else |
136 floatingObject->setX(logicalTop); | 136 floatingObject.setX(logicalTop); |
137 } | 137 } |
138 void setLogicalLeftForFloat(FloatingObject* floatingObject, LayoutUnit logic
alLeft) | 138 void setLogicalLeftForFloat(FloatingObject& floatingObject, LayoutUnit logic
alLeft) |
139 { | 139 { |
140 if (isHorizontalWritingMode()) | 140 if (isHorizontalWritingMode()) |
141 floatingObject->setX(logicalLeft); | 141 floatingObject.setX(logicalLeft); |
142 else | 142 else |
143 floatingObject->setY(logicalLeft); | 143 floatingObject.setY(logicalLeft); |
144 } | 144 } |
145 void setLogicalHeightForFloat(FloatingObject* floatingObject, LayoutUnit log
icalHeight) | 145 void setLogicalHeightForFloat(FloatingObject& floatingObject, LayoutUnit log
icalHeight) |
146 { | 146 { |
147 if (isHorizontalWritingMode()) | 147 if (isHorizontalWritingMode()) |
148 floatingObject->setHeight(logicalHeight); | 148 floatingObject.setHeight(logicalHeight); |
149 else | 149 else |
150 floatingObject->setWidth(logicalHeight); | 150 floatingObject.setWidth(logicalHeight); |
151 } | 151 } |
152 void setLogicalWidthForFloat(FloatingObject* floatingObject, LayoutUnit logi
calWidth) | 152 void setLogicalWidthForFloat(FloatingObject& floatingObject, LayoutUnit logi
calWidth) |
153 { | 153 { |
154 if (isHorizontalWritingMode()) | 154 if (isHorizontalWritingMode()) |
155 floatingObject->setWidth(logicalWidth); | 155 floatingObject.setWidth(logicalWidth); |
156 else | 156 else |
157 floatingObject->setHeight(logicalWidth); | 157 floatingObject.setHeight(logicalWidth); |
158 } | 158 } |
159 | 159 |
160 LayoutUnit startAlignedOffsetForLine(LayoutUnit position, bool shouldIndentT
ext); | 160 LayoutUnit startAlignedOffsetForLine(LayoutUnit position, bool shouldIndentT
ext); |
161 | 161 |
162 void setStaticInlinePositionForChild(LayoutBox&, LayoutUnit inlinePosition); | 162 void setStaticInlinePositionForChild(LayoutBox&, LayoutUnit inlinePosition); |
163 void updateStaticInlinePositionForChild(LayoutBox&, LayoutUnit logicalTop); | 163 void updateStaticInlinePositionForChild(LayoutBox&, LayoutUnit logicalTop); |
164 | 164 |
165 static bool shouldSkipCreatingRunsForObject(LayoutObject* obj) | 165 static bool shouldSkipCreatingRunsForObject(LayoutObject* obj) |
166 { | 166 { |
167 return obj->isFloating() || (obj->isOutOfFlowPositioned() && !obj->style
()->isOriginalDisplayInlineType() && !obj->container()->isLayoutInline()); | 167 return obj->isFloating() || (obj->isOutOfFlowPositioned() && !obj->style
()->isOriginalDisplayInlineType() && !obj->container()->isLayoutInline()); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 LayoutUnit paginationStrut() const { return m_rareData ? m_rareData->m_pagin
ationStrut : LayoutUnit(); } | 201 LayoutUnit paginationStrut() const { return m_rareData ? m_rareData->m_pagin
ationStrut : LayoutUnit(); } |
202 void setPaginationStrut(LayoutUnit); | 202 void setPaginationStrut(LayoutUnit); |
203 | 203 |
204 void positionSpannerDescendant(LayoutMultiColumnSpannerPlaceholder& child); | 204 void positionSpannerDescendant(LayoutMultiColumnSpannerPlaceholder& child); |
205 | 205 |
206 virtual bool avoidsFloats() const override; | 206 virtual bool avoidsFloats() const override; |
207 | 207 |
208 using LayoutBoxModelObject::moveChildrenTo; | 208 using LayoutBoxModelObject::moveChildrenTo; |
209 virtual void moveChildrenTo(LayoutBoxModelObject* toBoxModelObject, LayoutOb
ject* startChild, LayoutObject* endChild, LayoutObject* beforeChild, bool fullRe
moveInsert = false) override; | 209 virtual void moveChildrenTo(LayoutBoxModelObject* toBoxModelObject, LayoutOb
ject* startChild, LayoutObject* endChild, LayoutObject* beforeChild, bool fullRe
moveInsert = false) override; |
210 | 210 |
211 LayoutUnit xPositionForFloatIncludingMargin(const FloatingObject* child) con
st | 211 LayoutUnit xPositionForFloatIncludingMargin(const FloatingObject& child) con
st |
212 { | 212 { |
213 if (isHorizontalWritingMode()) | 213 if (isHorizontalWritingMode()) |
214 return child->x() + child->layoutObject()->marginLeft(); | 214 return child.x() + child.layoutObject()->marginLeft(); |
215 | 215 |
216 return child->x() + marginBeforeForChild(*(child->layoutObject())); | 216 return child.x() + marginBeforeForChild(*child.layoutObject()); |
217 } | 217 } |
218 | 218 |
219 LayoutUnit yPositionForFloatIncludingMargin(const FloatingObject* child) con
st | 219 LayoutUnit yPositionForFloatIncludingMargin(const FloatingObject& child) con
st |
220 { | 220 { |
221 if (isHorizontalWritingMode()) | 221 if (isHorizontalWritingMode()) |
222 return child->y() + marginBeforeForChild(*(child->layoutObject())); | 222 return child.y() + marginBeforeForChild(*child.layoutObject()); |
223 | 223 |
224 return child->y() + child->layoutObject()->marginTop(); | 224 return child.y() + child.layoutObject()->marginTop(); |
225 } | 225 } |
226 | 226 |
227 LayoutSize positionForFloatIncludingMargin(const FloatingObject* child) cons
t | 227 LayoutSize positionForFloatIncludingMargin(const FloatingObject& child) cons
t |
228 { | 228 { |
229 if (isHorizontalWritingMode()) { | 229 if (isHorizontalWritingMode()) { |
230 return LayoutSize(child->x() + child->layoutObject()->marginLeft(), | 230 return LayoutSize(child.x() + child.layoutObject()->marginLeft(), |
231 child->y() + marginBeforeForChild(*(child->layoutObject()))); | 231 child.y() + marginBeforeForChild(*child.layoutObject())); |
232 } | 232 } |
233 | 233 |
234 return LayoutSize(child->x() + marginBeforeForChild(*(child->layoutObjec
t())), | 234 return LayoutSize(child.x() + marginBeforeForChild(*child.layoutObject()
), |
235 child->y() + child->layoutObject()->marginTop()); | 235 child.y() + child.layoutObject()->marginTop()); |
236 } | 236 } |
237 | 237 |
238 LayoutPoint flipFloatForWritingModeForChild(const FloatingObject*, const Lay
outPoint&) const; | 238 LayoutPoint flipFloatForWritingModeForChild(const FloatingObject&, const Lay
outPoint&) const; |
239 | 239 |
240 virtual const char* name() const override { return "LayoutBlockFlow"; } | 240 virtual const char* name() const override { return "LayoutBlockFlow"; } |
241 | 241 |
242 protected: | 242 protected: |
243 void rebuildFloatsFromIntruding(); | 243 void rebuildFloatsFromIntruding(); |
244 void layoutInlineChildren(bool relayoutChildren, LayoutUnit& paintInvalidati
onLogicalTop, LayoutUnit& paintInvalidationLogicalBottom, LayoutUnit afterEdge); | 244 void layoutInlineChildren(bool relayoutChildren, LayoutUnit& paintInvalidati
onLogicalTop, LayoutUnit& paintInvalidationLogicalBottom, LayoutUnit afterEdge); |
245 void addLowestFloatFromChildren(LayoutBlockFlow*); | 245 void addLowestFloatFromChildren(LayoutBlockFlow*); |
246 | 246 |
247 void createFloatingObjects(); | 247 void createFloatingObjects(); |
248 | 248 |
(...skipping 21 matching lines...) Expand all Loading... |
270 void determineLogicalLeftPositionForChild(LayoutBox& child); | 270 void determineLogicalLeftPositionForChild(LayoutBox& child); |
271 | 271 |
272 private: | 272 private: |
273 bool layoutBlockFlow(bool relayoutChildren, LayoutUnit& pageLogicalHeight, S
ubtreeLayoutScope&); | 273 bool layoutBlockFlow(bool relayoutChildren, LayoutUnit& pageLogicalHeight, S
ubtreeLayoutScope&); |
274 void layoutBlockChildren(bool relayoutChildren, SubtreeLayoutScope&, LayoutU
nit beforeEdge, LayoutUnit afterEdge); | 274 void layoutBlockChildren(bool relayoutChildren, SubtreeLayoutScope&, LayoutU
nit beforeEdge, LayoutUnit afterEdge); |
275 | 275 |
276 void layoutBlockChild(LayoutBox& child, MarginInfo&, LayoutUnit& previousFlo
atLogicalBottom); | 276 void layoutBlockChild(LayoutBox& child, MarginInfo&, LayoutUnit& previousFlo
atLogicalBottom); |
277 void adjustPositionedBlock(LayoutBox& child, const MarginInfo&); | 277 void adjustPositionedBlock(LayoutBox& child, const MarginInfo&); |
278 void adjustFloatingBlock(const MarginInfo&); | 278 void adjustFloatingBlock(const MarginInfo&); |
279 | 279 |
280 LayoutPoint computeLogicalLocationForFloat(const FloatingObject*, LayoutUnit
logicalTopOffset) const; | 280 LayoutPoint computeLogicalLocationForFloat(const FloatingObject&, LayoutUnit
logicalTopOffset) const; |
281 | 281 |
282 FloatingObject* insertFloatingObject(LayoutBox&); | 282 FloatingObject* insertFloatingObject(LayoutBox&); |
283 void removeFloatingObject(LayoutBox*); | 283 void removeFloatingObject(LayoutBox*); |
284 void removeFloatingObjectsBelow(FloatingObject*, int logicalOffset); | 284 void removeFloatingObjectsBelow(FloatingObject*, int logicalOffset); |
285 | 285 |
286 // Called from lineWidth, to position the floats added in the last line. | 286 // Called from lineWidth, to position the floats added in the last line. |
287 // Returns true if and only if it has positioned any floats. | 287 // Returns true if and only if it has positioned any floats. |
288 bool positionNewFloats(LineWidth* = nullptr); | 288 bool positionNewFloats(LineWidth* = nullptr); |
289 | 289 |
290 LayoutUnit getClearDelta(LayoutBox* child, LayoutUnit yPos); | 290 LayoutUnit getClearDelta(LayoutBox* child, LayoutUnit yPos); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 // line layout code is separated from LayoutBlock and LayoutBlockFlow. | 507 // line layout code is separated from LayoutBlock and LayoutBlockFlow. |
508 // START METHODS DEFINED IN LayoutBlockFlowLine | 508 // START METHODS DEFINED IN LayoutBlockFlowLine |
509 private: | 509 private: |
510 InlineFlowBox* createLineBoxes(LayoutObject*, const LineInfo&, InlineBox* ch
ildBox); | 510 InlineFlowBox* createLineBoxes(LayoutObject*, const LineInfo&, InlineBox* ch
ildBox); |
511 RootInlineBox* constructLine(BidiRunList<BidiRun>&, const LineInfo&); | 511 RootInlineBox* constructLine(BidiRunList<BidiRun>&, const LineInfo&); |
512 void setMarginsForRubyRun(BidiRun*, LayoutRubyRun*, LayoutObject*, const Lin
eInfo&); | 512 void setMarginsForRubyRun(BidiRun*, LayoutRubyRun*, LayoutObject*, const Lin
eInfo&); |
513 void computeInlineDirectionPositionsForLine(RootInlineBox*, const LineInfo&,
BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAnd
FallbackFontsMap&, VerticalPositionCache&, WordMeasurements&); | 513 void computeInlineDirectionPositionsForLine(RootInlineBox*, const LineInfo&,
BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAnd
FallbackFontsMap&, VerticalPositionCache&, WordMeasurements&); |
514 BidiRun* computeInlineDirectionPositionsForSegment(RootInlineBox*, const Lin
eInfo&, ETextAlign, LayoutUnit& logicalLeft, | 514 BidiRun* computeInlineDirectionPositionsForSegment(RootInlineBox*, const Lin
eInfo&, ETextAlign, LayoutUnit& logicalLeft, |
515 LayoutUnit& availableLogicalWidth, BidiRun* firstRun, BidiRun* trailingS
paceRun, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache
&, WordMeasurements&); | 515 LayoutUnit& availableLogicalWidth, BidiRun* firstRun, BidiRun* trailingS
paceRun, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache
&, WordMeasurements&); |
516 void computeBlockDirectionPositionsForLine(RootInlineBox*, BidiRun*, GlyphOv
erflowAndFallbackFontsMap&, VerticalPositionCache&); | 516 void computeBlockDirectionPositionsForLine(RootInlineBox*, BidiRun*, GlyphOv
erflowAndFallbackFontsMap&, VerticalPositionCache&); |
517 void appendFloatingObjectToLastLine(FloatingObject*); | 517 void appendFloatingObjectToLastLine(FloatingObject&); |
518 // Helper function for layoutInlineChildren() | 518 // Helper function for layoutInlineChildren() |
519 RootInlineBox* createLineBoxesFromBidiRuns(unsigned bidiLevel, BidiRunList<B
idiRun>&, const InlineIterator& end, LineInfo&, VerticalPositionCache&, BidiRun*
trailingSpaceRun, WordMeasurements&); | 519 RootInlineBox* createLineBoxesFromBidiRuns(unsigned bidiLevel, BidiRunList<B
idiRun>&, const InlineIterator& end, LineInfo&, VerticalPositionCache&, BidiRun*
trailingSpaceRun, WordMeasurements&); |
520 void layoutRunsAndFloats(LineLayoutState&); | 520 void layoutRunsAndFloats(LineLayoutState&); |
521 const InlineIterator& restartLayoutRunsAndFloatsInRange(LayoutUnit oldLogica
lHeight, LayoutUnit newLogicalHeight, FloatingObject* lastFloatFromPreviousLine
, InlineBidiResolver&, const InlineIterator&); | 521 const InlineIterator& restartLayoutRunsAndFloatsInRange(LayoutUnit oldLogica
lHeight, LayoutUnit newLogicalHeight, FloatingObject* lastFloatFromPreviousLine
, InlineBidiResolver&, const InlineIterator&); |
522 void layoutRunsAndFloatsInRange(LineLayoutState&, InlineBidiResolver&, | 522 void layoutRunsAndFloatsInRange(LineLayoutState&, InlineBidiResolver&, |
523 const InlineIterator& cleanLineStart, const BidiStatus& cleanLineBidiSta
tus); | 523 const InlineIterator& cleanLineStart, const BidiStatus& cleanLineBidiSta
tus); |
524 void linkToEndLineIfNeeded(LineLayoutState&); | 524 void linkToEndLineIfNeeded(LineLayoutState&); |
525 static void markDirtyFloatsForPaintInvalidation(Vector<FloatWithRect>& float
s); | 525 static void markDirtyFloatsForPaintInvalidation(Vector<FloatWithRect>& float
s); |
526 void checkFloatsInCleanLine(RootInlineBox*, Vector<FloatWithRect>&, size_t&
floatIndex, bool& encounteredNewFloat, bool& dirtiedByFloat); | 526 void checkFloatsInCleanLine(RootInlineBox*, Vector<FloatWithRect>&, size_t&
floatIndex, bool& encounteredNewFloat, bool& dirtiedByFloat); |
527 RootInlineBox* determineStartPosition(LineLayoutState&, InlineBidiResolver&)
; | 527 RootInlineBox* determineStartPosition(LineLayoutState&, InlineBidiResolver&)
; |
528 void determineEndPosition(LineLayoutState&, RootInlineBox* startBox, InlineI
terator& cleanLineStart, BidiStatus& cleanLineBidiStatus); | 528 void determineEndPosition(LineLayoutState&, RootInlineBox* startBox, InlineI
terator& cleanLineStart, BidiStatus& cleanLineBidiStatus); |
529 bool checkPaginationAndFloatsAtEndLine(LineLayoutState&); | 529 bool checkPaginationAndFloatsAtEndLine(LineLayoutState&); |
530 bool matchedEndLine(LineLayoutState&, const InlineBidiResolver&, const Inlin
eIterator& endLineStart, const BidiStatus& endLineStatus); | 530 bool matchedEndLine(LineLayoutState&, const InlineBidiResolver&, const Inlin
eIterator& endLineStart, const BidiStatus& endLineStatus); |
531 void deleteEllipsisLineBoxes(); | 531 void deleteEllipsisLineBoxes(); |
532 void checkLinesForTextOverflow(); | 532 void checkLinesForTextOverflow(); |
533 // Positions new floats and also adjust all floats encountered on the line i
f any of them | 533 // Positions new floats and also adjust all floats encountered on the line i
f any of them |
534 // have to move to the next page/column. | 534 // have to move to the next page/column. |
535 bool positionNewFloatOnLine(FloatingObject* newFloat, FloatingObject* lastFl
oatFromPreviousLine, LineInfo&, LineWidth&); | 535 bool positionNewFloatOnLine(FloatingObject& newFloat, FloatingObject* lastFl
oatFromPreviousLine, LineInfo&, LineWidth&); |
536 void positionDialog(); | 536 void positionDialog(); |
537 | 537 |
538 // END METHODS DEFINED IN LayoutBlockFlowLine | 538 // END METHODS DEFINED IN LayoutBlockFlowLine |
539 | 539 |
540 }; | 540 }; |
541 | 541 |
542 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBlockFlow, isLayoutBlockFlow()); | 542 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBlockFlow, isLayoutBlockFlow()); |
543 | 543 |
544 } // namespace blink | 544 } // namespace blink |
545 | 545 |
546 #endif // LayoutBlockFlow_h | 546 #endif // LayoutBlockFlow_h |
OLD | NEW |