Changeset 175581 in webkit
- Timestamp:
- Nov 4, 2014 2:32:15 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r175580 r175581 1 2014-11-04 Chris Dumez <cdumez@apple.com> 2 3 Move -webkit-text-emphasis-position to the new StyleBuilder 4 https://bugs.webkit.org/show_bug.cgi?id=138359 5 6 Reviewed by Andreas Kling. 7 8 Move -webkit-text-emphasis-position from DeprecatedStyleBilder to the 9 new StyleBuilder so that it is now generated from CSSPropertyNames.in. 10 A new TextEmphasisPosition Converter was added 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::valueToEmphasisPosition): Deleted. 18 (WebCore::ApplyPropertyTextEmphasisPosition::applyValue): Deleted. 19 (WebCore::ApplyPropertyTextEmphasisPosition::createHandler): Deleted. 20 * css/StyleBuilderConverter.h: 21 (WebCore::StyleBuilderConverter::valueToEmphasisPosition): 22 (WebCore::StyleBuilderConverter::convertTextEmphasisPosition): 23 1 24 2014-11-04 Andreas Kling <akling@apple.com> 2 25 -
trunk/Source/WebCore/css/CSSPropertyNames.in
r175481 r175581 482 482 -epub-text-emphasis-color = -webkit-text-emphasis-color 483 483 text-emphasis-color = -webkit-text-emphasis-color 484 -webkit-text-emphasis-position [Inherited ]484 -webkit-text-emphasis-position [Inherited, NewStyleBuilder, Converter=TextEmphasisPosition] 485 485 text-emphasis-position = -webkit-text-emphasis-position 486 486 -webkit-text-emphasis-style [Inherited] -
trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp
r175513 r175581 1476 1476 1477 1477 static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); } 1478 };1479 1480 static TextEmphasisPosition valueToEmphasisPosition(CSSPrimitiveValue& primitiveValue)1481 {1482 ASSERT(primitiveValue.isValueID());1483 1484 switch (primitiveValue.getValueID()) {1485 case CSSValueOver:1486 return TextEmphasisPositionOver;1487 case CSSValueUnder:1488 return TextEmphasisPositionUnder;1489 case CSSValueLeft:1490 return TextEmphasisPositionLeft;1491 case CSSValueRight:1492 return TextEmphasisPositionRight;1493 default:1494 break;1495 }1496 1497 ASSERT_NOT_REACHED();1498 return RenderStyle::initialTextEmphasisPosition();1499 }1500 1501 class ApplyPropertyTextEmphasisPosition {1502 public:1503 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)1504 {1505 if (is<CSSPrimitiveValue>(*value)) {1506 styleResolver->style()->setTextEmphasisPosition(valueToEmphasisPosition(downcast<CSSPrimitiveValue>(*value)));1507 return;1508 }1509 1510 TextEmphasisPosition position = 0;1511 if (is<CSSValueList>(*value)) {1512 for (auto& currentValue : downcast<CSSValueList>(*value))1513 position |= valueToEmphasisPosition(downcast<CSSPrimitiveValue>(currentValue.get()));1514 }1515 styleResolver->style()->setTextEmphasisPosition(position);1516 }1517 static PropertyHandler createHandler()1518 {1519 PropertyHandler handler = ApplyPropertyDefaultBase<TextEmphasisPosition, &RenderStyle::textEmphasisPosition, TextEmphasisPosition, &RenderStyle::setTextEmphasisPosition, TextEmphasisPosition, &RenderStyle::initialTextEmphasisPosition>::createHandler();1520 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);1521 }1522 1478 }; 1523 1479 … … 2027 1983 setPropertyHandler(CSSPropertyWebkitPerspectiveOrigin, ApplyPropertyExpanding<SuppressValue, CSSPropertyWebkitPerspectiveOriginX, CSSPropertyWebkitPerspectiveOriginY>::createHandler()); 2028 1984 setPropertyHandler(CSSPropertyWebkitTextEmphasisColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textEmphasisColor, &RenderStyle::setTextEmphasisColor, &RenderStyle::setVisitedLinkTextEmphasisColor, &RenderStyle::color>::createHandler()); 2029 setPropertyHandler(CSSPropertyWebkitTextEmphasisPosition, ApplyPropertyTextEmphasisPosition::createHandler());2030 1985 setPropertyHandler(CSSPropertyWebkitTextEmphasisStyle, ApplyPropertyTextEmphasisStyle::createHandler()); 2031 1986 setPropertyHandler(CSSPropertyWebkitTextFillColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textFillColor, &RenderStyle::setTextFillColor, &RenderStyle::setVisitedLinkTextFillColor, &RenderStyle::color>::createHandler()); -
trunk/Source/WebCore/css/StyleBuilderConverter.h
r175487 r175581 57 57 static String convertStringOrAuto(StyleResolver&, CSSValue&); 58 58 static String convertStringOrNone(StyleResolver&, CSSValue&); 59 static TextEmphasisPosition convertTextEmphasisPosition(StyleResolver&, CSSValue&); 59 60 60 61 private: 61 62 static Length convertToRadiusLength(CSSToLengthConversionData&, CSSPrimitiveValue&); 63 static TextEmphasisPosition valueToEmphasisPosition(CSSPrimitiveValue&); 62 64 }; 63 65 … … 274 276 } 275 277 278 inline TextEmphasisPosition StyleBuilderConverter::valueToEmphasisPosition(CSSPrimitiveValue& primitiveValue) 279 { 280 ASSERT(primitiveValue.isValueID()); 281 282 switch (primitiveValue.getValueID()) { 283 case CSSValueOver: 284 return TextEmphasisPositionOver; 285 case CSSValueUnder: 286 return TextEmphasisPositionUnder; 287 case CSSValueLeft: 288 return TextEmphasisPositionLeft; 289 case CSSValueRight: 290 return TextEmphasisPositionRight; 291 default: 292 break; 293 } 294 295 ASSERT_NOT_REACHED(); 296 return RenderStyle::initialTextEmphasisPosition(); 297 } 298 299 inline TextEmphasisPosition StyleBuilderConverter::convertTextEmphasisPosition(StyleResolver&, CSSValue& value) 300 { 301 if (is<CSSPrimitiveValue>(value)) 302 return valueToEmphasisPosition(downcast<CSSPrimitiveValue>(value)); 303 304 TextEmphasisPosition position = 0; 305 for (auto& currentValue : downcast<CSSValueList>(value)) 306 position |= valueToEmphasisPosition(downcast<CSSPrimitiveValue>(currentValue.get())); 307 return position; 308 } 309 276 310 } // namespace WebCore 277 311
Note: See TracChangeset
for help on using the changeset viewer.