Title: [178626] trunk/Source/WebCore
Revision
178626
Author
[email protected]
Date
2015-01-17 08:54:33 -0800 (Sat, 17 Jan 2015)

Log Message

Generate shorthandForProperty() implementation from CSSPropertyNames.in
https://bugs.webkit.org/show_bug.cgi?id=140556

Reviewed by Darin Adler.

Generate shorthandForProperty() implementation from CSSPropertyNames.in.
This is just a big switch() statement calling the right
StylePropertyShorthand factory function for a given CSSPropertyID.

* css/StylePropertyShorthand.cpp:
(WebCore::shorthandForProperty): Deleted.
* css/StylePropertyShorthand.h:
* css/makeprop.pl:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (178625 => 178626)


--- trunk/Source/WebCore/ChangeLog	2015-01-17 16:49:53 UTC (rev 178625)
+++ trunk/Source/WebCore/ChangeLog	2015-01-17 16:54:33 UTC (rev 178626)
@@ -1,3 +1,19 @@
+2015-01-17  Chris Dumez  <[email protected]>
+
+        Generate shorthandForProperty() implementation from CSSPropertyNames.in
+        https://bugs.webkit.org/show_bug.cgi?id=140556
+
+        Reviewed by Darin Adler.
+
+        Generate shorthandForProperty() implementation from CSSPropertyNames.in.
+        This is just a big switch() statement calling the right
+        StylePropertyShorthand factory function for a given CSSPropertyID.
+
+        * css/StylePropertyShorthand.cpp:
+        (WebCore::shorthandForProperty): Deleted.
+        * css/StylePropertyShorthand.h:
+        * css/makeprop.pl:
+
 2015-01-16  Brent Fulgham  <[email protected]>
 
         [Mac] Correct infinite loop in Wheel Handler code in EventHandlerMac

Modified: trunk/Source/WebCore/css/StylePropertyShorthand.cpp (178625 => 178626)


--- trunk/Source/WebCore/css/StylePropertyShorthand.cpp	2015-01-17 16:49:53 UTC (rev 178625)
+++ trunk/Source/WebCore/css/StylePropertyShorthand.cpp	2015-01-17 16:54:33 UTC (rev 178626)
@@ -100,116 +100,6 @@
     return StylePropertyShorthand(CSSPropertyHeight, heightProperties);
 }
 
