Changeset 176218 in webkit
- Timestamp:
- Nov 17, 2014 11:52:42 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r176213 r176218 1 2014-11-17 Javier Fernandez <jfernandez@igalia.com> 2 3 [CSS Grid Layout] Upgrade align-self and align-items parsing to CSS 3 4 https://bugs.webkit.org/show_bug.cgi?id=133359 5 6 Reviewed by David Hyatt. 7 8 From Blink r164817 and r165264 by <jchaffraix@chromium.org> 9 10 Broaden justify-self's parsing name and upgrade align-self and 11 align-items parsing to CSS 3. 12 13 * css3/flexbox/css-properties-expected.txt: 14 * css3/flexbox/css-properties.html: 15 * css3/parse-align-items-expected.txt: Added. 16 * css3/parse-align-items.html: Added. 17 * css3/parse-align-self-expected.txt: Added. 18 * css3/parse-align-self.html: Added. 19 * css3/resources/alignment-parsing-utils.js: Added. 20 (checkValues): 21 (checkBadValues): 22 (checkInitialValues): 23 (checkInheritValues): 24 (checkLegacyValues): 25 * fast/css/getComputedStyle/computed-style-expected.txt: 26 * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt: 27 * fast/css/getComputedStyle/resources/property-names.js: 28 * svg/css/getComputedStyle-basic-expected.txt: 29 * platform/gtk/TestExpectations: Report new failures and update expectations. 30 1 31 2014-11-17 Shivakumar JM <shiva.jm@samsung.com> 2 32 -
trunk/LayoutTests/TestExpectations
r176144 r176218 67 67 # This test verifies dynamic manipulation of the mroot and msqrt elements. 68 68 mathml/roots-removeChild.html [ ImageOnlyFailure ] 69 70 webkit.org/b/133359 mathml/presentation/style-changed.html [ ImageOnlyFailure ] 71 webkit.org/b/136291 platform/mac/accessibility/webkit-alt-for-css-content.html [ Failure ] 72 webkit.org/b/136291 platform/mac/accessibility/alt-for-css-content.html [ Failure ] 69 73 70 74 # This test verifies that a mismatch reftest will fail as intended if both results are same. (introduced in r93187) -
trunk/LayoutTests/css3/flexbox/css-properties-expected.txt
r132136 r176218 30 30 PASS window.getComputedStyle(flexbox, null).webkitJustifyContent is "flex-start" 31 31 PASS flexbox.style.webkitAlignSelf is "" 32 PASS window.getComputedStyle(flexbox, null).webkitAlignSelf is "st retch"33 PASS window.getComputedStyle(document.documentElement, null).webkitAlignSelf is " stretch"32 PASS window.getComputedStyle(flexbox, null).webkitAlignSelf is "start" 33 PASS window.getComputedStyle(document.documentElement, null).webkitAlignSelf is "auto" 34 34 PASS flexbox.style.webkitAlignSelf is "" 35 PASS window.getComputedStyle(flexbox, null).webkitAlignSelf is "start" 35 36 PASS flexbox.style.webkitAlignSelf is "auto" 36 PASS window.getComputedStyle(flexbox, null).webkitAlignSelf is "st retch"37 PASS window.getComputedStyle(flexbox, null).webkitAlignSelf is "start" 37 38 PASS flexbox.style.webkitAlignSelf is "flex-start" 38 39 PASS window.getComputedStyle(flexbox, null).webkitAlignSelf is "flex-start" … … 46 47 PASS window.getComputedStyle(flexbox, null).webkitAlignSelf is "baseline" 47 48 PASS flexbox.style.webkitAlignSelf is "" 48 PASS window.getComputedStyle(flexbox, null).webkitAlignSelf is "stretch" 49 PASS flexbox.style.webkitAlignItems is "" 50 PASS window.getComputedStyle(flexbox, null).webkitAlignItems is "stretch" 51 PASS window.getComputedStyle(flexitem, null).webkitAlignSelf is "stretch" 52 PASS flexbox.style.webkitAlignItems is "" 53 PASS flexbox.style.webkitAlignItems is "" 49 PASS window.getComputedStyle(flexbox, null).webkitAlignSelf is "start" 50 PASS flexbox.style.webkitAlignItems is "" 51 PASS flexitem.style.webkitAlignSelf is "" 52 PASS window.getComputedStyle(flexbox, null).webkitAlignItems is "stretch" 53 PASS window.getComputedStyle(flexitem, null).webkitAlignSelf is "stretch" 54 PASS flexbox.style.webkitAlignItems is "" 55 PASS flexitem.style.webkitAlignSelf is "" 56 PASS window.getComputedStyle(flexbox, null).webkitAlignItems is "stretch" 57 PASS window.getComputedStyle(flexitem, null).webkitAlignSelf is "stretch" 58 PASS flexbox.style.webkitAlignItems is "auto" 59 PASS flexitem.style.webkitAlignSelf is "" 54 60 PASS window.getComputedStyle(flexbox, null).webkitAlignItems is "stretch" 55 61 PASS window.getComputedStyle(flexitem, null).webkitAlignSelf is "stretch" 56 62 PASS flexbox.style.webkitAlignItems is "flex-start" 63 PASS flexitem.style.webkitAlignSelf is "" 57 64 PASS window.getComputedStyle(flexbox, null).webkitAlignItems is "flex-start" 58 65 PASS window.getComputedStyle(flexitem, null).webkitAlignSelf is "flex-start" … … 73 80 PASS window.getComputedStyle(flexitem, null).webkitAlignSelf is "stretch" 74 81 PASS flexbox.style.webkitAlignItems is "" 75 PASS window.getComputedStyle(flexbox, null).webkitAlignItems is "st retch"76 PASS window.getComputedStyle(flexitem, null).webkitAlignSelf is "st retch"82 PASS window.getComputedStyle(flexbox, null).webkitAlignItems is "start" 83 PASS window.getComputedStyle(flexitem, null).webkitAlignSelf is "start" 77 84 PASS window.getComputedStyle(detachedFlexbox, null).webkitAlignSelf is "" 78 85 PASS window.getComputedStyle(detachedFlexItem, null).webkitAlignSelf is "" -
trunk/LayoutTests/css3/flexbox/css-properties.html
r155275 r176218 79 79 shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitJustifyContent', 'flex-start'); 80 80 81 flexbox.style.display = '-webkit-flex'; 81 82 82 83 shouldBeEqualToString('flexbox.style.webkitAlignSelf', ''); 83 // The initial value is ' stretch'.84 shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitAlignSelf', 'st retch');85 shouldBeEqualToString('window.getComputedStyle(document.documentElement, null).webkitAlignSelf', ' stretch');84 // The initial value is 'auto', which will be resolved depending on parent's style (except for the 'document' element). 85 shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitAlignSelf', 'start'); 86 shouldBeEqualToString('window.getComputedStyle(document.documentElement, null).webkitAlignSelf', 'auto'); 86 87 87 88 flexbox.style.webkitAlignSelf = 'foo'; 88 89 shouldBeEqualToString('flexbox.style.webkitAlignSelf', ''); 90 shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitAlignSelf', 'start'); 89 91 90 92 flexbox.style.webkitAlignSelf = 'auto'; 91 93 shouldBeEqualToString('flexbox.style.webkitAlignSelf', 'auto'); 92 shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitAlignSelf', 'st retch');94 shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitAlignSelf', 'start'); 93 95 94 96 flexbox.style.webkitAlignSelf = 'flex-start'; … … 114 116 flexbox.style.webkitAlignSelf = ''; 115 117 shouldBeEqualToString('flexbox.style.webkitAlignSelf', ''); 116 shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitAlignSelf', 'st retch');118 shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitAlignSelf', 'start'); 117 119 118 120 shouldBeEqualToString('flexbox.style.webkitAlignItems', ''); 119 // The initial value is 'stretch'. 121 shouldBeEqualToString('flexitem.style.webkitAlignSelf', ''); 122 // The initial value is 'auto', which will be resolved to 'stretch' in case of flexbox containers. 120 123 shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitAlignItems', 'stretch'); 121 124 shouldBeEqualToString('window.getComputedStyle(flexitem, null).webkitAlignSelf', 'stretch'); … … 123 126 flexbox.style.webkitAlignItems = 'foo'; 124 127 shouldBeEqualToString('flexbox.style.webkitAlignItems', ''); 128 shouldBeEqualToString('flexitem.style.webkitAlignSelf', ''); 129 shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitAlignItems', 'stretch'); 130 shouldBeEqualToString('window.getComputedStyle(flexitem, null).webkitAlignSelf', 'stretch'); 125 131 126 132 flexbox.style.webkitAlignItems = 'auto'; 127 shouldBeEqualToString('flexbox.style.webkitAlignItems', ''); 133 shouldBeEqualToString('flexbox.style.webkitAlignItems', 'auto'); 134 shouldBeEqualToString('flexitem.style.webkitAlignSelf', ''); 128 135 shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitAlignItems', 'stretch'); 129 136 shouldBeEqualToString('window.getComputedStyle(flexitem, null).webkitAlignSelf', 'stretch'); … … 131 138 flexbox.style.webkitAlignItems = 'flex-start'; 132 139 shouldBeEqualToString('flexbox.style.webkitAlignItems', 'flex-start'); 140 shouldBeEqualToString('flexitem.style.webkitAlignSelf', ''); 133 141 shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitAlignItems', 'flex-start'); 134 142 shouldBeEqualToString('window.getComputedStyle(flexitem, null).webkitAlignSelf', 'flex-start'); … … 161 169 flexbox.style.display = 'none'; 162 170 shouldBeEqualToString('flexbox.style.webkitAlignItems', ''); 163 shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitAlignItems', 'st retch');164 shouldBeEqualToString('window.getComputedStyle(flexitem, null).webkitAlignSelf', 'st retch');171 shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitAlignItems', 'start'); 172 shouldBeEqualToString('window.getComputedStyle(flexitem, null).webkitAlignSelf', 'start'); 165 173 flexbox.style.display = ''; 166 174 -
trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt
r175421 r176218 145 145 column-width: auto; 146 146 align-content: stretch; 147 align-items: st retch;148 align-self: st retch;147 align-items: start; 148 align-self: start; 149 149 flex-direction: row; 150 150 flex-wrap: nowrap; 151 151 justify-content: flex-start; 152 justify-self: auto; 152 153 -webkit-font-kerning: auto; 153 154 -webkit-font-smoothing: auto; -
trunk/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
r175421 r176218 144 144 column-width: auto 145 145 align-content: stretch 146 align-items: st retch147 align-self: st retch146 align-items: start 147 align-self: start 148 148 flex-direction: row 149 149 flex-wrap: nowrap 150 150 justify-content: flex-start 151 justify-self: auto 151 152 -webkit-font-kerning: auto 152 153 -webkit-font-smoothing: auto -
trunk/LayoutTests/fast/css/getComputedStyle/resources/property-names.js
r175421 r176218 66 66 "-webkit-hyphens": true, 67 67 "justify-content": true, 68 "justify-self": true, 68 69 "-webkit-line-align": true, 69 70 "-webkit-line-box-contain": true, -
trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt
r175421 r176218 287 287 rect: style.getPropertyValue(align-content) : stretch 288 288 rect: style.getPropertyCSSValue(align-content) : [object CSSPrimitiveValue] 289 rect: style.getPropertyValue(align-items) : st retch290 rect: style.getPropertyCSSValue(align-items) : [object CSS PrimitiveValue]291 rect: style.getPropertyValue(align-self) : st retch292 rect: style.getPropertyCSSValue(align-self) : [object CSS PrimitiveValue]289 rect: style.getPropertyValue(align-items) : start 290 rect: style.getPropertyCSSValue(align-items) : [object CSSValueList] 291 rect: style.getPropertyValue(align-self) : start 292 rect: style.getPropertyCSSValue(align-self) : [object CSSValueList] 293 293 rect: style.getPropertyValue(flex-direction) : row 294 294 rect: style.getPropertyCSSValue(flex-direction) : [object CSSPrimitiveValue] … … 297 297 rect: style.getPropertyValue(justify-content) : flex-start 298 298 rect: style.getPropertyCSSValue(justify-content) : [object CSSPrimitiveValue] 299 rect: style.getPropertyValue(justify-self) : auto 300 rect: style.getPropertyCSSValue(justify-self) : [object CSSValueList] 299 301 rect: style.getPropertyValue(-webkit-font-kerning) : auto 300 302 rect: style.getPropertyCSSValue(-webkit-font-kerning) : [object CSSPrimitiveValue] … … 799 801 g: style.getPropertyValue(align-content) : stretch 800 802 g: style.getPropertyCSSValue(align-content) : [object CSSPrimitiveValue] 801 g: style.getPropertyValue(align-items) : st retch802 g: style.getPropertyCSSValue(align-items) : [object CSS PrimitiveValue]803 g: style.getPropertyValue(align-self) : st retch804 g: style.getPropertyCSSValue(align-self) : [object CSS PrimitiveValue]803 g: style.getPropertyValue(align-items) : start 804 g: style.getPropertyCSSValue(align-items) : [object CSSValueList] 805 g: style.getPropertyValue(align-self) : start 806 g: style.getPropertyCSSValue(align-self) : [object CSSValueList] 805 807 g: style.getPropertyValue(flex-direction) : row 806 808 g: style.getPropertyCSSValue(flex-direction) : [object CSSPrimitiveValue] … … 809 811 g: style.getPropertyValue(justify-content) : flex-start 810 812 g: style.getPropertyCSSValue(justify-content) : [object CSSPrimitiveValue] 813 g: style.getPropertyValue(justify-self) : auto 814 g: style.getPropertyCSSValue(justify-self) : [object CSSValueList] 811 815 g: style.getPropertyValue(-webkit-font-kerning) : auto 812 816 g: style.getPropertyCSSValue(-webkit-font-kerning) : [object CSSPrimitiveValue] -
trunk/Source/WebCore/ChangeLog
r176213 r176218 1 2014-11-17 Javier Fernandez <jfernandez@igalia.com> 2 3 [CSS Grid Layout] Upgrade align-self and align-items parsing to CSS 3 4 https://bugs.webkit.org/show_bug.cgi?id=133359 5 6 Reviewed by David Hyatt. 7 8 Broaden justify-self's parsing name as a preparation of migrating 9 align-self, align-items and justify-items to the CSS 3 Alignment syntax. 10 11 The current naming was too tied to justify-self and needs to 12 be broadened. This will reduce the follow-up implementations' 13 patches. 14 15 Upgrade align-self and align-items parsing to CSS 3 16 17 This change migrates the 2 properties to the CSS 3 Alignment 18 parsing. The new parsing is identical to how we parse 19 'justify-self'. The 2 properties need to be migrated together 20 as they are used in tandem in CSSComputedStyleDeclaration. 21 22 This change also removes EAlignItems as it is now unused. 23 24 Tests: css3/parse-align-items.html 25 css3/parse-align-self.html 26 27 * css/CSSComputedStyleDeclaration.cpp: 28 (WebCore::valueForItemPositionWithOverflowAlignment): Added. Builds the CSSValue for the for the alignment properties. 29 (WebCore::ComputedStyleExtractor::propertyValue): 30 * css/CSSParser.cpp: 31 (WebCore::isKeywordPropertyID): Removed align-items and align-self from the list. 32 (WebCore::isValidKeywordPropertyAndValue): Removed align-items and align-self from the list. 33 (WebCore::CSSParser::parseValue): Added align-items and align-self to the list and call to the generic parsing fuction for the alignment properties. 34 (WebCore::isBaselinePositionKeyword): Utility function added to identify Baseline keyword values. 35 (WebCore::CSSParser::parseItemPositionOverflowPosition): Generic parsing fuction for the alignment properties. 36 (WebCore::CSSParser::parseJustifySelf): Deleted. 37 * css/CSSParser.h: 38 * css/CSSPrimitiveValueMappings.h: 39 (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Refactoring some mapping functions. 40 (WebCore::CSSPrimitiveValue::operator ItemPosition): Added. Replace the old EAlignItems enumeration. 41 (WebCore::CSSPrimitiveValue::operator OverflowAlignment): Added. 42 (WebCore::CSSPrimitiveValue::operator EAlignItems): Deleted. 43 (WebCore::CSSPrimitiveValue::operator EJustifySelf): Deleted. 44 (WebCore::CSSPrimitiveValue::operator EJustifySelfOverflowAlignment): Deleted. 45 * css/CSSPropertyNames.in: 46 * css/CSSValueKeywords.in: 47 * css/StyleResolver.cpp: 48 (WebCore::StyleResolver::adjustRenderStyle): Added a new adjustment to resolve the "auto" vale on the alignment properties. 49 (WebCore::StyleResolver::adjustStyleForAlignment): Added. Function to resolve the "auto" vale on the alignment properties. 50 (WebCore::StyleResolver::applyProperty): 51 (WebCore::isDisplayFlexibleBox): Deleted. Moved to the RenderStyle. 52 (WebCore::isDisplayGridBox): Deleted. Moved to the RenderStyle. 53 (WebCore::isDisplayFlexibleOrGridBox): Deleted. Moved to the RenderStyle. 54 * css/StyleResolver.h: 55 * rendering/RenderBox.cpp: 56 (WebCore::flexItemHasStretchAlignment): Adapted to the new ItemPosition enum. 57 * rendering/RenderFlexibleBox.cpp: 58 (WebCore::RenderFlexibleBox::firstLineBaseline): Adapted to the new ItemPosition enum. 59 (WebCore::resolveAlignment): Consider also that align-items could be "auto", since it's the default now. 60 (WebCore::RenderFlexibleBox::styleDidChange): Adapted to the new ItemPosition enum. 61 (WebCore::RenderFlexibleBox::alignmentForChild): Adapted to the new ItemPosition enum. 62 (WebCore::RenderFlexibleBox::needToStretchChild): Adapted to the new ItemPosition enum. 63 (WebCore::RenderFlexibleBox::layoutAndPlaceChildren): Adapted to the new ItemPosition enum. 64 (WebCore::RenderFlexibleBox::alignChildren): Adapted to the new ItemPosition enum. 65 * rendering/RenderFlexibleBox.h: 66 * rendering/RenderFullScreen.cpp: 67 (WebCore::createFullScreenStyle): Adapted to the new ItemPosition enum. 68 * rendering/RenderMenuList.cpp: 69 (WebCore::RenderMenuList::adjustInnerStyle): Adapted to the new ItemPosition enum. 70 * rendering/mathml/RenderMathMLRoot.cpp: 71 (WebCore::RenderMathMLRoot::updateStyle): Adapted to the new ItemPosition enum. 72 * rendering/mathml/RenderMathMLScripts.cpp: 73 (WebCore::RenderMathMLScripts::fixAnonymousStyleForSubSupPair): Adapted to the new ItemPosition enum. 74 (WebCore::RenderMathMLScripts::fixAnonymousStyles): Adapted to the new ItemPosition enum. 75 * rendering/style/RenderStyle.h: Adapted to the new ItemPosition enum. 76 * rendering/style/RenderStyleConstants.h: Adapted to the new ItemPosition enum. 77 * rendering/style/StyleRareNonInheritedData.cpp: Adapted to the new ItemPosition enum. 78 (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): Adapted to the new ItemPosition enum. 79 (WebCore::StyleRareNonInheritedData::operator==): Adapted to the new ItemPosition enum. 80 * rendering/style/StyleRareNonInheritedData.h: Adapted to the new ItemPosition enum. 81 * style/StyleResolveTree.cpp: 82 (WebCore::Style::determineChange): Changes in the alignItems property will cause a Detach. 83 1 84 2014-11-17 Shivakumar JM <shiva.jm@samsung.com> 2 85 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r176212 r176218 297 297 CSSPropertyFlexWrap, 298 298 CSSPropertyJustifyContent, 299 CSSProperty WebkitJustifySelf,299 CSSPropertyJustifySelf, 300 300 CSSPropertyWebkitFilter, 301 301 #if ENABLE(FILTERS_LEVEL_2) … … 1713 1713 } 1714 1714 #endif 1715 1716 static PassRefPtr<CSSValueList> valueForItemPositionWithOverflowAlignment(ItemPosition itemPosition, OverflowAlignment overflowAlignment) 1717 { 1718 RefPtr<CSSValueList> result = CSSValueList::createSpaceSeparated(); 1719 result->append(cssValuePool().createValue(itemPosition)); 1720 if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlignmentDefault) 1721 result->append(cssValuePool().createValue(overflowAlignment)); 1722 return result.release(); 1723 } 1715 1724 1716 1725 PassRefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const … … 2057 2066 return cssValuePool().createValue(style->alignContent()); 2058 2067 case CSSPropertyAlignItems: 2059 return cssValuePool().createValue(style->alignItems()); 2060 case CSSPropertyAlignSelf: 2061 if (style->alignSelf() == AlignAuto) { 2068 return valueForItemPositionWithOverflowAlignment(style->alignItems(), style->alignItemsOverflowAlignment()); 2069 case CSSPropertyAlignSelf: { 2070 ItemPosition alignSelf = style->alignSelf(); 2071 OverflowAlignment overflow = style->alignSelfOverflowAlignment(); 2072 if (alignSelf == ItemPositionAuto) { 2062 2073 Node* parent = styledNode->parentNode(); 2063 if (parent && parent->computedStyle()) 2064 return cssValuePool().createValue(parent->computedStyle()->alignItems()); 2065 return cssValuePool().createValue(AlignStretch); 2074 if (parent && parent->computedStyle()) { 2075 alignSelf = parent->computedStyle()->alignItems(); 2076 overflow = parent->computedStyle()->alignItemsOverflowAlignment(); 2077 } 2066 2078 } 2067 return cssValuePool().createValue(style->alignSelf()); 2079 return valueForItemPositionWithOverflowAlignment(alignSelf, overflow); 2080 } 2068 2081 case CSSPropertyFlex: 2069 2082 return getCSSPropertyValuesForShorthandProperties(flexShorthand()); … … 2082 2095 case CSSPropertyJustifyContent: 2083 2096 return cssValuePool().createValue(style->justifyContent()); 2084 case CSSPropertyWebkitJustifySelf: { 2085 RefPtr<CSSValueList> result = CSSValueList::createSpaceSeparated(); 2086 result->append(CSSPrimitiveValue::create(style->justifySelf())); 2087 if (style->justifySelf() >= JustifySelfCenter && style->justifySelfOverflowAlignment() != JustifySelfOverflowAlignmentDefault) 2088 result->append(CSSPrimitiveValue::create(style->justifySelfOverflowAlignment())); 2089 return result.release(); 2090 } 2097 case CSSPropertyJustifySelf: 2098 return valueForItemPositionWithOverflowAlignment(style->justifySelf(), style->justifySelfOverflowAlignment()); 2091 2099 case CSSPropertyOrder: 2092 2100 return cssValuePool().createValue(style->order(), CSSPrimitiveValue::CSS_NUMBER); -
trunk/Source/WebCore/css/CSSParser.cpp
r176171 r176218 866 866 return true; 867 867 break; 868 #if !ENABLE(CSS_GRID_LAYOUT) 868 869 case CSSPropertyAlignItems: 869 870 // FIXME: Per CSS alignment, this property should accept the same arguments as 'justify-self' so we should share its parsing code. … … 876 877 return true; 877 878 break; 879 #endif 878 880 case CSSPropertyFlexDirection: 879 881 if (valueID == CSSValueRow || valueID == CSSValueRowReverse || valueID == CSSValueColumn || valueID == CSSValueColumnReverse) … … 889 891 return true; 890 892 break; 891 case CSSPropertyWebkitJustifySelf: 893 #if !ENABLE(CSS_GRID_LAYOUT) 894 case CSSPropertyJustifySelf: 892 895 if (valueID == CSSValueAuto || valueID == CSSValueFlexStart || valueID == CSSValueFlexEnd || valueID == CSSValueCenter || valueID == CSSValueBaseline || valueID == CSSValueStretch) 893 896 return true; 894 897 break; 898 #endif 895 899 case CSSPropertyWebkitFontKerning: 896 900 if (valueID == CSSValueAuto || valueID == CSSValueNormal || valueID == CSSValueNone) … … 1107 1111 case CSSPropertyColumnRuleStyle: 1108 1112 case CSSPropertyAlignContent: 1113 #if !ENABLE(CSS_GRID_LAYOUT) 1109 1114 case CSSPropertyAlignItems: 1110 1115 case CSSPropertyAlignSelf: 1116 #endif 1111 1117 case CSSPropertyFlexDirection: 1112 1118 case CSSPropertyFlexWrap: … … 2631 2637 return false; 2632 2638 } 2633 case CSSPropertyWebkitJustifySelf:2634 return parseJustifySelf(propId, important);2635 2639 #if ENABLE(CSS_GRID_LAYOUT) 2640 case CSSPropertyJustifySelf: 2641 return parseItemPositionOverflowPosition(propId, important); 2636 2642 case CSSPropertyWebkitGridAutoColumns: 2637 2643 case CSSPropertyWebkitGridAutoRows: … … 2967 2973 parsedValue = parseImageResolution(); 2968 2974 break; 2975 #endif 2976 #if ENABLE(CSS_GRID_LAYOUT) 2977 case CSSPropertyAlignSelf: 2978 return parseItemPositionOverflowPosition(propId, important); 2979 2980 case CSSPropertyAlignItems: 2981 return parseItemPositionOverflowPosition(propId, important); 2969 2982 #endif 2970 2983 case CSSPropertyBorderBottomStyle: … … 3029 3042 case CSSPropertyColumnRuleStyle: 3030 3043 case CSSPropertyAlignContent: 3044 #if !ENABLE(CSS_GRID_LAYOUT) 3031 3045 case CSSPropertyAlignItems: 3032 3046 case CSSPropertyAlignSelf: 3047 case CSSPropertyJustifySelf: 3048 #endif 3033 3049 case CSSPropertyFlexDirection: 3034 3050 case CSSPropertyFlexWrap: … … 3141 3157 } 3142 3158 3159 static inline bool isBaselinePositionKeyword(CSSValueID id) 3160 { 3161 return id == CSSValueBaseline || id == CSSValueLastBaseline; 3162 } 3163 3143 3164 static bool isItemPositionKeyword(CSSValueID id) 3144 3165 { … … 3148 3169 } 3149 3170 3150 bool CSSParser::parse JustifySelf(CSSPropertyID propId, bool important)3171 bool CSSParser::parseItemPositionOverflowPosition(CSSPropertyID propId, bool important) 3151 3172 { 3152 3173 // auto | baseline | stretch | [<item-position> && <overflow-position>? ] … … 3156 3177 CSSParserValue* value = m_valueList->current(); 3157 3178 3158 if (value->id == CSSValueAuto || value->id == CSSValue Baseline || value->id == CSSValueStretch) {3179 if (value->id == CSSValueAuto || value->id == CSSValueStretch || isBaselinePositionKeyword(value->id)) { 3159 3180 if (m_valueList->next()) 3160 3181 return false; -
trunk/Source/WebCore/css/CSSParser.h
r176050 r176218 178 178 bool parseClipShape(CSSPropertyID, bool important); 179 179 180 bool parse JustifySelf(CSSPropertyID, bool important);180 bool parseItemPositionOverflowPosition(CSSPropertyID, bool important); 181 181 182 182 #if ENABLE(CSS_SHAPES) -
trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h
r176165 r176218 1427 1427 ASSERT_NOT_REACHED(); 1428 1428 return SHOW; 1429 }1430 1431 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EAlignItems e)1432 : CSSValue(PrimitiveClass)1433 {1434 m_primitiveUnitType = CSS_VALUE_ID;1435 switch (e) {1436 case AlignAuto:1437 m_value.valueID = CSSValueAuto;1438 break;1439 case AlignFlexStart:1440 m_value.valueID = CSSValueFlexStart;1441 break;1442 case AlignFlexEnd:1443 m_value.valueID = CSSValueFlexEnd;1444 break;1445 case AlignCenter:1446 m_value.valueID = CSSValueCenter;1447 break;1448 case AlignStretch:1449 m_value.valueID = CSSValueStretch;1450 break;1451 case AlignBaseline:1452 m_value.valueID = CSSValueBaseline;1453 break;1454 }1455 }1456 1457 template<> inline CSSPrimitiveValue::operator EAlignItems() const1458 {1459 ASSERT(isValueID());1460 1461 switch (m_value.valueID) {1462 case CSSValueAuto:1463 return AlignAuto;1464 case CSSValueFlexStart:1465 return AlignFlexStart;1466 case CSSValueFlexEnd:1467 return AlignFlexEnd;1468 case CSSValueCenter:1469 return AlignCenter;1470 case CSSValueStretch:1471 return AlignStretch;1472 case CSSValueBaseline:1473 return AlignBaseline;1474 default:1475 break;1476 }1477 1478 ASSERT_NOT_REACHED();1479 return AlignFlexStart;1480 1429 } 1481 1430 … … 5083 5032 } 5084 5033 5085 template<> inline CSSPrimitiveValue::CSSPrimitiveValue( EJustifySelf justifySelf)5086 : CSSValue(PrimitiveClass) 5087 { 5088 m_primitiveUnitType = CSS_VALUE_ID; 5089 switch ( justifySelf) {5090 case JustifySelfAuto:5034 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ItemPosition itemPosition) 5035 : CSSValue(PrimitiveClass) 5036 { 5037 m_primitiveUnitType = CSS_VALUE_ID; 5038 switch (itemPosition) { 5039 case ItemPositionAuto: 5091 5040 m_value.valueID = CSSValueAuto; 5092 5041 break; 5093 case JustifySelfStretch:5042 case ItemPositionStretch: 5094 5043 m_value.valueID = CSSValueStretch; 5095 5044 break; 5096 case JustifySelfBaseline:5045 case ItemPositionBaseline: 5097 5046 m_value.valueID = CSSValueBaseline; 5098 5047 break; 5099 case JustifySelfCenter: 5048 case ItemPositionLastBaseline: 5049 m_value.valueID = CSSValueLastBaseline; 5050 break; 5051 case ItemPositionCenter: 5100 5052 m_value.valueID = CSSValueCenter; 5101 5053 break; 5102 case JustifySelfStart:5054 case ItemPositionStart: 5103 5055 m_value.valueID = CSSValueStart; 5104 5056 break; 5105 case JustifySelfEnd:5057 case ItemPositionEnd: 5106 5058 m_value.valueID = CSSValueEnd; 5107 5059 break; 5108 case JustifySelfSelfStart:5060 case ItemPositionSelfStart: 5109 5061 m_value.valueID = CSSValueSelfStart; 5110 5062 break; 5111 case JustifySelfSelfEnd:5063 case ItemPositionSelfEnd: 5112 5064 m_value.valueID = CSSValueSelfEnd; 5113 5065 break; 5114 case JustifySelfFlexStart:5066 case ItemPositionFlexStart: 5115 5067 m_value.valueID = CSSValueFlexStart; 5116 5068 break; 5117 case JustifySelfFlexEnd:5069 case ItemPositionFlexEnd: 5118 5070 m_value.valueID = CSSValueFlexEnd; 5119 5071 break; 5120 case JustifySelfLeft:5072 case ItemPositionLeft: 5121 5073 m_value.valueID = CSSValueLeft; 5122 5074 break; 5123 case JustifySelfRight:5075 case ItemPositionRight: 5124 5076 m_value.valueID = CSSValueRight; 5125 5077 break; 5126 default: 5127 m_value.valueID = CSSValueAuto; 5128 break; 5129 } 5130 } 5131 5132 template<> inline CSSPrimitiveValue::operator EJustifySelf() const 5078 } 5079 } 5080 5081 template<> inline CSSPrimitiveValue::operator ItemPosition() const 5133 5082 { 5134 5083 switch (m_value.valueID) { 5135 5084 case CSSValueAuto: 5136 return JustifySelfAuto;5085 return ItemPositionAuto; 5137 5086 case CSSValueStretch: 5138 return JustifySelfStretch;5087 return ItemPositionStretch; 5139 5088 case CSSValueBaseline: 5140 return JustifySelfBaseline; 5089 return ItemPositionBaseline; 5090 case CSSValueLastBaseline: 5091 return ItemPositionLastBaseline; 5141 5092 case CSSValueCenter: 5142 return JustifySelfCenter;5093 return ItemPositionCenter; 5143 5094 case CSSValueStart: 5144 return JustifySelfStart;5095 return ItemPositionStart; 5145 5096 case CSSValueEnd: 5146 return JustifySelfEnd;5097 return ItemPositionEnd; 5147 5098 case CSSValueSelfStart: 5148 return JustifySelfSelfStart;5099 return ItemPositionSelfStart; 5149 5100 case CSSValueSelfEnd: 5150 return JustifySelfSelfEnd;5101 return ItemPositionSelfEnd; 5151 5102 case CSSValueFlexStart: 5152 return JustifySelfFlexStart;5103 return ItemPositionFlexStart; 5153 5104 case CSSValueFlexEnd: 5154 return JustifySelfFlexEnd;5105 return ItemPositionFlexEnd; 5155 5106 case CSSValueLeft: 5156 return JustifySelfLeft;5107 return ItemPositionLeft; 5157 5108 case CSSValueRight: 5158 return JustifySelfRight;5159 default: 5160 break; 5161 } 5162 ASSERT_NOT_REACHED(); 5163 return JustifySelfAuto;5164 } 5165 5166 template<> inline CSSPrimitiveValue::CSSPrimitiveValue( EJustifySelfOverflowAlignment overflowAlignment)5109 return ItemPositionRight; 5110 default: 5111 break; 5112 } 5113 ASSERT_NOT_REACHED(); 5114 return ItemPositionAuto; 5115 } 5116 5117 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(OverflowAlignment overflowAlignment) 5167 5118 : CSSValue(PrimitiveClass) 5168 5119 { 5169 5120 m_primitiveUnitType = CSS_VALUE_ID; 5170 5121 switch (overflowAlignment) { 5171 case JustifySelfOverflowAlignmentDefault:5122 case OverflowAlignmentDefault: 5172 5123 m_value.valueID = CSSValueDefault; 5173 5124 break; 5174 case JustifySelfOverflowAlignmentTrue:5125 case OverflowAlignmentTrue: 5175 5126 m_value.valueID = CSSValueTrue; 5176 5127 break; 5177 case JustifySelfOverflowAlignmentSafe:5128 case OverflowAlignmentSafe: 5178 5129 m_value.valueID = CSSValueSafe; 5179 5130 break; … … 5181 5132 } 5182 5133 5183 template<> inline CSSPrimitiveValue::operator EJustifySelfOverflowAlignment() const5134 template<> inline CSSPrimitiveValue::operator OverflowAlignment() const 5184 5135 { 5185 5136 switch (m_value.valueID) { 5186 5137 case CSSValueTrue: 5187 return JustifySelfOverflowAlignmentTrue;5138 return OverflowAlignmentTrue; 5188 5139 case CSSValueSafe: 5189 return JustifySelfOverflowAlignmentSafe;5190 default: 5191 break; 5192 } 5193 ASSERT_NOT_REACHED(); 5194 return JustifySelfOverflowAlignmentTrue;5140 return OverflowAlignmentSafe; 5141 default: 5142 break; 5143 } 5144 ASSERT_NOT_REACHED(); 5145 return OverflowAlignmentTrue; 5195 5146 } 5196 5147 -
trunk/Source/WebCore/css/CSSPropertyNames.in
r176202 r176218 365 365 align-content [NewStyleBuilder] 366 366 -webkit-align-content = align-content 367 align-items [NewStyleBuilder]367 align-items 368 368 -webkit-align-items = align-items 369 align-self [NewStyleBuilder, TypeName=EAlignItems]369 align-self 370 370 -webkit-align-self = align-self 371 371 flex … … 388 388 -webkit-backdrop-filter 389 389 #endif 390 -webkit-justify-self 390 justify-self 391 -webkit-justify-self = justify-self 391 392 -webkit-font-size-delta 392 393 #if defined(ENABLE_CSS_GRID_LAYOUT) && ENABLE_CSS_GRID_LAYOUT -
trunk/Source/WebCore/css/CSSValueKeywords.in
r174901 r176218 541 541 // center 542 542 // baseline 543 last-baseline 543 544 // stretch 544 545 … … 554 555 // stretch 555 556 // baseline 557 // last-baseline 556 558 // center 557 559 // start -
trunk/Source/WebCore/css/StyleResolver.cpp
r176174 r176218 1114 1114 } 1115 1115 1116 static bool isDisplayFlexibleBox(EDisplay display)1117 {1118 return display == FLEX || display == INLINE_FLEX;1119 }1120 1121 static inline bool isDisplayGridBox(EDisplay display)1122 {1123 #if ENABLE(CSS_GRID_LAYOUT)1124 return display == GRID || display == INLINE_GRID;1125 #else1126 UNUSED_PARAM(display);1127 return false;1128 #endif1129 }1130 1131 static bool isDisplayFlexibleOrGridBox(EDisplay display)1132 {1133 return isDisplayFlexibleBox(display) || isDisplayGridBox(display);1134 }1135 1136 1116 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) 1137 1117 static bool isScrollableOverflow(EOverflow overflow) … … 1236 1216 style.setWritingMode(TopToBottomWritingMode); 1237 1217 1238 if ( isDisplayFlexibleOrGridBox(parentStyle.display())) {1218 if (parentStyle.isDisplayFlexibleOrGridBox()) { 1239 1219 style.setFloating(NoFloat); 1240 1220 style.setDisplay(equivalentBlockDisplay(style.display(), style.isFloating(), !document().inQuirksMode())); … … 1243 1223 1244 1224 // Make sure our z-index value is only applied if the object is positioned. 1245 if (style.position() == StaticPosition && ! isDisplayFlexibleOrGridBox(parentStyle.display()))1225 if (style.position() == StaticPosition && !parentStyle.isDisplayFlexibleOrGridBox()) 1246 1226 style.setHasAutoZIndex(); 1247 1227 … … 1371 1351 if ((e->hasTagName(SVGNames::foreignObjectTag) || e->hasTagName(SVGNames::textTag)) && style.isDisplayInlineType()) 1372 1352 style.setDisplay(BLOCK); 1353 } 1354 1355 // CSS Box Alignment specification requires to resolve "auto" (inital/default) values. 1356 adjustStyleForAlignment(style); 1357 } 1358 1359 void StyleResolver::adjustStyleForAlignment(RenderStyle& style) 1360 { 1361 // The 'auto' keyword computes to: 1362 // - 'stretch' for flex containers and grid containers, 1363 // - 'start' for everything else. (to be resolved later, during the layout) 1364 if (style.alignItems() == ItemPositionAuto) { 1365 if (style.isDisplayFlexibleOrGridBox()) 1366 style.setAlignItems(ItemPositionStretch); 1367 else 1368 style.setAlignItems(ItemPositionStart); 1369 } 1370 1371 // The 'auto' keyword computes to 'stretch' on absolutely-positioned elements, 1372 // and to the computed value of align-items on the parent (minus 1373 // any 'legacy' keywords) on all other boxes (to be resolved during the layout). 1374 if (style.alignSelf() == ItemPositionAuto) { 1375 if ((style.position() == AbsolutePosition)) 1376 style.setAlignSelf(ItemPositionStretch); 1373 1377 } 1374 1378 } … … 2901 2905 } 2902 2906 #endif /* ENABLE(CSS_GRID_LAYOUT) */ 2903 2904 case CSSPropertyWebkitJustifySelf: 2905 HANDLE_INHERIT_AND_INITIAL(justifySelf, JustifySelf); 2907 case CSSPropertyAlignSelf: { 2908 if (isInherit) { 2909 state.style()->setAlignSelf(state.parentStyle()->alignSelf()); 2910 state.style()->setAlignSelfOverflowAlignment(state.parentStyle()->alignSelfOverflowAlignment()); 2911 return; 2912 } 2913 if (isInitial) { 2914 state.style()->setAlignSelf(RenderStyle::initialAlignSelf()); 2915 state.style()->setAlignSelfOverflowAlignment(RenderStyle::initialAlignSelfOverflowAlignment()); 2916 return; 2917 } 2918 if (Pair* pairValue = primitiveValue->getPairValue()) { 2919 state.style()->setAlignSelf(*pairValue->first()); 2920 state.style()->setAlignSelfOverflowAlignment(*pairValue->second()); 2921 } else 2922 state.style()->setAlignSelf(*primitiveValue); 2923 return; 2924 } 2925 2926 case CSSPropertyAlignItems: { 2927 if (isInherit) { 2928 state.style()->setAlignItems(state.parentStyle()->alignItems()); 2929 state.style()->setAlignItemsOverflowAlignment(state.parentStyle()->alignItemsOverflowAlignment()); 2930 return; 2931 } 2932 if (isInitial) { 2933 state.style()->setAlignItems(RenderStyle::initialAlignItems()); 2934 state.style()->setAlignItemsOverflowAlignment(RenderStyle::initialAlignItemsOverflowAlignment()); 2935 return; 2936 } 2937 if (Pair* pairValue = primitiveValue->getPairValue()) { 2938 state.style()->setAlignItems(*pairValue->first()); 2939 state.style()->setAlignItemsOverflowAlignment(*pairValue->second()); 2940 } else 2941 state.style()->setAlignItems(*primitiveValue); 2942 return; 2943 } 2944 case CSSPropertyJustifySelf: { 2945 if (isInherit) { 2946 state.style()->setJustifySelf(state.parentStyle()->justifySelf()); 2947 state.style()->setJustifySelfOverflowAlignment(state.parentStyle()->justifySelfOverflowAlignment()); 2948 return; 2949 } 2950 if (isInitial) { 2951 state.style()->setJustifySelf(RenderStyle::initialJustifySelf()); 2952 state.style()->setJustifySelfOverflowAlignment(RenderStyle::initialJustifySelfOverflowAlignment()); 2953 return; 2954 } 2906 2955 if (Pair* pairValue = primitiveValue->getPairValue()) { 2907 2956 state.style()->setJustifySelf(*pairValue->first()); … … 2910 2959 state.style()->setJustifySelf(*primitiveValue); 2911 2960 return; 2912 2961 } 2913 2962 #if ENABLE(CSS_SCROLL_SNAP) 2914 2963 case CSSPropertyWebkitScrollSnapType: … … 3129 3178 #endif 3130 3179 case CSSPropertyAlignContent: 3131 case CSSPropertyAlignItems:3132 case CSSPropertyAlignSelf:3133 3180 case CSSPropertyFlexBasis: 3134 3181 case CSSPropertyFlexDirection: -
trunk/Source/WebCore/css/StyleResolver.h
r175772 r176218 297 297 298 298 void adjustRenderStyle(RenderStyle& styleToAdjust, const RenderStyle& parentStyle, Element*); 299 void adjustStyleForAlignment(RenderStyle& styleToAdjust); 299 300 #if ENABLE(CSS_GRID_LAYOUT) 300 301 std::unique_ptr<GridPosition> adjustNamedGridItemPosition(const NamedGridAreaMap&, const NamedGridLinesMap&, const GridPosition&, GridPositionSide) const; -
trunk/Source/WebCore/rendering/RenderBox.cpp
r175583 r176218 2419 2419 { 2420 2420 auto parent = flexitem.parent(); 2421 return flexitem.style().alignSelf() == AlignStretch || (flexitem.style().alignSelf() == AlignAuto && parent->style().alignItems() == AlignStretch);2421 return flexitem.style().alignSelf() == ItemPositionStretch || (flexitem.style().alignSelf() == ItemPositionAuto && parent->style().alignItems() == ItemPositionStretch); 2422 2422 } 2423 2423 -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r172970 r176218 33 33 34 34 #include "LayoutRepainter.h" 35 #include "NotImplemented.h" 35 36 #include "RenderLayer.h" 36 37 #include "RenderView.h" … … 187 188 if (child->isOutOfFlowPositioned()) 188 189 continue; 189 if (alignmentForChild(*child) == AlignBaseline && !hasAutoMarginsInCrossAxis(*child)) {190 if (alignmentForChild(*child) == ItemPositionBaseline && !hasAutoMarginsInCrossAxis(*child)) { 190 191 baselineChild = child; 191 192 break; … … 228 229 } 229 230 230 static EAlignItemsresolveAlignment(const RenderStyle* parentStyle, const RenderStyle* childStyle)231 { 232 EAlignItemsalign = childStyle->alignSelf();233 if (align == AlignAuto)234 align = parentStyle->alignItems();231 static ItemPosition resolveAlignment(const RenderStyle* parentStyle, const RenderStyle* childStyle) 232 { 233 ItemPosition align = childStyle->alignSelf(); 234 if (align == ItemPositionAuto) 235 align = (parentStyle->alignItems() == ItemPositionAuto) ? ItemPositionStretch : parentStyle->alignItems(); 235 236 return align; 236 237 } … … 240 241 RenderBlock::styleDidChange(diff, oldStyle); 241 242 242 if (oldStyle && oldStyle->alignItems() == AlignStretch && diff == StyleDifferenceLayout) {243 if (oldStyle && oldStyle->alignItems() == ItemPositionStretch && diff == StyleDifferenceLayout) { 243 244 // Flex items that were previously stretching need to be relayed out so we can compute new available cross axis space. 244 245 // This is only necessary for stretching since other alignment values don't change the size of the box. 245 246 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) { 246 EAlignItemspreviousAlignment = resolveAlignment(oldStyle, &child->style());247 if (previousAlignment == AlignStretch && previousAlignment != resolveAlignment(&style(), &child->style()))247 ItemPosition previousAlignment = resolveAlignment(oldStyle, &child->style()); 248 if (previousAlignment == ItemPositionStretch && previousAlignment != resolveAlignment(&style(), &child->style())) 248 249 child->setChildNeedsLayout(MarkOnlyThis); 249 250 } … … 1024 1025 } 1025 1026 1026 EAlignItemsRenderFlexibleBox::alignmentForChild(RenderBox& child) const1027 { 1028 EAlignItemsalign = resolveAlignment(&style(), &child.style());1029 1030 if (align == AlignBaseline && hasOrthogonalFlow(child))1031 align = AlignFlexStart;1027 ItemPosition RenderFlexibleBox::alignmentForChild(RenderBox& child) const 1028 { 1029 ItemPosition align = resolveAlignment(&style(), &child.style()); 1030 1031 if (align == ItemPositionBaseline && hasOrthogonalFlow(child)) 1032 align = ItemPositionFlexStart; 1032 1033 1033 1034 if (style().flexWrap() == FlexWrapReverse) { 1034 if (align == AlignFlexStart)1035 align = AlignFlexEnd;1036 else if (align == AlignFlexEnd)1037 align = AlignFlexStart;1035 if (align == ItemPositionFlexStart) 1036 align = ItemPositionFlexEnd; 1037 else if (align == ItemPositionFlexEnd) 1038 align = ItemPositionFlexStart; 1038 1039 } 1039 1040 … … 1054 1055 bool RenderFlexibleBox::needToStretchChild(RenderBox& child) 1055 1056 { 1056 if (alignmentForChild(child) != AlignStretch)1057 if (alignmentForChild(child) != ItemPositionStretch) 1057 1058 return false; 1058 1059 … … 1105 1106 1106 1107 LayoutUnit childCrossAxisMarginBoxExtent; 1107 if (alignmentForChild(child) == AlignBaseline && !hasAutoMarginsInCrossAxis(child)) {1108 if (alignmentForChild(child) == ItemPositionBaseline && !hasAutoMarginsInCrossAxis(child)) { 1108 1109 LayoutUnit ascent = marginBoxAscentForChild(child); 1109 1110 LayoutUnit descent = (crossAxisMarginExtentForChild(child) + crossAxisExtentForChild(child)) - ascent; … … 1266 1267 1267 1268 switch (alignmentForChild(*child)) { 1268 case AlignAuto:1269 case ItemPositionAuto: 1269 1270 ASSERT_NOT_REACHED(); 1270 1271 break; 1271 case AlignStretch: { 1272 case ItemPositionStart: 1273 // FIXME: https://webkit.org/b/135460 - The extended grammar is not supported 1274 // yet for FlexibleBox. 1275 // Defaulting to Stretch for now, as it what most of FlexBox based renders 1276 // expect as default. 1277 notImplemented(); 1278 FALLTHROUGH; 1279 case ItemPositionStretch: { 1272 1280 applyStretchAlignmentToChild(*child, lineCrossAxisExtent); 1273 1281 // Since wrap-reverse flips cross start and cross end, strech children should be aligned with the cross end. … … 1276 1284 break; 1277 1285 } 1278 case AlignFlexStart:1286 case ItemPositionFlexStart: 1279 1287 break; 1280 case AlignFlexEnd:1288 case ItemPositionFlexEnd: 1281 1289 adjustAlignmentForChild(*child, availableAlignmentSpaceForChild(lineCrossAxisExtent, *child)); 1282 1290 break; 1283 case AlignCenter:1291 case ItemPositionCenter: 1284 1292 adjustAlignmentForChild(*child, availableAlignmentSpaceForChild(lineCrossAxisExtent, *child) / 2); 1285 1293 break; 1286 case AlignBaseline: {1294 case ItemPositionBaseline: { 1287 1295 // FIXME: If we get here in columns, we want the use the descent, except we currently can't get the ascent/descent of orthogonal children. 1288 1296 // https://bugs.webkit.org/show_bug.cgi?id=98076 … … 1295 1303 break; 1296 1304 } 1305 case ItemPositionLastBaseline: 1306 case ItemPositionSelfStart: 1307 case ItemPositionSelfEnd: 1308 case ItemPositionEnd: 1309 case ItemPositionLeft: 1310 case ItemPositionRight: 1311 // FIXME: https://webkit.org/b/135460 - The extended grammar is not supported 1312 // yet for FlexibleBox. 1313 notImplemented(); 1314 FALLTHROUGH; 1315 default: 1316 ASSERT_NOT_REACHED(); 1317 break; 1297 1318 } 1298 1319 } … … 1310 1331 for (size_t childNumber = 0; childNumber < lineContexts[lineNumber].numberOfChildren; ++childNumber, child = m_orderIterator.next()) { 1311 1332 ASSERT(child); 1312 if (alignmentForChild(*child) == AlignBaseline && !hasAutoMarginsInCrossAxis(*child) && minMarginAfterBaseline)1333 if (alignmentForChild(*child) == ItemPositionBaseline && !hasAutoMarginsInCrossAxis(*child) && minMarginAfterBaseline) 1313 1334 adjustAlignmentForChild(*child, minMarginAfterBaseline); 1314 1335 } -
trunk/Source/WebCore/rendering/RenderFlexibleBox.h
r175084 r176218 119 119 void setFlowAwareLocationForChild(RenderBox& child, const LayoutPoint&); 120 120 void adjustAlignmentForChild(RenderBox& child, LayoutUnit); 121 EAlignItemsalignmentForChild(RenderBox& child) const;121 ItemPosition alignmentForChild(RenderBox& child) const; 122 122 LayoutUnit mainAxisBorderAndPaddingExtentForChild(RenderBox& child) const; 123 123 LayoutUnit mainAxisScrollbarExtentForChild(RenderBox& child) const; -
trunk/Source/WebCore/rendering/RenderFullScreen.cpp
r174840 r176218 91 91 fullscreenStyle.get().setDisplay(FLEX); 92 92 fullscreenStyle.get().setJustifyContent(JustifyCenter); 93 fullscreenStyle.get().setAlignItems( AlignCenter);93 fullscreenStyle.get().setAlignItems(ItemPositionCenter); 94 94 fullscreenStyle.get().setFlexDirection(FlowColumn); 95 95 -
trunk/Source/WebCore/rendering/RenderMenuList.cpp
r174898 r176218 120 120 // when the content overflows, treat it the same as align-items: flex-start. 121 121 // But we only do that for the cases where html.css would otherwise use center. 122 if (style().alignItems() == AlignCenter) {122 if (style().alignItems() == ItemPositionCenter) { 123 123 innerStyle.setMarginTop(Length()); 124 124 innerStyle.setMarginBottom(Length()); 125 innerStyle.setAlignSelf( AlignFlexStart);125 innerStyle.setAlignSelf(ItemPositionFlexStart); 126 126 } 127 127 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp
r174619 r176218 234 234 auto baseStyle = RenderStyle::createAnonymousStyleWithDisplay(&style(), FLEX); 235 235 baseStyle.get().setMarginTop(Length(0, Fixed)); // This will be updated in RenderMathMLRoot::layout(). 236 baseStyle.get().setAlignItems( AlignBaseline);236 baseStyle.get().setAlignItems(ItemPositionBaseline); 237 237 base->setStyle(WTF::move(baseStyle)); 238 238 base->setNeedsLayoutAndPrefWidthsRecalc(); … … 245 245 indexStyle.get().setMarginStart(Length(kernBeforeDegree, Fixed)); 246 246 indexStyle.get().setMarginEnd(Length(kernAfterDegree, Fixed)); 247 indexStyle.get().setAlignItems( AlignBaseline);247 indexStyle.get().setAlignItems(ItemPositionBaseline); 248 248 index->setStyle(WTF::move(indexStyle)); 249 249 index->setNeedsLayoutAndPrefWidthsRecalc(); -
trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp
r174587 r176218 102 102 // Let's right align prescripts and left align postscripts. 103 103 // See http://lists.w3.org/Archives/Public/www-math/2012Aug/0006.html 104 scriptsStyle.setAlignItems(isPostScript ? AlignFlexStart : AlignFlexEnd);104 scriptsStyle.setAlignItems(isPostScript ? ItemPositionFlexStart : ItemPositionFlexEnd); 105 105 106 106 // We set the order property so that the prescripts are drawn before the base. … … 116 116 // We set the base wrapper's style so that baseHeight in layout() will be an unstretched height. 117 117 ASSERT(m_baseWrapper && m_baseWrapper->style().hasOneRef()); 118 m_baseWrapper->style().setAlignSelf( AlignFlexStart);118 m_baseWrapper->style().setAlignSelf(ItemPositionFlexStart); 119 119 120 120 // This sets the style for postscript pairs. … … 136 136 scriptsStyle.setFlexDirection(FlowRow); 137 137 scriptsStyle.setJustifyContent(JustifyFlexStart); 138 scriptsStyle.setAlignItems( AlignCenter);138 scriptsStyle.setAlignItems(ItemPositionCenter); 139 139 scriptsStyle.setOrder(0); 140 140 scriptsStyle.setFontSize(style().fontSize()); -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r175889 r176218 904 904 const Length& flexBasis() const { return rareNonInheritedData->m_flexibleBox->m_flexBasis; } 905 905 EAlignContent alignContent() const { return static_cast<EAlignContent>(rareNonInheritedData->m_alignContent); } 906 EAlignItems alignItems() const { return static_cast<EAlignItems>(rareNonInheritedData->m_alignItems); } 907 EAlignItems alignSelf() const { return static_cast<EAlignItems>(rareNonInheritedData->m_alignSelf); } 906 ItemPosition alignItems() const { return static_cast<ItemPosition>(rareNonInheritedData->m_alignItems); } 907 OverflowAlignment alignItemsOverflowAlignment() const { return static_cast<OverflowAlignment>(rareNonInheritedData->m_alignItemsOverflowAlignment); } 908 ItemPosition alignSelf() const { return static_cast<ItemPosition>(rareNonInheritedData->m_alignSelf); } 909 OverflowAlignment alignSelfOverflowAlignment() const { return static_cast<OverflowAlignment>(rareNonInheritedData->m_alignSelfOverflowAlignment); } 908 910 EFlexDirection flexDirection() const { return static_cast<EFlexDirection>(rareNonInheritedData->m_flexibleBox->m_flexDirection); } 909 911 bool isColumnFlexDirection() const { return flexDirection() == FlowColumn || flexDirection() == FlowColumnReverse; } … … 911 913 EFlexWrap flexWrap() const { return static_cast<EFlexWrap>(rareNonInheritedData->m_flexibleBox->m_flexWrap); } 912 914 EJustifyContent justifyContent() const { return static_cast<EJustifyContent>(rareNonInheritedData->m_justifyContent); } 913 EJustifySelf justifySelf() const { return static_cast<EJustifySelf>(rareNonInheritedData->m_justifySelf); }914 EJustifySelfOverflowAlignment justifySelfOverflowAlignment() const { return static_cast<EJustifySelfOverflowAlignment>(rareNonInheritedData->m_justifySelfOverflowAlignment); }915 ItemPosition justifySelf() const { return static_cast<ItemPosition>(rareNonInheritedData->m_justifySelf); } 916 OverflowAlignment justifySelfOverflowAlignment() const { return static_cast<OverflowAlignment>(rareNonInheritedData->m_justifySelfOverflowAlignment); } 915 917 916 918 #if ENABLE(CSS_GRID_LAYOUT) … … 1476 1478 void setOrder(int o) { SET_VAR(rareNonInheritedData, m_order, o); } 1477 1479 void setAlignContent(EAlignContent p) { SET_VAR(rareNonInheritedData, m_alignContent, p); } 1478 void setAlignItems(EAlignItems a) { SET_VAR(rareNonInheritedData, m_alignItems, a); } 1479 void setAlignSelf(EAlignItems a) { SET_VAR(rareNonInheritedData, m_alignSelf, a); } 1480 void setAlignItems(ItemPosition a) { SET_VAR(rareNonInheritedData, m_alignItems, a); } 1481 void setAlignItemsOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_alignItemsOverflowAlignment, overflowAlignment); } 1482 void setAlignSelf(ItemPosition a) { SET_VAR(rareNonInheritedData, m_alignSelf, a); } 1483 void setAlignSelfOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_alignSelfOverflowAlignment, overflowAlignment); } 1480 1484 void setFlexDirection(EFlexDirection direction) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexDirection, direction); } 1481 1485 void setFlexWrap(EFlexWrap w) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexWrap, w); } 1482 1486 void setJustifyContent(EJustifyContent p) { SET_VAR(rareNonInheritedData, m_justifyContent, p); } 1483 void setJustifySelf( EJustifySelfp) { SET_VAR(rareNonInheritedData, m_justifySelf, p); }1484 void setJustifySelfOverflowAlignment( EJustifySelfOverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_justifySelfOverflowAlignment, overflowAlignment); }1487 void setJustifySelf(ItemPosition p) { SET_VAR(rareNonInheritedData, m_justifySelf, p); } 1488 void setJustifySelfOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_justifySelfOverflowAlignment, overflowAlignment); } 1485 1489 #if ENABLE(CSS_GRID_LAYOUT) 1486 1490 void setGridAutoColumns(const GridTrackSize& length) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridAutoColumns, length); } … … 1761 1765 bool isDisplayInlineType() const { return isDisplayInlineType(display()); } 1762 1766 bool isOriginalDisplayInlineType() const { return isDisplayInlineType(originalDisplay()); } 1767 bool isDisplayFlexibleOrGridBox() const { return isDisplayFlexibleOrGridBox(display()); } 1763 1768 bool isDisplayRegionType() const 1764 1769 { … … 1884 1889 static int initialOrder() { return 0; } 1885 1890 static EAlignContent initialAlignContent() { return AlignContentStretch; } 1886 static EAlignItems initialAlignItems() { return AlignStretch; } 1887 static EAlignItems initialAlignSelf() { return AlignAuto; } 1891 static ItemPosition initialAlignItems() { return ItemPositionAuto; } 1892 static OverflowAlignment initialAlignItemsOverflowAlignment() { return OverflowAlignmentDefault; } 1893 static ItemPosition initialAlignSelf() { return ItemPositionAuto; } 1894 static OverflowAlignment initialAlignSelfOverflowAlignment() { return OverflowAlignmentDefault; } 1888 1895 static EFlexDirection initialFlexDirection() { return FlowRow; } 1889 1896 static EFlexWrap initialFlexWrap() { return FlexNoWrap; } 1890 1897 static EJustifyContent initialJustifyContent() { return JustifyFlexStart; } 1891 static EJustifySelf initialJustifySelf() { return JustifySelfAuto; }1892 static EJustifySelfOverflowAlignment initialJustifySelfOverflowAlignment() { return JustifySelfOverflowAlignmentDefault; }1898 static ItemPosition initialJustifySelf() { return ItemPositionAuto; } 1899 static OverflowAlignment initialJustifySelfOverflowAlignment() { return OverflowAlignmentDefault; } 1893 1900 static int initialMarqueeLoopCount() { return -1; } 1894 1901 static int initialMarqueeSpeed() { return 85; } … … 2076 2083 } 2077 2084 2085 bool isDisplayFlexibleBox(EDisplay display) const 2086 { 2087 return display == FLEX || display == INLINE_FLEX; 2088 } 2089 2090 bool isDisplayGridBox(EDisplay display) const 2091 { 2092 #if ENABLE(CSS_GRID_LAYOUT) 2093 return display == GRID || display == INLINE_GRID; 2094 #else 2095 UNUSED_PARAM(display); 2096 return false; 2097 #endif 2098 } 2099 2100 bool isDisplayFlexibleOrGridBox(EDisplay display) const 2101 { 2102 return isDisplayFlexibleBox(display) || isDisplayGridBox(display); 2103 } 2104 2078 2105 // Color accessors are all private to make sure callers use visitedDependentColor instead to access them. 2079 2106 Color invalidColor() const { static Color invalid; return invalid; } -
trunk/Source/WebCore/rendering/style/RenderStyleConstants.h
r175889 r176218 245 245 246 246 enum EAlignContent { AlignContentFlexStart, AlignContentFlexEnd, AlignContentCenter, AlignContentSpaceBetween, AlignContentSpaceAround, AlignContentStretch }; 247 enum EAlignItems { AlignAuto, AlignFlexStart, AlignFlexEnd, AlignCenter, AlignStretch, AlignBaseline };248 247 enum EFlexDirection { FlowRow, FlowRowReverse, FlowColumn, FlowColumnReverse }; 249 248 enum EFlexWrap { FlexNoWrap, FlexWrap, FlexWrapReverse }; 250 249 enum EJustifyContent { JustifyFlexStart, JustifyFlexEnd, JustifyCenter, JustifySpaceBetween, JustifySpaceAround }; 251 enum EJustifySelf {JustifySelfAuto, JustifySelfStretch, JustifySelfBaseline, JustifySelfCenter, JustifySelfStart, JustifySelfEnd, JustifySelfSelfStart, JustifySelfSelfEnd, JustifySelfFlexStart, JustifySelfFlexEnd, JustifySelfLeft, JustifySelfRight};252 enum EJustifySelfOverflowAlignment {JustifySelfOverflowAlignmentDefault, JustifySelfOverflowAlignmentTrue, JustifySelfOverflowAlignmentSafe};250 enum ItemPosition {ItemPositionAuto, ItemPositionStretch, ItemPositionBaseline, ItemPositionLastBaseline, ItemPositionCenter, ItemPositionStart, ItemPositionEnd, ItemPositionSelfStart, ItemPositionSelfEnd, ItemPositionFlexStart, ItemPositionFlexEnd, ItemPositionLeft, ItemPositionRight}; 251 enum OverflowAlignment {OverflowAlignmentDefault, OverflowAlignmentTrue, OverflowAlignmentSafe}; 253 252 254 253 -
trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
r175716 r176218 84 84 , m_alignContent(RenderStyle::initialAlignContent()) 85 85 , m_alignItems(RenderStyle::initialAlignItems()) 86 , m_alignItemsOverflowAlignment(RenderStyle::initialAlignItemsOverflowAlignment()) 86 87 , m_alignSelf(RenderStyle::initialAlignSelf()) 88 , m_alignSelfOverflowAlignment(RenderStyle::initialAlignSelfOverflowAlignment()) 87 89 , m_justifyContent(RenderStyle::initialJustifyContent()) 88 90 , m_justifySelf(RenderStyle::initialJustifySelf()) … … 171 173 , m_alignContent(o.m_alignContent) 172 174 , m_alignItems(o.m_alignItems) 175 , m_alignItemsOverflowAlignment(o.m_alignItemsOverflowAlignment) 173 176 , m_alignSelf(o.m_alignSelf) 177 , m_alignSelfOverflowAlignment(o.m_alignSelfOverflowAlignment) 174 178 , m_justifyContent(o.m_justifyContent) 175 179 , m_justifySelf(o.m_justifySelf) … … 266 270 && m_alignContent == o.m_alignContent 267 271 && m_alignItems == o.m_alignItems 272 && m_alignItemsOverflowAlignment == o.m_alignItemsOverflowAlignment 268 273 && m_alignSelf == o.m_alignSelf 274 && m_alignSelfOverflowAlignment == o.m_alignSelfOverflowAlignment 269 275 && m_justifyContent == o.m_justifyContent 270 276 && userDrag == o.userDrag -
trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h
r175716 r176218 189 189 190 190 unsigned m_alignContent : 3; // EAlignContent 191 unsigned m_alignItems : 3; // EAlignItems 192 unsigned m_alignSelf : 3; // EAlignItems 191 unsigned m_alignItems : 4; // ItemPosition 192 unsigned m_alignItemsOverflowAlignment : 2; // OverflowAlignment 193 unsigned m_alignSelf : 4; // ItemPosition 194 unsigned m_alignSelfOverflowAlignment : 2; // OverflowAlignment 193 195 unsigned m_justifyContent : 3; // EJustifyContent 194 196 195 unsigned m_justifySelf : 4; // EJustifySelf196 unsigned m_justifySelfOverflowAlignment : 2; // EJustifySelfOverflowAlignment197 unsigned m_justifySelf : 4; // ItemPosition 198 unsigned m_justifySelfOverflowAlignment : 2; // OverflowAlignment 197 199 198 200 unsigned userDrag : 2; // EUserDrag -
trunk/Source/WebCore/style/StyleResolveTree.cpp
r175583 r176218 122 122 if (s1.hasFlowFrom() && (s1.specifiesColumns() != s2.specifiesColumns())) 123 123 return Detach; 124 if (s1.alignItems() != s2.alignItems()) 125 return Detach; 124 126 125 127 if (s1 != s2) {
Note: See TracChangeset
for help on using the changeset viewer.