Changeset 175625 in webkit
- Timestamp:
- Nov 5, 2014 10:24:57 AM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r175623 r175625 1 2014-11-05 Chris Dumez <cdumez@apple.com> 2 3 Move text-align CSS property to the new StyleBuilder 4 https://bugs.webkit.org/show_bug.cgi?id=138398 5 6 Reviewed by Antti Koivisto. 7 8 Move text-align CSS property from DeprecatedStyleBuilder to the new 9 StyleBuilder so that it is now generated from CSSPropertyNames.in. 10 This patch adds a TextAlign Converter to support this. 11 12 No new tests, no behavior change. 13 14 * css/CSSPropertyNames.in: 15 * css/DeprecatedStyleBuilder.cpp: 16 (WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder): 17 (WebCore::ApplyPropertyTextAlign::applyValue): Deleted. 18 (WebCore::ApplyPropertyTextAlign::createHandler): Deleted. 19 * css/StyleBuilderConverter.h: 20 (WebCore::StyleBuilderConverter::convertTextAlign): 21 1 22 2014-11-05 Sanghyup Lee <sh53.lee@samsung.com> 2 23 -
trunk/Source/WebCore/css/CSSPropertyNames.in
r175581 r175625 216 216 table-layout [NewStyleBuilder] 217 217 tab-size [Inherited, NewStyleBuilder, TypeName=unsigned] 218 text-align [Inherited ]218 text-align [Inherited, NewStyleBuilder, Converter=TextAlign] 219 219 text-decoration [NewStyleBuilder, Converter=TextDecoration] 220 220 text-indent [Inherited] -
trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp
r175581 r175625 978 978 979 979 static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); } 980 };981 982 class ApplyPropertyTextAlign {983 public:984 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)985 {986 if (!is<CSSPrimitiveValue>(*value))987 return;988 989 CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*value);990 ASSERT(primitiveValue.isValueID());991 992 if (primitiveValue.getValueID() != CSSValueWebkitMatchParent)993 styleResolver->style()->setTextAlign(primitiveValue);994 else if (styleResolver->parentStyle()->textAlign() == TASTART)995 styleResolver->style()->setTextAlign(styleResolver->parentStyle()->isLeftToRightDirection() ? LEFT : RIGHT);996 else if (styleResolver->parentStyle()->textAlign() == TAEND)997 styleResolver->style()->setTextAlign(styleResolver->parentStyle()->isLeftToRightDirection() ? RIGHT : LEFT);998 else999 styleResolver->style()->setTextAlign(styleResolver->parentStyle()->textAlign());1000 }1001 static PropertyHandler createHandler()1002 {1003 PropertyHandler handler = ApplyPropertyDefaultBase<ETextAlign, &RenderStyle::textAlign, ETextAlign, &RenderStyle::setTextAlign, ETextAlign, &RenderStyle::initialTextAlign>::createHandler();1004 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);1005 }1006 980 }; 1007 981 … … 1938 1912 setPropertyHandler(CSSPropertyResize, ApplyPropertyResize::createHandler()); 1939 1913 setPropertyHandler(CSSPropertySize, ApplyPropertyPageSize::createHandler()); 1940 setPropertyHandler(CSSPropertyTextAlign, ApplyPropertyTextAlign::createHandler());1941 1914 setPropertyHandler(CSSPropertyWebkitTextDecorationColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textDecorationColor, &RenderStyle::setTextDecorationColor, &RenderStyle::setVisitedLinkTextDecorationColor, &RenderStyle::color>::createHandler()); 1942 1915 setPropertyHandler(CSSPropertyWebkitTextDecorationSkip, ApplyPropertyTextDecorationSkip::createHandler()); -
trunk/Source/WebCore/css/StyleBuilderConverter.h
r175581 r175625 58 58 static String convertStringOrNone(StyleResolver&, CSSValue&); 59 59 static TextEmphasisPosition convertTextEmphasisPosition(StyleResolver&, CSSValue&); 60 static ETextAlign convertTextAlign(StyleResolver&, CSSValue&); 60 61 61 62 private: … … 308 309 } 309 310 311 inline ETextAlign StyleBuilderConverter::convertTextAlign(StyleResolver& styleResolver, CSSValue& value) 312 { 313 auto& primitiveValue = downcast<CSSPrimitiveValue>(value); 314 ASSERT(primitiveValue.isValueID()); 315 316 if (primitiveValue.getValueID() != CSSValueWebkitMatchParent) 317 return primitiveValue; 318 319 auto* parentStyle = styleResolver.parentStyle(); 320 if (parentStyle->textAlign() == TASTART) 321 return parentStyle->isLeftToRightDirection() ? LEFT : RIGHT; 322 if (parentStyle->textAlign() == TAEND) 323 return parentStyle->isLeftToRightDirection() ? RIGHT : LEFT; 324 return parentStyle->textAlign(); 325 } 326 310 327 } // namespace WebCore 311 328
Note: See TracChangeset
for help on using the changeset viewer.