<!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>[178101] 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/178101">178101</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-01-07 21:36:59 -0800 (Wed, 07 Jan 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move 'font' CSS property to the new StyleBuilder
https://bugs.webkit.org/show_bug.cgi?id=140181

Reviewed by Darin Adler.

Move 'font' CSS property to the new StyleBuilder.</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>
<li><a href="#trunkSourceWebCorecssStyleResolverh">trunk/Source/WebCore/css/StyleResolver.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (178100 => 178101)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-01-08 05:33:07 UTC (rev 178100)
+++ trunk/Source/WebCore/ChangeLog        2015-01-08 05:36:59 UTC (rev 178101)
</span><span class="lines">@@ -1,5 +1,14 @@
</span><span class="cx"> 2015-01-07  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Move 'font' CSS property to the new StyleBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=140181
+
+        Reviewed by Darin Adler.
+
+        Move 'font' CSS property to the new StyleBuilder.
+
+2015-01-07  Chris Dumez  &lt;cdumez@apple.com&gt;
+
</ins><span class="cx">         Move '-webkit-dashboard-region' CSS property to the new StyleBuilder
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=140204
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSPropertyNamesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (178100 => 178101)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSPropertyNames.in        2015-01-08 05:33:07 UTC (rev 178100)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in        2015-01-08 05:36:59 UTC (rev 178101)
</span><span class="lines">@@ -95,7 +95,7 @@
</span><span class="cx"> color [Inherited, VisitedLinkColorSupport, NoDefaultColor]
</span><span class="cx"> direction [Inherited, Custom=Value]
</span><span class="cx"> display [Custom=Inherit|Value]
</span><del>-font [Inherited, LegacyStyleBuilder]
</del><ins>+font [Inherited, Custom=All]
</ins><span class="cx"> font-family [Inherited, Custom=All]
</span><span class="cx"> font-size [Inherited, Custom=All]
</span><span class="cx"> font-style [Inherited, FontProperty, TypeName=FontItalic, NameForMethods=Italic]
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleBuilderCustomh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleBuilderCustom.h (178100 => 178101)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleBuilderCustom.h        2015-01-08 05:33:07 UTC (rev 178100)
+++ trunk/Source/WebCore/css/StyleBuilderCustom.h        2015-01-08 05:36:59 UTC (rev 178101)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CSSAspectRatioValue.h&quot;
</span><span class="cx"> #include &quot;CSSCursorImageValue.h&quot;
</span><ins>+#include &quot;CSSFontValue.h&quot;
</ins><span class="cx"> #include &quot;CSSGradientValue.h&quot;
</span><span class="cx"> #include &quot;CSSShadowValue.h&quot;
</span><span class="cx"> #include &quot;Counter.h&quot;
</span><span class="lines">@@ -40,6 +41,7 @@
</span><span class="cx"> #include &quot;HTMLElement.h&quot;
</span><span class="cx"> #include &quot;LocaleToScriptMapping.h&quot;
</span><span class="cx"> #include &quot;Rect.h&quot;
</span><ins>+#include &quot;RenderTheme.h&quot;
</ins><span class="cx"> #include &quot;SVGElement.h&quot;
</span><span class="cx"> #include &quot;StyleBuilderConverter.h&quot;
</span><span class="cx"> #include &quot;StyleFontSizeFunctions.h&quot;
</span><span class="lines">@@ -68,6 +70,7 @@
</span><span class="cx">     DECLARE_PROPERTY_CUSTOM_HANDLERS(CounterIncrement);
</span><span class="cx">     DECLARE_PROPERTY_CUSTOM_HANDLERS(CounterReset);
</span><span class="cx">     DECLARE_PROPERTY_CUSTOM_HANDLERS(Cursor);
</span><ins>+    DECLARE_PROPERTY_CUSTOM_HANDLERS(Font);
</ins><span class="cx">     DECLARE_PROPERTY_CUSTOM_HANDLERS(FontFamily);
</span><span class="cx">     DECLARE_PROPERTY_CUSTOM_HANDLERS(FontSize);
</span><span class="cx">     DECLARE_PROPERTY_CUSTOM_HANDLERS(FontWeight);
</span><span class="lines">@@ -1219,6 +1222,64 @@
</span><span class="cx">         styleResolver.style()-&gt;setColumnGap(StyleBuilderConverter::convertComputedLength&lt;float&gt;(styleResolver, value));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline void StyleBuilderCustom::applyInitialFont(StyleResolver&amp; styleResolver)
+{
+    Settings* settings = styleResolver.documentSettings();
+    ASSERT(settings); // If we're doing style resolution, this document should always be in a frame and thus have settings
+    styleResolver.initializeFontStyle(settings);
+}
+
+inline void StyleBuilderCustom::applyInheritFont(StyleResolver&amp; styleResolver)
+{
+    FontDescription fontDescription = styleResolver.parentStyle()-&gt;fontDescription();
+    styleResolver.style()-&gt;setLineHeight(styleResolver.parentStyle()-&gt;specifiedLineHeight());
+    styleResolver.state().setLineHeightValue(0);
+    styleResolver.setFontDescription(fontDescription);
+}
+
+inline void StyleBuilderCustom::applyValueFont(StyleResolver&amp; styleResolver, CSSValue&amp; value)
+{
+    if (is&lt;CSSPrimitiveValue&gt;(value)) {
+        styleResolver.style()-&gt;setLineHeight(RenderStyle::initialLineHeight());
+        styleResolver.state().setLineHeightValue(0);
+
+        FontDescription fontDescription;
+        RenderTheme::defaultTheme()-&gt;systemFont(downcast&lt;CSSPrimitiveValue&gt;(value).getValueID(), fontDescription);
+
+        // Double-check and see if the theme did anything. If not, don't bother updating the font.
+        if (fontDescription.isAbsoluteSize()) {
+            // Make sure the rendering mode and printer font settings are updated.
+            Settings* settings = styleResolver.documentSettings();
+            ASSERT(settings); // If we're doing style resolution, this document should always be in a frame and thus have settings
+            fontDescription.setRenderingMode(settings-&gt;fontRenderingMode());
+            fontDescription.setUsePrinterFont(styleResolver.document().printing() || !settings-&gt;screenFontSubstitutionEnabled());
+
+            // Handle the zoom factor.
+            fontDescription.setComputedSize(Style::computedFontSizeFromSpecifiedSize(fontDescription.specifiedSize(), fontDescription.isAbsoluteSize(), styleResolver.useSVGZoomRules(), styleResolver.style(), styleResolver.document()));
+            styleResolver.setFontDescription(fontDescription);
+        }
+        return;
+    }
+    if (is&lt;CSSFontValue&gt;(value)) {
+        auto&amp; font = downcast&lt;CSSFontValue&gt;(value);
+        if (!font.style || !font.variant || !font.weight || !font.size || !font.lineHeight || !font.family)
+            return;
+        styleResolver.applyProperty(CSSPropertyFontStyle, font.style.get());
+        styleResolver.applyProperty(CSSPropertyFontVariant, font.variant.get());
+        styleResolver.applyProperty(CSSPropertyFontWeight, font.weight.get());
+        // The previous properties can dirty our font but they don't try to read the font's
+        // properties back, which is safe. However if font-size is using the 'ex' unit, it will
+        // need query the dirtied font's x-height to get the computed size. To be safe in this
+        // case, let's just update the font now.
+        styleResolver.updateFont();
+        styleResolver.applyProperty(CSSPropertyFontSize, font.size.get());
+
+        styleResolver.state().setLineHeightValue(font.lineHeight.get());
+
+        styleResolver.applyProperty(CSSPropertyFontFamily, font.family.get());
+    }
+}
+
</ins><span class="cx"> inline void StyleBuilderCustom::applyInitialContent(StyleResolver&amp; styleResolver)
</span><span class="cx"> {
</span><span class="cx">     styleResolver.style()-&gt;clearContent();
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.cpp (178100 => 178101)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.cpp        2015-01-08 05:33:07 UTC (rev 178100)
+++ trunk/Source/WebCore/css/StyleResolver.cpp        2015-01-08 05:36:59 UTC (rev 178101)
</span><span class="lines">@@ -1975,60 +1975,6 @@
</span><span class="cx">     // RenderStyle values.
</span><span class="cx">     switch (id) {
</span><span class="cx">     // Shorthand properties.
</span><del>-    case CSSPropertyFont:
-        if (isInherit) {
-            FontDescription fontDescription = state.parentStyle()-&gt;fontDescription();
-            state.style()-&gt;setLineHeight(state.parentStyle()-&gt;specifiedLineHeight());
-            state.setLineHeightValue(0);
-            setFontDescription(fontDescription);
-        } else if (isInitial) {
-            Settings* settings = documentSettings();
-            ASSERT(settings); // If we're doing style resolution, this document should always be in a frame and thus have settings
-            if (!settings)
-                return;
-            initializeFontStyle(settings);
-        } else if (primitiveValue) {
-            state.style()-&gt;setLineHeight(RenderStyle::initialLineHeight());
-            state.setLineHeightValue(0);
-
-            FontDescription fontDescription;
-            RenderTheme::defaultTheme()-&gt;systemFont(primitiveValue-&gt;getValueID(), fontDescription);
-
-            // Double-check and see if the theme did anything. If not, don't bother updating the font.
-            if (fontDescription.isAbsoluteSize()) {
-                // Make sure the rendering mode and printer font settings are updated.
-                Settings* settings = documentSettings();
-                ASSERT(settings); // If we're doing style resolution, this document should always be in a frame and thus have settings
-                if (!settings)
-                    return;
-                fontDescription.setRenderingMode(settings-&gt;fontRenderingMode());
-                fontDescription.setUsePrinterFont(document().printing() || !settings-&gt;screenFontSubstitutionEnabled());
-
-                // Handle the zoom factor.
-                fontDescription.setComputedSize(Style::computedFontSizeFromSpecifiedSize(fontDescription.specifiedSize(), fontDescription.isAbsoluteSize(), useSVGZoomRules(), state.style(), document()));
-                setFontDescription(fontDescription);
-            }
-        } else if (is&lt;CSSFontValue&gt;(*value)) {
-            CSSFontValue&amp; font = downcast&lt;CSSFontValue&gt;(*value);
-            if (!font.style || !font.variant || !font.weight
-                || !font.size || !font.lineHeight || !font.family)
-                return;
-            applyProperty(CSSPropertyFontStyle, font.style.get());
-            applyProperty(CSSPropertyFontVariant, font.variant.get());
-            applyProperty(CSSPropertyFontWeight, font.weight.get());
-            // The previous properties can dirty our font but they don't try to read the font's
-            // properties back, which is safe. However if font-size is using the 'ex' unit, it will
-            // need query the dirtied font's x-height to get the computed size. To be safe in this
-            // case, let's just update the font now.
-            updateFont();
-            applyProperty(CSSPropertyFontSize, font.size.get());
-
-            state.setLineHeightValue(font.lineHeight.get());
-
-            applyProperty(CSSPropertyFontFamily, font.family.get());
-        }
-        return;
-
</del><span class="cx">     case CSSPropertyAnimation:
</span><span class="cx">     case CSSPropertyBackground:
</span><span class="cx">     case CSSPropertyBackgroundPosition:
</span><span class="lines">@@ -2227,6 +2173,7 @@
</span><span class="cx">     case CSSPropertyDisplay:
</span><span class="cx">     case CSSPropertyEmptyCells:
</span><span class="cx">     case CSSPropertyFloat:
</span><ins>+    case CSSPropertyFont:
</ins><span class="cx">     case CSSPropertyFontSize:
</span><span class="cx">     case CSSPropertyFontStyle:
</span><span class="cx">     case CSSPropertyFontVariant:
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolverh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.h (178100 => 178101)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.h        2015-01-08 05:33:07 UTC (rev 178100)
+++ trunk/Source/WebCore/css/StyleResolver.h        2015-01-08 05:36:59 UTC (rev 178101)
</span><span class="lines">@@ -286,6 +286,8 @@
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx"> private:
</span><ins>+    friend class StyleBuilderCustom;
+
</ins><span class="cx">     // This function fixes up the default font size if it detects that the current generic font family has changed. -dwh
</span><span class="cx">     void checkForGenericFamilyChange(RenderStyle*, RenderStyle* parentStyle);
</span><span class="cx">     void checkForZoomChange(RenderStyle*, RenderStyle* parentStyle);
</span></span></pre>
</div>
</div>

</body>
</html>