Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: sky/engine/core/rendering/RenderBlockFlow.h

Issue 692563004: Remove more support for floats from RenderBlockFlow. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
52 explicit RenderBlockFlow(ContainerNode*); 52 explicit RenderBlockFlow(ContainerNode*);
53 virtual ~RenderBlockFlow(); 53 virtual ~RenderBlockFlow();
54 virtual void trace(Visitor*) override; 54 virtual void trace(Visitor*) override;
55 55
56 static RenderBlockFlow* createAnonymous(Document*); 56 static RenderBlockFlow* createAnonymous(Document*);
57 57
58 virtual bool isRenderBlockFlow() const override final { return true; } 58 virtual bool isRenderBlockFlow() const override final { return true; }
59 59
60 virtual void layoutBlock(bool relayoutChildren) override; 60 virtual void layoutBlock(bool relayoutChildren) override;
61 61
62 virtual void computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeFl oats = false) override;
63
64 virtual void deleteLineBoxTree() override final; 62 virtual void deleteLineBoxTree() override final;
65 63
66 LayoutUnit availableLogicalWidthForLine(LayoutUnit position, bool shouldInde ntText, LayoutUnit logicalHeight = 0) const 64 LayoutUnit availableLogicalWidthForLine(LayoutUnit position, bool shouldInde ntText, LayoutUnit logicalHeight = 0) const
67 { 65 {
68 return max<LayoutUnit>(0, logicalRightOffsetForLine(position, shouldInde ntText, logicalHeight) - logicalLeftOffsetForLine(position, shouldIndentText, lo gicalHeight)); 66 return max<LayoutUnit>(0, logicalRightOffsetForLine(position, shouldInde ntText, logicalHeight) - logicalLeftOffsetForLine(position, shouldIndentText, lo gicalHeight));
69 } 67 }
70 LayoutUnit logicalRightOffsetForLine(LayoutUnit position, bool shouldIndentT ext, LayoutUnit logicalHeight = 0) const 68 LayoutUnit logicalRightOffsetForLine(LayoutUnit position, bool shouldIndentT ext, LayoutUnit logicalHeight = 0) const
71 { 69 {
72 return logicalRightOffsetForLine(position, logicalRightOffsetForContent( ), shouldIndentText, logicalHeight); 70 return logicalRightOffsetForLine(position, logicalRightOffsetForContent( ), shouldIndentText, logicalHeight);
73 } 71 }
(...skipping 18 matching lines...) Expand all
92 using RenderBlock::firstLineBox; 90 using RenderBlock::firstLineBox;
93 using RenderBlock::lastLineBox; 91 using RenderBlock::lastLineBox;
94 using RenderBlock::firstRootBox; 92 using RenderBlock::firstRootBox;
95 using RenderBlock::lastRootBox; 93 using RenderBlock::lastRootBox;
96 94
97 virtual LayoutUnit logicalLeftSelectionOffset(RenderBlock* rootBlock, Layout Unit position) override; 95 virtual LayoutUnit logicalLeftSelectionOffset(RenderBlock* rootBlock, Layout Unit position) override;
98 virtual LayoutUnit logicalRightSelectionOffset(RenderBlock* rootBlock, Layou tUnit position) override; 96 virtual LayoutUnit logicalRightSelectionOffset(RenderBlock* rootBlock, Layou tUnit position) override;
99 97
100 RootInlineBox* createAndAppendRootInlineBox(); 98 RootInlineBox* createAndAppendRootInlineBox();
101 99
102 void markAllDescendantsWithFloatsForLayout(RenderBox* floatToRemove = 0, boo l inLayout = true);
103 void markSiblingsWithFloatsForLayout(RenderBox* floatToRemove = 0);
104
105 bool containsFloats() const { return false; }
106 bool containsFloat(RenderBox*) const { return false; }
107
108 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) override; 100 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) override;
109 101
110 void moveAllChildrenIncludingFloatsTo(RenderBlock* toBlock, bool fullRemoveI nsert); 102 void moveAllChildrenIncludingFloatsTo(RenderBlock* toBlock, bool fullRemoveI nsert);
111 103
112 bool generatesLineBoxesForInlineChild(RenderObject*); 104 bool generatesLineBoxesForInlineChild(RenderObject*);
113 105
114 LayoutUnit startAlignedOffsetForLine(LayoutUnit position, bool shouldIndentT ext); 106 LayoutUnit startAlignedOffsetForLine(LayoutUnit position, bool shouldIndentT ext);
115 107
116 void setStaticInlinePositionForChild(RenderBox*, LayoutUnit inlinePosition); 108 void setStaticInlinePositionForChild(RenderBox*, LayoutUnit inlinePosition);
117 void updateStaticInlinePositionForChild(RenderBox*, LayoutUnit logicalTop); 109 void updateStaticInlinePositionForChild(RenderBox*, LayoutUnit logicalTop);
118 110
119 static bool shouldSkipCreatingRunsForObject(RenderObject* obj) 111 static bool shouldSkipCreatingRunsForObject(RenderObject* obj)
120 { 112 {
121 return obj->isFloating() || (obj->isOutOfFlowPositioned() && !obj->style ()->isOriginalDisplayInlineType() && !obj->container()->isRenderInline()); 113 return obj->isFloating() || (obj->isOutOfFlowPositioned() && !obj->style ()->isOriginalDisplayInlineType() && !obj->container()->isRenderInline());
122 } 114 }
123 115
124 void addOverflowFromInlineChildren(); 116 void addOverflowFromInlineChildren();
125 117
126 // FIXME: This should be const to avoid a const_cast, but can modify child d irty bits 118 // FIXME: This should be const to avoid a const_cast, but can modify child d irty bits
127 void computeInlinePreferredLogicalWidths(LayoutUnit& minLogicalWidth, Layout Unit& maxLogicalWidth); 119 void computeInlinePreferredLogicalWidths(LayoutUnit& minLogicalWidth, Layout Unit& maxLogicalWidth);
128 120
129 GapRects inlineSelectionGaps(RenderBlock* rootBlock, const LayoutPoint& root BlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, 121 GapRects inlineSelectionGaps(RenderBlock* rootBlock, const LayoutPoint& root BlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
130 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& las tLogicalRight, const PaintInfo*); 122 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& las tLogicalRight, const PaintInfo*);
131 123
132 virtual bool avoidsFloats() const override; 124 virtual bool avoidsFloats() const override;
133 125
134 protected: 126 protected:
135 void rebuildFloatsFromIntruding();
136 void layoutInlineChildren(bool relayoutChildren, LayoutUnit& paintInvalidati onLogicalTop, LayoutUnit& paintInvalidationLogicalBottom, LayoutUnit afterEdge); 127 void layoutInlineChildren(bool relayoutChildren, LayoutUnit& paintInvalidati onLogicalTop, LayoutUnit& paintInvalidationLogicalBottom, LayoutUnit afterEdge);
137 128
138 virtual void styleWillChange(StyleDifference, const RenderStyle& newStyle) o verride;
139 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) ov erride;
140
141 void addOverflowFromFloats();
142
143 LayoutUnit logicalRightOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixed Offset, bool applyTextIndent, LayoutUnit logicalHeight = 0) const 129 LayoutUnit logicalRightOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixed Offset, bool applyTextIndent, LayoutUnit logicalHeight = 0) const
144 { 130 {
145 return adjustLogicalRightOffsetForLine(logicalRightFloatOffsetForLine(lo gicalTop, fixedOffset, logicalHeight), applyTextIndent); 131 return adjustLogicalRightOffsetForLine(logicalRightFloatOffsetForLine(lo gicalTop, fixedOffset, logicalHeight), applyTextIndent);
146 } 132 }
147 LayoutUnit logicalLeftOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedO ffset, bool applyTextIndent, LayoutUnit logicalHeight = 0) const 133 LayoutUnit logicalLeftOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedO ffset, bool applyTextIndent, LayoutUnit logicalHeight = 0) const
148 { 134 {
149 return adjustLogicalLeftOffsetForLine(logicalLeftFloatOffsetForLine(logi calTop, fixedOffset, logicalHeight), applyTextIndent); 135 return adjustLogicalLeftOffsetForLine(logicalLeftFloatOffsetForLine(logi calTop, fixedOffset, logicalHeight), applyTextIndent);
150 } 136 }
151 137
152 virtual bool updateLogicalWidthAndColumnWidth() override; 138 virtual bool updateLogicalWidthAndColumnWidth() override;
153 139
154 void setLogicalLeftForChild(RenderBox* child, LayoutUnit logicalLeft); 140 void setLogicalLeftForChild(RenderBox* child, LayoutUnit logicalLeft);
155 void setLogicalTopForChild(RenderBox* child, LayoutUnit logicalTop); 141 void setLogicalTopForChild(RenderBox* child, LayoutUnit logicalTop);
156 void determineLogicalLeftPositionForChild(RenderBox* child); 142 void determineLogicalLeftPositionForChild(RenderBox* child);
157 143
158 private: 144 private:
159 void layoutBlockFlow(bool relayoutChildren, SubtreeLayoutScope&); 145 void layoutBlockFlow(bool relayoutChildren, SubtreeLayoutScope&);
160 void layoutBlockChildren(bool relayoutChildren, SubtreeLayoutScope&, LayoutU nit beforeEdge, LayoutUnit afterEdge); 146 void layoutBlockChildren(bool relayoutChildren, SubtreeLayoutScope&, LayoutU nit beforeEdge, LayoutUnit afterEdge);
161 147
162 void layoutBlockChild(RenderBox* child, MarginInfo&, LayoutUnit& previousFlo atLogicalBottom); 148 void layoutBlockChild(RenderBox* child, MarginInfo&);
163 void adjustPositionedBlock(RenderBox* child, const MarginInfo&); 149 void adjustPositionedBlock(RenderBox* child, const MarginInfo&);
164 void adjustFloatingBlock(const MarginInfo&);
165
166 LayoutPoint computeLogicalLocationForFloat(const FloatingObject*, LayoutUnit logicalTopOffset) const;
167
168 // Called from lineWidth, to position the floats added in the last line.
169 // Returns true if and only if it has positioned any floats.
170 bool positionNewFloats();
171
172 LayoutUnit getClearDelta(RenderBox* child, LayoutUnit yPos);
173
174 bool hasOverhangingFloats() { return parent() && containsFloats() && lowestF loatLogicalBottom() > logicalHeight(); }
175 bool hasOverhangingFloat(RenderBox*);
176 void addIntrudingFloats(RenderBlockFlow* prev, LayoutUnit xoffset, LayoutUni t yoffset);
177 void addOverhangingFloats(RenderBlockFlow* child, bool makeChildPaintOtherFl oats);
178
179 // FIXME(sky): Remove this.
180 LayoutUnit lowestFloatLogicalBottom() const { return 0; }
181 150
182 virtual bool hitTestFloats(const HitTestRequest&, HitTestResult&, const HitT estLocation& locationInContainer, const LayoutPoint& accumulatedOffset) override final; 151 virtual bool hitTestFloats(const HitTestRequest&, HitTestResult&, const HitT estLocation& locationInContainer, const LayoutPoint& accumulatedOffset) override final;
183 152
184 virtual void invalidatePaintForOverhangingFloats(bool paintAllDescendants) o verride final;
185 virtual void invalidatePaintForOverflow() override final; 153 virtual void invalidatePaintForOverflow() override final;
186 virtual void paintFloats(PaintInfo&, const LayoutPoint&, bool preservePhase = false) override final; 154 virtual void paintFloats(PaintInfo&, const LayoutPoint&, bool preservePhase = false) override final;
187 void clearFloats(EClear);
188 155
189 LayoutUnit logicalRightFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, LayoutUnit logicalHeight) const; 156 LayoutUnit logicalRightFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, LayoutUnit logicalHeight) const;
190 LayoutUnit logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit f ixedOffset, LayoutUnit logicalHeight) const; 157 LayoutUnit logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit f ixedOffset, LayoutUnit logicalHeight) const;
191 158
192 LayoutUnit logicalRightOffsetForPositioningFloat(LayoutUnit logicalTop, Layo utUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining) const; 159 LayoutUnit logicalRightOffsetForPositioningFloat(LayoutUnit logicalTop, Layo utUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining) const;
193 LayoutUnit logicalLeftOffsetForPositioningFloat(LayoutUnit logicalTop, Layou tUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining) const; 160 LayoutUnit logicalLeftOffsetForPositioningFloat(LayoutUnit logicalTop, Layou tUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining) const;
194 161
195 LayoutUnit adjustLogicalRightOffsetForLine(LayoutUnit offsetFromFloats, bool applyTextIndent) const; 162 LayoutUnit adjustLogicalRightOffsetForLine(LayoutUnit offsetFromFloats, bool applyTextIndent) const;
196 LayoutUnit adjustLogicalLeftOffsetForLine(LayoutUnit offsetFromFloats, bool applyTextIndent) const; 163 LayoutUnit adjustLogicalLeftOffsetForLine(LayoutUnit offsetFromFloats, bool applyTextIndent) const;
197 164
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 m_rareData->m_discardMarginAfter = false; 273 m_rareData->m_discardMarginAfter = false;
307 } 274 }
308 } 275 }
309 276
310 virtual ETextAlign textAlignmentForLine(bool endsWithSoftBreak) const; 277 virtual ETextAlign textAlignmentForLine(bool endsWithSoftBreak) const;
311 private: 278 private:
312 virtual LayoutUnit collapsedMarginBefore() const override final { return max PositiveMarginBefore() - maxNegativeMarginBefore(); } 279 virtual LayoutUnit collapsedMarginBefore() const override final { return max PositiveMarginBefore() - maxNegativeMarginBefore(); }
313 virtual LayoutUnit collapsedMarginAfter() const override final { return maxP ositiveMarginAfter() - maxNegativeMarginAfter(); } 280 virtual LayoutUnit collapsedMarginAfter() const override final { return maxP ositiveMarginAfter() - maxNegativeMarginAfter(); }
314 281
315 LayoutUnit collapseMargins(RenderBox* child, MarginInfo&, bool childIsSelfCo llapsing); 282 LayoutUnit collapseMargins(RenderBox* child, MarginInfo&, bool childIsSelfCo llapsing);
316 LayoutUnit clearFloatsIfNeeded(RenderBox* child, MarginInfo&, LayoutUnit old TopPosMargin, LayoutUnit oldTopNegMargin, LayoutUnit yPos, bool childIsSelfColla psing);
317 LayoutUnit estimateLogicalTopPosition(RenderBox* child, const MarginInfo&); 283 LayoutUnit estimateLogicalTopPosition(RenderBox* child, const MarginInfo&);
318 void marginBeforeEstimateForChild(RenderBox*, LayoutUnit&, LayoutUnit&, bool &) const; 284 void marginBeforeEstimateForChild(RenderBox*, LayoutUnit&, LayoutUnit&, bool &) const;
319 void handleAfterSideOfBlock(RenderBox* lastChild, LayoutUnit top, LayoutUnit bottom, MarginInfo&); 285 void handleAfterSideOfBlock(RenderBox* lastChild, LayoutUnit top, LayoutUnit bottom, MarginInfo&);
320 void setCollapsedBottomMargin(const MarginInfo&); 286 void setCollapsedBottomMargin(const MarginInfo&);
321 287
322 // Used to store state between styleWillChange and styleDidChange
323 static bool s_canPropagateFloatIntoSibling;
324
325 RenderBlockFlowRareData& ensureRareData(); 288 RenderBlockFlowRareData& ensureRareData();
326 289
327 LayoutUnit m_paintInvalidationLogicalTop; 290 LayoutUnit m_paintInvalidationLogicalTop;
328 LayoutUnit m_paintInvalidationLogicalBottom; 291 LayoutUnit m_paintInvalidationLogicalBottom;
329 292
330 virtual bool isSelfCollapsingBlock() const override; 293 virtual bool isSelfCollapsingBlock() const override;
331 294
332 protected: 295 protected:
333 OwnPtr<RenderBlockFlowRareData> m_rareData; 296 OwnPtr<RenderBlockFlowRareData> m_rareData;
334 297
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 330
368 // END METHODS DEFINED IN RenderBlockLineLayout 331 // END METHODS DEFINED IN RenderBlockLineLayout
369 332
370 }; 333 };
371 334
372 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlockFlow, isRenderBlockFlow()); 335 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlockFlow, isRenderBlockFlow());
373 336
374 } // namespace blink 337 } // namespace blink
375 338
376 #endif // RenderBlockFlow_h 339 #endif // RenderBlockFlow_h
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/rendering/RenderBlockFlow.cpp » ('j') | sky/engine/core/rendering/RenderBlockFlow.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698