<!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>[176621] 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/176621">176621</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2014-12-01 18:16:55 -0800 (Mon, 01 Dec 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move 'text-shadow' / 'box-shadow' / '-webkit-box-shadow' to the new StyleBuilder
https://bugs.webkit.org/show_bug.cgi?id=138938

Reviewed by Sam Weinig.

Move 'text-shadow' / 'box-shadow' / '-webkit-box-shadow' CSS properties
from StyleResolver to the new StyleBuilder by using custom code.

No new tests, no behavior change.

* css/CSSPropertyNames.in:
* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderCustom::applyTextOrBoxShadowValue):
(WebCore::StyleBuilderCustom::applyInitialTextShadow):
(WebCore::StyleBuilderCustom::applyInheritTextShadow):
(WebCore::StyleBuilderCustom::applyValueTextShadow):
(WebCore::StyleBuilderCustom::applyInitialBoxShadow):
(WebCore::StyleBuilderCustom::applyInheritBoxShadow):
(WebCore::StyleBuilderCustom::applyValueBoxShadow):
(WebCore::StyleBuilderCustom::applyInitialWebkitBoxShadow):
(WebCore::StyleBuilderCustom::applyInheritWebkitBoxShadow):
(WebCore::StyleBuilderCustom::applyValueWebkitBoxShadow):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::applyProperty):</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="#trunkSourceWebCorecssStyleBuilderCustomh">trunk/Source/WebCore/css/StyleBuilderCustom.h</a></li>
<li><a href="#trunkSourceWebCorecssStyleResolvercpp">trunk/Source/WebCore/css/StyleResolver.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (176620 => 176621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-12-02 02:02:52 UTC (rev 176620)
+++ trunk/Source/WebCore/ChangeLog        2014-12-02 02:16:55 UTC (rev 176621)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2014-12-01  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Move 'text-shadow' / 'box-shadow' / '-webkit-box-shadow' to the new StyleBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=138938
+
+        Reviewed by Sam Weinig.
+
+        Move 'text-shadow' / 'box-shadow' / '-webkit-box-shadow' CSS properties
+        from StyleResolver to the new StyleBuilder by using custom code.
+
+        No new tests, no behavior change.
+
+        * css/CSSPropertyNames.in:
+        * css/StyleBuilderCustom.h:
+        (WebCore::StyleBuilderCustom::applyTextOrBoxShadowValue):
+        (WebCore::StyleBuilderCustom::applyInitialTextShadow):
+        (WebCore::StyleBuilderCustom::applyInheritTextShadow):
+        (WebCore::StyleBuilderCustom::applyValueTextShadow):
+        (WebCore::StyleBuilderCustom::applyInitialBoxShadow):
+        (WebCore::StyleBuilderCustom::applyInheritBoxShadow):
+        (WebCore::StyleBuilderCustom::applyValueBoxShadow):
+        (WebCore::StyleBuilderCustom::applyInitialWebkitBoxShadow):
+        (WebCore::StyleBuilderCustom::applyInheritWebkitBoxShadow):
+        (WebCore::StyleBuilderCustom::applyValueWebkitBoxShadow):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::applyProperty):
+
</ins><span class="cx"> 2014-12-01  Gyuyoung Kim  &lt;gyuyoung.kim@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [EFL] Add a ENABLE_CSS_SCROLL_SNAP macro to CMake build system
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSPropertyNamesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (176620 => 176621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSPropertyNames.in        2014-12-02 02:02:52 UTC (rev 176620)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in        2014-12-02 02:16:55 UTC (rev 176621)
</span><span class="lines">@@ -151,7 +151,7 @@
</span><span class="cx"> border-top-width [Initial=initialBorderWidth, Converter=LineWidth&lt;float&gt;]
</span><span class="cx"> border-width [LegacyStyleBuilder]
</span><span class="cx"> bottom [Initial=initialOffset, Converter=LengthOrAuto]
</span><del>-box-shadow [LegacyStyleBuilder]
</del><ins>+box-shadow [Custom=All]
</ins><span class="cx"> box-sizing
</span><span class="cx"> // -webkit-box-sizing worked in Safari 4 and earlier.
</span><span class="cx"> -webkit-box-sizing = box-sizing
</span><span class="lines">@@ -242,7 +242,7 @@
</span><span class="cx"> text-overline-mode [LegacyStyleBuilder]
</span><span class="cx"> text-overline-style [LegacyStyleBuilder]
</span><span class="cx"> text-overline-width [LegacyStyleBuilder]
</span><del>-text-shadow [Inherited, LegacyStyleBuilder]
</del><ins>+text-shadow [Inherited, Custom=All]
</ins><span class="cx"> text-transform [Inherited]
</span><span class="cx"> -epub-text-transform = text-transform
</span><span class="cx"> text-underline [LegacyStyleBuilder]
</span><span class="lines">@@ -326,7 +326,7 @@
</span><span class="cx"> // -webkit-box-shadow differs from box-shadow in its treatement of blur radii &gt; 8px.
</span><span class="cx"> // Let -webkit-box-shadow blur radius be w_r and box-shadow blur radius be b_r. For
</span><span class="cx"> // w_r &gt; 8px, b_r = 8 + 4 * sqrt((w_r - 8) / 2).
</span><del>--webkit-box-shadow [LegacyStyleBuilder]
</del><ins>+-webkit-box-shadow [Custom=All]
</ins><span class="cx"> -webkit-color-correction [Inherited, TypeName=ColorSpace, NameForMethods=ColorSpace]
</span><span class="cx"> -webkit-column-axis [TypeName=ColumnAxis]
</span><span class="cx"> -webkit-column-break-after [TypeName=EPageBreak, Initial=initialPageBreak]
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleBuilderCustomh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleBuilderCustom.h (176620 => 176621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleBuilderCustom.h        2014-12-02 02:02:52 UTC (rev 176620)
+++ trunk/Source/WebCore/css/StyleBuilderCustom.h        2014-12-02 02:16:55 UTC (rev 176621)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include &quot;CSSImageGeneratorValue.h&quot;
</span><span class="cx"> #include &quot;CSSImageSetValue.h&quot;
</span><span class="cx"> #include &quot;CSSImageValue.h&quot;
</span><ins>+#include &quot;CSSShadowValue.h&quot;
</ins><span class="cx"> #include &quot;Frame.h&quot;
</span><span class="cx"> #include &quot;LocaleToScriptMapping.h&quot;
</span><span class="cx"> #include &quot;Rect.h&quot;
</span><span class="lines">@@ -105,6 +106,16 @@
</span><span class="cx">     static void applyValueWebkitJustifySelf(StyleResolver&amp;, CSSValue&amp;);
</span><span class="cx">     static void applyValueWebkitPerspective(StyleResolver&amp;, CSSValue&amp;);
</span><span class="cx"> 
</span><ins>+    static void applyInitialTextShadow(StyleResolver&amp;);
+    static void applyInheritTextShadow(StyleResolver&amp;);
+    static void applyValueTextShadow(StyleResolver&amp;, CSSValue&amp;);
+    static void applyInitialBoxShadow(StyleResolver&amp;);
+    static void applyInheritBoxShadow(StyleResolver&amp;);
+    static void applyValueBoxShadow(StyleResolver&amp;, CSSValue&amp;);
+    static void applyInitialWebkitBoxShadow(StyleResolver&amp;);
+    static void applyInheritWebkitBoxShadow(StyleResolver&amp;);
+    static void applyValueWebkitBoxShadow(StyleResolver&amp;, CSSValue&amp;);
+
</ins><span class="cx"> private:
</span><span class="cx">     static void resetEffectiveZoom(StyleResolver&amp;);
</span><span class="cx">     static CSSToLengthConversionData csstoLengthConversionDataWithTextZoomFactor(StyleResolver&amp;);
</span><span class="lines">@@ -113,6 +124,9 @@
</span><span class="cx">     static Length mmLength(double mm);
</span><span class="cx">     static Length inchLength(double inch);
</span><span class="cx">     static bool getPageSizeFromName(CSSPrimitiveValue* pageSizeName, CSSPrimitiveValue* pageOrientation, Length&amp; width, Length&amp; height);
</span><ins>+
+    template &lt;CSSPropertyID id&gt;
+    static void applyTextOrBoxShadowValue(StyleResolver&amp;, CSSValue&amp;);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> inline void StyleBuilderCustom::applyValueWebkitMarqueeIncrement(StyleResolver&amp; styleResolver, CSSValue&amp; value)
</span><span class="lines">@@ -787,6 +801,86 @@
</span><span class="cx">         styleResolver.style()-&gt;setPerspective(perspectiveValue);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+template &lt;CSSPropertyID id&gt;
+inline void StyleBuilderCustom::applyTextOrBoxShadowValue(StyleResolver&amp; styleResolver, CSSValue&amp; value)
+{
+    if (is&lt;CSSPrimitiveValue&gt;(value)) {
+        ASSERT(downcast&lt;CSSPrimitiveValue&gt;(value).getValueID() == CSSValueNone);
+        if (id == CSSPropertyTextShadow)
+            styleResolver.style()-&gt;setTextShadow(nullptr);
+        else
+            styleResolver.style()-&gt;setBoxShadow(nullptr);
+        return;
+    }
+
+    bool isFirstEntry = true;
+    for (auto&amp; item : downcast&lt;CSSValueList&gt;(value)) {
+        auto&amp; shadowValue = downcast&lt;CSSShadowValue&gt;(item.get());
+        auto conversionData = styleResolver.state().cssToLengthConversionData();
+        int x = shadowValue.x-&gt;computeLength&lt;int&gt;(conversionData);
+        int y = shadowValue.y-&gt;computeLength&lt;int&gt;(conversionData);
+        int blur = shadowValue.blur ? shadowValue.blur-&gt;computeLength&lt;int&gt;(conversionData) : 0;
+        int spread = shadowValue.spread ? shadowValue.spread-&gt;computeLength&lt;int&gt;(conversionData) : 0;
+        ShadowStyle shadowStyle = shadowValue.style &amp;&amp; shadowValue.style-&gt;getValueID() == CSSValueInset ? Inset : Normal;
+        Color color;
+        if (shadowValue.color)
+            color = styleResolver.colorFromPrimitiveValue(shadowValue.color.get());
+        else
+            color = styleResolver.style()-&gt;color();
+        auto shadowData = std::make_unique&lt;ShadowData&gt;(IntPoint(x, y), blur, spread, shadowStyle, id == CSSPropertyWebkitBoxShadow, color.isValid() ? color : Color::transparent);
+        if (id == CSSPropertyTextShadow)
+            styleResolver.style()-&gt;setTextShadow(WTF::move(shadowData), !isFirstEntry); // add to the list if this is not the first entry
+        else
+            styleResolver.style()-&gt;setBoxShadow(WTF::move(shadowData), !isFirstEntry); // add to the list if this is not the first entry
+        isFirstEntry = false;
+    }
+}
+
+inline void StyleBuilderCustom::applyInitialTextShadow(StyleResolver&amp; styleResolver)
+{
+    styleResolver.style()-&gt;setTextShadow(nullptr);
+}
+
+inline void StyleBuilderCustom::applyInheritTextShadow(StyleResolver&amp; styleResolver)
+{
+    styleResolver.style()-&gt;setTextShadow(styleResolver.parentStyle()-&gt;textShadow() ? std::make_unique&lt;ShadowData&gt;(*styleResolver.parentStyle()-&gt;textShadow()) : nullptr);
+}
+
+inline void StyleBuilderCustom::applyValueTextShadow(StyleResolver&amp; styleResolver, CSSValue&amp; value)
+{
+    applyTextOrBoxShadowValue&lt;CSSPropertyTextShadow&gt;(styleResolver, value);
+}
+
+inline void StyleBuilderCustom::applyInitialBoxShadow(StyleResolver&amp; styleResolver)
+{
+    styleResolver.style()-&gt;setBoxShadow(nullptr);
+}
+
+inline void StyleBuilderCustom::applyInheritBoxShadow(StyleResolver&amp; styleResolver)
+{
+    styleResolver.style()-&gt;setBoxShadow(styleResolver.parentStyle()-&gt;boxShadow() ? std::make_unique&lt;ShadowData&gt;(*styleResolver.parentStyle()-&gt;boxShadow()) : nullptr);
+}
+
+inline void StyleBuilderCustom::applyValueBoxShadow(StyleResolver&amp; styleResolver, CSSValue&amp; value)
+{
+    applyTextOrBoxShadowValue&lt;CSSPropertyBoxShadow&gt;(styleResolver, value);
+}
+
+inline void StyleBuilderCustom::applyInitialWebkitBoxShadow(StyleResolver&amp; styleResolver)
+{
+    applyInitialBoxShadow(styleResolver);
+}
+
+inline void StyleBuilderCustom::applyInheritWebkitBoxShadow(StyleResolver&amp; styleResolver)
+{
+    applyInheritBoxShadow(styleResolver);
+}
+
+inline void StyleBuilderCustom::applyValueWebkitBoxShadow(StyleResolver&amp; styleResolver, CSSValue&amp; value)
+{
+    applyTextOrBoxShadowValue&lt;CSSPropertyWebkitBoxShadow&gt;(styleResolver, value);
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // StyleBuilderCustom_h
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.cpp (176620 => 176621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.cpp        2014-12-02 02:02:52 UTC (rev 176620)
+++ trunk/Source/WebCore/css/StyleResolver.cpp        2014-12-02 02:16:55 UTC (rev 176621)
</span><span class="lines">@@ -2371,46 +2371,6 @@
</span><span class="cx">         break;
</span><span class="cx"> 
</span><span class="cx">     // CSS3 Properties
</span><del>-    case CSSPropertyTextShadow:
-    case CSSPropertyBoxShadow:
-    case CSSPropertyWebkitBoxShadow: {
-        if (isInherit) {
-            if (id == CSSPropertyTextShadow)
-                return state.style()-&gt;setTextShadow(state.parentStyle()-&gt;textShadow() ? std::make_unique&lt;ShadowData&gt;(*state.parentStyle()-&gt;textShadow()) : nullptr);
-            return state.style()-&gt;setBoxShadow(state.parentStyle()-&gt;boxShadow() ? std::make_unique&lt;ShadowData&gt;(*state.parentStyle()-&gt;boxShadow()) : nullptr);
-        }
-        if (isInitial || primitiveValue) // initial | none
-            return id == CSSPropertyTextShadow ? state.style()-&gt;setTextShadow(nullptr) : state.style()-&gt;setBoxShadow(nullptr);
-
-        if (!is&lt;CSSValueList&gt;(*value))
-            return;
-
-        bool isFirstEntry = true;
-        for (auto&amp; currentValue : downcast&lt;CSSValueList&gt;(*value)) {
-            if (!is&lt;CSSShadowValue&gt;(currentValue.get()))
-                continue;
-            auto&amp; item = downcast&lt;CSSShadowValue&gt;(currentValue.get());
-            int x = item.x-&gt;computeLength&lt;int&gt;(state.cssToLengthConversionData());
-            int y = item.y-&gt;computeLength&lt;int&gt;(state.cssToLengthConversionData());
-            int blur = item.blur ? item.blur-&gt;computeLength&lt;int&gt;(state.cssToLengthConversionData()) : 0;
-            int spread = item.spread ? item.spread-&gt;computeLength&lt;int&gt;(state.cssToLengthConversionData()) : 0;
-            ShadowStyle shadowStyle = item.style &amp;&amp; item.style-&gt;getValueID() == CSSValueInset ? Inset : Normal;
-            Color color;
-            if (item.color)
-                color = colorFromPrimitiveValue(item.color.get());
-            else if (state.style())
-                color = state.style()-&gt;color();
-
-            auto shadowData = std::make_unique&lt;ShadowData&gt;(IntPoint(x, y), blur, spread, shadowStyle, id == CSSPropertyWebkitBoxShadow, color.isValid() ? color : Color::transparent);
-            if (id == CSSPropertyTextShadow)
-                state.style()-&gt;setTextShadow(WTF::move(shadowData), !isFirstEntry); // add to the list if this is not the first entry
-            else
-                state.style()-&gt;setBoxShadow(WTF::move(shadowData), !isFirstEntry); // add to the list if this is not the first entry
-
-            isFirstEntry = false;
-        }
-        return;
-    }
</del><span class="cx">     case CSSPropertySrc: // Only used in @font-face rules.
</span><span class="cx">         return;
</span><span class="cx">     case CSSPropertyUnicodeRange: // Only used in @font-face rules.
</span><span class="lines">@@ -2829,6 +2789,7 @@
</span><span class="cx">     case CSSPropertyBorderTopStyle:
</span><span class="cx">     case CSSPropertyBorderTopWidth:
</span><span class="cx">     case CSSPropertyBottom:
</span><ins>+    case CSSPropertyBoxShadow:
</ins><span class="cx">     case CSSPropertyBoxSizing:
</span><span class="cx">     case CSSPropertyCaptionSide:
</span><span class="cx">     case CSSPropertyClear:
</span><span class="lines">@@ -2898,6 +2859,7 @@
</span><span class="cx">     case CSSPropertyTextIndent:
</span><span class="cx">     case CSSPropertyTextOverflow:
</span><span class="cx">     case CSSPropertyTextRendering:
</span><ins>+    case CSSPropertyTextShadow:
</ins><span class="cx">     case CSSPropertyTextTransform:
</span><span class="cx">     case CSSPropertyTop:
</span><span class="cx">     case CSSPropertyUnicodeBidi:
</span><span class="lines">@@ -2933,6 +2895,7 @@
</span><span class="cx">     case CSSPropertyWebkitBoxOrdinalGroup:
</span><span class="cx">     case CSSPropertyWebkitBoxOrient:
</span><span class="cx">     case CSSPropertyWebkitBoxPack:
</span><ins>+    case CSSPropertyWebkitBoxShadow:
</ins><span class="cx">     case CSSPropertyWebkitBoxReflect:
</span><span class="cx">     case CSSPropertyWebkitColorCorrection:
</span><span class="cx">     case CSSPropertyWebkitColumnAxis:
</span></span></pre>
</div>
</div>

</body>
</html>