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