Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (177629 => 177630)
--- trunk/Source/WebCore/css/CSSPropertyNames.in 2014-12-22 02:00:04 UTC (rev 177629)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in 2014-12-22 10:38:57 UTC (rev 177630)
@@ -56,6 +56,10 @@
// If special handling is also needed to apply inherit or initial value, use
// Custom=All. Alternatively, several '|'-separated options can be passed:
// e.g. 'Custom=Inherit|Value".
+//
+// * AutoFunctions:
+// Indicates that this CSS property requires handling of "auto" and has
+// corresponding hasAutoXXX() / setHasAutoXXX() methods on RenderStyle.
// high-priority property names have to be listed first, to simplify the check
@@ -203,7 +207,7 @@
// Honor -webkit-opacity as a synonym for opacity. This was the only syntax that worked in Safari 1.1,
// and may be in use on some websites and widgets.
-webkit-opacity = opacity
-orphans [Inherited, LegacyStyleBuilder]
+orphans [Inherited, TypeName=short, AutoFunctions]
outline [LegacyStyleBuilder]
outline-color [LegacyStyleBuilder]
outline-offset [Converter=ComputedLength<int>]
@@ -267,13 +271,13 @@
vertical-align [Custom=Value]
visibility [Inherited]
white-space [Inherited]
-widows [Inherited, LegacyStyleBuilder]
+widows [Inherited, TypeName=short, AutoFunctions]
width [Initial=initialSize, Converter=LengthSizing]
word-break [Inherited]
-epub-word-break = word-break
word-spacing [Inherited, Custom=Value]
word-wrap [Inherited=EOverflowWrap, NameForMethods=OverflowWrap]
-z-index [LegacyStyleBuilder]
+z-index [TypeName=int, AutoFunctions]
alt [LegacyStyleBuilder]
-webkit-alt = alt
-webkit-animation [LegacyStyleBuilder]
@@ -337,11 +341,11 @@
-webkit-column-break-after [TypeName=EPageBreak, Initial=initialPageBreak]
-webkit-column-break-before [TypeName=EPageBreak, Initial=initialPageBreak]
-webkit-column-break-inside [TypeName=EPageBreak, Initial=initialPageBreak]
-column-count [LegacyStyleBuilder]
+column-count [TypeName=unsigned short, AutoFunctions]
-webkit-column-count = column-count
column-fill [TypeName=ColumnFill]
-webkit-column-fill = column-fill
-column-gap [LegacyStyleBuilder]
+column-gap [Custom=All]
-webkit-column-gap = column-gap
column-progression [TypeName=ColumnProgression]
-webkit-column-progression = column-progression
@@ -355,7 +359,7 @@
-webkit-column-rule-width = column-rule-width
column-span [TypeName=ColumnSpan]
-webkit-column-span = column-span
-column-width [LegacyStyleBuilder]
+column-width [TypeName=float, AutoFunctions, Converter=ComputedLength<float>]
-webkit-column-width = column-width
columns [LegacyStyleBuilder]
-webkit-columns = columns
Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (177629 => 177630)
--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp 2014-12-22 02:00:04 UTC (rev 177629)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp 2014-12-22 10:38:57 UTC (rev 177630)
@@ -41,42 +41,6 @@
using namespace HTMLNames;
-enum AutoValueType {Number = 0, ComputeLength};
-template <typename T, T (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(T), bool (RenderStyle::*hasAutoFunction)() const, void (RenderStyle::*setAutoFunction)(), AutoValueType valueType = Number, int autoIdentity = CSSValueAuto>
-class ApplyPropertyAuto {
-public:
- static void setValue(RenderStyle* style, T value) { (style->*setterFunction)(value); }
- static T value(RenderStyle* style) { return (style->*getterFunction)(); }
- static bool hasAuto(RenderStyle* style) { return (style->*hasAutoFunction)(); }
- static void setAuto(RenderStyle* style) { (style->*setAutoFunction)(); }
-
- static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
- {
- if (hasAuto(styleResolver->parentStyle()))
- setAuto(styleResolver->style());
- else
- setValue(styleResolver->style(), value(styleResolver->parentStyle()));
- }
-
- static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver) { setAuto(styleResolver->style()); }
-
- static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
- {
- if (!is<CSSPrimitiveValue>(*value))
- return;
-
- CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*value);
- if (primitiveValue.getValueID() == autoIdentity)
- setAuto(styleResolver->style());
- else if (valueType == Number)
- setValue(styleResolver->style(), primitiveValue);
- else if (valueType == ComputeLength)
- setValue(styleResolver->style(), primitiveValue.computeLength<T>(styleResolver->state().cssToLengthConversionData()));
- }
-
- static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
-};
-
enum ColorInherit {NoInheritFromParent = 0, InheritFromParent};
Color defaultInitialColor();
Color defaultInitialColor() { return Color(); }
@@ -586,7 +550,6 @@
setPropertyHandler(CSSPropertyFontSize, ApplyPropertyFontSize::createHandler());
setPropertyHandler(CSSPropertyFontStyle, ApplyPropertyFont<FontItalic, &FontDescription::italic, &FontDescription::setItalic, FontItalicOff>::createHandler());
setPropertyHandler(CSSPropertyFontVariant, ApplyPropertyFont<FontSmallCaps, &FontDescription::smallCaps, &FontDescription::setSmallCaps, FontSmallCapsOff>::createHandler());
- setPropertyHandler(CSSPropertyOrphans, ApplyPropertyAuto<short, &RenderStyle::orphans, &RenderStyle::setOrphans, &RenderStyle::hasAutoOrphans, &RenderStyle::setHasAutoOrphans>::createHandler());
setPropertyHandler(CSSPropertyOutlineColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::outlineColor, &RenderStyle::setOutlineColor, &RenderStyle::setVisitedLinkOutlineColor, &RenderStyle::color>::createHandler());
setPropertyHandler(CSSPropertyWebkitTextDecorationColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textDecorationColor, &RenderStyle::setTextDecorationColor, &RenderStyle::setVisitedLinkTextDecorationColor, &RenderStyle::color>::createHandler());
setPropertyHandler(CSSPropertyTextRendering, ApplyPropertyFont<TextRenderingMode, &FontDescription::textRenderingMode, &FontDescription::setTextRenderingMode, AutoTextRendering>::createHandler());
@@ -612,10 +575,7 @@
setPropertyHandler(CSSPropertyWebkitBackgroundComposite, ApplyPropertyFillLayer<CompositeOperator, CSSPropertyWebkitBackgroundComposite, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isCompositeSet, &FillLayer::composite, &FillLayer::setComposite, &FillLayer::clearComposite, &FillLayer::initialFillComposite, &CSSToStyleMap::mapFillComposite>::createHandler());
setPropertyHandler(CSSPropertyWebkitBackgroundOrigin, CSSPropertyBackgroundOrigin);
setPropertyHandler(CSSPropertyWebkitBackgroundSize, CSSPropertyBackgroundSize);
- setPropertyHandler(CSSPropertyColumnCount, ApplyPropertyAuto<unsigned short, &RenderStyle::columnCount, &RenderStyle::setColumnCount, &RenderStyle::hasAutoColumnCount, &RenderStyle::setHasAutoColumnCount>::createHandler());
- setPropertyHandler(CSSPropertyColumnGap, ApplyPropertyAuto<float, &RenderStyle::columnGap, &RenderStyle::setColumnGap, &RenderStyle::hasNormalColumnGap, &RenderStyle::setHasNormalColumnGap, ComputeLength, CSSValueNormal>::createHandler());
setPropertyHandler(CSSPropertyColumnRuleColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::columnRuleColor, &RenderStyle::setColumnRuleColor, &RenderStyle::setVisitedLinkColumnRuleColor, &RenderStyle::color>::createHandler());
- setPropertyHandler(CSSPropertyColumnWidth, ApplyPropertyAuto<float, &RenderStyle::columnWidth, &RenderStyle::setColumnWidth, &RenderStyle::hasAutoColumnWidth, &RenderStyle::setHasAutoColumnWidth, ComputeLength>::createHandler());
setPropertyHandler(CSSPropertyWebkitFontKerning, ApplyPropertyFont<FontDescription::Kerning, &FontDescription::kerning, &FontDescription::setKerning, FontDescription::AutoKerning>::createHandler());
setPropertyHandler(CSSPropertyWebkitFontSmoothing, ApplyPropertyFont<FontSmoothingMode, &FontDescription::fontSmoothing, &FontDescription::setFontSmoothing, AutoSmoothing>::createHandler());
setPropertyHandler(CSSPropertyWebkitFontVariantLigatures, ApplyPropertyFontVariantLigatures::createHandler());
@@ -635,10 +595,6 @@
setPropertyHandler(CSSPropertyWebkitTransitionDuration, ApplyPropertyAnimation<double, &Animation::duration, &Animation::setDuration, &Animation::isDurationSet, &Animation::clearDuration, &Animation::initialAnimationDuration, &CSSToStyleMap::mapAnimationDuration, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
setPropertyHandler(CSSPropertyWebkitTransitionProperty, ApplyPropertyAnimation<CSSPropertyID, &Animation::property, &Animation::setProperty, &Animation::isPropertySet, &Animation::clearProperty, &Animation::initialAnimationProperty, &CSSToStyleMap::mapAnimationProperty, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
setPropertyHandler(CSSPropertyWebkitTransitionTimingFunction, ApplyPropertyAnimation<const PassRefPtr<TimingFunction>, &Animation::timingFunction, &Animation::setTimingFunction, &Animation::isTimingFunctionSet, &Animation::clearTimingFunction, &Animation::initialAnimationTimingFunction, &CSSToStyleMap::mapAnimationTimingFunction, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
- setPropertyHandler(CSSPropertyWidows, ApplyPropertyAuto<short, &RenderStyle::widows, &RenderStyle::setWidows, &RenderStyle::hasAutoWidows, &RenderStyle::setHasAutoWidows>::createHandler());
-
- setPropertyHandler(CSSPropertyZIndex, ApplyPropertyAuto<int, &RenderStyle::zIndex, &RenderStyle::setZIndex, &RenderStyle::hasAutoZIndex, &RenderStyle::setHasAutoZIndex>::createHandler());
}
-
}
Modified: trunk/Source/WebCore/css/makeprop.pl (177629 => 177630)
--- trunk/Source/WebCore/css/makeprop.pl 2014-12-22 02:00:04 UTC (rev 177629)
+++ trunk/Source/WebCore/css/makeprop.pl 2014-12-22 10:38:57 UTC (rev 177630)
@@ -43,7 +43,8 @@
my %nameIsInherited;
my %propertiesWithStyleBuilderOptions;
my %styleBuilderOptions = (
- Converter => 1, # Defined in Source/WebCore/css/StyleBuilderConverter.h
+ AutoFunctions => 1, # Defined in Source/WebCore/css/StyleBuilderConverter.h
+ Converter => 1,
Custom => 1,
Getter => 1,
Initial => 1,
@@ -337,11 +338,36 @@
return $propertiesWithStyleBuilderOptions{$name}{"Custom"}{$builderFunction} ? "StyleBuilderCustom" : "StyleBuilderFunctions";
}
+sub getNameForMethods {
+ my $name = shift;
+
+ my $nameForMethods = $nameToId{$name};
+ $nameForMethods =~ s/Webkit//g;
+ if (exists($propertiesWithStyleBuilderOptions{$name}{"NameForMethods"})) {
+ $nameForMethods = $propertiesWithStyleBuilderOptions{$name}{"NameForMethods"};
+ }
+ return $nameForMethods;
+}
+
+sub getAutoGetter {
+ my $name = shift;
+ my $renderStyle = shift;
+
+ return $renderStyle . "->hasAuto" . getNameForMethods($name) . "()";
+}
+
+sub getAutoSetter {
+ my $name = shift;
+ my $renderStyle = shift;
+
+ return $renderStyle . "->setHasAuto" . getNameForMethods($name) . "()";
+}
+
foreach my $name (@names) {
# Skip properties still using the legacy style builder.
next unless exists($propertiesWithStyleBuilderOptions{$name});
- my $nameForMethods = $nameToId{$name};
+ my $nameForMethods = getNameForMethods($name);
$nameForMethods =~ s/Webkit//g;
if (exists($propertiesWithStyleBuilderOptions{$name}{"NameForMethods"})) {
$nameForMethods = $propertiesWithStyleBuilderOptions{$name}{"NameForMethods"};
@@ -368,6 +394,74 @@
$propertiesWithStyleBuilderOptions{$name}{"Custom"} = \%customValues;
}
+sub generateInitialValueSetter {
+ my $name = shift;
+ my $indent = shift;
+
+ my $setterContent = "";
+ $setterContent .= $indent . "inline void applyInitial" . $nameToId{$name} . "(StyleResolver& styleResolver)\n";
+ $setterContent .= $indent . "{\n";
+ my $style = "styleResolver.style()";
+ if (exists $propertiesWithStyleBuilderOptions{$name}{"AutoFunctions"}) {
+ $setterContent .= $indent . " " . getAutoSetter($name, $style) . ";\n";
+ } else {
+ my $setValue = $style . "->" . $propertiesWithStyleBuilderOptions{$name}{"Setter"};
+ $setterContent .= $indent . " " . $setValue . "(RenderStyle::" . $propertiesWithStyleBuilderOptions{$name}{"Initial"} . "());\n";
+ }
+ $setterContent .= $indent . "}\n";
+
+ return $setterContent;
+}
+
+sub generateInheritValueSetter {
+ my $name = shift;
+ my $indent = shift;
+
+ my $setterContent = "";
+ $setterContent .= $indent . "inline void applyInherit" . $nameToId{$name} . "(StyleResolver& styleResolver)\n";
+ $setterContent .= $indent . "{\n";
+ my $parentStyle = "styleResolver.parentStyle()";
+ my $style = "styleResolver.style()";
+ if (exists $propertiesWithStyleBuilderOptions{$name}{"AutoFunctions"}) {
+ $setterContent .= $indent . " if (" . getAutoGetter($name, $parentStyle) . ") {\n";
+ $setterContent .= $indent . " " . getAutoSetter($name, $style) . ";\n";
+ $setterContent .= $indent . " return;\n";
+ $setterContent .= $indent . " }\n";
+ }
+ my $setValue = $style . "->" . $propertiesWithStyleBuilderOptions{$name}{"Setter"};
+ $setterContent .= $indent . " " . $setValue . "(" . $parentStyle . "->" . $propertiesWithStyleBuilderOptions{$name}{"Getter"} . "());\n";
+ $setterContent .= $indent . "}\n";
+
+ return $setterContent;
+}
+
+sub generateValueSetter {
+ my $name = shift;
+ my $indent = shift;
+
+ my $setterContent = "";
+ $setterContent .= $indent . "inline void applyValue" . $nameToId{$name} . "(StyleResolver& styleResolver, CSSValue& value)\n";
+ $setterContent .= $indent . "{\n";
+ my $convertedValue;
+ if (exists($propertiesWithStyleBuilderOptions{$name}{"Converter"})) {
+ $convertedValue = "StyleBuilderConverter::convert" . $propertiesWithStyleBuilderOptions{$name}{"Converter"} . "(styleResolver, value)";
+ } else {
+ $convertedValue = "static_cast<" . $propertiesWithStyleBuilderOptions{$name}{"TypeName"} . ">(downcast<CSSPrimitiveValue>(value))";
+ }
+ my $style = "styleResolver.style()";
+ if (exists $propertiesWithStyleBuilderOptions{$name}{"AutoFunctions"}) {
+ $setterContent .= $indent . " if (downcast<CSSPrimitiveValue>(value).getValueID() == CSSValueAuto) {\n";
+ $setterContent .= $indent . " ". getAutoSetter($name, $style) . ";\n";
+ $setterContent .= $indent . " return;\n";
+ $setterContent .= $indent . " }\n";
+ }
+ my $setValue = $style . "->" . $propertiesWithStyleBuilderOptions{$name}{"Setter"};
+ $setterContent .= $indent . " " . $setValue . "(" . $convertedValue . ");\n";
+ $setterContent .= $indent . "}\n";
+
+ return $setterContent;
+}
+
open STYLEBUILDER, ">StyleBuilder.cpp" || die "Could not open StyleBuilder.cpp for writing";
print STYLEBUILDER << "EOF";
/* This file is automatically generated from CSSPropertyNames.in by makeprop, do not edit */
@@ -391,30 +485,15 @@
# Skip properties still using the legacy style builder.
next unless exists($propertiesWithStyleBuilderOptions{$name});
- my $setValue = "styleResolver.style()->" . $propertiesWithStyleBuilderOptions{$name}{"Setter"};
+ my $indent = " ";
if (!$propertiesWithStyleBuilderOptions{$name}{"Custom"}{"Initial"}) {
- print STYLEBUILDER " inline void applyInitial" . $nameToId{$name} . "(StyleResolver& styleResolver)\n";
- print STYLEBUILDER " {\n";
- print STYLEBUILDER " " . $setValue . "(RenderStyle::" . $propertiesWithStyleBuilderOptions{$name}{"Initial"} . "());\n";
- print STYLEBUILDER " }\n";
+ print STYLEBUILDER generateInitialValueSetter($name, $indent);
}
if (!$propertiesWithStyleBuilderOptions{$name}{"Custom"}{"Inherit"}) {
- print STYLEBUILDER " inline void applyInherit" . $nameToId{$name} . "(StyleResolver& styleResolver)\n";
- print STYLEBUILDER " {\n";
- print STYLEBUILDER " " . $setValue . "(styleResolver.parentStyle()->" . $propertiesWithStyleBuilderOptions{$name}{"Getter"} . "());\n";
- print STYLEBUILDER " }\n";
+ print STYLEBUILDER generateInheritValueSetter($name, $indent);
}
if (!$propertiesWithStyleBuilderOptions{$name}{"Custom"}{"Value"}) {
- print STYLEBUILDER " inline void applyValue" . $nameToId{$name} . "(StyleResolver& styleResolver, CSSValue& value)\n";
- print STYLEBUILDER " {\n";
- my $convertedValue;
- if (exists($propertiesWithStyleBuilderOptions{$name}{"Converter"})) {
- $convertedValue = "StyleBuilderConverter::convert" . $propertiesWithStyleBuilderOptions{$name}{"Converter"} . "(styleResolver, value)";
- } else {
- $convertedValue = "static_cast<" . $propertiesWithStyleBuilderOptions{$name}{"TypeName"} . ">(downcast<CSSPrimitiveValue>(value))";
- }
- print STYLEBUILDER " " . $setValue . "(" . $convertedValue . ");\n";
- print STYLEBUILDER " }\n";
+ print STYLEBUILDER generateValueSetter($name, $indent);
}
}