Changeset 136324 in webkit
- Timestamp:
- Dec 2, 2012, 2:39:51 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r136323 r136324 1 2012-12-02 Tony Chang <tony@chromium.org> 2 3 Avoid a second layout of flex items in layoutAndPlaceChildren() 4 https://bugs.webkit.org/show_bug.cgi?id=102352 5 6 Reviewed by Ojan Vafai. 7 8 Add a test case to make sure we relayout when a sibling is stretching. 9 10 * css3/flexbox/stretch-after-sibling-size-change-expected.txt: Added. 11 * css3/flexbox/stretch-after-sibling-size-change.html: Added. 12 1 13 2012-12-02 Yongjun Zhang <yongjun_zhang@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r136323 r136324 1 2012-12-02 Tony Chang <tony@chromium.org> 2 3 Avoid a second layout of flex items in layoutAndPlaceChildren() 4 https://bugs.webkit.org/show_bug.cgi?id=102352 5 6 Reviewed by Ojan Vafai. 7 8 Avoid doing a second layout if we're going to get the same size as before. 9 This prevents us from doing an exponential number of layouts in some 10 common cases. 11 12 Test: css3/flexbox/stretch-after-sibling-size-change.html 13 14 * html/shadow/SliderThumbElement.cpp: 15 (WebCore::RenderSliderContainer::layout): Force a layout of the track, which positions the thumb. 16 * rendering/RenderFlexibleBox.cpp: 17 (WebCore::RenderFlexibleBox::needToStretchChild): Determine if a child is going to stretch. 18 (WebCore::RenderFlexibleBox::resetAutoMarginsAndLogicalTopInCrossAxis): Makes sure we're in a consistent state before 19 we apply auto margins. 20 (WebCore::RenderFlexibleBox::layoutAndPlaceChildren): 21 * rendering/RenderFlexibleBox.h: Add needToStretchChild. 22 1 23 2012-12-02 Yongjun Zhang <yongjun_zhang@apple.com> 2 24 -
trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp
r135913 r136324 179 179 180 180 RenderBox* thumb = 0; 181 RenderBox* track = 0; 181 182 if (input->sliderThumbElement() && input->sliderThumbElement()->renderer()) { 182 183 thumb = toRenderBox(input->sliderThumbElement()->renderer()); 183 // Reset the thumb location before layout. 184 thumb->setLocation(LayoutPoint()); 184 track = toRenderBox(thumb->parent()); 185 // Force a layout to reset the position of the thumb so the code below doesn't move the thumb to the wrong place. 186 // FIXME: Make a custom Render class for the track and move the thumb positioning code there. 187 track->setChildNeedsLayout(true, MarkOnlyThis); 185 188 } 186 189 … … 191 194 if (!thumb) 192 195 return; 193 RenderBox* track = toRenderBox(thumb->parent());194 196 195 197 double percentageOffset = sliderPosition(input).toDouble(); -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r134683 r136324 1066 1066 } 1067 1067 1068 bool RenderFlexibleBox::needToStretchChild(RenderBox* child) 1069 { 1070 if (alignmentForChild(child) != AlignStretch) 1071 return false; 1072 1073 Length crossAxisLength = isHorizontalFlow() ? child->style()->height() : child->style()->width(); 1074 return crossAxisLength.isAuto(); 1075 } 1076 1077 void RenderFlexibleBox::resetAutoMarginsAndLogicalTopInCrossAxis(RenderBox* child) 1078 { 1079 if (hasAutoMarginsInCrossAxis(child)) 1080 child->updateLogicalHeight(); 1081 } 1082 1068 1083 void RenderFlexibleBox::layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, const OrderedFlexItemList& children, const WTF::Vector<LayoutUnit>& childSizes, LayoutUnit availableFreeSpace, WTF::Vector<LineContext>& lineContexts) 1069 1084 { … … 1091 1106 setLogicalOverrideSize(child, childPreferredSize); 1092 1107 // FIXME: Can avoid laying out here in some cases. See https://webkit.org/b/87905. 1093 child->setChildNeedsLayout(true, MarkOnlyThis); 1108 if (needToStretchChild(child) || childPreferredSize != mainAxisExtentForChild(child)) 1109 child->setChildNeedsLayout(true, MarkOnlyThis); 1110 else { 1111 // To avoid double applying margin changes in updateAutoMarginsInCrossAxis, we reset the margins here. 1112 resetAutoMarginsAndLogicalTopInCrossAxis(child); 1113 } 1094 1114 child->layoutIfNeeded(); 1095 1115 -
trunk/Source/WebCore/rendering/RenderFlexibleBox.h
r134683 r136324 135 135 void freezeViolations(const WTF::Vector<Violation>&, LayoutUnit& availableFreeSpace, double& totalFlexGrow, double& totalWeightedFlexShrink, InflexibleFlexItemSize&); 136 136 137 void resetAutoMarginsAndLogicalTopInCrossAxis(RenderBox*); 138 bool needToStretchChild(RenderBox*); 137 139 void setLogicalOverrideSize(RenderBox* child, LayoutUnit childPreferredSize); 138 140 void prepareChildForPositionedLayout(RenderBox* child, LayoutUnit mainAxisOffset, LayoutUnit crossAxisOffset, PositionedLayoutMode);
Note:
See TracChangeset
for help on using the changeset viewer.