Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[CSS Grid Layout] Upgrade align-self and align-items parsing to CSS 3
https://bugs.webkit.org/show_bug.cgi?id=133359 Reviewed by David Hyatt. From Blink r164817 and r165264 by <jchaffraix@chromium.org> Source/WebCore: Broaden justify-self's parsing name This is in preparation of migrating align-self, align-items and justify-items to the CSS 3 Alignment syntax. The current naming was too tied to justify-self and needs to be broadened. This will reduce the follow-up implementations' patches. Upgrade align-self and align-items parsing to CSS 3 This change migrates the 2 properties to the CSS 3 Alignment parsing. The new parsing is identical to how we parse 'justify-self'. The 2 properties need to be migrated together as they are used in tandem in CSSComputedStyleDeclaration. This change also removes EAlignItems as it is now unused. Tests: css3/parse-align-items.html css3/parse-align-self.html * css/CSSComputedStyleDeclaration.cpp: (WebCore::resolveAlignmentAuto): Added. Resolves the "auto" value for the alignment properties. (WebCore::valueForItemPositionWithOverflowAlignment): Added. Builds the CSSValue for the for the alignment properties. (WebCore::ComputedStyleExtractor::propertyValue): * css/CSSParser.cpp: (WebCore::isValidKeywordPropertyAndValue): Removed align-self, align-items and justify-items. (WebCore::isKeywordPropertyID): Removed align-self, align-items and justify-items. (WebCore::isBaselinePositionKeyword): Added. Set of keywords related to baseline value. (WebCore::CSSParser::parseItemPositionOverflowPosition): Generic parsing fuction for the alignment properties. (WebCore::CSSParser::parseJustifySelf): Deleted. (WebCore::CSSParser::parseValue): Added align-items and align-self to the list and call to the generic parsing fuction for the alignment properties. * css/CSSParser.h: * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Added. (WebCore::CSSPrimitiveValue::operator ItemPosition): Added. Replace the old EAlignItems enumeration. (WebCore::CSSPrimitiveValue::operator OverflowAlignment): Added. (WebCore::CSSPrimitiveValue::operator EAlignItems): Deleted. (WebCore::CSSPrimitiveValue::operator EJustifySelf): Deleted. (WebCore::CSSPrimitiveValue::operator EJustifySelfOverflowAlignment): Deleted. * css/CSSPropertyNames.in: * css/CSSValueKeywords.in: * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyInheritAlignSelf): Added. (WebCore::StyleBuilderCustom::applyInitialAlignSelf): Added. (WebCore::StyleBuilderCustom::applyValueAlignSelf): Added. (WebCore::StyleBuilderCustom::applyInheritAlignItems): Added. (WebCore::StyleBuilderCustom::applyInitialAlignItems): Added. (WebCore::StyleBuilderCustom::applyValueAlignItems): Added. (WebCore::StyleBuilderCustom::applyInheritJustifySelf): Added. (WebCore::StyleBuilderCustom::applyInitialJustifySelf): Added. (WebCore::StyleBuilderCustom::applyValueJustifySelf): Added. (WebCore::StyleBuilderCustom::applyValueWebkitJustifySelf): Deleted. * css/StyleResolver.cpp: (WebCore::StyleResolver::adjustRenderStyle): isDisplayFlexibleOrGridBox now a RenderStyle function. (WebCore::isDisplayFlexibleBox): Deleted. Moved to RenderStyle. (WebCore::isDisplayGridBox): Deleted. Moved to RenderStyle. (WebCore::isDisplayFlexibleOrGridBox): Deleted. Moved to RenderStyle. * rendering/RenderBox.cpp: (WebCore::flexItemHasStretchAlignment): Adapted to the new ItemPostition enum. * rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::firstLineBaseline): Adapted to the new ItemPostition enum. (WebCore::RenderFlexibleBox::styleDidChange): Adapted to the new ItemPostition enum. (WebCore::RenderFlexibleBox::alignmentForChild): Adapted to the new ItemPostition enum. (WebCore::RenderFlexibleBox::needToStretchChild): Adapted to the new ItemPostition enum. (WebCore::RenderFlexibleBox::layoutAndPlaceChildren): Adapted to the new ItemPostition enum. (WebCore::RenderFlexibleBox::alignChildren): Adapted to the new ItemPostition enum. (WebCore::resolveAlignment): Deleted. Moved to RenderStyle. * rendering/RenderFlexibleBox.h: * rendering/RenderFullScreen.cpp: (WebCore::createFullScreenStyle): Adapted to the new ItemPostition enum. * rendering/RenderMenuList.cpp: (WebCore::RenderMenuList::adjustInnerStyle): Adapted to the new ItemPostition enum. * rendering/mathml/RenderMathMLRoot.cpp: (WebCore::RenderMathMLRoot::updateStyle): Adapted to the new ItemPostition enum. * rendering/mathml/RenderMathMLScripts.cpp: (WebCore::RenderMathMLScripts::fixAnonymousStyleForSubSupPair): Adapted to the new ItemPostition enum. (WebCore::RenderMathMLScripts::fixAnonymousStyles): Adapted to the new ItemPostition enum. * rendering/style/ContentData.h: * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::resolveAlignment): Added. * rendering/style/RenderStyle.h: Adapted to the new ItemPostition enum. * rendering/style/RenderStyleConstants.h: Adapted to the new ItemPostition enum. * rendering/style/StyleRareNonInheritedData.cpp: Adapted to the new ItemPostition enum. (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): Adapted to the new ItemPostition enum. (WebCore::StyleRareNonInheritedData::operator==): Adapted to the new ItemPostition enum. * rendering/style/StyleRareNonInheritedData.h: Adapted to the new ItemPostition enum. * style/StyleResolveTree.cpp: (WebCore::Style::determineChange): Changes in the alignItems property cause a Detach. LayoutTests: Broaden justify-self's parsing name and upgrade align-self and align-items parsing to CSS 3. * TestExpectations: * css3/flexbox/css-properties-expected.txt: * css3/flexbox/css-properties.html: * css3/parse-align-items-expected.txt: Added. * css3/parse-align-items.html: Added. * css3/parse-align-self-expected.txt: Added. * css3/parse-align-self.html: Added. * css3/resources/alignment-parsing-utils.js: Added. (checkValues): (checkBadValues): (checkInitialValues): (checkInheritValues): (checkLegacyValues): * fast/css/getComputedStyle/computed-style-expected.txt: * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt: * fast/css/getComputedStyle/resources/property-names.js: * fast/css/parse-justify-self-expected.txt: * fast/css/parse-justify-self.html: * svg/css/getComputedStyle-basic-expected.txt: Canonical link: https://commits.webkit.org/161247@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182147 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
with
1,502 additions
and 383 deletions.
- +32 −0 LayoutTests/ChangeLog
- +4 −0 LayoutTests/TestExpectations
- +14 −7 LayoutTests/css3/flexbox/css-properties-expected.txt
- +17 −9 LayoutTests/css3/flexbox/css-properties.html
- +137 −0 LayoutTests/css3/parse-align-items-expected.txt
- +270 −0 LayoutTests/css3/parse-align-items.html
- +155 −0 LayoutTests/css3/parse-align-self-expected.txt
- +291 −0 LayoutTests/css3/parse-align-self.html
- +46 −0 LayoutTests/css3/resources/alignment-parsing-utils.js
- +3 −2 LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt
- +3 −2 LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
- +1 −0 LayoutTests/fast/css/getComputedStyle/resources/property-names.js
- +42 −44 LayoutTests/fast/css/parse-justify-self-expected.txt
- +80 −86 LayoutTests/fast/css/parse-justify-self.html
- +12 −8 LayoutTests/svg/css/getComputedStyle-basic-expected.txt
- +99 −0 Source/WebCore/ChangeLog
- +37 −16 Source/WebCore/css/CSSComputedStyleDeclaration.cpp
- +14 −22 Source/WebCore/css/CSSParser.cpp
- +1 −1 Source/WebCore/css/CSSParser.h
- +41 −90 Source/WebCore/css/CSSPrimitiveValueMappings.h
- +3 −3 Source/WebCore/css/CSSPropertyNames.in
- +2 −0 Source/WebCore/css/CSSValueKeywords.in
- +75 −12 Source/WebCore/css/StyleBuilderCustom.h
- +2 −22 Source/WebCore/css/StyleResolver.cpp
- +4 −0 Source/WebCore/mathml/MathMLTextElement.cpp
- +1 −1 Source/WebCore/rendering/RenderBox.cpp
- +37 −29 Source/WebCore/rendering/RenderFlexibleBox.cpp
- +1 −1 Source/WebCore/rendering/RenderFlexibleBox.h
- +1 −1 Source/WebCore/rendering/RenderFullScreen.cpp
- +2 −2 Source/WebCore/rendering/RenderMenuList.cpp
- +2 −2 Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp
- +3 −3 Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp
- +4 −1 Source/WebCore/rendering/style/ContentData.h
- +8 −0 Source/WebCore/rendering/style/RenderStyle.cpp
- +41 −12 Source/WebCore/rendering/style/RenderStyle.h
- +2 −3 Source/WebCore/rendering/style/RenderStyleConstants.h
- +7 −0 Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
- +6 −4 Source/WebCore/rendering/style/StyleRareNonInheritedData.h
- +2 −0 Source/WebCore/style/StyleResolveTree.cpp
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,137 @@ | ||
Test that setting and getting align-items works as expected | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
Test getting align-items set through CSS | ||
PASS getComputedStyle(alignItemsBaseline, '').getPropertyValue('-webkit-align-items') is 'baseline' | ||
PASS getComputedStyle(alignItemsLastBaseline, '').getPropertyValue('-webkit-align-items') is 'last-baseline' | ||
PASS getComputedStyle(alignItemsStretch, '').getPropertyValue('-webkit-align-items') is 'stretch' | ||
PASS getComputedStyle(alignItemsStart, '').getPropertyValue('-webkit-align-items') is 'start' | ||
PASS getComputedStyle(alignItemsEnd, '').getPropertyValue('-webkit-align-items') is 'end' | ||
PASS getComputedStyle(alignItemsCenter, '').getPropertyValue('-webkit-align-items') is 'center' | ||
PASS getComputedStyle(alignItemsSelfEnd, '').getPropertyValue('-webkit-align-items') is 'self-end' | ||
PASS getComputedStyle(alignItemsSelfStart, '').getPropertyValue('-webkit-align-items') is 'self-start' | ||
PASS getComputedStyle(alignItemsLeft, '').getPropertyValue('-webkit-align-items') is 'left' | ||
PASS getComputedStyle(alignItemsRight, '').getPropertyValue('-webkit-align-items') is 'right' | ||
PASS getComputedStyle(alignItemsFlexStart, '').getPropertyValue('-webkit-align-items') is 'flex-start' | ||
PASS getComputedStyle(alignItemsFlexEnd, '').getPropertyValue('-webkit-align-items') is 'flex-end' | ||
PASS getComputedStyle(alignItemsEndTrue, '').getPropertyValue('-webkit-align-items') is 'end true' | ||
PASS getComputedStyle(alignItemsCenterTrue, '').getPropertyValue('-webkit-align-items') is 'center true' | ||
PASS getComputedStyle(alignItemsSelfEndSafe, '').getPropertyValue('-webkit-align-items') is 'self-end safe' | ||
PASS getComputedStyle(alignItemsSelfStartSafe, '').getPropertyValue('-webkit-align-items') is 'self-start safe' | ||
PASS getComputedStyle(alignItemsRightSafe, '').getPropertyValue('-webkit-align-items') is 'right safe' | ||
PASS getComputedStyle(alignItemsLeftTrue, '').getPropertyValue('-webkit-align-items') is 'left true' | ||
PASS getComputedStyle(alignItemsFlexStartTrue, '').getPropertyValue('-webkit-align-items') is 'flex-start true' | ||
PASS getComputedStyle(alignItemsFlexEndSafe, '').getPropertyValue('-webkit-align-items') is 'flex-end safe' | ||
|
||
Test initial value of align-items through JS | ||
PASS getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is 'start' | ||
|
||
Test getting and setting align-items through JS | ||
PASS element.style.webkitAlignItems is "center" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "center" | ||
PASS element.style.webkitAlignItems is "start true" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start true" | ||
PASS element.style.webkitAlignItems is "flex-end safe" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "flex-end safe" | ||
PASS element.style.webkitAlignItems is "right" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "right" | ||
PASS element.style.webkitAlignItems is "center" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "center" | ||
PASS element.style.webkitAlignItems is "self-start" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "self-start" | ||
PASS element.style.webkitAlignItems is "auto" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
PASS element.style.webkitAlignItems is "auto" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "stretch" | ||
PASS element.style.webkitAlignItems is "auto" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "stretch" | ||
PASS element.style.webkitAlignItems is "self-end" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "self-end" | ||
|
||
Test bad combinations of align-items | ||
PASS element.style.webkitAlignItems is "" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
PASS element.style.webkitAlignItems is "" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
PASS element.style.webkitAlignItems is "" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
PASS element.style.webkitAlignItems is "" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
PASS element.style.webkitAlignItems is "" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
PASS element.style.webkitAlignItems is "" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
PASS element.style.webkitAlignItems is "" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
PASS element.style.webkitAlignItems is "" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
PASS element.style.webkitAlignItems is "" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
PASS element.style.webkitAlignItems is "" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
PASS element.style.webkitAlignItems is "" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
PASS element.style.webkitAlignItems is "" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
PASS element.style.webkitAlignItems is "" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
PASS element.style.webkitAlignItems is "" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
PASS element.style.webkitAlignItems is "" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
PASS element.style.webkitAlignItems is "" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
PASS element.style.webkitAlignItems is "" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
PASS element.style.webkitAlignItems is "" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
PASS element.style.webkitAlignItems is "" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
PASS element.style.webkitAlignItems is "" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
PASS element.style.webkitAlignItems is "" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
PASS element.style.webkitAlignItems is "" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
PASS element.style.webkitAlignItems is "" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
PASS element.style.webkitAlignItems is "" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
|
||
Test the value 'initial' | ||
PASS element.style.webkitAlignItems is "center" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "center" | ||
PASS element.style.webkitAlignItems is "initial" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "start" | ||
|
||
Test the value 'initial' for grid containers | ||
PASS element.style.webkitAlignItems is "left safe" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "left safe" | ||
PASS element.style.webkitAlignItems is "initial" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "stretch" | ||
|
||
Test the value 'initial' for flex containers | ||
PASS element.style.webkitAlignItems is "right true" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "right true" | ||
PASS element.style.webkitAlignItems is "initial" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "stretch" | ||
|
||
Test the value 'inherit' | ||
PASS element.style.webkitAlignItems is "end" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "end" | ||
PASS element.style.webkitAlignItems is "inherit" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "end" | ||
PASS element.style.webkitAlignItems is "left safe" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "left safe" | ||
PASS element.style.webkitAlignItems is "inherit" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "left safe" | ||
PASS element.style.webkitAlignItems is "center true" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "center true" | ||
PASS element.style.webkitAlignItems is "inherit" | ||
PASS window.getComputedStyle(element, '').getPropertyValue('-webkit-align-items') is "center true" | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
Oops, something went wrong.