-// FIXME: This function should be generated from CSSPropertyNames.in.
-// Returns an empty list if the property is not a shorthand.
-StylePropertyShorthand shorthandForProperty(CSSPropertyID propertyID)
-{
-    switch (propertyID) {
-    case CSSPropertyAnimation:
-        return animationShorthand();
-    case CSSPropertyBackground:
-        return backgroundShorthand();
-    case CSSPropertyBackgroundPosition:
-        return backgroundPositionShorthand();
-    case CSSPropertyBackgroundRepeat:
-        return backgroundRepeatShorthand();
-    case CSSPropertyBorder:
-        return borderShorthand();
-    case CSSPropertyBorderBottom:
-        return borderBottomShorthand();
-    case CSSPropertyBorderColor:
-        return borderColorShorthand();
-    case CSSPropertyBorderImage:
-        return borderImageShorthand();
-    case CSSPropertyBorderLeft:
-        return borderLeftShorthand();
-    case CSSPropertyBorderRadius:
-        return borderRadiusShorthand();
-    case CSSPropertyBorderRight:
-        return borderRightShorthand();
-    case CSSPropertyBorderSpacing:
-        return borderSpacingShorthand();
-    case CSSPropertyBorderStyle:
-        return borderStyleShorthand();
-    case CSSPropertyBorderTop:
-        return borderTopShorthand();
-    case CSSPropertyBorderWidth:
-        return borderWidthShorthand();
-    case CSSPropertyListStyle:
-        return listStyleShorthand();
-    case CSSPropertyFont:
-        return fontShorthand();
-    case CSSPropertyMargin:
-        return marginShorthand();
-    case CSSPropertyOutline:
-        return outlineShorthand();
-    case CSSPropertyOverflow:
-        return overflowShorthand();
-    case CSSPropertyPadding:
-        return paddingShorthand();
-    case CSSPropertyTransition:
-        return transitionShorthand();
-    case CSSPropertyWebkitAnimation:
-        return webkitAnimationShorthand();
-    case CSSPropertyWebkitBorderAfter:
-        return webkitBorderAfterShorthand();
-    case CSSPropertyWebkitBorderBefore:
-        return webkitBorderBeforeShorthand();
-    case CSSPropertyWebkitBorderEnd:
-        return webkitBorderEndShorthand();
-    case CSSPropertyWebkitBorderStart:
-        return webkitBorderStartShorthand();
-    case CSSPropertyWebkitBorderRadius:
-        return borderRadiusShorthand();
-    case CSSPropertyColumns:
-        return columnsShorthand();
-    case CSSPropertyColumnRule:
-        return columnRuleShorthand();
-    case CSSPropertyFlex:
-        return flexShorthand();
-    case CSSPropertyFlexFlow:
-        return flexFlowShorthand();
-#if ENABLE(CSS_GRID_LAYOUT)
-    case CSSPropertyWebkitGridArea:
-        return webkitGridAreaShorthand();
-    case CSSPropertyWebkitGridTemplate:
-        return webkitGridTemplateShorthand();
-    case CSSPropertyWebkitGrid:
-        return webkitGridShorthand();
-    case CSSPropertyWebkitGridColumn:
-        return webkitGridColumnShorthand();
-    case CSSPropertyWebkitGridRow:
-        return webkitGridRowShorthand();
-#endif
-    case CSSPropertyWebkitMarginCollapse:
-        return webkitMarginCollapseShorthand();
-    case CSSPropertyWebkitMarquee:
-        return webkitMarqueeShorthand();
-    case CSSPropertyWebkitMask:
-        return webkitMaskShorthand();
-    case CSSPropertyWebkitMaskPosition:
-        return webkitMaskPositionShorthand();
-    case CSSPropertyWebkitMaskRepeat:
-        return webkitMaskRepeatShorthand();
-    case CSSPropertyWebkitPerspectiveOrigin:
-        return webkitPerspectiveOriginShorthand();
-    case CSSPropertyWebkitTextEmphasis:
-        return webkitTextEmphasisShorthand();
-    case CSSPropertyWebkitTextStroke:
-        return webkitTextStrokeShorthand();
-    case CSSPropertyWebkitTransition:
-        return webkitTransitionShorthand();
-    case CSSPropertyWebkitTransformOrigin:
-        return webkitTransformOriginShorthand();
-    case CSSPropertyWebkitTextDecoration:
-        return webkitTextDecorationShorthand();
-    case CSSPropertyMarker:
-        return markerShorthand();
-    default:
-        return StylePropertyShorthand();
-    }
-}
-
 bool isExpandedShorthand(CSSPropertyID id)
 {
     // The system fonts bypass the normal style resolution by using RenderTheme,

Modified: trunk/Source/WebCore/css/StylePropertyShorthand.h (178625 => 178626)


--- trunk/Source/WebCore/css/StylePropertyShorthand.h	2015-01-17 16:49:53 UTC (rev 178625)
+++ trunk/Source/WebCore/css/StylePropertyShorthand.h	2015-01-17 16:54:33 UTC (rev 178626)
@@ -67,6 +67,7 @@
 StylePropertyShorthand widthShorthand();
 
 // Returns empty value if the property is not a shorthand.
+// The implementation is generated in StylePropertyShorthandFunctions.cpp.
 StylePropertyShorthand shorthandForProperty(CSSPropertyID);
 
 // Return the list of shorthands for a given longhand.

Modified: trunk/Source/WebCore/css/makeprop.pl (178625 => 178626)


--- trunk/Source/WebCore/css/makeprop.pl	2015-01-17 16:49:53 UTC (rev 178625)
+++ trunk/Source/WebCore/css/makeprop.pl	2015-01-17 16:54:33 UTC (rev 178626)
@@ -933,6 +933,7 @@
 #include "StylePropertyShorthandFunctions.h"
 
 #include "StylePropertyShorthand.h"
+#include <wtf/NeverDestroyed.h>
 
 namespace WebCore {
 
@@ -958,6 +959,33 @@
 }
 
 print SHORTHANDS_CPP << "EOF";
+StylePropertyShorthand shorthandForProperty(CSSPropertyID propertyID)
+{
+    static NeverDestroyed<StylePropertyShorthand> emptyShorthand;
+
+    switch (propertyID) {
+EOF
+
+foreach my $name (@names) {
+  # Skip non-Shorthand properties.
+  next if (!exists $propertiesWithStyleBuilderOptions{$name}{"Longhands"});
+
+  print SHORTHANDS_CPP "    case CSSProperty" . $nameToId{$name} . ":\n";
+  print SHORTHANDS_CPP "        return " . lcfirst($nameToId{$name}) . "Shorthand();\n";
+}
+
+# FIXME: CSSPropertyFont is currently an exception. It is hard-coded here
+# because it is not marked as a shorthand in CSSPropertyNames.in.
+print SHORTHANDS_CPP << "EOF";
+    case CSSPropertyFont:
+        return fontShorthand();
+    default:
+        return emptyShorthand;
+    }
+}
+EOF
+
+print SHORTHANDS_CPP << "EOF";
 } // namespace WebCore
 EOF
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to