<!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 <cdumez@apple.com>
+
+ 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 <gyuyoung.kim@samsung.com>
</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<float>]
</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 > 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 > 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 "CSSImageGeneratorValue.h"
</span><span class="cx"> #include "CSSImageSetValue.h"
</span><span class="cx"> #include "CSSImageValue.h"
</span><ins>+#include "CSSShadowValue.h"
</ins><span class="cx"> #include "Frame.h"
</span><span class="cx"> #include "LocaleToScriptMapping.h"
</span><span class="cx"> #include "Rect.h"
</span><span class="lines">@@ -105,6 +106,16 @@
</span><span class="cx"> static void applyValueWebkitJustifySelf(StyleResolver&, CSSValue&);
</span><span class="cx"> static void applyValueWebkitPerspective(StyleResolver&, CSSValue&);
</span><span class="cx">
</span><ins>+ static void applyInitialTextShadow(StyleResolver&);
+ static void applyInheritTextShadow(StyleResolver&);
+ static void applyValueTextShadow(StyleResolver&, CSSValue&);
+ static void applyInitialBoxShadow(StyleResolver&);
+ static void applyInheritBoxShadow(StyleResolver&);
+ static void applyValueBoxShadow(StyleResolver&, CSSValue&);
+ static void applyInitialWebkitBoxShadow(StyleResolver&);
+ static void applyInheritWebkitBoxShadow(StyleResolver&);
+ static void applyValueWebkitBoxShadow(StyleResolver&, CSSValue&);
+
</ins><span class="cx"> private:
</span><span class="cx"> static void resetEffectiveZoom(StyleResolver&);
</span><span class="cx"> static CSSToLengthConversionData csstoLengthConversionDataWithTextZoomFactor(StyleResolver&);
</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& width, Length& height);
</span><ins>+
+ template <CSSPropertyID id>
+ static void applyTextOrBoxShadowValue(StyleResolver&, CSSValue&);
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> inline void StyleBuilderCustom::applyValueWebkitMarqueeIncrement(StyleResolver& styleResolver, CSSValue& value)
</span><span class="lines">@@ -787,6 +801,86 @@
</span><span class="cx"> styleResolver.style()->setPerspective(perspectiveValue);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+template <CSSPropertyID id>
+inline void StyleBuilderCustom::applyTextOrBoxShadowValue(StyleResolver& styleResolver, CSSValue& value)
+{
+ if (is<CSSPrimitiveValue>(value)) {
+ ASSERT(downcast<CSSPrimitiveValue>(value).getValueID() == CSSValueNone);
+ if (id == CSSPropertyTextShadow)
+ styleResolver.style()->setTextShadow(nullptr);
+ else
+ styleResolver.style()->setBoxShadow(nullptr);
+ return;
+ }
+
+ bool isFirstEntry = true;
+ for (auto& item : downcast<CSSValueList>(value)) {
+ auto& shadowValue = downcast<CSSShadowValue>(item.get());
+ auto conversionData = styleResolver.state().cssToLengthConversionData();
+ int x = shadowValue.x->computeLength<int>(conversionData);
+ int y = shadowValue.y->computeLength<int>(conversionData);
+ int blur = shadowValue.blur ? shadowValue.blur->computeLength<int>(conversionData) : 0;
+ int spread = shadowValue.spread ? shadowValue.spread->computeLength<int>(conversionData) : 0;
+ ShadowStyle shadowStyle = shadowValue.style && shadowValue.style->getValueID() == CSSValueInset ? Inset : Normal;
+ Color color;
+ if (shadowValue.color)
+ color = styleResolver.colorFromPrimitiveValue(shadowValue.color.get());
+ else
+ color = styleResolver.style()->color();
+ auto shadowData = std::make_unique<ShadowData>(IntPoint(x, y), blur, spread, shadowStyle, id == CSSPropertyWebkitBoxShadow, color.isValid() ? color : Color::transparent);
+ if (id == CSSPropertyTextShadow)
+ styleResolver.style()->setTextShadow(WTF::move(shadowData), !isFirstEntry); // add to the list if this is not the first entry
+ else
+ styleResolver.style()->setBoxShadow(WTF::move(shadowData), !isFirstEntry); // add to the list if this is not the first entry
+ isFirstEntry = false;
+ }
+}
+
+inline void StyleBuilderCustom::applyInitialTextShadow(StyleResolver& styleResolver)
+{
+ styleResolver.style()->setTextShadow(nullptr);
+}
+
+inline void StyleBuilderCustom::applyInheritTextShadow(StyleResolver& styleResolver)
+{
+ styleResolver.style()->setTextShadow(styleResolver.parentStyle()->textShadow() ? std::make_unique<ShadowData>(*styleResolver.parentStyle()->textShadow()) : nullptr);
+}
+
+inline void StyleBuilderCustom::applyValueTextShadow(StyleResolver& styleResolver, CSSValue& value)
+{
+ applyTextOrBoxShadowValue<CSSPropertyTextShadow>(styleResolver, value);
+}
+
+inline void StyleBuilderCustom::applyInitialBoxShadow(StyleResolver& styleResolver)
+{
+ styleResolver.style()->setBoxShadow(nullptr);
+}
+
+inline void StyleBuilderCustom::applyInheritBoxShadow(StyleResolver& styleResolver)
+{
+ styleResolver.style()->setBoxShadow(styleResolver.parentStyle()->boxShadow() ? std::make_unique<ShadowData>(*styleResolver.parentStyle()->boxShadow()) : nullptr);
+}
+
+inline void StyleBuilderCustom::applyValueBoxShadow(StyleResolver& styleResolver, CSSValue& value)
+{
+ applyTextOrBoxShadowValue<CSSPropertyBoxShadow>(styleResolver, value);
+}
+
+inline void StyleBuilderCustom::applyInitialWebkitBoxShadow(StyleResolver& styleResolver)
+{
+ applyInitialBoxShadow(styleResolver);
+}
+
+inline void StyleBuilderCustom::applyInheritWebkitBoxShadow(StyleResolver& styleResolver)
+{
+ applyInheritBoxShadow(styleResolver);
+}
+
+inline void StyleBuilderCustom::applyValueWebkitBoxShadow(StyleResolver& styleResolver, CSSValue& value)
+{
+ applyTextOrBoxShadowValue<CSSPropertyWebkitBoxShadow>(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()->setTextShadow(state.parentStyle()->textShadow() ? std::make_unique<ShadowData>(*state.parentStyle()->textShadow()) : nullptr);
- return state.style()->setBoxShadow(state.parentStyle()->boxShadow() ? std::make_unique<ShadowData>(*state.parentStyle()->boxShadow()) : nullptr);
- }
- if (isInitial || primitiveValue) // initial | none
- return id == CSSPropertyTextShadow ? state.style()->setTextShadow(nullptr) : state.style()->setBoxShadow(nullptr);
-
- if (!is<CSSValueList>(*value))
- return;
-
- bool isFirstEntry = true;
- for (auto& currentValue : downcast<CSSValueList>(*value)) {
- if (!is<CSSShadowValue>(currentValue.get()))
- continue;
- auto& item = downcast<CSSShadowValue>(currentValue.get());
- int x = item.x->computeLength<int>(state.cssToLengthConversionData());
- int y = item.y->computeLength<int>(state.cssToLengthConversionData());
- int blur = item.blur ? item.blur->computeLength<int>(state.cssToLengthConversionData()) : 0;
- int spread = item.spread ? item.spread->computeLength<int>(state.cssToLengthConversionData()) : 0;
- ShadowStyle shadowStyle = item.style && item.style->getValueID() == CSSValueInset ? Inset : Normal;
- Color color;
- if (item.color)
- color = colorFromPrimitiveValue(item.color.get());
- else if (state.style())
- color = state.style()->color();
-
- auto shadowData = std::make_unique<ShadowData>(IntPoint(x, y), blur, spread, shadowStyle, id == CSSPropertyWebkitBoxShadow, color.isValid() ? color : Color::transparent);
- if (id == CSSPropertyTextShadow)
- state.style()->setTextShadow(WTF::move(shadowData), !isFirstEntry); // add to the list if this is not the first entry
- else
- state.style()->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>