mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Remove layoutBlock.
We've simplified RenderBlock::layout to the point where we no longer need it or layoutBlock. The RenderBlock subclasses can just override layout the way every other renderer does. R=abarth@chromium.org Review URL: https://codereview.chromium.org/876663003
This commit is contained in:
parent
88f2015c22
commit
bebd6e370d
@ -304,12 +304,6 @@ void RenderBlock::updateScrollInfoAfterLayout()
|
||||
}
|
||||
}
|
||||
|
||||
void RenderBlock::layout()
|
||||
{
|
||||
// FIXME(sky): Inline layoutBlock here and get rid of it.
|
||||
layoutBlock(false);
|
||||
}
|
||||
|
||||
bool RenderBlock::widthAvailableToChildrenHasChanged()
|
||||
{
|
||||
bool widthAvailableToChildrenHasChanged = m_hasBorderOrPaddingLogicalWidthChanged;
|
||||
@ -329,12 +323,6 @@ bool RenderBlock::updateLogicalWidthAndColumnWidth()
|
||||
return oldWidth != logicalWidth() || widthAvailableToChildrenHasChanged();
|
||||
}
|
||||
|
||||
void RenderBlock::layoutBlock(bool)
|
||||
{
|
||||
ASSERT_NOT_REACHED();
|
||||
clearNeedsLayout();
|
||||
}
|
||||
|
||||
void RenderBlock::addOverflowFromChildren()
|
||||
{
|
||||
for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
|
||||
|
||||
@ -94,8 +94,6 @@ public:
|
||||
virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) override;
|
||||
virtual void removeChild(RenderObject*) override;
|
||||
|
||||
virtual void layoutBlock(bool relayoutChildren);
|
||||
|
||||
void insertPositionedObject(RenderBox*);
|
||||
static void removePositionedObject(RenderBox*);
|
||||
void removePositionedObjects(RenderBlock*, ContainingBlockState = SameContainingBlock);
|
||||
@ -208,8 +206,6 @@ protected:
|
||||
|
||||
void dirtyForLayoutFromPercentageHeightDescendants(SubtreeLayoutScope&);
|
||||
|
||||
virtual void layout() override;
|
||||
|
||||
enum PositionedLayoutBehavior {
|
||||
DefaultLayout,
|
||||
ForcedLayoutAfterContainingBlockMoved
|
||||
|
||||
@ -65,17 +65,17 @@ bool RenderBlockFlow::updateLogicalWidthAndColumnWidth()
|
||||
return RenderBlock::updateLogicalWidthAndColumnWidth();
|
||||
}
|
||||
|
||||
void RenderBlockFlow::layoutBlock(bool relayoutChildren)
|
||||
void RenderBlockFlow::layout()
|
||||
{
|
||||
ASSERT(needsLayout());
|
||||
ASSERT(isInlineBlock() || !isInline());
|
||||
|
||||
if (!relayoutChildren && simplifiedLayout())
|
||||
if (simplifiedLayout())
|
||||
return;
|
||||
|
||||
SubtreeLayoutScope layoutScope(*this);
|
||||
|
||||
layoutBlockFlow(relayoutChildren, layoutScope);
|
||||
layoutBlockFlow(layoutScope);
|
||||
|
||||
updateLayerTransformAfterLayout();
|
||||
|
||||
@ -86,11 +86,11 @@ void RenderBlockFlow::layoutBlock(bool relayoutChildren)
|
||||
clearNeedsLayout();
|
||||
}
|
||||
|
||||
inline void RenderBlockFlow::layoutBlockFlow(bool relayoutChildren, SubtreeLayoutScope& layoutScope)
|
||||
inline void RenderBlockFlow::layoutBlockFlow(SubtreeLayoutScope& layoutScope)
|
||||
{
|
||||
LayoutUnit oldLeft = logicalLeft();
|
||||
bool logicalWidthChanged = updateLogicalWidthAndColumnWidth();
|
||||
relayoutChildren |= logicalWidthChanged;
|
||||
bool relayoutChildren = logicalWidthChanged;
|
||||
|
||||
LayoutState state(*this, locationOffset(), logicalWidthChanged);
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ public:
|
||||
|
||||
virtual bool isRenderBlockFlow() const override final { return true; }
|
||||
|
||||
virtual void layoutBlock(bool relayoutChildren) override;
|
||||
void layout() override;
|
||||
|
||||
virtual void deleteLineBoxTree() override final;
|
||||
|
||||
@ -122,7 +122,7 @@ protected:
|
||||
void determineLogicalLeftPositionForChild(RenderBox* child);
|
||||
|
||||
private:
|
||||
void layoutBlockFlow(bool relayoutChildren, SubtreeLayoutScope&);
|
||||
void layoutBlockFlow(SubtreeLayoutScope&);
|
||||
|
||||
void layoutBlockChild(RenderBox* child);
|
||||
void adjustPositionedBlock(RenderBox* child);
|
||||
|
||||
@ -213,16 +213,14 @@ void RenderFlexibleBox::styleDidChange(StyleDifference diff, const RenderStyle*
|
||||
}
|
||||
}
|
||||
|
||||
void RenderFlexibleBox::layoutBlock(bool relayoutChildren)
|
||||
void RenderFlexibleBox::layout()
|
||||
{
|
||||
ASSERT(needsLayout());
|
||||
|
||||
if (!relayoutChildren && simplifiedLayout())
|
||||
if (simplifiedLayout())
|
||||
return;
|
||||
|
||||
if (updateLogicalWidthAndColumnWidth())
|
||||
relayoutChildren = true;
|
||||
|
||||
bool relayoutChildren = updateLogicalWidthAndColumnWidth();
|
||||
LayoutUnit previousHeight = logicalHeight();
|
||||
setLogicalHeight(borderAndPaddingLogicalHeight());
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ public:
|
||||
virtual const char* renderName() const override;
|
||||
|
||||
virtual bool isFlexibleBox() const override final { return true; }
|
||||
virtual void layoutBlock(bool relayoutChildren) override final;
|
||||
void layout() final;
|
||||
|
||||
virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
|
||||
virtual int firstLineBoxBaseline() const override;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user