REGRESSION: Block no longer shrinks to preferred width in this flex box layout
authorhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Mar 2017 01:29:19 +0000 (01:29 +0000)
committerhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Mar 2017 01:29:19 +0000 (01:29 +0000)
commit7c77914479b86a3f137753ffc0deb3e486f0cd2c
treeb0679cb161dac2b90ddb65b4eac321374ecbfe63
parent10446e8dec12c6574e592c311b29d8f6664ceec4
REGRESSION: Block no longer shrinks to preferred width in this flex box layout
https://bugs.webkit.org/show_bug.cgi?id=169203
<rdar://problem/30873895>

Reviewed by Simon Fraser.

Source/WebCore:

Added new test in css3/flexbox.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::adjustRenderStyle):
(WebCore::StyleResolver::adjustStyleForAlignment):
* html/shadow/TextControlInnerElements.cpp:
(WebCore::TextControlInnerElement::resolveCustomStyle):
Resolve auto alignment values by adjusting the render style as needed. Make a helper
function for adjusting only alignment that can be called from the inner text control
custom style creation.

* rendering/GridTrackSizingAlgorithm.cpp:
(WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild):
Replaced items in grids should not stretch by default.

* rendering/RenderBox.cpp:
(WebCore::RenderBox::hasStretchedLogicalWidth):
Patched to properly check the default alignment for the child, making sure
that if it's a replacd item inside a grid, that the default is start and not
stretch.

* rendering/RenderBox.h:
(WebCore::RenderBox::selfAlignmentNormalBehavior):
Self-alignment function now takes an optional child argument, since the behavior
varies in grids depending on the child being replaced or not.

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::alignmentForChild):
Fixed to do the right thing when the child is anonymous.

(WebCore::RenderFlexibleBox::styleDidChange): Deleted.
* rendering/RenderFlexibleBox.h:
Deleted, since alignment changes are handled at the style diff level now.

* rendering/RenderFullScreen.h:
Patched the selfAlignmentNormalBehavior method to take an optional child argument.

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::styleDidChange):
(WebCore::RenderGrid::alignSelfForChild):
(WebCore::RenderGrid::justifySelfForChild):
(WebCore::RenderGrid::columnAxisPositionForChild):
(WebCore::RenderGrid::rowAxisPositionForChild):
(WebCore::RenderGrid::columnAxisOffsetForChild):
(WebCore::RenderGrid::rowAxisOffsetForChild):
(WebCore::defaultAlignmentIsStretch): Deleted.
(WebCore::defaultAlignmentChangedToStretchInRowAxis): Deleted.
(WebCore::defaultAlignmentChangedFromStretchInRowAxis): Deleted.
(WebCore::defaultAlignmentChangedFromStretchInColumnAxis): Deleted.
(WebCore::selfAlignmentChangedToStretchInRowAxis): Deleted.
(WebCore::selfAlignmentChangedFromStretchInRowAxis): Deleted.
(WebCore::selfAlignmentChangedFromStretchInColumnAxis): Deleted.
* rendering/RenderGrid.h:
Removed the alignment change logic in styleDidChange for grids, since style diffing handles
it now. Updated all selfAlignmentForNormalBehavior queries to pass in the child so that
replaced elements are handled properly.

* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::overflowInlineDirection):
(WebCore::RenderStyle::overflowBlockDirection):
(WebCore::RenderStyle::setJustifySelfPosition):
New helpers used by grid and by adjustRenderStyle.

* style/StyleChange.cpp:
(WebCore::Style::determineChange):
If alignment or justification changes occur on a parent that could affect the child (e.g., align-items)
return Inherit so the child render styles get adjusted properly.

LayoutTests:

* css3/flexbox/column-inside-normal-block-preferred-width-expected.html: Added.
* css3/flexbox/column-inside-normal-block-preferred-width.html: Added.
* fast/css-grid-layout/grid-align-stretching-replaced-items-expected.txt:
* fast/css-grid-layout/grid-align-stretching-replaced-items.html:
* fast/repaint/align-items-change-expected.txt:
* fast/repaint/align-items-overflow-change-expected.txt:
* fast/repaint/justify-items-change-expected.txt:
* fast/repaint/justify-items-legacy-change-expected.txt:
* fast/repaint/justify-items-overflow-change-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213480 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed:
LayoutTests/ChangeLog
LayoutTests/css3/flexbox/column-inside-normal-block-preferred-width-expected.html [new file with mode: 0644]
LayoutTests/css3/flexbox/column-inside-normal-block-preferred-width.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-align-stretching-replaced-items-expected.txt
LayoutTests/fast/css-grid-layout/grid-align-stretching-replaced-items.html
LayoutTests/fast/repaint/align-items-change-expected.txt
LayoutTests/fast/repaint/align-items-overflow-change-expected.txt
LayoutTests/fast/repaint/justify-items-change-expected.txt
LayoutTests/fast/repaint/justify-items-legacy-change-expected.txt
LayoutTests/fast/repaint/justify-items-overflow-change-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/StyleResolver.h
Source/WebCore/html/shadow/TextControlInnerElements.cpp
Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBox.h
Source/WebCore/rendering/RenderFlexibleBox.cpp
Source/WebCore/rendering/RenderFlexibleBox.h
Source/WebCore/rendering/RenderFullScreen.h
Source/WebCore/rendering/RenderGrid.cpp
Source/WebCore/rendering/RenderGrid.h
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/style/StyleChange.cpp