Changeset 171010 in webkit
- Timestamp:
- Jul 11, 2014 1:26:00 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r171004 r171010 1 2014-07-11 Javier Fernandez <jfernandez@igalia.com> 2 3 [CSS Grid Layout] Implement justify-self css property 4 https://bugs.webkit.org/show_bug.cgi?id=134419 5 6 Reviewed by Dean Jackson. 7 8 This change adds the justify-self property from CSS 3 Box Alignment 9 and implements the parsing. 10 11 From Blink r164685 by <jchaffraix@chromium.org> 12 13 * fast/css/parse-justify-self-expected.txt: Added. 14 * fast/css/parse-justify-self.html: Added. 15 1 16 2014-07-11 Brent Fulgham <bfulgham@apple.com> 2 17 -
trunk/Source/WebCore/ChangeLog
r171008 r171010 1 2014-07-11 Javier Fernandez <jfernandez@igalia.com> 2 3 [CSS Grid Layout] Implement justify-self css property 4 https://bugs.webkit.org/show_bug.cgi?id=134419 5 6 Reviewed by Dean Jackson. 7 8 This change adds the justify-self property from CSS 3 Box Alignment 9 and implements the parsing. 10 11 From Blink r164685 by <jchaffraix@chromium.org> 12 13 Test: fast/css/parse-justify-self.html 14 15 * css/CSSComputedStyleDeclaration.cpp: 16 (WebCore::ComputedStyleExtractor::propertyValue): 17 * css/CSSParser.cpp: 18 (WebCore::isValidKeywordPropertyAndValue): 19 (WebCore::CSSParser::parseValue): 20 (WebCore::isItemPositionKeyword): 21 (WebCore::CSSParser::parseJustifySelf): 22 * css/CSSParser.h: 23 * css/CSSPrimitiveValueMappings.h: 24 (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): 25 (WebCore::CSSPrimitiveValue::operator EJustifySelf): 26 (WebCore::CSSPrimitiveValue::operator EJustifySelfOverflowAlignment): 27 * css/CSSPropertyNames.in: 28 * css/CSSValueKeywords.in: 29 * css/DeprecatedStyleBuilder.cpp: 30 (WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder): 31 * css/StyleResolver.cpp: 32 (WebCore::StyleResolver::applyProperty): 33 * rendering/style/RenderStyle.h: 34 * rendering/style/RenderStyleConstants.h: 35 * rendering/style/StyleRareNonInheritedData.cpp: 36 (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): 37 (WebCore::StyleRareNonInheritedData::operator==): 38 * rendering/style/StyleRareNonInheritedData.h: 39 1 40 2014-07-11 Bear Travis <betravis@adobe.com> 2 41 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r170996 r171010 284 284 CSSPropertyWebkitFlexWrap, 285 285 CSSPropertyWebkitJustifyContent, 286 CSSPropertyWebkitJustifySelf, 286 287 CSSPropertyWebkitFontKerning, 287 288 CSSPropertyWebkitFontSmoothing, … … 2007 2008 case CSSPropertyWebkitJustifyContent: 2008 2009 return cssValuePool().createValue(style->justifyContent()); 2010 case CSSPropertyWebkitJustifySelf: { 2011 RefPtr<CSSValueList> result = CSSValueList::createSpaceSeparated(); 2012 result->append(CSSPrimitiveValue::create(style->justifySelf())); 2013 if (style->justifySelf() >= JustifySelfCenter && style->justifySelfOverflowAlignment() != JustifySelfOverflowAlignmentDefault) 2014 result->append(CSSPrimitiveValue::create(style->justifySelfOverflowAlignment())); 2015 return result.release(); 2016 } 2009 2017 case CSSPropertyWebkitOrder: 2010 2018 return cssValuePool().createValue(style->order(), CSSPrimitiveValue::CSS_NUMBER); -
trunk/Source/WebCore/css/CSSParser.cpp
r170996 r171010 849 849 break; 850 850 case CSSPropertyWebkitAlignContent: 851 if (valueID == CSSValueFlexStart || valueID == CSSValueFlexEnd || valueID == CSSValueCenter || valueID == CSSValueSpaceBetween || valueID == CSSValueSpaceAround || valueID == CSSValueStretch) 852 return true; 853 break; 851 // FIXME: Per CSS alignment, this property should accept an optional <overflow-position>. We should share this parsing code with 'justify-self'. 852 if (valueID == CSSValueFlexStart || valueID == CSSValueFlexEnd || valueID == CSSValueCenter || valueID == CSSValueSpaceBetween || valueID == CSSValueSpaceAround || valueID == CSSValueStretch) 853 return true; 854 break; 854 855 case CSSPropertyWebkitAlignItems: 856 // FIXME: Per CSS alignment, this property should accept the same arguments as 'justify-self' so we should share its parsing code. 855 857 if (valueID == CSSValueFlexStart || valueID == CSSValueFlexEnd || valueID == CSSValueCenter || valueID == CSSValueBaseline || valueID == CSSValueStretch) 856 858 return true; 857 859 break; 858 860 case CSSPropertyWebkitAlignSelf: 861 // FIXME: Per CSS alignment, this property should accept the same arguments as 'justify-self' so we should share its parsing code. 859 862 if (valueID == CSSValueAuto || valueID == CSSValueFlexStart || valueID == CSSValueFlexEnd || valueID == CSSValueCenter || valueID == CSSValueBaseline || valueID == CSSValueStretch) 860 863 return true; … … 869 872 break; 870 873 case CSSPropertyWebkitJustifyContent: 874 // FIXME: Per CSS alignment, this property should accept an optional <overflow-position>. We should share this parsing code with 'justify-self'. 871 875 if (valueID == CSSValueFlexStart || valueID == CSSValueFlexEnd || valueID == CSSValueCenter || valueID == CSSValueSpaceBetween || valueID == CSSValueSpaceAround) 876 return true; 877 break; 878 case CSSPropertyWebkitJustifySelf: 879 if (valueID == CSSValueAuto || valueID == CSSValueFlexStart || valueID == CSSValueFlexEnd || valueID == CSSValueCenter || valueID == CSSValueBaseline || valueID == CSSValueStretch) 872 880 return true; 873 881 break; … … 2567 2575 return false; 2568 2576 } 2577 case CSSPropertyWebkitJustifySelf: 2578 return parseJustifySelf(propId, important); 2569 2579 #if ENABLE(CSS_GRID_LAYOUT) 2570 2580 case CSSPropertyWebkitGridAutoColumns: … … 3068 3078 else 3069 3079 lval = rval; 3080 } 3081 3082 static bool isItemPositionKeyword(CSSValueID id) 3083 { 3084 return id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter 3085 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFlexStart 3086 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight; 3087 } 3088 3089 bool CSSParser::parseJustifySelf(CSSPropertyID propId, bool important) 3090 { 3091 // auto | baseline | stretch | [<item-position> && <overflow-position>? ] 3092 // <item-position> = center | start | end | self-start | self-end | flex-start | flex-end | left | right; 3093 // <overflow-position> = true | safe 3094 3095 CSSParserValue* value = m_valueList->current(); 3096 3097 if (value->id == CSSValueAuto || value->id == CSSValueBaseline || value->id == CSSValueStretch) { 3098 if (m_valueList->next()) 3099 return false; 3100 3101 addProperty(propId, cssValuePool().createIdentifierValue(value->id), important); 3102 return true; 3103 } 3104 3105 RefPtr<CSSPrimitiveValue> position = 0; 3106 RefPtr<CSSPrimitiveValue> overflowAlignmentKeyword = 0; 3107 if (isItemPositionKeyword(value->id)) { 3108 position = cssValuePool().createIdentifierValue(value->id); 3109 value = m_valueList->next(); 3110 if (value) { 3111 if (value->id != CSSValueTrue && value->id != CSSValueSafe) 3112 return false; 3113 overflowAlignmentKeyword = cssValuePool().createIdentifierValue(value->id); 3114 } 3115 } else if (value->id != CSSValueTrue && value->id != CSSValueSafe) 3116 return false; 3117 else { 3118 overflowAlignmentKeyword = cssValuePool().createIdentifierValue(value->id); 3119 value = m_valueList->next(); 3120 if (value) { 3121 if (!isItemPositionKeyword(value->id)) 3122 return false; 3123 position = cssValuePool().createIdentifierValue(value->id); 3124 } 3125 } 3126 3127 if (m_valueList->next()) 3128 return false; 3129 3130 ASSERT(position); 3131 if (overflowAlignmentKeyword) 3132 addProperty(propId, createPrimitiveValuePair(position.release(), overflowAlignmentKeyword.release()), important); 3133 else 3134 addProperty(propId, position.release(), important); 3135 3136 return true; 3070 3137 } 3071 3138 -
trunk/Source/WebCore/css/CSSParser.h
r170996 r171010 184 184 bool parseClipShape(CSSPropertyID, bool important); 185 185 186 bool parseJustifySelf(CSSPropertyID, bool important); 187 186 188 #if ENABLE(CSS_SHAPES) 187 189 PassRefPtr<CSSValue> parseShapeProperty(CSSPropertyID); -
trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h
r170996 r171010 5090 5090 } 5091 5091 5092 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EJustifySelf justifySelf) 5093 : CSSValue(PrimitiveClass) 5094 { 5095 m_primitiveUnitType = CSS_VALUE_ID; 5096 switch (justifySelf) { 5097 case JustifySelfAuto: 5098 m_value.valueID = CSSValueAuto; 5099 break; 5100 case JustifySelfStretch: 5101 m_value.valueID = CSSValueStretch; 5102 break; 5103 case JustifySelfBaseline: 5104 m_value.valueID = CSSValueBaseline; 5105 break; 5106 case JustifySelfCenter: 5107 m_value.valueID = CSSValueCenter; 5108 break; 5109 case JustifySelfStart: 5110 m_value.valueID = CSSValueStart; 5111 break; 5112 case JustifySelfEnd: 5113 m_value.valueID = CSSValueEnd; 5114 break; 5115 case JustifySelfSelfStart: 5116 m_value.valueID = CSSValueSelfStart; 5117 break; 5118 case JustifySelfSelfEnd: 5119 m_value.valueID = CSSValueSelfEnd; 5120 break; 5121 case JustifySelfFlexStart: 5122 m_value.valueID = CSSValueFlexStart; 5123 break; 5124 case JustifySelfFlexEnd: 5125 m_value.valueID = CSSValueFlexEnd; 5126 break; 5127 case JustifySelfLeft: 5128 m_value.valueID = CSSValueLeft; 5129 break; 5130 case JustifySelfRight: 5131 m_value.valueID = CSSValueRight; 5132 break; 5133 default: 5134 m_value.valueID = CSSValueAuto; 5135 break; 5136 } 5137 } 5138 5139 template<> inline CSSPrimitiveValue::operator EJustifySelf() const 5140 { 5141 switch (m_value.valueID) { 5142 case CSSValueAuto: 5143 return JustifySelfAuto; 5144 case CSSValueStretch: 5145 return JustifySelfStretch; 5146 case CSSValueBaseline: 5147 return JustifySelfBaseline; 5148 case CSSValueCenter: 5149 return JustifySelfCenter; 5150 case CSSValueStart: 5151 return JustifySelfStart; 5152 case CSSValueEnd: 5153 return JustifySelfEnd; 5154 case CSSValueSelfStart: 5155 return JustifySelfSelfStart; 5156 case CSSValueSelfEnd: 5157 return JustifySelfSelfEnd; 5158 case CSSValueFlexStart: 5159 return JustifySelfFlexStart; 5160 case CSSValueFlexEnd: 5161 return JustifySelfFlexEnd; 5162 case CSSValueLeft: 5163 return JustifySelfLeft; 5164 case CSSValueRight: 5165 return JustifySelfRight; 5166 default: 5167 break; 5168 } 5169 ASSERT_NOT_REACHED(); 5170 return JustifySelfAuto; 5171 } 5172 5173 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EJustifySelfOverflowAlignment overflowAlignment) 5174 : CSSValue(PrimitiveClass) 5175 { 5176 m_primitiveUnitType = CSS_VALUE_ID; 5177 switch (overflowAlignment) { 5178 case JustifySelfOverflowAlignmentDefault: 5179 m_value.valueID = CSSValueDefault; 5180 break; 5181 case JustifySelfOverflowAlignmentTrue: 5182 m_value.valueID = CSSValueTrue; 5183 break; 5184 case JustifySelfOverflowAlignmentSafe: 5185 m_value.valueID = CSSValueSafe; 5186 break; 5187 } 5188 } 5189 5190 template<> inline CSSPrimitiveValue::operator EJustifySelfOverflowAlignment() const 5191 { 5192 switch (m_value.valueID) { 5193 case CSSValueTrue: 5194 return JustifySelfOverflowAlignmentTrue; 5195 case CSSValueSafe: 5196 return JustifySelfOverflowAlignmentSafe; 5197 default: 5198 break; 5199 } 5200 ASSERT_NOT_REACHED(); 5201 return JustifySelfOverflowAlignmentTrue; 5202 } 5203 5092 5204 } 5093 5205 -
trunk/Source/WebCore/css/CSSPropertyNames.in
r169349 r171010 304 304 -webkit-flex-wrap 305 305 -webkit-justify-content 306 -webkit-justify-self 306 307 -webkit-font-size-delta 307 308 #if defined(ENABLE_CSS_GRID_LAYOUT) && ENABLE_CSS_GRID_LAYOUT -
trunk/Source/WebCore/css/CSSValueKeywords.in
r170996 r171010 545 545 // space-around 546 546 547 // CSS_PROP_JUSTIFY_SELF 548 // auto 549 // stretch 550 // baseline 551 // center 552 // start 553 // end 554 self-start 555 self-end 556 // flex-start 557 // flex-end 558 // left 559 // right 560 true 561 safe 562 547 563 // CSS_PROP_FLEX_FLOW 548 564 row -
trunk/Source/WebCore/css/StyleResolver.cpp
r170996 r171010 2828 2828 } 2829 2829 #endif /* ENABLE(CSS_GRID_LAYOUT) */ 2830 case CSSPropertyWebkitJustifySelf: { 2831 HANDLE_INHERIT_AND_INITIAL(justifySelf, JustifySelf); 2832 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 2833 if (Pair* pairValue = primitiveValue->getPairValue()) { 2834 state.style()->setJustifySelf(*pairValue->first()); 2835 state.style()->setJustifySelfOverflowAlignment(*pairValue->second()); 2836 } else 2837 state.style()->setJustifySelf(*primitiveValue); 2838 return; 2839 } 2830 2840 // These properties are aliased and DeprecatedStyleBuilder already applied the property on the prefixed version. 2831 2841 case CSSPropertyTransitionDelay: -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r170996 r171010 915 915 EFlexWrap flexWrap() const { return static_cast<EFlexWrap>(rareNonInheritedData->m_flexibleBox->m_flexWrap); } 916 916 EJustifyContent justifyContent() const { return static_cast<EJustifyContent>(rareNonInheritedData->m_justifyContent); } 917 EJustifySelf justifySelf() const { return static_cast<EJustifySelf>(rareNonInheritedData->m_justifySelf); } 918 EJustifySelfOverflowAlignment justifySelfOverflowAlignment() const { return static_cast<EJustifySelfOverflowAlignment>(rareNonInheritedData->m_justifySelfOverflowAlignment); } 917 919 918 920 #if ENABLE(CSS_GRID_LAYOUT) … … 1462 1464 void setFlexWrap(EFlexWrap w) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexWrap, w); } 1463 1465 void setJustifyContent(EJustifyContent p) { SET_VAR(rareNonInheritedData, m_justifyContent, p); } 1466 void setJustifySelf(EJustifySelf p) { SET_VAR(rareNonInheritedData, m_justifySelf, p); } 1467 void setJustifySelfOverflowAlignment(EJustifySelfOverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_justifySelfOverflowAlignment, overflowAlignment); } 1464 1468 #if ENABLE(CSS_GRID_LAYOUT) 1465 1469 void setGridAutoColumns(const GridTrackSize& length) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridAutoColumns, length); } … … 1826 1830 static EFlexWrap initialFlexWrap() { return FlexNoWrap; } 1827 1831 static EJustifyContent initialJustifyContent() { return JustifyFlexStart; } 1832 static EJustifySelf initialJustifySelf() { return JustifySelfAuto; } 1833 static EJustifySelfOverflowAlignment initialJustifySelfOverflowAlignment() { return JustifySelfOverflowAlignmentDefault; } 1828 1834 static int initialMarqueeLoopCount() { return -1; } 1829 1835 static int initialMarqueeSpeed() { return 85; } -
trunk/Source/WebCore/rendering/style/RenderStyleConstants.h
r170996 r171010 185 185 enum EFlexWrap { FlexNoWrap, FlexWrap, FlexWrapReverse }; 186 186 enum EJustifyContent { JustifyFlexStart, JustifyFlexEnd, JustifyCenter, JustifySpaceBetween, JustifySpaceAround }; 187 enum EJustifySelf {JustifySelfAuto, JustifySelfStretch, JustifySelfBaseline, JustifySelfCenter, JustifySelfStart, JustifySelfEnd, JustifySelfSelfStart, JustifySelfSelfEnd, JustifySelfFlexStart, JustifySelfFlexEnd, JustifySelfLeft, JustifySelfRight}; 188 enum EJustifySelfOverflowAlignment {JustifySelfOverflowAlignmentDefault, JustifySelfOverflowAlignmentTrue, JustifySelfOverflowAlignmentSafe}; 189 187 190 188 191 enum ETextSecurity { -
trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
r166618 r171010 77 77 , m_alignSelf(RenderStyle::initialAlignSelf()) 78 78 , m_justifyContent(RenderStyle::initialJustifyContent()) 79 , m_justifySelf(RenderStyle::initialJustifySelf()) 80 , m_justifySelfOverflowAlignment(RenderStyle::initialJustifySelfOverflowAlignment()) 79 81 , userDrag(RenderStyle::initialUserDrag()) 80 82 , textOverflow(RenderStyle::initialTextOverflow()) … … 154 156 , m_alignSelf(o.m_alignSelf) 155 157 , m_justifyContent(o.m_justifyContent) 158 , m_justifySelf(o.m_justifySelf) 159 , m_justifySelfOverflowAlignment(o.m_justifySelfOverflowAlignment) 156 160 , userDrag(o.userDrag) 157 161 , textOverflow(o.textOverflow) … … 256 260 #endif 257 261 && m_aspectRatioType == o.m_aspectRatioType 258 && m_objectFit == o.m_objectFit; 262 && m_objectFit == o.m_objectFit 263 && m_justifySelf == o.m_justifySelf 264 && m_justifySelfOverflowAlignment == o.m_justifySelfOverflowAlignment; 259 265 } 260 266 -
trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h
r166618 r171010 177 177 unsigned m_justifyContent : 3; // EJustifyContent 178 178 179 unsigned m_justifySelf : 4; // EJustifySelf 180 unsigned m_justifySelfOverflowAlignment : 2; // EJustifySelfOverflowAlignment 181 179 182 unsigned userDrag : 2; // EUserDrag 180 183 unsigned textOverflow : 1; // Whether or not lines that spill out should be truncated with "..."
Note: See TracChangeset
for help on using the changeset viewer.