| 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 LayoutUnit logicalHeightForFloat(const FloatingObject* floatingObject) const
{ return isHorizontalWritingMode() ? floatingObject->height() : floatingObject-
>width(); } | |
| 126 LayoutSize logicalSizeForFloat(const FloatingObject* floatingObject) const {
return isHorizontalWritingMode() ? LayoutSize(floatingObject->width(), floating
Object->height()) : LayoutSize(floatingObject->height(), floatingObject->width()
); } | |
| 127 | 125 |
| 128 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(); } |
| 129 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(); } |
| 130 int pixelSnappedLogicalLeftForFloat(const FloatingObject* floatingObject) co
nst { return isHorizontalWritingMode() ? floatingObject->frameRect().pixelSnappe
dX() : floatingObject->frameRect().pixelSnappedY(); } | |
| 131 int pixelSnappedLogicalRightForFloat(const FloatingObject* floatingObject) c
onst { return isHorizontalWritingMode() ? floatingObject->frameRect().pixelSnapp
edMaxX() : floatingObject->frameRect().pixelSnappedMaxY(); } | |
| 132 | 128 |
| 133 void setLogicalTopForFloat(FloatingObject* floatingObject, LayoutUnit logica
lTop) | 129 void setLogicalTopForFloat(FloatingObject& floatingObject, LayoutUnit logica
lTop) |
| 134 { | 130 { |
| 135 if (isHorizontalWritingMode()) | 131 if (isHorizontalWritingMode()) |
| 136 floatingObject->setY(logicalTop); | 132 floatingObject.setY(logicalTop); |
| 137 else | 133 else |
| 138 floatingObject->setX(logicalTop); | 134 floatingObject.setX(logicalTop); |
| 139 } | 135 } |
| 140 void setLogicalLeftForFloat(FloatingObject* floatingObject, LayoutUnit logic
alLeft) | 136 void setLogicalLeftForFloat(FloatingObject& floatingObject, LayoutUnit logic
alLeft) |
| 141 { | 137 { |
| 142 if (isHorizontalWritingMode()) | 138 if (isHorizontalWritingMode()) |
| 143 floatingObject->setX(logicalLeft); | 139 floatingObject.setX(logicalLeft); |
| 144 else | 140 else |
| 145 floatingObject->setY(logicalLeft); | 141 floatingObject.setY(logicalLeft); |
| 146 } | 142 } |
| 147 void setLogicalHeightForFloat(FloatingObject* floatingObject, LayoutUnit log
icalHeight) | 143 void setLogicalHeightForFloat(FloatingObject& floatingObject, LayoutUnit log
icalHeight) |
| 148 { | 144 { |
| 149 if (isHorizontalWritingMode()) | 145 if (isHorizontalWritingMode()) |
| 150 floatingObject->setHeight(logicalHeight); | 146 floatingObject.setHeight(logicalHeight); |
| 151 else | 147 else |
| 152 floatingObject->setWidth(logicalHeight); | 148 floatingObject.setWidth(logicalHeight); |
| 153 } | 149 } |
| 154 void setLogicalWidthForFloat(FloatingObject* floatingObject, LayoutUnit logi
calWidth) | 150 void setLogicalWidthForFloat(FloatingObject& floatingObject, LayoutUnit logi
calWidth) |
| 155 { | 151 { |
| 156 if (isHorizontalWritingMode()) | 152 if (isHorizontalWritingMode()) |
| 157 floatingObject->setWidth(logicalWidth); | 153 floatingObject.setWidth(logicalWidth); |
| 158 else | 154 else |
| 159 floatingObject->setHeight(logicalWidth); | 155 floatingObject.setHeight(logicalWidth); |
| 160 } | 156 } |
| 161 | 157 |
| 162 LayoutUnit startAlignedOffsetForLine(LayoutUnit position, bool shouldIndentT
ext); | 158 LayoutUnit startAlignedOffsetForLine(LayoutUnit position, bool shouldIndentT
ext); |
| 163 | 159 |
| 164 void setStaticInlinePositionForChild(LayoutBox&, LayoutUnit inlinePosition); | 160 void setStaticInlinePositionForChild(LayoutBox&, LayoutUnit inlinePosition); |
| 165 void updateStaticInlinePositionForChild(LayoutBox&, LayoutUnit logicalTop); | 161 void updateStaticInlinePositionForChild(LayoutBox&, LayoutUnit logicalTop); |
| 166 | 162 |
| 167 static bool shouldSkipCreatingRunsForObject(LayoutObject* obj) | 163 static bool shouldSkipCreatingRunsForObject(LayoutObject* obj) |
| 168 { | 164 { |
| 169 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... |
| 202 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(); } |
| 203 void setPaginationStrut(LayoutUnit); | 199 void setPaginationStrut(LayoutUnit); |
| 204 | 200 |
| 205 void positionSpannerDescendant(LayoutMultiColumnSpannerPlaceholder& child); | 201 void positionSpannerDescendant(LayoutMultiColumnSpannerPlaceholder& child); |
| 206 | 202 |
| 207 virtual bool avoidsFloats() const override; | 203 virtual bool avoidsFloats() const override; |
| 208 | 204 |
| 209 using LayoutBoxModelObject::moveChildrenTo; | 205 using LayoutBoxModelObject::moveChildrenTo; |
| 210 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; |
| 211 | 207 |
| 212 LayoutUnit xPositionForFloatIncludingMargin(const FloatingObject* child) con
st | 208 LayoutUnit xPositionForFloatIncludingMargin(const FloatingObject& child) con
st |
| 213 { | 209 { |
| 214 if (isHorizontalWritingMode()) | 210 if (isHorizontalWritingMode()) |
| 215 return child->x() + child->layoutObject()->marginLeft(); | 211 return child.x() + child.layoutObject()->marginLeft(); |
| 216 | 212 |
| 217 return child->x() + marginBeforeForChild(*(child->layoutObject())); | 213 return child.x() + marginBeforeForChild(*(child.layoutObject())); |
| 218 } | 214 } |
| 219 | 215 |
| 220 LayoutUnit yPositionForFloatIncludingMargin(const FloatingObject* child) con
st | 216 LayoutUnit yPositionForFloatIncludingMargin(const FloatingObject& child) con
st |
| 221 { | 217 { |
| 222 if (isHorizontalWritingMode()) | 218 if (isHorizontalWritingMode()) |
| 223 return child->y() + marginBeforeForChild(*(child->layoutObject())); | 219 return child.y() + marginBeforeForChild(*(child.layoutObject())); |
| 224 | 220 |
| 225 return child->y() + child->layoutObject()->marginTop(); | 221 return child.y() + child.layoutObject()->marginTop(); |
| 226 } | 222 } |
| 227 | 223 |
| 228 LayoutSize positionForFloatIncludingMargin(const FloatingObject* child) cons
t | 224 LayoutSize positionForFloatIncludingMargin(const FloatingObject& child) cons
t |
| 229 { | 225 { |
| 230 if (isHorizontalWritingMode()) { | 226 if (isHorizontalWritingMode()) { |
| 231 return LayoutSize(child->x() + child->layoutObject()->marginLeft(), | 227 return LayoutSize(child.x() + child.layoutObject()->marginLeft(), |
| 232 child->y() + marginBeforeForChild(*(child->layoutObject()))); | 228 child.y() + marginBeforeForChild(*(child.layoutObject()))); |
| 233 } | 229 } |
| 234 | 230 |
| 235 return LayoutSize(child->x() + marginBeforeForChild(*(child->layoutObjec
t())), | 231 return LayoutSize(child.x() + marginBeforeForChild(*(child.layoutObject(
))), |
| 236 child->y() + child->layoutObject()->marginTop()); | 232 child.y() + child.layoutObject()->marginTop()); |
| 237 } | 233 } |
| 238 | 234 |
| 239 LayoutPoint flipFloatForWritingModeForChild(const FloatingObject*, const Lay
outPoint&) const; | 235 LayoutPoint flipFloatForWritingModeForChild(const FloatingObject&, const Lay
outPoint&) const; |
| 240 | 236 |
| 241 virtual const char* name() const override; | 237 virtual const char* name() const override; |
| 242 | 238 |
| 243 protected: | 239 protected: |
| 244 void rebuildFloatsFromIntruding(); | 240 void rebuildFloatsFromIntruding(); |
| 245 void layoutInlineChildren(bool relayoutChildren, LayoutUnit& paintInvalidati
onLogicalTop, LayoutUnit& paintInvalidationLogicalBottom, LayoutUnit afterEdge); | 241 void layoutInlineChildren(bool relayoutChildren, LayoutUnit& paintInvalidati
onLogicalTop, LayoutUnit& paintInvalidationLogicalBottom, LayoutUnit afterEdge); |
| 246 | 242 |
| 247 void createFloatingObjects(); | 243 void createFloatingObjects(); |
| 248 | 244 |
| 249 virtual void styleWillChange(StyleDifference, const LayoutStyle& newStyle) o
verride; | 245 virtual void styleWillChange(StyleDifference, const LayoutStyle& newStyle) o
verride; |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 // line layout code is separated from LayoutBlock and LayoutBlockFlow. | 505 // line layout code is separated from LayoutBlock and LayoutBlockFlow. |
| 510 // START METHODS DEFINED IN LayoutBlockFlowLine | 506 // START METHODS DEFINED IN LayoutBlockFlowLine |
| 511 private: | 507 private: |
| 512 InlineFlowBox* createLineBoxes(LayoutObject*, const LineInfo&, InlineBox* ch
ildBox); | 508 InlineFlowBox* createLineBoxes(LayoutObject*, const LineInfo&, InlineBox* ch
ildBox); |
| 513 RootInlineBox* constructLine(BidiRunList<BidiRun>&, const LineInfo&); | 509 RootInlineBox* constructLine(BidiRunList<BidiRun>&, const LineInfo&); |
| 514 void setMarginsForRubyRun(BidiRun*, LayoutRubyRun*, LayoutObject*, const Lin
eInfo&); | 510 void setMarginsForRubyRun(BidiRun*, LayoutRubyRun*, LayoutObject*, const Lin
eInfo&); |
| 515 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&); |
| 516 BidiRun* computeInlineDirectionPositionsForSegment(RootInlineBox*, const Lin
eInfo&, ETextAlign, float& logicalLeft, | 512 BidiRun* computeInlineDirectionPositionsForSegment(RootInlineBox*, const Lin
eInfo&, ETextAlign, float& logicalLeft, |
| 517 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&); |
| 518 void computeBlockDirectionPositionsForLine(RootInlineBox*, BidiRun*, GlyphOv
erflowAndFallbackFontsMap&, VerticalPositionCache&); | 514 void computeBlockDirectionPositionsForLine(RootInlineBox*, BidiRun*, GlyphOv
erflowAndFallbackFontsMap&, VerticalPositionCache&); |
| 519 void appendFloatingObjectToLastLine(FloatingObject*); | 515 void appendFloatingObjectToLastLine(FloatingObject&); |
| 520 // Helper function for layoutInlineChildren() | 516 // Helper function for layoutInlineChildren() |
| 521 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&); |
| 522 void layoutRunsAndFloats(LineLayoutState&); | 518 void layoutRunsAndFloats(LineLayoutState&); |
| 523 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&); |
| 524 void layoutRunsAndFloatsInRange(LineLayoutState&, InlineBidiResolver&, | 520 void layoutRunsAndFloatsInRange(LineLayoutState&, InlineBidiResolver&, |
| 525 const InlineIterator& cleanLineStart, const BidiStatus& cleanLineBidiSta
tus); | 521 const InlineIterator& cleanLineStart, const BidiStatus& cleanLineBidiSta
tus); |
| 526 void linkToEndLineIfNeeded(LineLayoutState&); | 522 void linkToEndLineIfNeeded(LineLayoutState&); |
| 527 static void markDirtyFloatsForPaintInvalidation(Vector<FloatWithRect>& float
s); | 523 static void markDirtyFloatsForPaintInvalidation(Vector<FloatWithRect>& float
s); |
| 528 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); |
| 529 RootInlineBox* determineStartPosition(LineLayoutState&, InlineBidiResolver&)
; | 525 RootInlineBox* determineStartPosition(LineLayoutState&, InlineBidiResolver&)
; |
| 530 void determineEndPosition(LineLayoutState&, RootInlineBox* startBox, InlineI
terator& cleanLineStart, BidiStatus& cleanLineBidiStatus); | 526 void determineEndPosition(LineLayoutState&, RootInlineBox* startBox, InlineI
terator& cleanLineStart, BidiStatus& cleanLineBidiStatus); |
| 531 bool checkPaginationAndFloatsAtEndLine(LineLayoutState&); | 527 bool checkPaginationAndFloatsAtEndLine(LineLayoutState&); |
| 532 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); |
| 533 void deleteEllipsisLineBoxes(); | 529 void deleteEllipsisLineBoxes(); |
| 534 void checkLinesForTextOverflow(); | 530 void checkLinesForTextOverflow(); |
| 535 // 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 |
| 536 // have to move to the next page/column. | 532 // have to move to the next page/column. |
| 537 bool positionNewFloatOnLine(FloatingObject* newFloat, FloatingObject* lastFl
oatFromPreviousLine, LineInfo&, LineWidth&); | 533 bool positionNewFloatOnLine(FloatingObject* newFloat, FloatingObject* lastFl
oatFromPreviousLine, LineInfo&, LineWidth&); |
| 538 void positionDialog(); | 534 void positionDialog(); |
| 539 | 535 |
| 540 // END METHODS DEFINED IN LayoutBlockFlowLine | 536 // END METHODS DEFINED IN LayoutBlockFlowLine |
| 541 | 537 |
| 542 }; | 538 }; |
| 543 | 539 |
| 544 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBlockFlow, isLayoutBlockFlow()); | 540 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBlockFlow, isLayoutBlockFlow()); |
| 545 | 541 |
| 546 } // namespace blink | 542 } // namespace blink |
| 547 | 543 |
| 548 #endif // LayoutBlockFlow_h | 544 #endif // LayoutBlockFlow_h |
| OLD | NEW |