<!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>[208107] 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/208107">208107</a></dd>
<dt>Author</dt> <dd>hyatt@apple.com</dd>
<dt>Date</dt> <dd>2016-10-29 10:46:54 -0700 (Sat, 29 Oct 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[CSS Parser] Fix transform-origin and perspective-origin to parse as shorthands
https://bugs.webkit.org/show_bug.cgi?id=164178

Reviewed by Zalan Bujtas.

* css/CSSPropertyNames.in:
Patch the transform-origin-x/y and perspective-origin-x/y properties
to use new converters that can handle keywords.

* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertPositionComponentX):
(WebCore::StyleBuilderConverter::convertPositionComponentY):
Add the new converters. They just call convertPositionComponent method
that we already use for object-position and background-position.

* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::consumeTransformOrigin):
(WebCore::CSSPropertyParser::consumePerspectiveOrigin):
Changed to treat the properties as shorthands and add the longhand
properties once parsed.

(WebCore::CSSPropertyParser::parseSingleValue):
(WebCore::CSSPropertyParser::parseShorthand):
* css/parser/CSSPropertyParser.h:
Move the parsing into the shorthand method, since we're still treating
these properties as shorthands.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSPropertyNamesin">trunk/Source/WebCore/css/CSSPropertyNames.in</a></li>
<li><a href="#trunkSourceWebCorecssStyleBuilderConverterh">trunk/Source/WebCore/css/StyleBuilderConverter.h</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSPropertyParsercpp">trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSPropertyParserh">trunk/Source/WebCore/css/parser/CSSPropertyParser.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (208106 => 208107)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-10-29 16:32:53 UTC (rev 208106)
+++ trunk/Source/WebCore/ChangeLog        2016-10-29 17:46:54 UTC (rev 208107)
</span><span class="lines">@@ -1,5 +1,34 @@
</span><span class="cx"> 2016-10-29  Dave Hyatt  &lt;hyatt@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        [CSS Parser] Fix transform-origin and perspective-origin to parse as shorthands
+        https://bugs.webkit.org/show_bug.cgi?id=164178
+
+        Reviewed by Zalan Bujtas.
+
+        * css/CSSPropertyNames.in:
+        Patch the transform-origin-x/y and perspective-origin-x/y properties
+        to use new converters that can handle keywords.
+
+        * css/StyleBuilderConverter.h:
+        (WebCore::StyleBuilderConverter::convertPositionComponentX):
+        (WebCore::StyleBuilderConverter::convertPositionComponentY):
+        Add the new converters. They just call convertPositionComponent method
+        that we already use for object-position and background-position.
+
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::CSSPropertyParser::consumeTransformOrigin):
+        (WebCore::CSSPropertyParser::consumePerspectiveOrigin):
+        Changed to treat the properties as shorthands and add the longhand
+        properties once parsed.
+
+        (WebCore::CSSPropertyParser::parseSingleValue):
+        (WebCore::CSSPropertyParser::parseShorthand):
+        * css/parser/CSSPropertyParser.h:
+        Move the parsing into the shorthand method, since we're still treating
+        these properties as shorthands.
+
+2016-10-29  Dave Hyatt  &lt;hyatt@apple.com&gt;
+
</ins><span class="cx">         [CSS Parser] Support -webkit-background-composite
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=164179
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSPropertyNamesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (208106 => 208107)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSPropertyNames.in        2016-10-29 16:32:53 UTC (rev 208106)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in        2016-10-29 17:46:54 UTC (rev 208107)
</span><span class="lines">@@ -580,9 +580,9 @@
</span><span class="cx"> -webkit-perspective = perspective
</span><span class="cx"> perspective-origin [Longhands=perspective-origin-x|perspective-origin-y]
</span><span class="cx"> -webkit-perspective-origin = perspective-origin
</span><del>-perspective-origin-x [Converter=Length]
</del><ins>+perspective-origin-x [Converter=PositionComponentX]
</ins><span class="cx"> -webkit-perspective-origin-x = perspective-origin-x
</span><del>-perspective-origin-y [Converter=Length]
</del><ins>+perspective-origin-y [Converter=PositionComponentY]
</ins><span class="cx"> -webkit-perspective-origin-y = perspective-origin-y
</span><span class="cx"> -webkit-print-color-adjust [Inherited]
</span><span class="cx"> -webkit-rtl-ordering [Inherited, Setter=setRTLOrdering, Initial=initialRTLOrdering]
</span><span class="lines">@@ -628,9 +628,9 @@
</span><span class="cx"> -webkit-transform = transform
</span><span class="cx"> transform-origin [Longhands=transform-origin-x|transform-origin-y|transform-origin-z]
</span><span class="cx"> -webkit-transform-origin = transform-origin
</span><del>-transform-origin-x [Converter=Length]
</del><ins>+transform-origin-x [Converter=PositionComponentX]
</ins><span class="cx"> -webkit-transform-origin-x = transform-origin-x
</span><del>-transform-origin-y [Converter=Length]
</del><ins>+transform-origin-y [Converter=PositionComponentY]
</ins><span class="cx"> -webkit-transform-origin-y = transform-origin-y
</span><span class="cx"> transform-origin-z [Converter=ComputedLength&lt;float&gt;]
</span><span class="cx"> -webkit-transform-origin-z = transform-origin-z
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleBuilderConverterh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleBuilderConverter.h (208106 => 208107)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleBuilderConverter.h        2016-10-29 16:32:53 UTC (rev 208106)
+++ trunk/Source/WebCore/css/StyleBuilderConverter.h        2016-10-29 17:46:54 UTC (rev 208107)
</span><span class="lines">@@ -147,6 +147,9 @@
</span><span class="cx">     
</span><span class="cx">     static HangingPunctuation convertHangingPunctuation(StyleResolver&amp;, const CSSValue&amp;);
</span><span class="cx"> 
</span><ins>+    static Length convertPositionComponentX(StyleResolver&amp;, const CSSValue&amp;);
+    static Length convertPositionComponentY(StyleResolver&amp;, const CSSValue&amp;);
+    
</ins><span class="cx"> private:
</span><span class="cx">     friend class StyleBuilderCustom;
</span><span class="cx"> 
</span><span class="lines">@@ -323,6 +326,16 @@
</span><span class="cx">     return Length(CalculationValue::create(WTFMove(op), ValueRangeAll));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline Length StyleBuilderConverter::convertPositionComponentX(StyleResolver&amp; styleResolver, const CSSValue&amp; value)
+{
+    return convertPositionComponent&lt;CSSValueLeft, CSSValueRight&gt;(styleResolver, downcast&lt;CSSPrimitiveValue&gt;(value));
+}
+
+inline Length StyleBuilderConverter::convertPositionComponentY(StyleResolver&amp; styleResolver, const CSSValue&amp; value)
+{
+    return convertPositionComponent&lt;CSSValueTop, CSSValueBottom&gt;(styleResolver, downcast&lt;CSSPrimitiveValue&gt;(value));
+}
+
</ins><span class="cx"> template &lt;CSSValueID cssValueFor0, CSSValueID cssValueFor100&gt;
</span><span class="cx"> inline Length StyleBuilderConverter::convertPositionComponent(StyleResolver&amp; styleResolver, const CSSPrimitiveValue&amp; value)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSPropertyParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (208106 => 208107)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp        2016-10-29 16:32:53 UTC (rev 208106)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp        2016-10-29 17:46:54 UTC (rev 208107)
</span><span class="lines">@@ -358,23 +358,35 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static RefPtr&lt;CSSValueList&gt; consumeTransformOrigin(CSSParserTokenRange&amp; range, CSSParserMode cssParserMode, UnitlessQuirk unitless)
</del><ins>+bool CSSPropertyParser::consumeTransformOrigin(bool important)
</ins><span class="cx"> {
</span><span class="cx">     RefPtr&lt;CSSPrimitiveValue&gt; resultX;
</span><span class="cx">     RefPtr&lt;CSSPrimitiveValue&gt; resultY;
</span><del>-    if (consumeOneOrTwoValuedPosition(range, cssParserMode, unitless, resultX, resultY)) {
-        RefPtr&lt;CSSValueList&gt; list = CSSValueList::createSpaceSeparated();
-        list-&gt;append(resultX.releaseNonNull());
-        list-&gt;append(resultY.releaseNonNull());
-        RefPtr&lt;CSSPrimitiveValue&gt; resultZ = consumeLength(range, cssParserMode, ValueRangeAll);
</del><ins>+    if (consumeOneOrTwoValuedPosition(m_range, m_context.mode, UnitlessQuirk::Forbid, resultX, resultY)) {
+        RefPtr&lt;CSSPrimitiveValue&gt; resultZ = consumeLength(m_range, m_context.mode, ValueRangeAll);
</ins><span class="cx">         if (!resultZ)
</span><del>-            resultZ = CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitTypes::CSS_PX);
-        list-&gt;append(resultZ.releaseNonNull());
-        return list;
</del><ins>+            resultZ = CSSValuePool::singleton().createValue(0, CSSPrimitiveValue::UnitTypes::CSS_PX);
+        addProperty(CSSPropertyTransformOriginX, CSSPropertyTransformOrigin, resultX.releaseNonNull(), important);
+        addProperty(CSSPropertyTransformOriginY, CSSPropertyTransformOrigin, resultY.releaseNonNull(), important);
+        addProperty(CSSPropertyTransformOriginZ, CSSPropertyTransformOrigin, resultZ.releaseNonNull(), important);
+        
+        return true;
</ins><span class="cx">     }
</span><del>-    return nullptr;
</del><ins>+    return false;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool CSSPropertyParser::consumePerspectiveOrigin(bool important)
+{
+    RefPtr&lt;CSSPrimitiveValue&gt; resultX;
+    RefPtr&lt;CSSPrimitiveValue&gt; resultY;
+    if (consumePosition(m_range, m_context.mode, UnitlessQuirk::Forbid, resultX, resultY)) {
+        addProperty(CSSPropertyPerspectiveOriginX, CSSPropertyPerspectiveOrigin, resultX.releaseNonNull(), important);
+        addProperty(CSSPropertyPerspectiveOriginY, CSSPropertyPerspectiveOrigin, resultY.releaseNonNull(), important);
+        return true;
+    }
+    return false;
+}
+
</ins><span class="cx"> // Methods for consuming non-shorthand properties starts here.
</span><span class="cx"> static RefPtr&lt;CSSValue&gt; consumeWillChange(CSSParserTokenRange&amp; range)
</span><span class="cx"> {
</span><span class="lines">@@ -3312,7 +3324,6 @@
</span><span class="cx">         return consumeTouchAction(m_range);
</span><span class="cx"> #endif
</span><span class="cx">     case CSSPropertyObjectPosition:
</span><del>-    case CSSPropertyPerspectiveOrigin:
</del><span class="cx">         return consumePosition(m_range, m_context.mode, UnitlessQuirk::Forbid);
</span><span class="cx">     case CSSPropertyWebkitLineClamp:
</span><span class="cx">         return consumeLineClamp(m_range);
</span><span class="lines">@@ -3475,8 +3486,6 @@
</span><span class="cx">         return consumeRxOrRy(m_range);
</span><span class="cx">     case CSSPropertyCursor:
</span><span class="cx">         return consumeCursor(m_range, m_context, inQuirksMode());
</span><del>-    case CSSPropertyTransformOrigin:
-        return consumeTransformOrigin(m_range, m_context.mode, UnitlessQuirk::Forbid);
</del><span class="cx">     case CSSPropertyContent:
</span><span class="cx">         return consumeContent(m_range, m_context);
</span><span class="cx">     case CSSPropertyListStyleImage:
</span><span class="lines">@@ -4814,6 +4823,10 @@
</span><span class="cx">         return consumeBackgroundShorthand(backgroundShorthand(), important);
</span><span class="cx">     case CSSPropertyWebkitMask:
</span><span class="cx">         return consumeBackgroundShorthand(webkitMaskShorthand(), important);
</span><ins>+    case CSSPropertyTransformOrigin:
+        return consumeTransformOrigin(important);
+    case CSSPropertyPerspectiveOrigin:
+        return consumePerspectiveOrigin(important);
</ins><span class="cx">     case CSSPropertyGridGap: {
</span><span class="cx">         RefPtr&lt;CSSValue&gt; rowGap = consumeLength(m_range, m_context.mode, ValueRangeNonNegative);
</span><span class="cx">         RefPtr&lt;CSSValue&gt; columnGap = consumeLength(m_range, m_context.mode, ValueRangeNonNegative);
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSPropertyParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.h (208106 => 208107)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSPropertyParser.h        2016-10-29 16:32:53 UTC (rev 208106)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.h        2016-10-29 17:46:54 UTC (rev 208107)
</span><span class="lines">@@ -94,6 +94,9 @@
</span><span class="cx"> 
</span><span class="cx">     bool consumeLegacyBreakProperty(CSSPropertyID, bool important);
</span><span class="cx"> 
</span><ins>+    bool consumeTransformOrigin(bool important);
+    bool consumePerspectiveOrigin(bool important);
+
</ins><span class="cx"> private:
</span><span class="cx">     // Inputs:
</span><span class="cx">     CSSParserTokenRange m_range;
</span></span></pre>
</div>
</div>

</body>
</html>