summaryrefslogtreecommitdiff
path: root/Source/WebCore/css/CSSParser.cpp
diff options
context:
space:
mode:
authorDean Jackson <dino@apple.com>2014-09-12 20:46:05 +0000
committerKonstantin Tokarev <annulen@yandex.ru>2016-09-27 11:20:54 +0000
commitdd3b76df6531a6305f35e847192ce2b3638683d7 (patch)
tree8a6122167ceb9ce0197bad7d5a2a2d52b52bab66 /Source/WebCore/css/CSSParser.cpp
parent6ca6514fa0caae5bf1df1aae126c51efb618d757 (diff)
downloadqtwebkit-dd3b76df6531a6305f35e847192ce2b3638683d7.tar.gz
Unprefix the flexbox CSS properties
https://bugs.webkit.org/show_bug.cgi?id=98420 Reviewed by Benjamin Poulain. Source/WebCore: Remove the need for a "-webkit-" prefix on flexbox and related properties. This includes: - align-content - align-items - align-self - flex-basis - flex-direction - flex-wrap - flex-grow - flex-shrink - flex - flex-flow - justify - order ... as well as the display keyword values "flex" and "inline-flex". * css/CSSComputedStyleDeclaration.cpp: Change names. (WebCore::ComputedStyleExtractor::propertyValue): * css/CSSParser.cpp: Ditto. (WebCore::isValidKeywordPropertyAndValue): (WebCore::isKeywordPropertyID): (WebCore::CSSParser::parseValue): (WebCore::CSSParser::parseFlex): * css/CSSPrimitiveValueMappings.h: Since we need to still handle the old keywords for display, this has added two new keywords. (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator EDisplay): If the older keywords were used in content, map them to the new value names. * css/CSSPropertyNames.in: Add aliases for the prefixed properties. * css/CSSValueKeywords.in: Add "flex" and "inline-flex". * css/DeprecatedStyleBuilder.cpp: Change names. (WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder): * css/StyleProperties.cpp: Change names. (WebCore::StyleProperties::getPropertyValue): (WebCore::StyleProperties::asText): * css/StylePropertyShorthand.cpp: Rename shorthand methods to remove the prefix. (WebCore::flexFlowShorthand): (WebCore::flexShorthand): (WebCore::shorthandForProperty): (WebCore::matchingShorthandsForLonghand): (WebCore::webkitFlexFlowShorthand): Deleted. (WebCore::webkitFlexShorthand): Deleted. * css/StylePropertyShorthand.h: * css/StyleResolver.cpp: (WebCore::equivalentBlockDisplay): (WebCore::StyleResolver::applyProperty): * page/animation/CSSPropertyAnimation.cpp: Change names. (WebCore::PropertyWrapperFlex::PropertyWrapperFlex): * rendering/RenderElement.cpp: (WebCore::RenderElement::createFor): Handle the two new display values (the same way as the old values). * rendering/style/RenderStyleConstants.h: Add constants for the new display values. LayoutTests: Now that we return "flex" instead of "-webkit-flex" (and similar changes) update the tests that rely on this. Other than that, we're still testing the prefixed content. A followup patch will add tests for non-prefixed content. * css3/flexbox/display-flexbox-set-get-expected.txt: * css3/flexbox/display-flexbox-set-get.html: * css3/flexbox/flexitem.html: * fast/css-grid-layout/grid-item-display.html: * 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/inherit-initial-shorthand-values-expected.txt: * fast/css/inherit-initial-shorthand-values.html: * svg/css/getComputedStyle-basic-expected.txt: * transitions/flex-transitions-expected.txt: * transitions/flex-transitions.html: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@173572 268f45cc-cd09-0410-ab3c-d52691b4dbfc Change-Id: If273fd32d5165e8fa504cdfd5b591a17d61f4bbc Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'Source/WebCore/css/CSSParser.cpp')
-rw-r--r--Source/WebCore/css/CSSParser.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp
index 99ee8043a..eabbd5024 100644
--- a/Source/WebCore/css/CSSParser.cpp
+++ b/Source/WebCore/css/CSSParser.cpp
@@ -703,7 +703,7 @@ static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int
// inline | block | list-item | run-in | inline-block | table |
// inline-table | table-row-group | table-header-group | table-footer-group | table-row |
// table-column-group | table-column | table-cell | table-caption | -webkit-box | -webkit-inline-box | none | inherit
- // -webkit-flex | -webkit-inline-flex | -webkit-grid | -webkit-inline-grid
+ // flex | -webkit-flex | inline-flex | -webkit-inline-flex | -webkit-grid | -webkit-inline-grid
if ((valueID >= CSSValueInline && valueID <= CSSValueWebkitInlineFlex) || valueID == CSSValueNone)
return true;
if (parserContext.isCSSGridLayoutEnabled && (valueID == CSSValueWebkitGrid || valueID == CSSValueWebkitInlineGrid))
@@ -872,27 +872,27 @@ static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int
if (valueID == CSSValueSrgb || valueID == CSSValueDefault)
return true;
break;
- case CSSPropertyWebkitAlignContent:
+ case CSSPropertyAlignContent:
if (valueID == CSSValueFlexStart || valueID == CSSValueFlexEnd || valueID == CSSValueCenter || valueID == CSSValueSpaceBetween || valueID == CSSValueSpaceAround || valueID == CSSValueStretch)
return true;
break;
- case CSSPropertyWebkitAlignItems:
+ case CSSPropertyAlignItems:
if (valueID == CSSValueFlexStart || valueID == CSSValueFlexEnd || valueID == CSSValueCenter || valueID == CSSValueBaseline || valueID == CSSValueStretch)
return true;
break;
- case CSSPropertyWebkitAlignSelf:
+ case CSSPropertyAlignSelf:
if (valueID == CSSValueAuto || valueID == CSSValueFlexStart || valueID == CSSValueFlexEnd || valueID == CSSValueCenter || valueID == CSSValueBaseline || valueID == CSSValueStretch)
return true;
break;
- case CSSPropertyWebkitFlexDirection:
+ case CSSPropertyFlexDirection:
if (valueID == CSSValueRow || valueID == CSSValueRowReverse || valueID == CSSValueColumn || valueID == CSSValueColumnReverse)
return true;
break;
- case CSSPropertyWebkitFlexWrap:
+ case CSSPropertyFlexWrap:
if (valueID == CSSValueNowrap || valueID == CSSValueWrap || valueID == CSSValueWrapReverse)
return true;
break;
- case CSSPropertyWebkitJustifyContent:
+ case CSSPropertyJustifyContent:
if (valueID == CSSValueFlexStart || valueID == CSSValueFlexEnd || valueID == CSSValueCenter || valueID == CSSValueSpaceBetween || valueID == CSSValueSpaceAround)
return true;
break;
@@ -1119,12 +1119,12 @@ static inline bool isKeywordPropertyID(CSSPropertyID propertyId)
case CSSPropertyWebkitColumnBreakBefore:
case CSSPropertyWebkitColumnBreakInside:
case CSSPropertyWebkitColumnRuleStyle:
- case CSSPropertyWebkitAlignContent:
- case CSSPropertyWebkitAlignItems:
- case CSSPropertyWebkitAlignSelf:
- case CSSPropertyWebkitFlexDirection:
- case CSSPropertyWebkitFlexWrap:
- case CSSPropertyWebkitJustifyContent:
+ case CSSPropertyAlignContent:
+ case CSSPropertyAlignItems:
+ case CSSPropertyAlignSelf:
+ case CSSPropertyFlexDirection:
+ case CSSPropertyFlexWrap:
+ case CSSPropertyJustifyContent:
case CSSPropertyWebkitFontKerning:
case CSSPropertyWebkitFontSmoothing:
case CSSPropertyWebkitHyphens:
@@ -2509,28 +2509,28 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important)
validPrimitive = true;
break;
#endif
- case CSSPropertyWebkitFlex: {
+ case CSSPropertyFlex: {
ShorthandScope scope(this, propId);
if (id == CSSValueNone) {
- addProperty(CSSPropertyWebkitFlexGrow, cssValuePool().createValue(0, CSSPrimitiveValue::CSS_NUMBER), important);
- addProperty(CSSPropertyWebkitFlexShrink, cssValuePool().createValue(0, CSSPrimitiveValue::CSS_NUMBER), important);
- addProperty(CSSPropertyWebkitFlexBasis, cssValuePool().createIdentifierValue(CSSValueAuto), important);
+ addProperty(CSSPropertyFlexGrow, cssValuePool().createValue(0, CSSPrimitiveValue::CSS_NUMBER), important);
+ addProperty(CSSPropertyFlexShrink, cssValuePool().createValue(0, CSSPrimitiveValue::CSS_NUMBER), important);
+ addProperty(CSSPropertyFlexBasis, cssValuePool().createIdentifierValue(CSSValueAuto), important);
return true;
}
return parseFlex(m_valueList.get(), important);
}
- case CSSPropertyWebkitFlexBasis:
+ case CSSPropertyFlexBasis:
// FIXME: Support intrinsic dimensions too.
if (id == CSSValueAuto)
validPrimitive = true;
else
validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonNeg));
break;
- case CSSPropertyWebkitFlexGrow:
- case CSSPropertyWebkitFlexShrink:
+ case CSSPropertyFlexGrow:
+ case CSSPropertyFlexShrink:
validPrimitive = validUnit(value, FNumber | FNonNeg);
break;
- case CSSPropertyWebkitOrder:
+ case CSSPropertyOrder:
if (validUnit(value, FInteger, CSSStrictMode)) {
// We restrict the smallest value to int min + 2 because we use int min and int min + 1 as special values in a hash set.
parsedValue = cssValuePool().createValue(max(static_cast<double>(std::numeric_limits<int>::min() + 2), value->fValue),
@@ -2883,8 +2883,8 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important)
case CSSPropertyPadding:
// <padding-width>{1,4} | inherit
return parse4Values(propId, paddingShorthand().properties(), important);
- case CSSPropertyWebkitFlexFlow:
- return parseShorthand(propId, webkitFlexFlowShorthand(), important);
+ case CSSPropertyFlexFlow:
+ return parseShorthand(propId, flexFlowShorthand(), important);
case CSSPropertyFont:
// [ [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [ / 'line-height' ]?
// 'font-family' ] | caption | icon | menu | message-box | small-caption | status-bar | inherit
@@ -3056,12 +3056,12 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important)
case CSSPropertyWebkitColumnBreakBefore:
case CSSPropertyWebkitColumnBreakInside:
case CSSPropertyWebkitColumnRuleStyle:
- case CSSPropertyWebkitAlignContent:
- case CSSPropertyWebkitAlignItems:
- case CSSPropertyWebkitAlignSelf:
- case CSSPropertyWebkitFlexDirection:
- case CSSPropertyWebkitFlexWrap:
- case CSSPropertyWebkitJustifyContent:
+ case CSSPropertyAlignContent:
+ case CSSPropertyAlignItems:
+ case CSSPropertyAlignSelf:
+ case CSSPropertyFlexDirection:
+ case CSSPropertyFlexWrap:
+ case CSSPropertyJustifyContent:
case CSSPropertyWebkitFontKerning:
case CSSPropertyWebkitFontSmoothing:
case CSSPropertyWebkitHyphens:
@@ -6607,9 +6607,9 @@ bool CSSParser::parseFlex(CSSParserValueList* args, bool important)
if (!flexBasis)
flexBasis = cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX);
- addProperty(CSSPropertyWebkitFlexGrow, cssValuePool().createValue(clampToFloat(flexGrow), CSSPrimitiveValue::CSS_NUMBER), important);
- addProperty(CSSPropertyWebkitFlexShrink, cssValuePool().createValue(clampToFloat(flexShrink), CSSPrimitiveValue::CSS_NUMBER), important);
- addProperty(CSSPropertyWebkitFlexBasis, flexBasis, important);
+ addProperty(CSSPropertyFlexGrow, cssValuePool().createValue(clampToFloat(flexGrow), CSSPrimitiveValue::CSS_NUMBER), important);
+ addProperty(CSSPropertyFlexShrink, cssValuePool().createValue(clampToFloat(flexShrink), CSSPrimitiveValue::CSS_NUMBER), important);
+ addProperty(CSSPropertyFlexBasis, flexBasis, important);
return true;
}