Index: third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp |
index 644462c02b06b7beca7a8293bf04c25832650309..0b77851ed1035d6f1324f7fafeff55715eb15a15 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp |
@@ -892,9 +892,14 @@ void LayoutFlexibleBox::layoutFlexItems(bool relayoutChildren, SubtreeLayoutScop |
PaintLayerScrollableArea::PreventRelayoutScope preventRelayoutScope(layoutScope); |
+ // Fieldsets need to find their legend and position it inside the border of the object. |
+ // The legend then gets skipped during normal layout. |
+ // It doesn't get included in the normal layout process but is instead skipped. |
+ LayoutObject* childToExclude = layoutSpecialExcludedChild(relayoutChildren, layoutScope); |
+ |
m_orderIterator.first(); |
LayoutUnit crossAxisOffset = flowAwareBorderBefore() + flowAwarePaddingBefore(); |
- while (computeNextFlexLine(orderedChildren, sumFlexBaseSize, totalFlexGrow, totalFlexShrink, totalWeightedFlexShrink, sumHypotheticalMainSize, relayoutChildren)) { |
+ while (computeNextFlexLine(orderedChildren, sumFlexBaseSize, totalFlexGrow, totalFlexShrink, totalWeightedFlexShrink, sumHypotheticalMainSize, relayoutChildren, childToExclude)) { |
LayoutUnit containerMainInnerSize = mainAxisContentExtent(sumHypotheticalMainSize); |
// availableFreeSpace is the initial amount of free space in this flexbox. |
// remainingFreeSpace starts out at the same value but as we place and lay out |
@@ -1220,7 +1225,7 @@ LayoutFlexibleBox::FlexItem LayoutFlexibleBox::constructFlexItem(LayoutBox& chil |
return FlexItem(&child, childInnerFlexBaseSize, childMinMaxAppliedMainAxisExtent, borderAndPadding, margin); |
} |
-bool LayoutFlexibleBox::computeNextFlexLine(OrderedFlexItemList& orderedChildren, LayoutUnit& sumFlexBaseSize, double& totalFlexGrow, double& totalFlexShrink, double& totalWeightedFlexShrink, LayoutUnit& sumHypotheticalMainSize, bool relayoutChildren) |
+bool LayoutFlexibleBox::computeNextFlexLine(OrderedFlexItemList& orderedChildren, LayoutUnit& sumFlexBaseSize, double& totalFlexGrow, double& totalFlexShrink, double& totalWeightedFlexShrink, LayoutUnit& sumHypotheticalMainSize, bool relayoutChildren, LayoutObject* childToExclude) |
{ |
orderedChildren.clear(); |
sumFlexBaseSize = LayoutUnit(); |
@@ -1235,6 +1240,10 @@ bool LayoutFlexibleBox::computeNextFlexLine(OrderedFlexItemList& orderedChildren |
bool lineHasInFlowItem = false; |
for (LayoutBox* child = m_orderIterator.currentChild(); child; child = m_orderIterator.next()) { |
+ |
+ if (childToExclude == child) |
+ continue; // Skip this child, since it will be positioned by the specialized subclass (fieldsets runs). |
+ |
if (child->isOutOfFlowPositioned()) { |
orderedChildren.append(FlexItem(child)); |
continue; |