From 2bb551c41e4d8a129f6022c7a70b901b873f9ad8 Mon Sep 17 00:00:00 2001 From: "tony@chromium.org" Date: Fri, 24 Feb 2012 09:53:12 +0000 Subject: [PATCH] Small refactor in RenderFlexibleBox::layoutAndPlaceChildren https://bugs.webkit.org/show_bug.cgi?id=79420 Reviewed by Ojan Vafai. No new tests, just a refactor. * rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::layoutAndPlaceChildren): Share some of the logic in computing the cross axis length. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108755 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebCore/ChangeLog | 13 +++++++++++++ Source/WebCore/rendering/RenderFlexibleBox.cpp | 10 ++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index e639267..c23efc2 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,16 @@ +2012-02-24 Tony Chang + + Small refactor in RenderFlexibleBox::layoutAndPlaceChildren + https://bugs.webkit.org/show_bug.cgi?id=79420 + + Reviewed by Ojan Vafai. + + No new tests, just a refactor. + + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::layoutAndPlaceChildren): Share some of the logic + in computing the cross axis length. + 2012-02-24 Yury Semikhatsky Web Inspector: cannot drag timeline overview window when clicking inside the window diff --git a/Source/WebCore/rendering/RenderFlexibleBox.cpp b/Source/WebCore/rendering/RenderFlexibleBox.cpp index e45eb74..f2f993d 100644 --- a/Source/WebCore/rendering/RenderFlexibleBox.cpp +++ b/Source/WebCore/rendering/RenderFlexibleBox.cpp @@ -734,6 +734,7 @@ void RenderFlexibleBox::layoutAndPlaceChildren(const OrderedFlexItemList& childr child->setChildNeedsLayout(true); child->layoutIfNeeded(); + LayoutUnit childCrossAxisExtent; if (flexAlignForChild(child) == AlignBaseline) { LayoutUnit ascent = marginBoxAscent(child); LayoutUnit descent = (crossAxisMarginExtentForChild(child) + crossAxisExtentForChild(child)) - ascent; @@ -741,10 +742,11 @@ void RenderFlexibleBox::layoutAndPlaceChildren(const OrderedFlexItemList& childr maxAscent = std::max(maxAscent, ascent); maxDescent = std::max(maxDescent, descent); - if (crossAxisLength().isAuto()) - setCrossAxisExtent(std::max(crossAxisExtent(), crossAxisBorderAndPaddingExtent() + crossAxisMarginExtentForChild(child) + maxAscent + maxDescent + crossAxisScrollbarExtent())); - } else if (crossAxisLength().isAuto()) - setCrossAxisExtent(std::max(crossAxisExtent(), crossAxisBorderAndPaddingExtent() + crossAxisMarginExtentForChild(child) + crossAxisExtentForChild(child) + crossAxisScrollbarExtent())); + childCrossAxisExtent = maxAscent + maxDescent; + } else + childCrossAxisExtent = crossAxisExtentForChild(child); + if (crossAxisLength().isAuto()) + setCrossAxisExtent(std::max(crossAxisExtent(), crossAxisBorderAndPaddingExtent() + crossAxisMarginExtentForChild(child) + childCrossAxisExtent + crossAxisScrollbarExtent())); mainAxisOffset += flowAwareMarginStartForChild(child); -- 2.7.4