Changeset 189910 in webkit
- Timestamp:
- Sep 17, 2015 2:13:35 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 26 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r189908 r189910 1 2015-09-17 Javier Fernandez <jfernandez@igalia.com> 2 3 [CSS Grid Layout] Relayout whenever Box Alignment properties change 4 https://bugs.webkit.org/show_bug.cgi?id=148070 5 6 Reviewed by Darin Adler. 7 8 Tests to verify we force a layout of grid container or grid items, as appropriated, 9 whenever Box Alignment properties change their value. 10 11 This patch also adds some repaint tests, so we can ensure we generate the correct 12 repaint rects as well. 13 14 * fast/css-grid-layout/relayout-align-items-changed-expected.txt: Added. 15 * fast/css-grid-layout/relayout-align-items-changed.html: Added. 16 * fast/css-grid-layout/relayout-align-self-changed-expected.txt: Added. 17 * fast/css-grid-layout/relayout-align-self-changed.html: Added. 18 * fast/css-grid-layout/relayout-justify-items-changed-expected.txt: Added. 19 * fast/css-grid-layout/relayout-justify-items-changed.html: Added. 20 * fast/css-grid-layout/relayout-justify-self-changed-expected.txt: Added. 21 * fast/css-grid-layout/relayout-justify-self-changed.html: Added. 22 * fast/repaint/align-items-change-expected.txt: Added. 23 * fast/repaint/align-items-change.html: Added. 24 * fast/repaint/align-items-overflow-change-expected.txt: Added. 25 * fast/repaint/align-items-overflow-change.html: Added. 26 * fast/repaint/align-self-change-expected.txt: Added. 27 * fast/repaint/align-self-change.html: Added. 28 * fast/repaint/align-self-overflow-change-expected.txt: Added. 29 * fast/repaint/align-self-overflow-change.html: Added. 30 * fast/repaint/justify-items-change-expected.txt: Added. 31 * fast/repaint/justify-items-change.html: Added. 32 * fast/repaint/justify-items-legacy-change-expected.txt: Added. 33 * fast/repaint/justify-items-legacy-change.html: Added. 34 * fast/repaint/justify-items-overflow-change-expected.txt: Added. 35 * fast/repaint/justify-items-overflow-change.html: Added. 36 * fast/repaint/justify-self-change-expected.txt: Added. 37 * fast/repaint/justify-self-change.html: Added. 38 * fast/repaint/justify-self-overflow-change-expected.txt: Added. 39 * fast/repaint/justify-self-overflow-change.html: Added. 40 1 41 2015-09-16 Carlos Garcia Campos <cgarcia@igalia.com> 2 42 -
trunk/Source/WebCore/ChangeLog
r189908 r189910 1 2015-09-17 Javier Fernandez <jfernandez@igalia.com> 2 3 [CSS Grid Layout] Relayout whenever Box Alignment properties change 4 https://bugs.webkit.org/show_bug.cgi?id=148070 5 6 Reviewed by Darin Adler. 7 8 We were Reattaching the styles to the RenderTree whenever Content Alignment 9 properties (align-items and justify-items) changed their values, since the 10 Self Alignment properties depend on such values to resolve 'auto' values 11 during layout. 12 13 This patch removes such restriction, since we resolve the auto values 14 whenever we access the alignment properties. The only thing we need to 15 do is to mark a grid item for layout whenever the Default Alignment 16 properties change from/to stretch, since it implies a resize of the grid 17 items using 'auto' values for the Self Alignment properties. 18 19 Tests: fast/css-grid-layout/relayout-align-items-changed.html 20 fast/css-grid-layout/relayout-align-self-changed.html 21 fast/css-grid-layout/relayout-justify-items-changed.html 22 fast/css-grid-layout/relayout-justify-self-changed.html 23 fast/repaint/align-items-change.html 24 fast/repaint/align-items-overflow-change.html 25 fast/repaint/align-self-change.html 26 fast/repaint/align-self-overflow-change.html 27 fast/repaint/justify-items-change.html 28 fast/repaint/justify-items-legacy-change.html 29 fast/repaint/justify-items-overflow-change.html 30 fast/repaint/justify-self-change.html 31 fast/repaint/justify-self-overflow-change.html 32 33 * rendering/RenderGrid.cpp: 34 (WebCore::defaultAlignmentIsStretch): 35 (WebCore::RenderGrid::styleDidChange): 36 * rendering/RenderGrid.h: 37 * rendering/style/RenderStyle.cpp: 38 (WebCore::RenderStyle::resolveAlignmentOverflow): 39 (WebCore::RenderStyle::changeRequiresLayout): 40 * style/StyleResolveTree.cpp: 41 (WebCore::Style::determineChange): Deleted. 42 1 43 2015-09-16 Carlos Garcia Campos <cgarcia@igalia.com> 2 44 -
trunk/Source/WebCore/rendering/RenderGrid.cpp
r189860 r189910 241 241 RenderGrid::~RenderGrid() 242 242 { 243 } 244 245 static inline bool defaultAlignmentIsStretch(ItemPosition position) 246 { 247 return position == ItemPositionStretch || position == ItemPositionAuto; 248 } 249 250 static inline bool defaultAlignmentChangedToStretchInRowAxis(const RenderStyle& oldStyle, const RenderStyle& newStyle) 251 { 252 return !defaultAlignmentIsStretch(oldStyle.justifyItemsPosition()) && defaultAlignmentIsStretch(newStyle.justifyItemsPosition()); 253 } 254 255 static inline bool defaultAlignmentChangedFromStretchInColumnAxis(const RenderStyle& oldStyle, const RenderStyle& newStyle) 256 { 257 return defaultAlignmentIsStretch(oldStyle.alignItemsPosition()) && !defaultAlignmentIsStretch(newStyle.alignItemsPosition()); 258 } 259 260 static inline bool selfAlignmentChangedToStretchInRowAxis(const RenderStyle& oldStyle, const RenderStyle& newStyle, const RenderStyle& childStyle) 261 { 262 return RenderStyle::resolveJustification(oldStyle, childStyle, ItemPositionStretch) != ItemPositionStretch 263 && RenderStyle::resolveJustification(newStyle, childStyle, ItemPositionStretch) == ItemPositionStretch; 264 } 265 266 static inline bool selfAlignmentChangedFromStretchInColumnAxis(const RenderStyle& oldStyle, const RenderStyle& newStyle, const RenderStyle& childStyle) 267 { 268 return RenderStyle::resolveAlignment(oldStyle, childStyle, ItemPositionStretch) == ItemPositionStretch 269 && RenderStyle::resolveAlignment(newStyle, childStyle, ItemPositionStretch) != ItemPositionStretch; 270 } 271 272 void RenderGrid::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) 273 { 274 RenderBlock::styleDidChange(diff, oldStyle); 275 if (!oldStyle || diff != StyleDifferenceLayout) 276 return; 277 278 const RenderStyle& newStyle = style(); 279 if (defaultAlignmentChangedToStretchInRowAxis(*oldStyle, newStyle) || defaultAlignmentChangedFromStretchInColumnAxis(*oldStyle, newStyle)) { 280 // Grid items that were not previously stretched in row-axis need to be relayed out so we can compute new available space. 281 // Grid items that were previously stretching in column-axis need to be relayed out so we can compute new available space. 282 // This is only necessary for stretching since other alignment values don't change the size of the box. 283 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) { 284 if (child->isOutOfFlowPositioned()) 285 continue; 286 if (selfAlignmentChangedToStretchInRowAxis(*oldStyle, newStyle, child->style()) || selfAlignmentChangedFromStretchInColumnAxis(*oldStyle, newStyle, child->style())) 287 child->setChildNeedsLayout(MarkOnlyThis); 288 } 289 } 243 290 } 244 291 -
trunk/Source/WebCore/rendering/RenderGrid.h
r189806 r189910 50 50 Element& element() const { return downcast<Element>(nodeForNonAnonymous()); } 51 51 52 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override; 52 53 virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) override; 53 54 -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r189830 r189910 197 197 OverflowAlignment RenderStyle::resolveAlignmentOverflow(const RenderStyle& parentStyle, const RenderStyle& childStyle) 198 198 { 199 return resolve JustificationData(parentStyle, childStyle, ItemPositionStretch).overflow();199 return resolveAlignmentData(parentStyle, childStyle, ItemPositionStretch).overflow(); 200 200 } 201 201 … … 525 525 || rareNonInheritedData->m_alignItems != other.rareNonInheritedData->m_alignItems 526 526 || rareNonInheritedData->m_alignSelf != other.rareNonInheritedData->m_alignSelf 527 || rareNonInheritedData->m_justifyContent != other.rareNonInheritedData->m_justifyContent) 527 || rareNonInheritedData->m_justifyContent != other.rareNonInheritedData->m_justifyContent 528 || rareNonInheritedData->m_justifyItems != other.rareNonInheritedData->m_justifyItems 529 || rareNonInheritedData->m_justifySelf != other.rareNonInheritedData->m_justifySelf) 528 530 return true; 529 531 -
trunk/Source/WebCore/style/StyleResolveTree.cpp
r189836 r189910 98 98 if (s1.hasFlowFrom() && (s1.specifiesColumns() != s2.specifiesColumns())) 99 99 return Detach; 100 if (s1.alignItems() != s2.alignItems())101 return Detach;102 100 103 101 if (s1 != s2) {
Note: See TracChangeset
for help on using the changeset viewer.