haikuwebkit/LayoutTests/css3/resources/alignment-parsing-utils.js

49 lines
1.8 KiB
JavaScript
Raw Permalink Normal View History

[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
2015-03-30 18:33:39 +00:00
function checkValues(element, property, propertyID, value, computedValue)
{
window.element = element;
var elementID = element.id || "element";
shouldBeEqualToString("element.style." + property, value);
shouldBeEqualToString("window.getComputedStyle(" + elementID + ", '').getPropertyValue('" + propertyID + "')", computedValue);
}
function checkBadValues(element, property, propertyID, value)
{
[CSS Box Alignment] New CSS Value 'normal' for Content Alignment https://bugs.webkit.org/show_bug.cgi?id=154282 Source/WebCore: Reviewed by David Hyatt. The Box Alignment specification defines a new value 'normal' to be used as default for the different layout models, which will define the specific behavior for each case. This patch adds a new CSS value in the parsing logic and adapts the Content Alignment properties to the new value. The 'auto' value is no longer valid and the Computed Value will be always the specified value. Hence, I removed the StyleResolver logic because is not required now; the specific behavior of the 'normal' value will be resolved at layout time. Computed value of both align-content and justify-content is the specified value, we don't have to resolve any 'auto' value now. Additionally, this patch updates the layout logic as well, for both Flexbox and Grid layout models. No new tests, since we only need to rebaseline those test cases affected by the new default computed value. * css/CSSComputedStyleDeclaration.cpp: (WebCore::valueForContentPositionAndDistributionWithOverflowAlignment): (WebCore::ComputedStyleExtractor::propertyValue): (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Deleted. (WebCore::CSSComputedStyleDeclaration::copyProperties): Deleted. (WebCore::nodeOrItsAncestorNeedsStyleRecalc): Deleted. (WebCore::isFlexOrGrid): Deleted. (WebCore::ComputedStyleExtractor::customPropertyValue): Deleted. * css/CSSParser.cpp: (WebCore::CSSParser::parseContentDistributionOverflowPosition): * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator ContentPosition): * rendering/RenderFlexibleBox.cpp: (WebCore::normalValueBehavior): (WebCore::RenderFlexibleBox::layoutAndPlaceChildren): (WebCore::RenderFlexibleBox::layoutColumnReverse): (WebCore::RenderFlexibleBox::alignFlexLines): (WebCore::alignContentSpaceBetweenChildren): Deleted. * rendering/RenderGrid.cpp: (WebCore::normalValueBehavior): (WebCore::RenderGrid::applyStretchAlignmentToTracksIfNeeded): (WebCore::RenderGrid::columnAxisOffsetForChild): (WebCore::RenderGrid::rowAxisOffsetForChild): (WebCore::resolveContentDistributionFallback): (WebCore::contentDistributionOffset): (WebCore::RenderGrid::computeContentPositionAndDistributionOffset): * rendering/style/RenderStyle.cpp: (WebCore::resolvedContentAlignmentPosition): (WebCore::resolvedContentAlignmentDistribution): (WebCore::RenderStyle::resolvedJustifyContentPosition): (WebCore::RenderStyle::resolvedJustifyContentDistribution): (WebCore::RenderStyle::resolvedAlignContentPosition): (WebCore::RenderStyle::resolvedAlignContentDistribution): * rendering/style/RenderStyle.h: * rendering/style/RenderStyleConstants.h: LayoutTests: The Box Alignment specification defines a new value 'normal' to be used as default for the different layout models, which will define the specific behavior for each case. This patch adds a new CSS value in the parsing logic and adapts the Content Alignment properties to the new value. Since the 'normal' vlaue, initial/default for both justify-content and align-content CSS properties, behaves now as 'stretch' instead of o'start' we have to rebaseline those tests affected by the new default value. Reviewed by David Hyatt. * css3/flexbox/css-properties-expected.txt: * css3/flexbox/css-properties.html: * css3/parse-align-content-expected.txt: * css3/parse-align-content.html: * css3/parse-justify-content-expected.txt: * css3/parse-justify-content.html: * css3/resources/alignment-parsing-utils.js: (checkBadValues): * fast/css-grid-layout/auto-content-resolution-columns.html: * fast/css-grid-layout/grid-auto-columns-rows-update.html: * fast/css-grid-layout/grid-auto-flow-resolution.html: * fast/css-grid-layout/grid-columns-rows-get-set-multiple.html: * fast/css-grid-layout/grid-columns-rows-get-set.html: * fast/css-grid-layout/grid-container-change-named-grid-lines-recompute-child.html: * fast/css-grid-layout/grid-content-sized-columns-resolution.html: * fast/css-grid-layout/grid-dynamic-updates-relayout.html: * fast/css-grid-layout/grid-element-min-max-width.html: * fast/css-grid-layout/grid-element-repeat-get-set.html: * fast/css-grid-layout/grid-initialize-span-one-items.html: * fast/css-grid-layout/grid-item-addition-auto-placement-update.html: * fast/css-grid-layout/grid-item-addition-track-breadth-update.html: * fast/css-grid-layout/grid-item-bad-named-area-auto-placement.html: * fast/css-grid-layout/grid-item-margin-auto-columns-rows-horizontal-ltr.html: * fast/css-grid-layout/grid-item-margin-auto-columns-rows-horizontal-rtl.html: * fast/css-grid-layout/grid-item-margin-auto-columns-rows-vertical-ltr.html: * fast/css-grid-layout/grid-item-margin-auto-columns-rows-vertical-rtl.html: * fast/css-grid-layout/grid-item-multiple-minmax-content-resolution.html: * fast/css-grid-layout/grid-item-named-grid-area-resolution.html: * fast/css-grid-layout/grid-item-negative-indexes.html: * fast/css-grid-layout/grid-item-order-in-content-sized-columns-resolution.html: * fast/css-grid-layout/grid-item-removal-auto-placement-update.html: * fast/css-grid-layout/grid-item-removal-track-breadth-update.html: * fast/css-grid-layout/grid-update-sizes-after-distributing-all.html: * fast/css-grid-layout/implicit-columns-auto-resolution.html: * fast/css-grid-layout/implicit-position-dynamic-change.html: * fast/css-grid-layout/mark-as-infinitely-growable.html: * fast/css-grid-layout/maximize-tracks-definite-indefinite-width.html: * fast/css-grid-layout/minmax-spanning-resolution-columns.html: * fast/css-grid-layout/named-grid-line-get-set.html: * fast/css-grid-layout/named-grid-lines-computed-style-implicit-tracks.html: * fast/css-grid-layout/named-grid-lines-with-named-grid-areas-resolution.html: * fast/css-grid-layout/percent-intrinsic-track-breadth.html: * fast/css-grid-layout/percent-track-breadths-regarding-container-size.html: * fast/css-grid-layout/resources/grid-definitions-parsing-utils.js: (checkGridTemplatesSetJSValues): * fast/css-grid-layout/resources/grid-template-shorthand-parsing-utils.js: (checkGridDefinitionsSetJSValues): (testGridDefinitionsSetBadJSValues): * fast/css/getComputedStyle/computed-style-expected.txt: * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt: * svg/css/getComputedStyle-basic-expected.txt: Canonical link: https://commits.webkit.org/173051@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197503 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-03 11:05:32 +00:00
var elementID = element.id || "element";
var initialValue = eval("window.getComputedStyle(" + elementID + " , '').getPropertyValue('" + propertyID + "')");
[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
2015-03-30 18:33:39 +00:00
element.style[property] = value;
[CSS Box Alignment] New CSS Value 'normal' for Content Alignment https://bugs.webkit.org/show_bug.cgi?id=154282 Source/WebCore: Reviewed by David Hyatt. The Box Alignment specification defines a new value 'normal' to be used as default for the different layout models, which will define the specific behavior for each case. This patch adds a new CSS value in the parsing logic and adapts the Content Alignment properties to the new value. The 'auto' value is no longer valid and the Computed Value will be always the specified value. Hence, I removed the StyleResolver logic because is not required now; the specific behavior of the 'normal' value will be resolved at layout time. Computed value of both align-content and justify-content is the specified value, we don't have to resolve any 'auto' value now. Additionally, this patch updates the layout logic as well, for both Flexbox and Grid layout models. No new tests, since we only need to rebaseline those test cases affected by the new default computed value. * css/CSSComputedStyleDeclaration.cpp: (WebCore::valueForContentPositionAndDistributionWithOverflowAlignment): (WebCore::ComputedStyleExtractor::propertyValue): (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Deleted. (WebCore::CSSComputedStyleDeclaration::copyProperties): Deleted. (WebCore::nodeOrItsAncestorNeedsStyleRecalc): Deleted. (WebCore::isFlexOrGrid): Deleted. (WebCore::ComputedStyleExtractor::customPropertyValue): Deleted. * css/CSSParser.cpp: (WebCore::CSSParser::parseContentDistributionOverflowPosition): * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator ContentPosition): * rendering/RenderFlexibleBox.cpp: (WebCore::normalValueBehavior): (WebCore::RenderFlexibleBox::layoutAndPlaceChildren): (WebCore::RenderFlexibleBox::layoutColumnReverse): (WebCore::RenderFlexibleBox::alignFlexLines): (WebCore::alignContentSpaceBetweenChildren): Deleted. * rendering/RenderGrid.cpp: (WebCore::normalValueBehavior): (WebCore::RenderGrid::applyStretchAlignmentToTracksIfNeeded): (WebCore::RenderGrid::columnAxisOffsetForChild): (WebCore::RenderGrid::rowAxisOffsetForChild): (WebCore::resolveContentDistributionFallback): (WebCore::contentDistributionOffset): (WebCore::RenderGrid::computeContentPositionAndDistributionOffset): * rendering/style/RenderStyle.cpp: (WebCore::resolvedContentAlignmentPosition): (WebCore::resolvedContentAlignmentDistribution): (WebCore::RenderStyle::resolvedJustifyContentPosition): (WebCore::RenderStyle::resolvedJustifyContentDistribution): (WebCore::RenderStyle::resolvedAlignContentPosition): (WebCore::RenderStyle::resolvedAlignContentDistribution): * rendering/style/RenderStyle.h: * rendering/style/RenderStyleConstants.h: LayoutTests: The Box Alignment specification defines a new value 'normal' to be used as default for the different layout models, which will define the specific behavior for each case. This patch adds a new CSS value in the parsing logic and adapts the Content Alignment properties to the new value. Since the 'normal' vlaue, initial/default for both justify-content and align-content CSS properties, behaves now as 'stretch' instead of o'start' we have to rebaseline those tests affected by the new default value. Reviewed by David Hyatt. * css3/flexbox/css-properties-expected.txt: * css3/flexbox/css-properties.html: * css3/parse-align-content-expected.txt: * css3/parse-align-content.html: * css3/parse-justify-content-expected.txt: * css3/parse-justify-content.html: * css3/resources/alignment-parsing-utils.js: (checkBadValues): * fast/css-grid-layout/auto-content-resolution-columns.html: * fast/css-grid-layout/grid-auto-columns-rows-update.html: * fast/css-grid-layout/grid-auto-flow-resolution.html: * fast/css-grid-layout/grid-columns-rows-get-set-multiple.html: * fast/css-grid-layout/grid-columns-rows-get-set.html: * fast/css-grid-layout/grid-container-change-named-grid-lines-recompute-child.html: * fast/css-grid-layout/grid-content-sized-columns-resolution.html: * fast/css-grid-layout/grid-dynamic-updates-relayout.html: * fast/css-grid-layout/grid-element-min-max-width.html: * fast/css-grid-layout/grid-element-repeat-get-set.html: * fast/css-grid-layout/grid-initialize-span-one-items.html: * fast/css-grid-layout/grid-item-addition-auto-placement-update.html: * fast/css-grid-layout/grid-item-addition-track-breadth-update.html: * fast/css-grid-layout/grid-item-bad-named-area-auto-placement.html: * fast/css-grid-layout/grid-item-margin-auto-columns-rows-horizontal-ltr.html: * fast/css-grid-layout/grid-item-margin-auto-columns-rows-horizontal-rtl.html: * fast/css-grid-layout/grid-item-margin-auto-columns-rows-vertical-ltr.html: * fast/css-grid-layout/grid-item-margin-auto-columns-rows-vertical-rtl.html: * fast/css-grid-layout/grid-item-multiple-minmax-content-resolution.html: * fast/css-grid-layout/grid-item-named-grid-area-resolution.html: * fast/css-grid-layout/grid-item-negative-indexes.html: * fast/css-grid-layout/grid-item-order-in-content-sized-columns-resolution.html: * fast/css-grid-layout/grid-item-removal-auto-placement-update.html: * fast/css-grid-layout/grid-item-removal-track-breadth-update.html: * fast/css-grid-layout/grid-update-sizes-after-distributing-all.html: * fast/css-grid-layout/implicit-columns-auto-resolution.html: * fast/css-grid-layout/implicit-position-dynamic-change.html: * fast/css-grid-layout/mark-as-infinitely-growable.html: * fast/css-grid-layout/maximize-tracks-definite-indefinite-width.html: * fast/css-grid-layout/minmax-spanning-resolution-columns.html: * fast/css-grid-layout/named-grid-line-get-set.html: * fast/css-grid-layout/named-grid-lines-computed-style-implicit-tracks.html: * fast/css-grid-layout/named-grid-lines-with-named-grid-areas-resolution.html: * fast/css-grid-layout/percent-intrinsic-track-breadth.html: * fast/css-grid-layout/percent-track-breadths-regarding-container-size.html: * fast/css-grid-layout/resources/grid-definitions-parsing-utils.js: (checkGridTemplatesSetJSValues): * fast/css-grid-layout/resources/grid-template-shorthand-parsing-utils.js: (checkGridDefinitionsSetJSValues): (testGridDefinitionsSetBadJSValues): * fast/css/getComputedStyle/computed-style-expected.txt: * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt: * svg/css/getComputedStyle-basic-expected.txt: Canonical link: https://commits.webkit.org/173051@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197503 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-03 11:05:32 +00:00
checkValues(element, property, propertyID, "", initialValue);
[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
2015-03-30 18:33:39 +00:00
}
function checkInitialValues(element, property, propertyID, value, initial)
{
element.style[property] = value;
checkValues(element, property, propertyID, value, value);
element.style[property] = "initial";
checkValues(element, property, propertyID, "initial", initial);
}
function checkInheritValues(property, propertyID, value)
{
var parentElement = document.createElement("div");
document.body.appendChild(parentElement);
parentElement.style[property] = value;
checkValues(parentElement, property, propertyID, value, value);
var element = document.createElement("div");
parentElement.appendChild(element);
element.style[property] = "inherit";
checkValues(element, property, propertyID, "inherit", value);
}
function checkLegacyValues(property, propertyID, value)
{
var parentElement = document.createElement("div");
document.body.appendChild(parentElement);
parentElement.style[property] = value;
checkValues(parentElement, property, propertyID, value, value);
var element = document.createElement("div");
parentElement.appendChild(element);
checkValues(element, property, propertyID, "", value);
}