- Revision
- 175815
- Author
- cdu...@apple.com
- Date
- 2014-11-10 11:34:11 -0800 (Mon, 10 Nov 2014)
Log Message
Move 'text-indent' CSS property to the new StyleBuilder
https://bugs.webkit.org/show_bug.cgi?id=138547
Reviewed by Andreas Kling.
Move 'text-indent' CSS property from DeprecatedStyleBuilder to the new
StyleBuilder, by using custom code.
No new tests, no behavior change.
* css/CSSPropertyNames.in:
* css/DeprecatedStyleBuilder.cpp:
(WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
(WebCore::ApplyPropertyTextIndent::applyInheritValue): Deleted.
(WebCore::ApplyPropertyTextIndent::applyInitialValue): Deleted.
(WebCore::ApplyPropertyTextIndent::applyValue): Deleted.
(WebCore::ApplyPropertyTextIndent::createHandler): Deleted.
* css/StyleBuilderConverter.h:
* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderFunctions::applyInheritTextIndent):
(WebCore::StyleBuilderFunctions::applyInitialTextIndent):
(WebCore::StyleBuilderFunctions::applyValueTextIndent):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (175814 => 175815)
--- trunk/Source/WebCore/ChangeLog 2014-11-10 19:19:52 UTC (rev 175814)
+++ trunk/Source/WebCore/ChangeLog 2014-11-10 19:34:11 UTC (rev 175815)
@@ -1,3 +1,28 @@
+2014-11-10 Chris Dumez <cdu...@apple.com>
+
+ Move 'text-indent' CSS property to the new StyleBuilder
+ https://bugs.webkit.org/show_bug.cgi?id=138547
+
+ Reviewed by Andreas Kling.
+
+ Move 'text-indent' CSS property from DeprecatedStyleBuilder to the new
+ StyleBuilder, by using custom code.
+
+ No new tests, no behavior change.
+
+ * css/CSSPropertyNames.in:
+ * css/DeprecatedStyleBuilder.cpp:
+ (WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
+ (WebCore::ApplyPropertyTextIndent::applyInheritValue): Deleted.
+ (WebCore::ApplyPropertyTextIndent::applyInitialValue): Deleted.
+ (WebCore::ApplyPropertyTextIndent::applyValue): Deleted.
+ (WebCore::ApplyPropertyTextIndent::createHandler): Deleted.
+ * css/StyleBuilderConverter.h:
+ * css/StyleBuilderCustom.h:
+ (WebCore::StyleBuilderFunctions::applyInheritTextIndent):
+ (WebCore::StyleBuilderFunctions::applyInitialTextIndent):
+ (WebCore::StyleBuilderFunctions::applyValueTextIndent):
+
2014-11-10 Beth Dakin <bda...@apple.com>
WK1: Support default actions for read-only text
Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (175814 => 175815)
--- trunk/Source/WebCore/css/CSSPropertyNames.in 2014-11-10 19:19:52 UTC (rev 175814)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in 2014-11-10 19:34:11 UTC (rev 175815)
@@ -217,7 +217,7 @@
tab-size [Inherited, NewStyleBuilder, TypeName=unsigned]
text-align [Inherited, NewStyleBuilder, Converter=TextAlign]
text-decoration [NewStyleBuilder, Converter=TextDecoration]
-text-indent [Inherited]
+text-indent [Inherited, NewStyleBuilder, Custom=All]
text-line-through
text-line-through-color
text-line-through-mode
Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (175814 => 175815)
--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp 2014-11-10 19:19:52 UTC (rev 175814)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp 2014-11-10 19:34:11 UTC (rev 175815)
@@ -1576,67 +1576,6 @@
};
#endif
-class ApplyPropertyTextIndent {
-public:
- static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
- {
- styleResolver->style()->setTextIndent(styleResolver->parentStyle()->textIndent());
-#if ENABLE(CSS3_TEXT)
- styleResolver->style()->setTextIndentLine(styleResolver->parentStyle()->textIndentLine());
- styleResolver->style()->setTextIndentType(styleResolver->parentStyle()->textIndentType());
-#endif
- }
-
- static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
- {
- styleResolver->style()->setTextIndent(RenderStyle::initialTextIndent());
-#if ENABLE(CSS3_TEXT)
- styleResolver->style()->setTextIndentLine(RenderStyle::initialTextIndentLine());
- styleResolver->style()->setTextIndentType(RenderStyle::initialTextIndentType());
-#endif
- }
-
- static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
- {
- if (!is<CSSValueList>(*value))
- return;
-
- Length lengthOrPercentageValue;
-#if ENABLE(CSS3_TEXT)
- TextIndentLine textIndentLineValue = RenderStyle::initialTextIndentLine();
- TextIndentType textIndentTypeValue = RenderStyle::initialTextIndentType();
-#endif
- CSSValueList& valueList = downcast<CSSValueList>(*value);
- for (size_t i = 0; i < valueList.length(); ++i) {
- CSSValue* item = valueList.itemWithoutBoundsCheck(i);
- if (!is<CSSPrimitiveValue>(*item))
- continue;
-
- CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*item);
- if (!primitiveValue.getValueID())
- lengthOrPercentageValue = primitiveValue.convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion>(styleResolver->state().cssToLengthConversionData());
-#if ENABLE(CSS3_TEXT)
- else if (primitiveValue.getValueID() == CSSValueWebkitEachLine)
- textIndentLineValue = TextIndentEachLine;
- else if (primitiveValue.getValueID() == CSSValueWebkitHanging)
- textIndentTypeValue = TextIndentHanging;
-#endif
- }
-
- ASSERT(!lengthOrPercentageValue.isUndefined());
- styleResolver->style()->setTextIndent(lengthOrPercentageValue);
-#if ENABLE(CSS3_TEXT)
- styleResolver->style()->setTextIndentLine(textIndentLineValue);
- styleResolver->style()->setTextIndentType(textIndentTypeValue);
-#endif
- }
-
- static PropertyHandler createHandler()
- {
- return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
- }
-};
-
const DeprecatedStyleBuilder& DeprecatedStyleBuilder::sharedStyleBuilder()
{
static NeverDestroyed<DeprecatedStyleBuilder> styleBuilderInstance;
@@ -1695,7 +1634,6 @@
setPropertyHandler(CSSPropertyWebkitTextDecorationColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textDecorationColor, &RenderStyle::setTextDecorationColor, &RenderStyle::setVisitedLinkTextDecorationColor, &RenderStyle::color>::createHandler());
setPropertyHandler(CSSPropertyWebkitTextDecorationSkip, ApplyPropertyTextDecorationSkip::createHandler());
setPropertyHandler(CSSPropertyWebkitTextUnderlinePosition, ApplyPropertyTextUnderlinePosition::createHandler());
- setPropertyHandler(CSSPropertyTextIndent, ApplyPropertyTextIndent::createHandler());
setPropertyHandler(CSSPropertyTextRendering, ApplyPropertyFont<TextRenderingMode, &FontDescription::textRenderingMode, &FontDescription::setTextRenderingMode, AutoTextRendering>::createHandler());
setPropertyHandler(CSSPropertyVerticalAlign, ApplyPropertyVerticalAlign::createHandler());
setPropertyHandler(CSSPropertyWebkitAnimationDelay, ApplyPropertyAnimation<double, &Animation::delay, &Animation::setDelay, &Animation::isDelaySet, &Animation::clearDelay, &Animation::initialAnimationDelay, &CSSToStyleMap::mapAnimationDelay, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
Modified: trunk/Source/WebCore/css/StyleBuilderConverter.h (175814 => 175815)
--- trunk/Source/WebCore/css/StyleBuilderConverter.h 2014-11-10 19:19:52 UTC (rev 175814)
+++ trunk/Source/WebCore/css/StyleBuilderConverter.h 2014-11-10 19:34:11 UTC (rev 175815)
@@ -37,6 +37,7 @@
namespace WebCore {
+// Note that we assume the CSS parser only allows valid CSSValue types.
class StyleBuilderConverter {
public:
static Length convertLength(StyleResolver&, CSSValue&);
Modified: trunk/Source/WebCore/css/StyleBuilderCustom.h (175814 => 175815)
--- trunk/Source/WebCore/css/StyleBuilderCustom.h 2014-11-10 19:19:52 UTC (rev 175814)
+++ trunk/Source/WebCore/css/StyleBuilderCustom.h 2014-11-10 19:34:11 UTC (rev 175815)
@@ -35,6 +35,7 @@
namespace WebCore {
+// Note that we assume the CSS parser only allows valid CSSValue types.
namespace StyleBuilderFunctions {
inline void applyValueWebkitMarqueeIncrement(StyleResolver& styleResolver, CSSValue& value)
@@ -308,6 +309,51 @@
styleResolver.style()->setPageSize(LengthSize(width, height));
}
+inline void applyInheritTextIndent(StyleResolver& styleResolver)
+{
+ styleResolver.style()->setTextIndent(styleResolver.parentStyle()->textIndent());
+#if ENABLE(CSS3_TEXT)
+ styleResolver.style()->setTextIndentLine(styleResolver.parentStyle()->textIndentLine());
+ styleResolver.style()->setTextIndentType(styleResolver.parentStyle()->textIndentType());
+#endif
+}
+
+inline void applyInitialTextIndent(StyleResolver& styleResolver)
+{
+ styleResolver.style()->setTextIndent(RenderStyle::initialTextIndent());
+#if ENABLE(CSS3_TEXT)
+ styleResolver.style()->setTextIndentLine(RenderStyle::initialTextIndentLine());
+ styleResolver.style()->setTextIndentType(RenderStyle::initialTextIndentType());
+#endif
+}
+
+inline void applyValueTextIndent(StyleResolver& styleResolver, CSSValue& value)
+{
+ Length lengthOrPercentageValue;
+#if ENABLE(CSS3_TEXT)
+ TextIndentLine textIndentLineValue = RenderStyle::initialTextIndentLine();
+ TextIndentType textIndentTypeValue = RenderStyle::initialTextIndentType();
+#endif
+ for (auto& item : downcast<CSSValueList>(value)) {
+ auto& primitiveValue = downcast<CSSPrimitiveValue>(item.get());
+ if (!primitiveValue.getValueID())
+ lengthOrPercentageValue = primitiveValue.convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion>(styleResolver.state().cssToLengthConversionData());
+#if ENABLE(CSS3_TEXT)
+ else if (primitiveValue.getValueID() == CSSValueWebkitEachLine)
+ textIndentLineValue = TextIndentEachLine;
+ else if (primitiveValue.getValueID() == CSSValueWebkitHanging)
+ textIndentTypeValue = TextIndentHanging;
+#endif
+ }
+
+ ASSERT(!lengthOrPercentageValue.isUndefined());
+ styleResolver.style()->setTextIndent(lengthOrPercentageValue);
+#if ENABLE(CSS3_TEXT)
+ styleResolver.style()->setTextIndentLine(textIndentLineValue);
+ styleResolver.style()->setTextIndentType(textIndentTypeValue);
+#endif
+}
+
} // namespace StyleBuilderFunctions
} // namespace WebCore