Changeset 205807 in webkit
- Timestamp:
- Sep 12, 2016, 4:46:57 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r205791 r205807 1 2016-09-12 Javier Fernandez <jfernandez@igalia.com> 2 3 [css-align] Initial values are parsed as invalid for some Alignment properties 4 https://bugs.webkit.org/show_bug.cgi?id=161303 5 6 Reviewed by Darin Adler. 7 8 Test to verify the "initial" values of the CSS Box Alignment properties 9 are parsed as valid independently of whether Grid Layout is enabled or not. 10 11 * fast/css/ensure-flexbox-compatibility-with-initial-values-expected.txt: Added. 12 * fast/css/ensure-flexbox-compatibility-with-initial-values.html: Added. 13 * fast/css/resources/alignment-parsing-utils.js: 14 (checkSupportedValues): 15 1 16 2016-09-11 Chris Dumez <cdumez@apple.com> 2 17 -
trunk/LayoutTests/fast/css/resources/alignment-parsing-utils.js
r201498 r205807 47 47 checkValues(element, property, propertyID, "", value); 48 48 } 49 50 function checkSupportedValues(elementID, property) 51 { 52 var value = eval("window.getComputedStyle(" + elementID + " , '').getPropertyValue('" + property + "')"); 53 shouldBeTrue("CSS.supports('" + property + "', '" + value + "')"); 54 } -
trunk/Source/WebCore/ChangeLog
r205806 r205807 1 2016-09-12 Javier Fernandez <jfernandez@igalia.com> 2 3 [css-align] Initial values are parsed as invalid for some Alignment properties 4 https://bugs.webkit.org/show_bug.cgi?id=161303 5 6 Reviewed by Darin Adler. 7 8 Due to the implementation of the new CSS Box Alignment specification, 9 some properties have now new values allowed, which are not valid 10 according to the Flexible Box Layout specification. 11 12 In r205102 we have get back the keywordID parsing, originally implemented for 13 the Flexbible Box Layout specification. Even though the new valued would be 14 parsed as invalid when they are set, the 'initial' values will be assigned 15 in any case. 16 17 This patch verifies that the 'initial' values depend on whether the Grid 18 Layout is enabled or not and verifying such values are parsed as valid. 19 20 Additionally, it gets back as well they keywordID parsing for the Content 21 Alignment properties (align-content and justify-content). This required to 22 touch a bit the StyleBuilderConverter logic, since we will have to deal with 23 either the complex CSSContentDistributionValue complex or the simpler 24 CSSPrimitiveValue. 25 26 Test: fast/css/ensure-flexbox-compatibility-with-initial-values.html 27 28 * css/StyleBuilderConverter.h: 29 (WebCore::StyleBuilderConverter::convertContentAlignmentData): Handling a primitive value if Grid Layout is not enabled. 30 * css/parser/CSSParser.cpp: 31 (WebCore::isValidKeywordPropertyAndValue): Simpler parsing of alignment properties if Grid Layout is not enabled. 32 (WebCore::isKeywordPropertyID): Alignment properties are defined as keyword if Grid Layout is no enabled. 33 (WebCore::CSSParser::parseValue): Assert Grid Layout is enabled when using the complex parsing. 34 * rendering/style/RenderStyle.cpp: 35 (WebCore::RenderStyle::isCSSGridLayoutEnabled): Checking out the Grid Layout runtime flags. 36 * rendering/style/RenderStyle.h: 37 (WebCore::RenderStyle::initialDefaultAlignment): Initial value will depend on whether Grid Layout is enabled or not. 38 (WebCore::RenderStyle::initialContentAlignment): Initial value will depend on whether Grid Layout is enabled or not. 39 1 40 2016-09-12 Chris Dumez <cdumez@apple.com> 2 41 -
trunk/Source/WebCore/css/StyleBuilderConverter.h
r205421 r205807 47 47 #include "Pair.h" 48 48 #include "QuotesData.h" 49 #include "RuntimeEnabledFeatures.h" 49 50 #include "SVGURIReference.h" 50 51 #include "Settings.h" … … 1254 1255 { 1255 1256 StyleContentAlignmentData alignmentData = RenderStyle::initialContentAlignment(); 1256 auto& contentValue = downcast<CSSContentDistributionValue>(value); 1257 if (contentValue.distribution()->getValueID() != CSSValueInvalid) 1258 alignmentData.setDistribution(contentValue.distribution().get()); 1259 if (contentValue.position()->getValueID() != CSSValueInvalid) 1260 alignmentData.setPosition(contentValue.position().get()); 1261 if (contentValue.overflow()->getValueID() != CSSValueInvalid) 1262 alignmentData.setOverflow(contentValue.overflow().get()); 1257 #if ENABLE(CSS_GRID_LAYOUT) 1258 if (RuntimeEnabledFeatures::sharedFeatures().isCSSGridLayoutEnabled()) { 1259 auto& contentValue = downcast<CSSContentDistributionValue>(value); 1260 if (contentValue.distribution()->getValueID() != CSSValueInvalid) 1261 alignmentData.setDistribution(contentValue.distribution().get()); 1262 if (contentValue.position()->getValueID() != CSSValueInvalid) 1263 alignmentData.setPosition(contentValue.position().get()); 1264 if (contentValue.overflow()->getValueID() != CSSValueInvalid) 1265 alignmentData.setOverflow(contentValue.overflow().get()); 1266 return alignmentData; 1267 } 1268 #endif 1269 auto& primitiveValue = downcast<CSSPrimitiveValue>(value); 1270 switch (primitiveValue.getValueID()) { 1271 case CSSValueStretch: 1272 case CSSValueSpaceBetween: 1273 case CSSValueSpaceAround: 1274 alignmentData.setDistribution(primitiveValue); 1275 break; 1276 case CSSValueFlexStart: 1277 case CSSValueFlexEnd: 1278 case CSSValueCenter: 1279 alignmentData.setPosition(primitiveValue); 1280 break; 1281 default: 1282 ASSERT_NOT_REACHED(); 1283 } 1263 1284 return alignmentData; 1264 1285 } -
trunk/Source/WebCore/css/parser/CSSParser.cpp
r205787 r205807 820 820 return true; 821 821 break; 822 case CSSPropertyAlignContent: 823 // FIXME: Per CSS alignment, this property should accept an optional <overflow-position>. We should share this parsing code with 'justify-self'. 824 // FIXME: For now, we will do it behind the GRID_LAYOUT compile flag. 825 return valueID == CSSValueFlexStart || valueID == CSSValueFlexEnd || valueID == CSSValueCenter || valueID == CSSValueSpaceBetween || valueID == CSSValueSpaceAround || valueID == CSSValueStretch; 822 826 case CSSPropertyAlignItems: 823 827 // FIXME: Per CSS alignment, this property should accept the same arguments as 'justify-self' so we should share its parsing code. … … 840 844 return true; 841 845 break; 846 case CSSPropertyJustifyContent: 847 // FIXME: Per CSS alignment, this property should accept an optional <overflow-position>. We should share this parsing code with 'justify-self'. 848 // FIXME: For now, we will do it behind the GRID_LAYOUT compile flag. 849 return valueID == CSSValueFlexStart || valueID == CSSValueFlexEnd || valueID == CSSValueCenter || valueID == CSSValueSpaceBetween || valueID == CSSValueSpaceAround; 842 850 case CSSPropertyWebkitFontKerning: 843 851 if (valueID == CSSValueAuto || valueID == CSSValueNormal || valueID == CSSValueNone) … … 1156 1164 case CSSPropertyFontVariantAlternates: 1157 1165 return true; 1166 case CSSPropertyJustifyContent: 1167 case CSSPropertyAlignContent: 1158 1168 case CSSPropertyAlignItems: 1159 1169 case CSSPropertyAlignSelf: … … 2739 2749 return false; 2740 2750 } 2751 #if ENABLE(CSS_GRID_LAYOUT) 2741 2752 case CSSPropertyJustifyContent: 2753 ASSERT(RuntimeEnabledFeatures::sharedFeatures().isCSSGridLayoutEnabled()); 2742 2754 parsedValue = parseContentDistributionOverflowPosition(); 2743 2755 break; 2744 #if ENABLE(CSS_GRID_LAYOUT)2745 2756 case CSSPropertyJustifySelf: 2746 2757 if (!isCSSGridLayoutEnabled()) … … 3163 3174 break; 3164 3175 #endif 3176 #if ENABLE(CSS_GRID_LAYOUT) 3165 3177 case CSSPropertyAlignContent: 3178 ASSERT(RuntimeEnabledFeatures::sharedFeatures().isCSSGridLayoutEnabled()); 3166 3179 parsedValue = parseContentDistributionOverflowPosition(); 3167 3180 break; 3168 #if ENABLE(CSS_GRID_LAYOUT)3169 3181 case CSSPropertyAlignSelf: 3170 3182 ASSERT(RuntimeEnabledFeatures::sharedFeatures().isCSSGridLayoutEnabled()); -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r205102 r205807 1399 1399 // Defaulting to Stretch for now, as it what most of FlexBox based renders 1400 1400 // expect as default. 1401 #if ENABLE(CSS_GRID_LAYOUT) 1401 1402 ASSERT(RuntimeEnabledFeatures::sharedFeatures().isCSSGridLayoutEnabled()); 1403 #else 1404 ASSERT_NOT_REACHED(); 1405 #endif 1402 1406 FALLTHROUGH; 1403 1407 case ItemPositionStretch: { … … 1435 1439 // FIXME: https://webkit.org/b/135460 - The extended grammar is not supported 1436 1440 // yet for FlexibleBox. 1441 #if ENABLE(CSS_GRID_LAYOUT) 1437 1442 ASSERT(RuntimeEnabledFeatures::sharedFeatures().isCSSGridLayoutEnabled()); 1443 #else 1444 ASSERT_NOT_REACHED(); 1445 #endif 1438 1446 break; 1439 1447 default: -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r203250 r205807 38 38 #include "RenderObject.h" 39 39 #include "RenderTheme.h" 40 #include "RuntimeEnabledFeatures.h" 40 41 #include "ScaleTransformOperation.h" 41 42 #include "ShadowData.h" … … 188 189 ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun); 189 190 m_deletionHasBegun = true; 191 #endif 192 } 193 194 bool RenderStyle::isCSSGridLayoutEnabled() 195 { 196 #if ENABLE(CSS_GRID_LAYOUT) 197 return RuntimeEnabledFeatures::sharedFeatures().isCSSGridLayoutEnabled(); 198 #else 199 return false; 190 200 #endif 191 201 } -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r204717 r205807 2002 2002 static int initialOrder() { return 0; } 2003 2003 static StyleSelfAlignmentData initialSelfAlignment() { return StyleSelfAlignmentData(ItemPositionAuto, OverflowAlignmentDefault); } 2004 static StyleSelfAlignmentData initialDefaultAlignment() { return StyleSelfAlignmentData( ItemPositionNormal, OverflowAlignmentDefault); }2005 static StyleContentAlignmentData initialContentAlignment() { return StyleContentAlignmentData( ContentPositionNormal, ContentDistributionDefault, OverflowAlignmentDefault); }2004 static StyleSelfAlignmentData initialDefaultAlignment() { return StyleSelfAlignmentData(isCSSGridLayoutEnabled() ? ItemPositionNormal : ItemPositionStretch, OverflowAlignmentDefault); } 2005 static StyleContentAlignmentData initialContentAlignment() { return StyleContentAlignmentData(isCSSGridLayoutEnabled() ? ContentPositionNormal : ContentPositionFlexStart, ContentDistributionDefault, OverflowAlignmentDefault); } 2006 2006 static EFlexDirection initialFlexDirection() { return FlowRow; } 2007 2007 static EFlexWrap initialFlexWrap() { return FlexNoWrap; } … … 2067 2067 static const AtomicString& initialContentAltText() { return emptyAtom; } 2068 2068 2069 static bool isCSSGridLayoutEnabled(); 2070 2069 2071 static WillChangeData* initialWillChange() { return nullptr; } 2070 2072
Note:
See TracChangeset
for help on using the changeset viewer.