<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[178638] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/178638">178638</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-01-18 21:32:28 -0800 (Sun, 18 Jan 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Generate matchingShorthandsForLonghand() implementation from CSSPropertyNames.in
https://bugs.webkit.org/show_bug.cgi?id=140599

Reviewed by Antti Koivisto.

Generate matchingShorthandsForLonghand() implementation from
CSSPropertyNames.in. We already have all the information we need in
CSSPropertyNames.in to generate the big switch() in
matchingShorthandsForLonghand().

A few shorthands still aren't generated. I will look into getting rid
of the custom code in a follow-up patch.

* css/StylePropertyShorthand.cpp:
(WebCore::makeVector): Deleted.
(WebCore::matchingShorthandsForLonghand): Deleted.
* css/StylePropertyShorthand.h:
(WebCore::matchingCustomShorthandsForLonghand):
* css/makeprop.pl:
(constructShorthandsVector):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssStylePropertyShorthandcpp">trunk/Source/WebCore/css/StylePropertyShorthand.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStylePropertyShorthandh">trunk/Source/WebCore/css/StylePropertyShorthand.h</a></li>
<li><a href="#trunkSourceWebCorecssmakeproppl">trunk/Source/WebCore/css/makeprop.pl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (178637 => 178638)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-01-19 05:14:56 UTC (rev 178637)
+++ trunk/Source/WebCore/ChangeLog        2015-01-19 05:32:28 UTC (rev 178638)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2015-01-18  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Generate matchingShorthandsForLonghand() implementation from CSSPropertyNames.in
+        https://bugs.webkit.org/show_bug.cgi?id=140599
+
+        Reviewed by Antti Koivisto.
+
+        Generate matchingShorthandsForLonghand() implementation from
+        CSSPropertyNames.in. We already have all the information we need in
+        CSSPropertyNames.in to generate the big switch() in
+        matchingShorthandsForLonghand().
+
+        A few shorthands still aren't generated. I will look into getting rid
+        of the custom code in a follow-up patch.
+
+        * css/StylePropertyShorthand.cpp:
+        (WebCore::makeVector): Deleted.
+        (WebCore::matchingShorthandsForLonghand): Deleted.
+        * css/StylePropertyShorthand.h:
+        (WebCore::matchingCustomShorthandsForLonghand):
+        * css/makeprop.pl:
+        (constructShorthandsVector):
+
</ins><span class="cx"> 2015-01-18  Dean Jackson  &lt;dino@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Out of bounds write in canvas.toDataURL
</span></span></pre></div>
<a id="trunkSourceWebCorecssStylePropertyShorthandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StylePropertyShorthand.cpp (178637 => 178638)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StylePropertyShorthand.cpp        2015-01-19 05:14:56 UTC (rev 178637)
+++ trunk/Source/WebCore/css/StylePropertyShorthand.cpp        2015-01-19 05:32:28 UTC (rev 178638)
</span><span class="lines">@@ -112,240 +112,6 @@
</span><span class="cx">     return shorthandForProperty(id).length();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static Vector&lt;StylePropertyShorthand&gt; makeVector(const StylePropertyShorthand&amp; a)
-{
-    return Vector&lt;StylePropertyShorthand&gt;(1, a);
-}
-
-static Vector&lt;StylePropertyShorthand&gt; makeVector(const StylePropertyShorthand&amp; a, const StylePropertyShorthand&amp; b)
-{
-    Vector&lt;StylePropertyShorthand&gt; vector;
-    vector.reserveInitialCapacity(2);
-    vector.uncheckedAppend(a);
-    vector.uncheckedAppend(b);
-    return vector;
-}
-
-static Vector&lt;StylePropertyShorthand&gt; makeVector(const StylePropertyShorthand&amp; a, const StylePropertyShorthand&amp; b, const StylePropertyShorthand&amp; c)
-{
-    Vector&lt;StylePropertyShorthand&gt; vector;
-    vector.reserveInitialCapacity(3);
-    vector.uncheckedAppend(a);
-    vector.uncheckedAppend(b);
-    vector.uncheckedAppend(c);
-    return vector;
-}
-
-// FIXME: This function should be generated from CSSPropertyNames.in.
-Vector&lt;StylePropertyShorthand&gt; matchingShorthandsForLonghand(CSSPropertyID propertyID)
-{
-    switch (propertyID) {
-    case CSSPropertyAnimationName:
-    case CSSPropertyAnimationDuration:
-    case CSSPropertyAnimationTimingFunction:
-    case CSSPropertyAnimationDelay:
-    case CSSPropertyAnimationIterationCount:
-    case CSSPropertyAnimationDirection:
-    case CSSPropertyAnimationFillMode:
-        return makeVector(animationShorthand());
-    case CSSPropertyBackgroundImage:
-    case CSSPropertyBackgroundSize:
-    case CSSPropertyBackgroundAttachment:
-    case CSSPropertyBackgroundOrigin:
-    case CSSPropertyBackgroundClip:
-    case CSSPropertyBackgroundColor:
-        return makeVector(backgroundShorthand());
-    case CSSPropertyBackgroundPositionX:
-    case CSSPropertyBackgroundPositionY:
-        return makeVector(backgroundShorthand(), backgroundPositionShorthand());
-    case CSSPropertyBackgroundRepeatX:
-    case CSSPropertyBackgroundRepeatY:
-        return makeVector(backgroundShorthand(), backgroundRepeatShorthand());
-    case CSSPropertyBorderBottomWidth:
-        return makeVector(borderShorthand(), borderBottomShorthand(), borderWidthShorthand());
-    case CSSPropertyBorderTopColor:
-        return makeVector(borderShorthand(), borderTopShorthand(), borderColorShorthand());
-    case CSSPropertyBorderRightColor:
-        return makeVector(borderShorthand(), borderRightShorthand(), borderColorShorthand());
-    case CSSPropertyBorderLeftColor:
-        return makeVector(borderShorthand(), borderLeftShorthand(), borderColorShorthand());
-    case CSSPropertyBorderBottomColor:
-        return makeVector(borderShorthand(), borderBottomShorthand(), borderColorShorthand());
-    case CSSPropertyBorderImageSource:
-    case CSSPropertyBorderImageSlice:
-    case CSSPropertyBorderImageWidth:
-    case CSSPropertyBorderImageOutset:
-    case CSSPropertyBorderImageRepeat:
-        return makeVector(borderImageShorthand());
-    case CSSPropertyBorderLeftWidth:
-        return makeVector(borderShorthand(), borderLeftShorthand(), borderWidthShorthand());
-    case CSSPropertyBorderTopLeftRadius:
-    case CSSPropertyBorderTopRightRadius:
-    case CSSPropertyBorderBottomRightRadius:
-    case CSSPropertyBorderBottomLeftRadius:
-        return makeVector(borderRadiusShorthand(), webkitBorderRadiusShorthand());
-    case CSSPropertyBorderRightWidth:
-        return makeVector(borderShorthand(), borderRightShorthand(), borderWidthShorthand());
-    case CSSPropertyWebkitBorderHorizontalSpacing:
-    case CSSPropertyWebkitBorderVerticalSpacing:
-        return makeVector(borderSpacingShorthand());
-    case CSSPropertyBorderTopStyle:
-        return makeVector(borderShorthand(), borderTopShorthand(), borderStyleShorthand());
-    case CSSPropertyBorderBottomStyle:
-        return makeVector(borderShorthand(), borderBottomShorthand(), borderStyleShorthand());
-    case CSSPropertyBorderLeftStyle:
-        return makeVector(borderShorthand(), borderLeftShorthand(), borderStyleShorthand());
-    case CSSPropertyBorderRightStyle:
-        return makeVector(borderShorthand(), borderRightShorthand(), borderStyleShorthand());
-    case CSSPropertyBorderTopWidth:
-        return makeVector(borderShorthand(), borderTopShorthand(), borderWidthShorthand());
-    case CSSPropertyListStyleType:
-    case CSSPropertyListStylePosition:
-    case CSSPropertyListStyleImage:
-        return makeVector(listStyleShorthand());
-    case CSSPropertyFontFamily:
-    case CSSPropertyFontSize:
-    case CSSPropertyFontStyle:
-    case CSSPropertyFontVariant:
-    case CSSPropertyFontWeight:
-    case CSSPropertyLineHeight:
-        return makeVector(fontShorthand());
-    case CSSPropertyMarginTop:
-    case CSSPropertyMarginRight:
-    case CSSPropertyMarginBottom:
-    case CSSPropertyMarginLeft:
-        return makeVector(marginShorthand());
-    case CSSPropertyOutlineColor:
-    case CSSPropertyOutlineStyle:
-    case CSSPropertyOutlineWidth:
-        return makeVector(outlineShorthand());
-    case CSSPropertyPaddingTop:
-    case CSSPropertyPaddingRight:
-    case CSSPropertyPaddingBottom:
-    case CSSPropertyPaddingLeft:
-        return makeVector(paddingShorthand());
-    case CSSPropertyOverflowX:
-    case CSSPropertyOverflowY:
-        return makeVector(overflowShorthand());
-    case CSSPropertyTransitionProperty:
-    case CSSPropertyTransitionDuration:
-    case CSSPropertyTransitionTimingFunction:
-    case CSSPropertyTransitionDelay:
-        return makeVector(transitionShorthand());
-    case CSSPropertyWebkitAnimationName:
-    case CSSPropertyWebkitAnimationDuration:
-    case CSSPropertyWebkitAnimationTimingFunction:
-    case CSSPropertyWebkitAnimationDelay:
-    case CSSPropertyWebkitAnimationIterationCount:
-    case CSSPropertyWebkitAnimationDirection:
-    case CSSPropertyWebkitAnimationFillMode:
-        return makeVector(webkitAnimationShorthand());
-    case CSSPropertyWebkitBorderAfterWidth:
-    case CSSPropertyWebkitBorderAfterStyle:
-    case CSSPropertyWebkitBorderAfterColor:
-        return makeVector(webkitBorderAfterShorthand());
-    case CSSPropertyWebkitBorderBeforeWidth:
-    case CSSPropertyWebkitBorderBeforeStyle:
-    case CSSPropertyWebkitBorderBeforeColor:
-        return makeVector(webkitBorderBeforeShorthand());
-    case CSSPropertyWebkitBorderEndWidth:
-    case CSSPropertyWebkitBorderEndStyle:
-    case CSSPropertyWebkitBorderEndColor:
-        return makeVector(webkitBorderEndShorthand());
-    case CSSPropertyWebkitBorderStartWidth:
-    case CSSPropertyWebkitBorderStartStyle:
-    case CSSPropertyWebkitBorderStartColor:
-        return makeVector(webkitBorderStartShorthand());
-    case CSSPropertyColumnWidth:
-    case CSSPropertyColumnCount:
-        return makeVector(columnsShorthand());
-    case CSSPropertyColumnRuleWidth:
-    case CSSPropertyColumnRuleStyle:
-    case CSSPropertyColumnRuleColor:
-        return makeVector(columnRuleShorthand());
-    case CSSPropertyFlexGrow:
-    case CSSPropertyFlexShrink:
-    case CSSPropertyFlexBasis:
-        return makeVector(flexShorthand());
-    case CSSPropertyFlexDirection:
-    case CSSPropertyFlexWrap:
-        return makeVector(flexFlowShorthand());
-#if ENABLE(CSS_GRID_LAYOUT)
-    case CSSPropertyWebkitGridColumnStart:
-    case CSSPropertyWebkitGridColumnEnd:
-        return makeVector(webkitGridColumnShorthand());
-    case CSSPropertyWebkitGridRowStart:
-    case CSSPropertyWebkitGridRowEnd:
-        return makeVector(webkitGridRowShorthand());
-    case CSSPropertyWebkitGridTemplateColumns:
-    case CSSPropertyWebkitGridTemplateRows:
-    case CSSPropertyWebkitGridTemplateAreas:
-        return makeVector(webkitGridTemplateShorthand(), webkitGridShorthand());
-    case CSSPropertyWebkitGridAutoFlow:
-    case CSSPropertyWebkitGridAutoColumns:
-    case CSSPropertyWebkitGridAutoRows:
-        return makeVector(webkitGridShorthand());
-#endif
-    case CSSPropertyWebkitMarginBeforeCollapse:
-    case CSSPropertyWebkitMarginAfterCollapse:
-        return makeVector(webkitMarginCollapseShorthand());
-    case CSSPropertyWebkitMarqueeDirection:
-    case CSSPropertyWebkitMarqueeIncrement:
-    case CSSPropertyWebkitMarqueeRepetition:
-    case CSSPropertyWebkitMarqueeStyle:
-    case CSSPropertyWebkitMarqueeSpeed:
-        return makeVector(webkitMarqueeShorthand());
-    case CSSPropertyWebkitMaskImage:
-    case CSSPropertyWebkitMaskSourceType:
-    case CSSPropertyWebkitMaskSize:
-    case CSSPropertyWebkitMaskOrigin:
-    case CSSPropertyWebkitMaskClip:
-        return makeVector(webkitMaskShorthand());
-    case CSSPropertyWebkitMaskPositionX:
-    case CSSPropertyWebkitMaskPositionY:
-        return makeVector(webkitMaskPositionShorthand());
-    case CSSPropertyWebkitMaskRepeatX:
-    case CSSPropertyWebkitMaskRepeatY:
-        return makeVector(webkitMaskRepeatShorthand());
-    case CSSPropertyWebkitPerspectiveOriginX:
-    case CSSPropertyWebkitPerspectiveOriginY:
-        return makeVector(webkitPerspectiveOriginShorthand());
-    case CSSPropertyWebkitTextEmphasisStyle:
-    case CSSPropertyWebkitTextEmphasisColor:
-        return makeVector(webkitTextEmphasisShorthand());
-    case CSSPropertyWebkitTextStrokeWidth:
-    case CSSPropertyWebkitTextStrokeColor:
-        return makeVector(webkitTextStrokeShorthand());
-    case CSSPropertyWebkitTransitionProperty:
-    case CSSPropertyWebkitTransitionDuration:
-    case CSSPropertyWebkitTransitionTimingFunction:
-    case CSSPropertyWebkitTransitionDelay:
-        return makeVector(webkitTransitionShorthand());
-    case CSSPropertyWebkitTransformOriginX:
-    case CSSPropertyWebkitTransformOriginY:
-    case CSSPropertyWebkitTransformOriginZ:
-        return makeVector(webkitTransformOriginShorthand());
-    case CSSPropertyMinWidth:
-    case CSSPropertyMaxWidth:
-        return makeVector(widthShorthand());
-    case CSSPropertyMinHeight:
-    case CSSPropertyMaxHeight:
-        return makeVector(heightShorthand());
-    case CSSPropertyWebkitTextDecorationLine:
-    case CSSPropertyWebkitTextDecorationStyle:
-    case CSSPropertyWebkitTextDecorationColor:
-        return makeVector(webkitTextDecorationShorthand());
-    case CSSPropertyMarkerStart:
-    case CSSPropertyMarkerMid:
-    case CSSPropertyMarkerEnd:
-        return makeVector(markerShorthand());
-    default:
-        break;
-    }
-
-    return Vector&lt;StylePropertyShorthand&gt;();
-}
-
</del><span class="cx"> unsigned indexOfShorthandForLonghand(CSSPropertyID shorthandID, const Vector&lt;StylePropertyShorthand&gt;&amp; shorthands)
</span><span class="cx"> {
</span><span class="cx">     for (unsigned i = 0, size = shorthands.size(); i &lt; size; ++i) {
</span></span></pre></div>
<a id="trunkSourceWebCorecssStylePropertyShorthandh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StylePropertyShorthand.h (178637 => 178638)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StylePropertyShorthand.h        2015-01-19 05:14:56 UTC (rev 178637)
+++ trunk/Source/WebCore/css/StylePropertyShorthand.h        2015-01-19 05:32:28 UTC (rev 178638)
</span><span class="lines">@@ -71,11 +71,37 @@
</span><span class="cx"> StylePropertyShorthand shorthandForProperty(CSSPropertyID);
</span><span class="cx"> 
</span><span class="cx"> // Return the list of shorthands for a given longhand.
</span><ins>+// The implementation is generated in StylePropertyShorthandFunctions.cpp.
</ins><span class="cx"> Vector&lt;StylePropertyShorthand&gt; matchingShorthandsForLonghand(CSSPropertyID);
</span><ins>+
</ins><span class="cx"> unsigned indexOfShorthandForLonghand(CSSPropertyID, const Vector&lt;StylePropertyShorthand&gt;&amp;);
</span><span class="cx"> 
</span><span class="cx"> bool isExpandedShorthand(CSSPropertyID);
</span><span class="cx"> 
</span><ins>+// FIXME: This should try to get rid of this function and generate the rest of these shorthands.
+inline Vector&lt;StylePropertyShorthand&gt; matchingCustomShorthandsForLonghand(CSSPropertyID propertyID)
+{
+    switch (propertyID) {
+    case CSSPropertyFontFamily:
+    case CSSPropertyFontSize:
+    case CSSPropertyFontStyle:
+    case CSSPropertyFontVariant:
+    case CSSPropertyFontWeight:
+    case CSSPropertyLineHeight:
+        return Vector&lt;StylePropertyShorthand&gt;{fontShorthand()};
+    case CSSPropertyMinWidth:
+    case CSSPropertyMaxWidth:
+        return Vector&lt;StylePropertyShorthand&gt;{widthShorthand()};
+    case CSSPropertyMinHeight:
+    case CSSPropertyMaxHeight:
+        return Vector&lt;StylePropertyShorthand&gt;{heightShorthand()};
+    default:
+        break;
+    }
+
+    return Vector&lt;StylePropertyShorthand&gt;();
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // StylePropertyShorthand_h
</span></span></pre></div>
<a id="trunkSourceWebCorecssmakeproppl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/makeprop.pl (178637 => 178638)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/makeprop.pl        2015-01-19 05:14:56 UTC (rev 178637)
+++ trunk/Source/WebCore/css/makeprop.pl        2015-01-19 05:32:28 UTC (rev 178638)
</span><span class="lines">@@ -939,6 +939,8 @@
</span><span class="cx"> 
</span><span class="cx"> EOF
</span><span class="cx"> 
</span><ins>+my %longhandToShorthands = ();
+
</ins><span class="cx"> foreach my $name (@names) {
</span><span class="cx">   # Skip non-Shorthand properties.
</span><span class="cx">   next if (!exists $propertiesWithStyleBuilderOptions{$name}{&quot;Longhands&quot;});
</span><span class="lines">@@ -951,6 +953,7 @@
</span><span class="cx">   print SHORTHANDS_CPP &quot;    static const CSSPropertyID &quot; . $lowercaseId . &quot;Properties[] = {\n&quot;;
</span><span class="cx">   foreach (@longhands) {
</span><span class="cx">     die &quot;Unknown CSS property used in Longhands: &quot; . $nameToId{$_} if !exists($nameToId{$_});
</span><ins>+    push(@{$longhandToShorthands{$_}}, $name);
</ins><span class="cx">     print SHORTHANDS_CPP &quot;        CSSProperty&quot; . $nameToId{$_} . &quot;,\n&quot;;
</span><span class="cx">   }
</span><span class="cx">   print SHORTHANDS_CPP &quot;    };\n&quot;;
</span><span class="lines">@@ -986,6 +989,44 @@
</span><span class="cx"> EOF
</span><span class="cx"> 
</span><span class="cx"> print SHORTHANDS_CPP &lt;&lt; &quot;EOF&quot;;
</span><ins>+Vector&lt;StylePropertyShorthand&gt; matchingShorthandsForLonghand(CSSPropertyID propertyID)
+{
+    switch (propertyID) {
+EOF
+
+sub constructShorthandsVector {
+  my $shorthands = shift;
+
+  my $vector = &quot;Vector&lt;StylePropertyShorthand&gt;{&quot;;
+  foreach my $i (0 .. $#$shorthands) {
+    $vector .= &quot;, &quot; unless $i == 0;
+    $vector .= lcfirst($nameToId{$shorthands-&gt;[$i]}) . &quot;Shorthand()&quot;;
+  }
+  $vector .= &quot;}&quot;;
+  return $vector;
+}
+
+my %vectorToLonghands = ();
+for my $longhand (sort keys %longhandToShorthands) {
+  my @shorthands = sort(@{$longhandToShorthands{$longhand}});
+  push(@{$vectorToLonghands{constructShorthandsVector(\@shorthands)}}, $longhand);
+}
+
+for my $vector (sort keys %vectorToLonghands) {
+  foreach (@{$vectorToLonghands{$vector}}) {
+    print SHORTHANDS_CPP &quot;    case CSSProperty&quot; . $nameToId{$_} . &quot;:\n&quot;;
+  }
+  print SHORTHANDS_CPP &quot;        return &quot; . $vector . &quot;;\n&quot;;
+}
+
+print SHORTHANDS_CPP &lt;&lt; &quot;EOF&quot;;
+    default:
+        return matchingCustomShorthandsForLonghand(propertyID);
+    }
+}
+EOF
+
+print SHORTHANDS_CPP &lt;&lt; &quot;EOF&quot;;
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> EOF
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>