| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 virtual ~RenderBlockFlow(); | 52 virtual ~RenderBlockFlow(); |
| 53 | 53 |
| 54 static RenderBlockFlow* createAnonymous(Document*); | 54 static RenderBlockFlow* createAnonymous(Document*); |
| 55 | 55 |
| 56 virtual bool isRenderBlockFlow() const override final { return true; } | 56 virtual bool isRenderBlockFlow() const override final { return true; } |
| 57 | 57 |
| 58 virtual void layoutBlock(bool relayoutChildren) override; | 58 virtual void layoutBlock(bool relayoutChildren) override; |
| 59 | 59 |
| 60 virtual void deleteLineBoxTree() override final; | 60 virtual void deleteLineBoxTree() override final; |
| 61 | 61 |
| 62 LayoutUnit availableLogicalWidthForLine(LayoutUnit position, bool shouldInde
ntText, LayoutUnit logicalHeight = 0) const | 62 LayoutUnit availableLogicalWidthForLine(bool shouldIndentText) const |
| 63 { | 63 { |
| 64 return max<LayoutUnit>(0, logicalRightOffsetForLine(position, shouldInde
ntText, logicalHeight) - logicalLeftOffsetForLine(position, shouldIndentText, lo
gicalHeight)); | 64 return max<LayoutUnit>(0, logicalRightOffsetForLine(shouldIndentText) -
logicalLeftOffsetForLine(shouldIndentText)); |
| 65 } | 65 } |
| 66 LayoutUnit logicalRightOffsetForLine(LayoutUnit position, bool shouldIndentT
ext, LayoutUnit logicalHeight = 0) const | 66 LayoutUnit logicalRightOffsetForLine(bool shouldIndentText) const |
| 67 { | 67 { |
| 68 return logicalRightOffsetForLine(position, logicalRightOffsetForContent(
), shouldIndentText, logicalHeight); | 68 return logicalRightOffsetForLine(logicalRightOffsetForContent(), shouldI
ndentText); |
| 69 } | 69 } |
| 70 LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, bool shouldIndentTe
xt, LayoutUnit logicalHeight = 0) const | 70 LayoutUnit logicalLeftOffsetForLine(bool shouldIndentText) const |
| 71 { | 71 { |
| 72 return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(),
shouldIndentText, logicalHeight); | 72 return logicalLeftOffsetForLine(logicalLeftOffsetForContent(), shouldInd
entText); |
| 73 } | 73 } |
| 74 LayoutUnit startOffsetForLine(LayoutUnit position, bool shouldIndentText, La
youtUnit logicalHeight = 0) const | 74 LayoutUnit startOffsetForLine(bool shouldIndentText) const |
| 75 { | 75 { |
| 76 return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(posi
tion, shouldIndentText, logicalHeight) | 76 return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(shou
ldIndentText) |
| 77 : logicalWidth() - logicalRightOffsetForLine(position, shouldIndentT
ext, logicalHeight); | 77 : logicalWidth() - logicalRightOffsetForLine(shouldIndentText); |
| 78 } | 78 } |
| 79 LayoutUnit endOffsetForLine(LayoutUnit position, bool shouldIndentText, Layo
utUnit logicalHeight = 0) const | 79 LayoutUnit endOffsetForLine(bool shouldIndentText) const |
| 80 { | 80 { |
| 81 return !style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(pos
ition, shouldIndentText, logicalHeight) | 81 return !style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(sho
uldIndentText) |
| 82 : logicalWidth() - logicalRightOffsetForLine(position, shouldIndentT
ext, logicalHeight); | 82 : logicalWidth() - logicalRightOffsetForLine(shouldIndentText); |
| 83 } | 83 } |
| 84 | 84 |
| 85 // FIXME-BLOCKFLOW: Move this into RenderBlockFlow once there are no calls | 85 // FIXME-BLOCKFLOW: Move this into RenderBlockFlow once there are no calls |
| 86 // in RenderBlock. http://crbug.com/393945, http://crbug.com/302024 | 86 // in RenderBlock. http://crbug.com/393945, http://crbug.com/302024 |
| 87 using RenderBlock::lineBoxes; | 87 using RenderBlock::lineBoxes; |
| 88 using RenderBlock::firstLineBox; | 88 using RenderBlock::firstLineBox; |
| 89 using RenderBlock::lastLineBox; | 89 using RenderBlock::lastLineBox; |
| 90 using RenderBlock::firstRootBox; | 90 using RenderBlock::firstRootBox; |
| 91 using RenderBlock::lastRootBox; | 91 using RenderBlock::lastRootBox; |
| 92 | 92 |
| 93 virtual LayoutUnit logicalLeftSelectionOffset(RenderBlock* rootBlock, Layout
Unit position) override; | 93 virtual LayoutUnit logicalLeftSelectionOffset(RenderBlock* rootBlock, Layout
Unit position) override; |
| 94 virtual LayoutUnit logicalRightSelectionOffset(RenderBlock* rootBlock, Layou
tUnit position) override; | 94 virtual LayoutUnit logicalRightSelectionOffset(RenderBlock* rootBlock, Layou
tUnit position) override; |
| 95 | 95 |
| 96 RootInlineBox* createAndAppendRootInlineBox(); | 96 RootInlineBox* createAndAppendRootInlineBox(); |
| 97 | 97 |
| 98 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0)
override; | 98 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0)
override; |
| 99 | 99 |
| 100 void moveAllChildrenIncludingFloatsTo(RenderBlock* toBlock, bool fullRemoveI
nsert); | |
| 101 | |
| 102 bool generatesLineBoxesForInlineChild(RenderObject*); | 100 bool generatesLineBoxesForInlineChild(RenderObject*); |
| 103 | 101 |
| 104 LayoutUnit startAlignedOffsetForLine(LayoutUnit position, bool shouldIndentT
ext); | 102 LayoutUnit startAlignedOffsetForLine(bool shouldIndentText); |
| 105 | 103 |
| 106 void setStaticInlinePositionForChild(RenderBox*, LayoutUnit inlinePosition); | 104 void setStaticInlinePositionForChild(RenderBox*, LayoutUnit inlinePosition); |
| 107 void updateStaticInlinePositionForChild(RenderBox*, LayoutUnit logicalTop); | 105 void updateStaticInlinePositionForChild(RenderBox*); |
| 108 | 106 |
| 109 static bool shouldSkipCreatingRunsForObject(RenderObject* obj) | 107 static bool shouldSkipCreatingRunsForObject(RenderObject* obj) |
| 110 { | 108 { |
| 111 return obj->isOutOfFlowPositioned() && !obj->style()->isOriginalDisplayI
nlineType() && !obj->container()->isRenderInline(); | 109 return obj->isOutOfFlowPositioned() && !obj->style()->isOriginalDisplayI
nlineType() && !obj->container()->isRenderInline(); |
| 112 } | 110 } |
| 113 | 111 |
| 114 void addOverflowFromInlineChildren(); | 112 void addOverflowFromInlineChildren(); |
| 115 | 113 |
| 116 // FIXME: This should be const to avoid a const_cast, but can modify child d
irty bits | 114 // FIXME: This should be const to avoid a const_cast, but can modify child d
irty bits |
| 117 void computeInlinePreferredLogicalWidths(LayoutUnit& minLogicalWidth, Layout
Unit& maxLogicalWidth); | 115 void computeInlinePreferredLogicalWidths(LayoutUnit& minLogicalWidth, Layout
Unit& maxLogicalWidth); |
| 118 | 116 |
| 119 GapRects inlineSelectionGaps(RenderBlock* rootBlock, const LayoutPoint& root
BlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, | 117 GapRects inlineSelectionGaps(RenderBlock* rootBlock, const LayoutPoint& root
BlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, |
| 120 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& las
tLogicalRight, const PaintInfo*); | 118 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& las
tLogicalRight, const PaintInfo*); |
| 121 | 119 |
| 122 protected: | 120 protected: |
| 123 void layoutInlineChildren(bool relayoutChildren, LayoutUnit& paintInvalidati
onLogicalTop, LayoutUnit& paintInvalidationLogicalBottom, LayoutUnit afterEdge); | 121 void layoutInlineChildren(bool relayoutChildren, LayoutUnit& paintInvalidati
onLogicalTop, LayoutUnit& paintInvalidationLogicalBottom, LayoutUnit afterEdge); |
| 124 | 122 |
| 125 LayoutUnit logicalRightOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixed
Offset, bool applyTextIndent, LayoutUnit logicalHeight = 0) const | |
| 126 { | |
| 127 return adjustLogicalRightOffsetForLine(logicalRightFloatOffsetForLine(lo
gicalTop, fixedOffset, logicalHeight), applyTextIndent); | |
| 128 } | |
| 129 LayoutUnit logicalLeftOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedO
ffset, bool applyTextIndent, LayoutUnit logicalHeight = 0) const | |
| 130 { | |
| 131 return adjustLogicalLeftOffsetForLine(logicalLeftFloatOffsetForLine(logi
calTop, fixedOffset, logicalHeight), applyTextIndent); | |
| 132 } | |
| 133 | |
| 134 virtual bool updateLogicalWidthAndColumnWidth() override; | 123 virtual bool updateLogicalWidthAndColumnWidth() override; |
| 135 | 124 |
| 136 void determineLogicalLeftPositionForChild(RenderBox* child); | 125 void determineLogicalLeftPositionForChild(RenderBox* child); |
| 137 | 126 |
| 138 private: | 127 private: |
| 128 LayoutUnit logicalRightOffsetForLine(LayoutUnit fixedOffset, bool applyTextI
ndent) const |
| 129 { |
| 130 LayoutUnit right = fixedOffset; |
| 131 if (applyTextIndent && !style()->isLeftToRightDirection()) |
| 132 right -= textIndentOffset(); |
| 133 return right; |
| 134 } |
| 135 LayoutUnit logicalLeftOffsetForLine(LayoutUnit fixedOffset, bool applyTextIn
dent) const |
| 136 { |
| 137 LayoutUnit left = fixedOffset; |
| 138 if (applyTextIndent && style()->isLeftToRightDirection()) |
| 139 left += textIndentOffset(); |
| 140 return left; |
| 141 } |
| 142 |
| 139 void layoutBlockFlow(bool relayoutChildren, SubtreeLayoutScope&); | 143 void layoutBlockFlow(bool relayoutChildren, SubtreeLayoutScope&); |
| 140 void layoutBlockChildren(bool relayoutChildren, SubtreeLayoutScope&, LayoutU
nit beforeEdge, LayoutUnit afterEdge); | 144 void layoutBlockChildren(bool relayoutChildren, SubtreeLayoutScope&, LayoutU
nit beforeEdge, LayoutUnit afterEdge); |
| 141 | 145 |
| 142 void layoutBlockChild(RenderBox* child); | 146 void layoutBlockChild(RenderBox* child); |
| 143 void adjustPositionedBlock(RenderBox* child); | 147 void adjustPositionedBlock(RenderBox* child); |
| 144 | 148 |
| 145 virtual bool hitTestFloats(const HitTestRequest&, HitTestResult&, const HitT
estLocation& locationInContainer, const LayoutPoint& accumulatedOffset) override
final; | 149 virtual void invalidatePaintForOverflow() override final; |
| 146 | 150 |
| 147 virtual void invalidatePaintForOverflow() override final; | 151 RootInlineBox* createRootInlineBox(); |
| 148 virtual void paintFloats(PaintInfo&, const LayoutPoint&, bool preservePhase
= false) override final; | |
| 149 | |
| 150 LayoutUnit logicalRightFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit
fixedOffset, LayoutUnit logicalHeight) const; | |
| 151 LayoutUnit logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit f
ixedOffset, LayoutUnit logicalHeight) const; | |
| 152 | |
| 153 LayoutUnit logicalRightOffsetForPositioningFloat(LayoutUnit logicalTop, Layo
utUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining) const; | |
| 154 LayoutUnit logicalLeftOffsetForPositioningFloat(LayoutUnit logicalTop, Layou
tUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining) const; | |
| 155 | |
| 156 LayoutUnit adjustLogicalRightOffsetForLine(LayoutUnit offsetFromFloats, bool
applyTextIndent) const; | |
| 157 LayoutUnit adjustLogicalLeftOffsetForLine(LayoutUnit offsetFromFloats, bool
applyTextIndent) const; | |
| 158 | |
| 159 virtual RootInlineBox* createRootInlineBox(); // Subclassed by SVG | |
| 160 | 152 |
| 161 void updateLogicalWidthForAlignment(const ETextAlign&, const RootInlineBox*,
BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float&
availableLogicalWidth, unsigned expansionOpportunityCount); | 153 void updateLogicalWidthForAlignment(const ETextAlign&, const RootInlineBox*,
BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float&
availableLogicalWidth, unsigned expansionOpportunityCount); |
| 162 | 154 |
| 163 public: | 155 public: |
| 164 struct FloatWithRect { | 156 struct FloatWithRect { |
| 165 FloatWithRect(RenderBox* f) | 157 FloatWithRect(RenderBox* f) |
| 166 : object(f) | 158 : object(f) |
| 167 , rect(LayoutRect(f->x() - f->marginLeft(), f->y() - f->marginTop(),
f->width() + f->marginWidth(), f->height() + f->marginHeight())) | 159 , rect(LayoutRect(f->x() - f->marginLeft(), f->y() - f->marginTop(),
f->width() + f->marginWidth(), f->height() + f->marginHeight())) |
| 168 , everHadLayout(f->everHadLayout()) | 160 , everHadLayout(f->everHadLayout()) |
| 169 { | 161 { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 | 207 |
| 216 // END METHODS DEFINED IN RenderBlockLineLayout | 208 // END METHODS DEFINED IN RenderBlockLineLayout |
| 217 | 209 |
| 218 }; | 210 }; |
| 219 | 211 |
| 220 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlockFlow, isRenderBlockFlow()); | 212 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlockFlow, isRenderBlockFlow()); |
| 221 | 213 |
| 222 } // namespace blink | 214 } // namespace blink |
| 223 | 215 |
| 224 #endif // RenderBlockFlow_h | 216 #endif // RenderBlockFlow_h |
| OLD | NEW |