Changeset 145450 in webkit
- Timestamp:
- Mar 11, 2013 6:10:35 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r145448 r145450 1 2013-03-11 Lamarque V. Souza <Lamarque.Souza@basyskom.com> 2 3 [css3-text] Add partial parsing support for text-underline-position property from CSS3 Text 4 https://bugs.webkit.org/show_bug.cgi?id=102491 5 6 Reviewed by Julien Chaffraix. 7 8 Added getComputedStyle layout tests for 'text-underline-position' CSS3 9 property, with 'webkit' prefix. 10 11 * fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-underline-position-expected.txt: Added. 12 * fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-underline-position.html: Added. 13 * fast/css3-text/css3-text-decoration/getComputedStyle/script-tests/getComputedStyle-text-underline-position.js: Added. 14 (testElementStyle): 15 (testComputedStyle): 16 1 17 2013-03-11 Christian Biesinger <cbiesinger@chromium.org> 2 18 -
trunk/Source/WebCore/ChangeLog
r145448 r145450 1 2013-03-11 Lamarque V. Souza <Lamarque.Souza@basyskom.com> 2 3 [css3-text] Add partial parsing support for text-underline-position property from CSS3 Text 4 https://bugs.webkit.org/show_bug.cgi?id=102491 5 6 Reviewed by Julien Chaffraix. 7 8 This patch extends the existing parsing to support 'auto', 'alphabetic' and 'under'. We don't fully match 9 the specification as we don't support [ left | right ] and this is left for another implementation 10 as the rendering will need to be added. 11 12 Test: fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-underline-position.html 13 14 * css/CSSComputedStyleDeclaration.cpp: 15 (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): 16 * css/CSSParser.cpp: 17 (WebCore::CSSParser::parseValue): 18 (WebCore::CSSParser::parseTextUnderlinePosition): 19 * css/CSSParser.h: 20 * css/CSSPrimitiveValueMappings.h: 21 (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): 22 (WebCore::CSSPrimitiveValue::operator TextUnderlinePosition): 23 * css/CSSProperty.cpp: 24 (WebCore::CSSProperty::isInheritedProperty): 25 Added parsing-related checks for text-underline-position property. 26 * css/CSSPropertyNames.in: Added '-webkit-underline-position' property. 27 * css/CSSValueKeywords.in: 28 * css/SVGCSSValueKeywords.in: 29 * css/StyleBuilder.cpp: 30 (ApplyPropertyTextUnderlinePosition): 31 (WebCore::ApplyPropertyTextUnderlinePosition::applyValue): 32 (WebCore::ApplyPropertyTextUnderlinePosition::createHandler): 33 (WebCore::StyleBuilder::StyleBuilder): 34 Set property handler for text-underline-position. 35 * css/StyleResolver.cpp: 36 (WebCore::StyleResolver::applyProperty): 37 * rendering/style/RenderStyle.h: 38 * rendering/style/RenderStyleConstants.h: 39 * rendering/style/StyleRareInheritedData.cpp: 40 (WebCore::StyleRareInheritedData::StyleRareInheritedData): 41 (WebCore::StyleRareInheritedData::operator==): 42 Added support for m_textUnderlinePosition on copy constructor and operator 43 assignment functions. 44 * rendering/style/StyleRareInheritedData.h: 45 (StyleRareInheritedData): Added m_textUnderlinePosition here as it won't be used regularly. 46 1 47 2013-03-11 Christian Biesinger <cbiesinger@chromium.org> 2 48 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r145168 r145450 192 192 CSSPropertyWebkitTextDecorationStyle, 193 193 CSSPropertyWebkitTextAlignLast, 194 CSSPropertyWebkitTextUnderlinePosition, 194 195 #endif // CSS3_TEXT 195 196 CSSPropertyTextIndent, … … 2156 2157 case CSSPropertyWebkitTextAlignLast: 2157 2158 return cssValuePool().createValue(style->textAlignLast()); 2159 case CSSPropertyWebkitTextUnderlinePosition: 2160 return cssValuePool().createValue(style->textUnderlinePosition()); 2158 2161 #endif // CSS3_TEXT 2159 2162 case CSSPropertyWebkitTextDecorationsInEffect: -
trunk/Source/WebCore/css/CSSParser.cpp
r145168 r145450 2297 2297 validPrimitive = true; 2298 2298 break; 2299 2300 case CSSPropertyWebkitTextUnderlinePosition: 2301 // auto | alphabetic | under 2302 return parseTextUnderlinePosition(important); 2299 2303 #endif // CSS3_TEXT 2300 2304 … … 9142 9146 } 9143 9147 9148 #if ENABLE(CSS3_TEXT) 9149 bool CSSParser::parseTextUnderlinePosition(bool important) 9150 { 9151 // The text-underline-position property has sintax "auto | alphabetic | [ under || [ left | right ] ]". 9152 // However, values 'left' and 'right' are not implemented yet, so we will parse sintax 9153 // "auto | alphabetic | under" for now. 9154 CSSParserValue* value = m_valueList->current(); 9155 switch (value->id) { 9156 case CSSValueAuto: 9157 case CSSValueAlphabetic: 9158 case CSSValueUnder: 9159 if (m_valueList->next()) 9160 return false; 9161 9162 addProperty(CSSPropertyWebkitTextUnderlinePosition, cssValuePool().createIdentifierValue(value->id), important); 9163 return true; 9164 } 9165 return false; 9166 } 9167 #endif // CSS3_TEXT 9168 9144 9169 bool CSSParser::parseTextEmphasisStyle(bool important) 9145 9170 { -
trunk/Source/WebCore/css/CSSParser.h
r145029 r145450 265 265 void addTextDecorationProperty(CSSPropertyID, PassRefPtr<CSSValue>, bool important); 266 266 bool parseTextDecoration(CSSPropertyID propId, bool important); 267 #if ENABLE(CSS3_TEXT) 268 bool parseTextUnderlinePosition(bool important); 269 #endif // CSS3_TEXT 267 270 268 271 bool parseLineBoxContain(bool important); -
trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h
r145196 r145450 2397 2397 ASSERT_NOT_REACHED(); 2398 2398 return TextDecorationStyleSolid; 2399 } 2400 2401 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextUnderlinePosition e) 2402 : CSSValue(PrimitiveClass) 2403 { 2404 m_primitiveUnitType = CSS_IDENT; 2405 switch (e) { 2406 case TextUnderlinePositionAuto: 2407 m_value.ident = CSSValueAuto; 2408 break; 2409 case TextUnderlinePositionAlphabetic: 2410 m_value.ident = CSSValueAlphabetic; 2411 break; 2412 case TextUnderlinePositionUnder: 2413 m_value.ident = CSSValueUnder; 2414 break; 2415 } 2416 2417 // FIXME: Implement support for 'under left' and 'under right' values. 2418 } 2419 2420 template<> inline CSSPrimitiveValue::operator TextUnderlinePosition() const 2421 { 2422 switch (m_value.ident) { 2423 case CSSValueAuto: 2424 return TextUnderlinePositionAuto; 2425 case CSSValueAlphabetic: 2426 return TextUnderlinePositionAlphabetic; 2427 case CSSValueUnder: 2428 return TextUnderlinePositionUnder; 2429 } 2430 2431 // FIXME: Implement support for 'under left' and 'under right' values. 2432 2433 ASSERT_NOT_REACHED(); 2434 return TextUnderlinePositionAuto; 2399 2435 } 2400 2436 #endif // CSS3_TEXT -
trunk/Source/WebCore/css/CSSProperty.cpp
r145168 r145450 333 333 case CSSPropertyWebkitTextDecorationLine: 334 334 case CSSPropertyWebkitTextAlignLast: 335 case CSSPropertyWebkitTextUnderlinePosition: 335 336 #endif // CSS3_TEXT 336 337 case CSSPropertyWebkitTextDecorationsInEffect: -
trunk/Source/WebCore/css/CSSPropertyNames.in
r145168 r145450 373 373 -webkit-text-decoration-style 374 374 -webkit-text-align-last 375 -webkit-text-underline-position 375 376 #endif 376 377 -webkit-text-decorations-in-effect -
trunk/Source/WebCore/css/CSSValueKeywords.in
r145255 r145450 953 953 edges 954 954 955 #if (defined(ENABLE_SVG) && ENABLE_SVG) || (defined(ENABLE_CSS3_TEXT) && ENABLE_CSS3_TEXT) 956 alphabetic 957 #endif 958 955 959 // position 956 960 #if defined(ENABLE_CSS_STICKY_POSITION) && ENABLE_CSS_STICKY_POSITION -
trunk/Source/WebCore/css/SVGCSSValueKeywords.in
r129018 r145450 242 242 text-after-edge 243 243 ideographic 244 alphabetic245 244 hanging 246 245 mathematical -
trunk/Source/WebCore/css/StyleBuilder.cpp
r145168 r145450 1149 1149 } 1150 1150 }; 1151 1152 #if ENABLE(CSS3_TEXT) 1153 class ApplyPropertyTextUnderlinePosition { 1154 public: 1155 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) 1156 { 1157 // This is true if value is 'auto' or 'alphabetic'. 1158 if (value->isPrimitiveValue()) { 1159 TextUnderlinePosition t = *static_cast<CSSPrimitiveValue*>(value); 1160 styleResolver->style()->setTextUnderlinePosition(t); 1161 return; 1162 } 1163 1164 unsigned t = 0; 1165 for (CSSValueListIterator i(value); i.hasMore(); i.advance()) { 1166 CSSValue* item = i.value(); 1167 ASSERT(item->isPrimitiveValue()); 1168 TextUnderlinePosition t2 = *static_cast<CSSPrimitiveValue*>(item); 1169 t |= t2; 1170 } 1171 styleResolver->style()->setTextUnderlinePosition(static_cast<TextUnderlinePosition>(t)); 1172 } 1173 static PropertyHandler createHandler() 1174 { 1175 PropertyHandler handler = ApplyPropertyDefaultBase<TextUnderlinePosition, &RenderStyle::textUnderlinePosition, TextUnderlinePosition, &RenderStyle::setTextUnderlinePosition, TextUnderlinePosition, &RenderStyle::initialTextUnderlinePosition>::createHandler(); 1176 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); 1177 } 1178 }; 1179 #endif // CSS3_TEXT 1151 1180 1152 1181 class ApplyPropertyLineHeight { … … 1904 1933 setPropertyHandler(CSSPropertyWebkitTextDecorationStyle, ApplyPropertyDefault<TextDecorationStyle, &RenderStyle::textDecorationStyle, TextDecorationStyle, &RenderStyle::setTextDecorationStyle, TextDecorationStyle, &RenderStyle::initialTextDecorationStyle>::createHandler()); 1905 1934 setPropertyHandler(CSSPropertyWebkitTextAlignLast, ApplyPropertyDefault<TextAlignLast, &RenderStyle::textAlignLast, TextAlignLast, &RenderStyle::setTextAlignLast, TextAlignLast, &RenderStyle::initialTextAlignLast>::createHandler()); 1935 setPropertyHandler(CSSPropertyWebkitTextUnderlinePosition, ApplyPropertyTextUnderlinePosition::createHandler()); 1906 1936 #endif // CSS3_TEXT 1907 1937 setPropertyHandler(CSSPropertyTextIndent, ApplyPropertyLength<&RenderStyle::textIndent, &RenderStyle::setTextIndent, &RenderStyle::initialTextIndent>::createHandler()); -
trunk/Source/WebCore/css/StyleResolver.cpp
r145397 r145450 3805 3805 case CSSPropertyWebkitTextDecorationStyle: 3806 3806 case CSSPropertyWebkitTextAlignLast: 3807 case CSSPropertyWebkitTextUnderlinePosition: 3807 3808 #endif // CSS3_TEXT 3808 3809 case CSSPropertyWebkitTextEmphasisColor: -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r145391 r145450 576 576 TextDecorationStyle textDecorationStyle() const { return static_cast<TextDecorationStyle>(rareNonInheritedData->m_textDecorationStyle); } 577 577 TextAlignLast textAlignLast() const { return static_cast<TextAlignLast>(rareInheritedData->m_textAlignLast); } 578 TextUnderlinePosition textUnderlinePosition() const { return static_cast<TextUnderlinePosition>(rareInheritedData->m_textUnderlinePosition); } 578 579 #else 579 580 TextDecorationStyle textDecorationStyle() const { return TextDecorationStyleSolid; } … … 1138 1139 void setTextDecorationStyle(TextDecorationStyle v) { SET_VAR(rareNonInheritedData, m_textDecorationStyle, v); } 1139 1140 void setTextAlignLast(TextAlignLast v) { SET_VAR(rareInheritedData, m_textAlignLast, v); } 1141 void setTextUnderlinePosition(TextUnderlinePosition v) { SET_VAR(rareInheritedData, m_textUnderlinePosition, v); } 1140 1142 #endif // CSS3_TEXT 1141 1143 void setDirection(TextDirection v) { inherited_flags._direction = v; } … … 1612 1614 static TextDecorationStyle initialTextDecorationStyle() { return TextDecorationStyleSolid; } 1613 1615 static TextAlignLast initialTextAlignLast() { return TextAlignLastAuto; } 1616 static TextUnderlinePosition initialTextUnderlinePosition() { return TextUnderlinePositionAuto; } 1614 1617 #endif // CSS3_TEXT 1615 1618 static float initialZoom() { return 1.0f; } -
trunk/Source/WebCore/rendering/style/RenderStyleConstants.h
r145003 r145450 359 359 TextAlignLastAuto, TextAlignLastStart, TextAlignLastEnd, TextAlignLastLeft, TextAlignLastRight, TextAlignLastCenter, TextAlignLastJustify 360 360 }; 361 362 enum TextUnderlinePosition { 363 // FIXME: Implement support for 'under left' and 'under right' values. 364 TextUnderlinePositionAuto = 0x1, TextUnderlinePositionAlphabetic = 0x2, TextUnderlinePositionUnder = 0x4 365 }; 361 366 #endif // CSS3_TEXT 362 367 -
trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp
r145168 r145450 104 104 #if ENABLE(CSS3_TEXT) 105 105 , m_textAlignLast(RenderStyle::initialTextAlignLast()) 106 , m_textUnderlinePosition(RenderStyle::initialTextUnderlinePosition()) 106 107 #endif // CSS3_TEXT 107 108 , m_rubyPosition(RenderStyle::initialRubyPosition()) … … 173 174 #if ENABLE(CSS3_TEXT) 174 175 , m_textAlignLast(o.m_textAlignLast) 176 , m_textUnderlinePosition(o.m_textUnderlinePosition) 175 177 #endif // CSS3_TEXT 176 178 , m_rubyPosition(o.m_rubyPosition) … … 268 270 #if ENABLE(CSS3_TEXT) 269 271 && m_textAlignLast == o.m_textAlignLast 272 && m_textUnderlinePosition == o.m_textUnderlinePosition 270 273 #endif // CSS3_TEXT 271 274 && m_rubyPosition == o.m_rubyPosition -
trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h
r145168 r145450 118 118 #if ENABLE(CSS3_TEXT) 119 119 unsigned m_textAlignLast : 3; // TextAlignLast 120 unsigned m_textUnderlinePosition : 3; // TextUnderlinePosition 120 121 #endif // CSS3_TEXT 121 122 unsigned m_rubyPosition : 1; // RubyPosition
Note: See TracChangeset
for help on using the changeset viewer.