<!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>[177866] 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/177866">177866</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-01-02 11:53:38 -0800 (Fri, 02 Jan 2015)</dd>
</dl>

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

Reviewed by Darin Adler.

Move 'font-size' CSS property to the new StyleBuilder by using custom
code.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSComputedStyleDeclarationcpp">trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSPropertyNamesin">trunk/Source/WebCore/css/CSSPropertyNames.in</a></li>
<li><a href="#trunkSourceWebCorecssDeprecatedStyleBuildercpp">trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp</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="#trunkSourceWebCoreplatformgraphicsFontDescriptionh">trunk/Source/WebCore/platform/graphics/FontDescription.h</a></li>
<li><a href="#trunkSourceWebCorestyleStyleResolveForDocumentcpp">trunk/Source/WebCore/style/StyleResolveForDocument.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (177865 => 177866)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-01-02 18:32:38 UTC (rev 177865)
+++ trunk/Source/WebCore/ChangeLog        2015-01-02 19:53:38 UTC (rev 177866)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2015-01-02  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Move 'font-size' CSS property to the new StyleBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=140010
+
+        Reviewed by Darin Adler.
+
+        Move 'font-size' CSS property to the new StyleBuilder by using custom
+        code.
+
</ins><span class="cx"> 2015-01-02  Darin Adler  &lt;darin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Pass Document instead of ScriptExecutionContext to non-worker constructors
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSComputedStyleDeclarationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (177865 => 177866)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp        2015-01-02 18:32:38 UTC (rev 177865)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp        2015-01-02 19:53:38 UTC (rev 177866)
</span><span class="lines">@@ -1282,13 +1282,6 @@
</span><span class="cx">     ec = NO_MODIFICATION_ALLOWED_ERR;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static CSSValueID cssIdentifierForFontSizeKeyword(int keywordSize)
-{
-    ASSERT_ARG(keywordSize, keywordSize);
-    ASSERT_ARG(keywordSize, keywordSize &lt;= 8);
-    return static_cast&lt;CSSValueID&gt;(CSSValueXxSmall + keywordSize - 1);
-}
-
</del><span class="cx"> PassRefPtr&lt;CSSPrimitiveValue&gt; ComputedStyleExtractor::getFontSizeCSSValuePreferringKeyword() const
</span><span class="cx"> {
</span><span class="cx">     if (!m_node)
</span><span class="lines">@@ -1300,8 +1293,8 @@
</span><span class="cx">     if (!style)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    if (int keywordSize = style-&gt;fontDescription().keywordSize())
-        return cssValuePool().createIdentifierValue(cssIdentifierForFontSizeKeyword(keywordSize));
</del><ins>+    if (CSSValueID sizeIdentifier = style-&gt;fontDescription().keywordSizeAsIdentifier())
+        return cssValuePool().createIdentifierValue(sizeIdentifier);
</ins><span class="cx"> 
</span><span class="cx">     return zoomAdjustedPixelValue(style-&gt;fontDescription().computedPixelSize(), style.get());
</span><span class="cx"> }
</span><span class="lines">@@ -3241,12 +3234,12 @@
</span><span class="cx"> {
</span><span class="cx">     if (propertyID == CSSPropertyFontSize &amp;&amp; is&lt;CSSPrimitiveValue&gt;(*value) &amp;&amp; m_node) {
</span><span class="cx">         m_node-&gt;document().updateLayoutIgnorePendingStylesheets();
</span><del>-        RenderStyle* style = m_node-&gt;computedStyle(m_pseudoElementSpecifier);
-        if (style &amp;&amp; style-&gt;fontDescription().keywordSize()) {
-            CSSValueID sizeValue = cssIdentifierForFontSizeKeyword(style-&gt;fontDescription().keywordSize());
-            const CSSPrimitiveValue&amp; primitiveValue = downcast&lt;CSSPrimitiveValue&gt;(*value);
-            if (primitiveValue.isValueID() &amp;&amp; primitiveValue.getValueID() == sizeValue)
-                return true;
</del><ins>+        if (RenderStyle* style = m_node-&gt;computedStyle(m_pseudoElementSpecifier)) {
+            if (CSSValueID sizeIdentifier = style-&gt;fontDescription().keywordSizeAsIdentifier()) {
+                auto&amp; primitiveValue = downcast&lt;CSSPrimitiveValue&gt;(*value);
+                if (primitiveValue.isValueID() &amp;&amp; primitiveValue.getValueID() == sizeIdentifier)
+                    return true;
+            }
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     RefPtr&lt;CSSValue&gt; computedValue = propertyValue(propertyID);
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSPropertyNamesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (177865 => 177866)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSPropertyNames.in        2015-01-02 18:32:38 UTC (rev 177865)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in        2015-01-02 19:53:38 UTC (rev 177866)
</span><span class="lines">@@ -89,7 +89,7 @@
</span><span class="cx"> display [Custom=Inherit|Value]
</span><span class="cx"> font [Inherited, LegacyStyleBuilder]
</span><span class="cx"> font-family [Inherited, Custom=All]
</span><del>-font-size [Inherited, LegacyStyleBuilder]
</del><ins>+font-size [Inherited, Custom=All]
</ins><span class="cx"> font-style [Inherited, FontProperty, TypeName=FontItalic, NameForMethods=Italic]
</span><span class="cx"> font-variant [Inherited, FontProperty, TypeName=FontSmallCaps, NameForMethods=SmallCaps]
</span><span class="cx"> font-weight [Inherited, Custom=All]
</span></span></pre></div>
<a id="trunkSourceWebCorecssDeprecatedStyleBuildercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (177865 => 177866)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp        2015-01-02 18:32:38 UTC (rev 177865)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp        2015-01-02 19:53:38 UTC (rev 177866)
</span><span class="lines">@@ -34,13 +34,10 @@
</span><span class="cx"> #include &quot;CSSValueList.h&quot;
</span><span class="cx"> #include &quot;HTMLElement.h&quot;
</span><span class="cx"> #include &quot;RenderStyle.h&quot;
</span><del>-#include &quot;StyleFontSizeFunctions.h&quot;
</del><span class="cx"> #include &quot;StyleResolver.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-using namespace HTMLNames;
-
</del><span class="cx"> template &lt;typename T&gt;
</span><span class="cx"> struct FillLayerAccessorTypes {
</span><span class="cx">     typedef T Setter;
</span><span class="lines">@@ -141,148 +138,6 @@
</span><span class="cx">     static PropertyHandler createHandler() { return PropertyHandler(&amp;applyInheritValue, &amp;applyInitialValue, &amp;applyValue); }
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-class ApplyPropertyFontSize {
-private:
-    // When the CSS keyword &quot;larger&quot; is used, this function will attempt to match within the keyword
-    // table, and failing that, will simply multiply by 1.2.
-    static float largerFontSize(float size)
-    {
-        // FIXME: Figure out where we fall in the size ranges (xx-small to xxx-large) and scale up to
-        // the next size level.
-        return size * 1.2f;
-    }
-
-    // Like the previous function, but for the keyword &quot;smaller&quot;.
-    static float smallerFontSize(float size)
-    {
-        // FIXME: Figure out where we fall in the size ranges (xx-small to xxx-large) and scale down to
-        // the next size level.
-        return size / 1.2f;
-    }
-public:
-    static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        float size = styleResolver-&gt;parentStyle()-&gt;fontDescription().specifiedSize();
-
-        if (size &lt; 0)
-            return;
-
-        FontDescription fontDescription = styleResolver-&gt;style()-&gt;fontDescription();
-        fontDescription.setKeywordSize(styleResolver-&gt;parentStyle()-&gt;fontDescription().keywordSize());
-        styleResolver-&gt;setFontSize(fontDescription, size);
-        styleResolver-&gt;setFontDescription(fontDescription);
-        return;
-    }
-
-    static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        FontDescription fontDescription = styleResolver-&gt;style()-&gt;fontDescription();
-        float size = Style::fontSizeForKeyword(CSSValueMedium, fontDescription.useFixedDefaultSize(), styleResolver-&gt;document());
-
-        if (size &lt; 0)
-            return;
-
-        fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1);
-        styleResolver-&gt;setFontSize(fontDescription, size);
-        styleResolver-&gt;setFontDescription(fontDescription);
-        return;
-    }
-
-    static float determineRubyTextSizeMultiplier(StyleResolver* styleResolver)
-    {
-        if (styleResolver-&gt;style()-&gt;rubyPosition() != RubyPositionInterCharacter)
-            return 0.5f;
-        
-        Element* element = styleResolver-&gt;state().element();
-        if (element == nullptr)
-            return 0.25f;
-        
-        // FIXME: This hack is to ensure tone marks are the same size as
-        // the bopomofo. This code will go away if we make a special renderer
-        // for the tone marks eventually.
-        for (const Element* currElement = element-&gt;parentElement(); currElement; currElement = currElement-&gt;parentElement()) {
-            if (currElement-&gt;hasTagName(rtTag))
-                return 1.0f;
-        }
-        return 0.25f;
-    }
-    
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (!is&lt;CSSPrimitiveValue&gt;(*value))
-            return;
-
-        CSSPrimitiveValue&amp; primitiveValue = downcast&lt;CSSPrimitiveValue&gt;(*value);
-
-        FontDescription fontDescription = styleResolver-&gt;style()-&gt;fontDescription();
-        fontDescription.setKeywordSize(0);
-        float parentSize = 0;
-        bool parentIsAbsoluteSize = false;
-        float size = 0;
-
-        if (styleResolver-&gt;parentStyle()) {
-            parentSize = styleResolver-&gt;parentStyle()-&gt;fontDescription().specifiedSize();
-            parentIsAbsoluteSize = styleResolver-&gt;parentStyle()-&gt;fontDescription().isAbsoluteSize();
-        }
-
-        if (CSSValueID ident = primitiveValue.getValueID()) {
-            // Keywords are being used.
-            switch (ident) {
-            case CSSValueXxSmall:
-            case CSSValueXSmall:
-            case CSSValueSmall:
-            case CSSValueMedium:
-            case CSSValueLarge:
-            case CSSValueXLarge:
-            case CSSValueXxLarge:
-            case CSSValueWebkitXxxLarge:
-                size = Style::fontSizeForKeyword(ident, fontDescription.useFixedDefaultSize(), styleResolver-&gt;document());
-                fontDescription.setKeywordSize(ident - CSSValueXxSmall + 1);
-                break;
-            case CSSValueLarger:
-                size = largerFontSize(parentSize);
-                break;
-            case CSSValueSmaller:
-                size = smallerFontSize(parentSize);
-                break;
-            case CSSValueWebkitRubyText: {
-                float rubyTextSizeMultiplier = determineRubyTextSizeMultiplier(styleResolver);
-                size = rubyTextSizeMultiplier * parentSize;
-                break;
-            } default:
-                return;
-            }
-
-            fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize &amp;&amp; (ident == CSSValueLarger || ident == CSSValueSmaller || ident == CSSValueWebkitRubyText));
-        } else {
-            fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize || !(primitiveValue.isPercentage() || primitiveValue.isFontRelativeLength()));
-            if (primitiveValue.isLength()) {
-                size = primitiveValue.computeLength&lt;float&gt;(CSSToLengthConversionData(styleResolver-&gt;parentStyle(), styleResolver-&gt;rootElementStyle(), styleResolver-&gt;document().renderView(), 1.0f, true));
-                styleResolver-&gt;state().setFontSizeHasViewportUnits(primitiveValue.isViewportPercentageLength());
-            } else if (primitiveValue.isPercentage())
-                size = (primitiveValue.getFloatValue() * parentSize) / 100.0f;
-            else if (primitiveValue.isCalculatedPercentageWithLength()) {
-                Ref&lt;CalculationValue&gt; calculationValue { primitiveValue.cssCalcValue()-&gt;createCalculationValue(styleResolver-&gt;state().cssToLengthConversionData().copyWithAdjustedZoom(1.0f)) };
-                size = calculationValue-&gt;evaluate(parentSize);
-            } else
-                return;
-        }
-
-        if (size &lt; 0)
-            return;
-
-        // Overly large font sizes will cause crashes on some platforms (such as Windows).
-        // Cap font size here to make sure that doesn't happen.
-        size = std::min(maximumAllowedFontSize, size);
-
-        styleResolver-&gt;setFontSize(fontDescription, size);
-        styleResolver-&gt;setFontDescription(fontDescription);
-        return;
-    }
-
-    static PropertyHandler createHandler() { return PropertyHandler(&amp;applyInheritValue, &amp;applyInitialValue, &amp;applyValue); }
-};
-
</del><span class="cx"> const DeprecatedStyleBuilder&amp; DeprecatedStyleBuilder::sharedStyleBuilder()
</span><span class="cx"> {
</span><span class="cx">     static NeverDestroyed&lt;DeprecatedStyleBuilder&gt; styleBuilderInstance;
</span><span class="lines">@@ -305,8 +160,6 @@
</span><span class="cx">     setPropertyHandler(CSSPropertyBackgroundRepeatX, ApplyPropertyFillLayer&lt;EFillRepeat, CSSPropertyBackgroundRepeatX, BackgroundFillLayer, &amp;RenderStyle::accessBackgroundLayers, &amp;RenderStyle::backgroundLayers, &amp;FillLayer::isRepeatXSet, &amp;FillLayer::repeatX, &amp;FillLayer::setRepeatX, &amp;FillLayer::clearRepeatX, &amp;FillLayer::initialFillRepeatX, &amp;CSSToStyleMap::mapFillRepeatX&gt;::createHandler());
</span><span class="cx">     setPropertyHandler(CSSPropertyBackgroundRepeatY, ApplyPropertyFillLayer&lt;EFillRepeat, CSSPropertyBackgroundRepeatY, BackgroundFillLayer, &amp;RenderStyle::accessBackgroundLayers, &amp;RenderStyle::backgroundLayers, &amp;FillLayer::isRepeatYSet, &amp;FillLayer::repeatY, &amp;FillLayer::setRepeatY, &amp;FillLayer::clearRepeatY, &amp;FillLayer::initialFillRepeatY, &amp;CSSToStyleMap::mapFillRepeatY&gt;::createHandler());
</span><span class="cx">     setPropertyHandler(CSSPropertyBackgroundSize, ApplyPropertyFillLayer&lt;FillSize, CSSPropertyBackgroundSize, BackgroundFillLayer, &amp;RenderStyle::accessBackgroundLayers, &amp;RenderStyle::backgroundLayers, &amp;FillLayer::isSizeSet, &amp;FillLayer::size, &amp;FillLayer::setSize, &amp;FillLayer::clearSize, &amp;FillLayer::initialFillSize, &amp;CSSToStyleMap::mapFillSize&gt;::createHandler());
</span><del>-    setPropertyHandler(CSSPropertyFontSize, ApplyPropertyFontSize::createHandler());
-
</del><span class="cx">     setPropertyHandler(CSSPropertyWebkitBackgroundClip, CSSPropertyBackgroundClip);
</span><span class="cx">     setPropertyHandler(CSSPropertyWebkitBackgroundComposite, ApplyPropertyFillLayer&lt;CompositeOperator, CSSPropertyWebkitBackgroundComposite, BackgroundFillLayer, &amp;RenderStyle::accessBackgroundLayers, &amp;RenderStyle::backgroundLayers, &amp;FillLayer::isCompositeSet, &amp;FillLayer::composite, &amp;FillLayer::setComposite, &amp;FillLayer::clearComposite, &amp;FillLayer::initialFillComposite, &amp;CSSToStyleMap::mapFillComposite&gt;::createHandler());
</span><span class="cx">     setPropertyHandler(CSSPropertyWebkitBackgroundOrigin, CSSPropertyBackgroundOrigin);
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleBuilderCustomh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleBuilderCustom.h (177865 => 177866)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleBuilderCustom.h        2015-01-02 18:32:38 UTC (rev 177865)
+++ trunk/Source/WebCore/css/StyleBuilderCustom.h        2015-01-02 19:53:38 UTC (rev 177866)
</span><span class="lines">@@ -31,7 +31,9 @@
</span><span class="cx"> #include &quot;CSSCursorImageValue.h&quot;
</span><span class="cx"> #include &quot;CSSShadowValue.h&quot;
</span><span class="cx"> #include &quot;CursorList.h&quot;
</span><ins>+#include &quot;ElementAncestorIterator.h&quot;
</ins><span class="cx"> #include &quot;Frame.h&quot;
</span><ins>+#include &quot;HTMLElement.h&quot;
</ins><span class="cx"> #include &quot;LocaleToScriptMapping.h&quot;
</span><span class="cx"> #include &quot;Rect.h&quot;
</span><span class="cx"> #include &quot;SVGElement.h&quot;
</span><span class="lines">@@ -61,6 +63,7 @@
</span><span class="cx">     DECLARE_PROPERTY_CUSTOM_HANDLERS(CounterReset);
</span><span class="cx">     DECLARE_PROPERTY_CUSTOM_HANDLERS(Cursor);
</span><span class="cx">     DECLARE_PROPERTY_CUSTOM_HANDLERS(FontFamily);
</span><ins>+    DECLARE_PROPERTY_CUSTOM_HANDLERS(FontSize);
</ins><span class="cx">     DECLARE_PROPERTY_CUSTOM_HANDLERS(FontWeight);
</span><span class="cx"> #if ENABLE(CSS_IMAGE_RESOLUTION)
</span><span class="cx">     DECLARE_PROPERTY_CUSTOM_HANDLERS(ImageResolution);
</span><span class="lines">@@ -118,6 +121,10 @@
</span><span class="cx">     static void applyInheritCounter(StyleResolver&amp;);
</span><span class="cx">     template &lt;CounterBehavior counterBehavior&gt;
</span><span class="cx">     static void applyValueCounter(StyleResolver&amp;, CSSValue&amp;);
</span><ins>+
+    static float largerFontSize(float size);
+    static float smallerFontSize(float size);
+    static float determineRubyTextSizeMultiplier(StyleResolver&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">@@ -842,8 +849,10 @@
</span><span class="cx">     FontDescription initialDesc = FontDescription();
</span><span class="cx"> 
</span><span class="cx">     // We need to adjust the size to account for the generic family change from monospace to non-monospace.
</span><del>-    if (fontDescription.keywordSize() &amp;&amp; fontDescription.useFixedDefaultSize())
-        styleResolver.setFontSize(fontDescription, Style::fontSizeForKeyword(CSSValueXxSmall + fontDescription.keywordSize() - 1, false, styleResolver.document()));
</del><ins>+    if (fontDescription.useFixedDefaultSize()) {
+        if (CSSValueID sizeIdentifier = fontDescription.keywordSizeAsIdentifier())
+            styleResolver.setFontSize(fontDescription, Style::fontSizeForKeyword(sizeIdentifier, false, styleResolver.document()));
+    }
</ins><span class="cx">     if (!initialDesc.firstFamily().isEmpty())
</span><span class="cx">         fontDescription.setFamilies(initialDesc.families());
</span><span class="cx"> 
</span><span class="lines">@@ -923,8 +932,10 @@
</span><span class="cx">         return;
</span><span class="cx">     fontDescription.setFamilies(families);
</span><span class="cx"> 
</span><del>-    if (fontDescription.keywordSize() &amp;&amp; fontDescription.useFixedDefaultSize() != oldFamilyUsedFixedDefaultSize)
-        styleResolver.setFontSize(fontDescription, Style::fontSizeForKeyword(CSSValueXxSmall + fontDescription.keywordSize() - 1, !oldFamilyUsedFixedDefaultSize, styleResolver.document()));
</del><ins>+    if (fontDescription.useFixedDefaultSize() != oldFamilyUsedFixedDefaultSize) {
+        if (CSSValueID sizeIdentifier = fontDescription.keywordSizeAsIdentifier())
+            styleResolver.setFontSize(fontDescription, Style::fontSizeForKeyword(sizeIdentifier, !oldFamilyUsedFixedDefaultSize, styleResolver.document()));
+    }
</ins><span class="cx"> 
</span><span class="cx">     styleResolver.setFontDescription(fontDescription);
</span><span class="cx"> }
</span><span class="lines">@@ -1268,6 +1279,129 @@
</span><span class="cx">     styleResolver.setFontDescription(fontDescription);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline void StyleBuilderCustom::applyInitialFontSize(StyleResolver&amp; styleResolver)
+{
+    FontDescription fontDescription = styleResolver.style()-&gt;fontDescription();
+    float size = Style::fontSizeForKeyword(CSSValueMedium, fontDescription.useFixedDefaultSize(), styleResolver.document());
+
+    if (size &lt; 0)
+        return;
+
+    fontDescription.setKeywordSizeFromIdentifier(CSSValueMedium);
+    styleResolver.setFontSize(fontDescription, size);
+    styleResolver.setFontDescription(fontDescription);
+}
+
+inline void StyleBuilderCustom::applyInheritFontSize(StyleResolver&amp; styleResolver)
+{
+    const FontDescription&amp; parentFontDescription = styleResolver.parentStyle()-&gt;fontDescription();
+    float size = parentFontDescription.specifiedSize();
+
+    if (size &lt; 0)
+        return;
+
+    FontDescription fontDescription = styleResolver.style()-&gt;fontDescription();
+    fontDescription.setKeywordSize(parentFontDescription.keywordSize());
+    styleResolver.setFontSize(fontDescription, size);
+    styleResolver.setFontDescription(fontDescription);
+}
+
+// When the CSS keyword &quot;larger&quot; is used, this function will attempt to match within the keyword
+// table, and failing that, will simply multiply by 1.2.
+inline float StyleBuilderCustom::largerFontSize(float size)
+{
+    // FIXME: Figure out where we fall in the size ranges (xx-small to xxx-large) and scale up to
+    // the next size level.
+    return size * 1.2f;
+}
+
+// Like the previous function, but for the keyword &quot;smaller&quot;.
+inline float StyleBuilderCustom::smallerFontSize(float size)
+{
+    // FIXME: Figure out where we fall in the size ranges (xx-small to xxx-large) and scale down to
+    // the next size level.
+    return size / 1.2f;
+}
+
+inline float StyleBuilderCustom::determineRubyTextSizeMultiplier(StyleResolver&amp; styleResolver)
+{
+    if (styleResolver.style()-&gt;rubyPosition() != RubyPositionInterCharacter)
+        return 0.5f;
+
+    // FIXME: This hack is to ensure tone marks are the same size as
+    // the bopomofo. This code will go away if we make a special renderer
+    // for the tone marks eventually.
+    if (auto* element = styleResolver.state().element()) {
+        for (auto&amp; ancestor : ancestorsOfType&lt;HTMLElement&gt;(*element)) {
+            if (ancestor.hasTagName(HTMLNames::rtTag))
+                return 1.0f;
+        }
+    }
+    return 0.25f;
+}
+
+inline void StyleBuilderCustom::applyValueFontSize(StyleResolver&amp; styleResolver, CSSValue&amp; value)
+{
+    FontDescription fontDescription = styleResolver.style()-&gt;fontDescription();
+    fontDescription.setKeywordSizeFromIdentifier(CSSValueInvalid);
+
+    float parentSize = 0;
+    bool parentIsAbsoluteSize = false;
+    if (auto* parentStyle = styleResolver.parentStyle()) {
+        parentSize = parentStyle-&gt;fontDescription().specifiedSize();
+        parentIsAbsoluteSize = parentStyle-&gt;fontDescription().isAbsoluteSize();
+    }
+
+    auto&amp; primitiveValue = downcast&lt;CSSPrimitiveValue&gt;(value);
+    float size;
+    if (CSSValueID ident = primitiveValue.getValueID()) {
+        fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize &amp;&amp; (ident == CSSValueLarger || ident == CSSValueSmaller || ident == CSSValueWebkitRubyText));
+
+        // Keywords are being used.
+        switch (ident) {
+        case CSSValueXxSmall:
+        case CSSValueXSmall:
+        case CSSValueSmall:
+        case CSSValueMedium:
+        case CSSValueLarge:
+        case CSSValueXLarge:
+        case CSSValueXxLarge:
+        case CSSValueWebkitXxxLarge:
+            size = Style::fontSizeForKeyword(ident, fontDescription.useFixedDefaultSize(), styleResolver.document());
+            fontDescription.setKeywordSizeFromIdentifier(ident);
+            break;
+        case CSSValueLarger:
+            size = largerFontSize(parentSize);
+            break;
+        case CSSValueSmaller:
+            size = smallerFontSize(parentSize);
+            break;
+        case CSSValueWebkitRubyText:
+            size = determineRubyTextSizeMultiplier(styleResolver) * parentSize;
+            break;
+        default:
+            return;
+        }
+    } else {
+        fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize || !(primitiveValue.isPercentage() || primitiveValue.isFontRelativeLength()));
+        if (primitiveValue.isLength()) {
+            size = primitiveValue.computeLength&lt;float&gt;(CSSToLengthConversionData(styleResolver.parentStyle(), styleResolver.rootElementStyle(), styleResolver.document().renderView(), 1.0f, true));
+            styleResolver.state().setFontSizeHasViewportUnits(primitiveValue.isViewportPercentageLength());
+        } else if (primitiveValue.isPercentage())
+            size = (primitiveValue.getFloatValue() * parentSize) / 100.0f;
+        else if (primitiveValue.isCalculatedPercentageWithLength())
+            size = primitiveValue.cssCalcValue()-&gt;createCalculationValue(styleResolver.state().cssToLengthConversionData().copyWithAdjustedZoom(1.0f))-&gt;evaluate(parentSize);
+        else
+            return;
+    }
+
+    if (size &lt; 0)
+        return;
+
+    styleResolver.setFontSize(fontDescription, std::min(maximumAllowedFontSize, size));
+    styleResolver.setFontDescription(fontDescription);
+}
+
</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 (177865 => 177866)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.cpp        2015-01-02 18:32:38 UTC (rev 177865)
+++ trunk/Source/WebCore/css/StyleResolver.cpp        2015-01-02 19:53:38 UTC (rev 177866)
</span><span class="lines">@@ -3215,8 +3215,8 @@
</span><span class="cx">     // If the font uses a keyword size, then we refetch from the table rather than
</span><span class="cx">     // multiplying by our scale factor.
</span><span class="cx">     float size;
</span><del>-    if (childFont.keywordSize())
-        size = Style::fontSizeForKeyword(CSSValueXxSmall + childFont.keywordSize() - 1, childFont.useFixedDefaultSize(), document());
</del><ins>+    if (CSSValueID sizeIdentifier = childFont.keywordSizeAsIdentifier())
+        size = Style::fontSizeForKeyword(sizeIdentifier, childFont.useFixedDefaultSize(), document());
</ins><span class="cx">     else {
</span><span class="cx">         Settings* settings = documentSettings();
</span><span class="cx">         float fixedScaleFactor = (settings &amp;&amp; settings-&gt;defaultFixedFontSize() &amp;&amp; settings-&gt;defaultFontSize())
</span><span class="lines">@@ -3238,7 +3238,7 @@
</span><span class="cx">     fontDescription.setRenderingMode(settings-&gt;fontRenderingMode());
</span><span class="cx">     fontDescription.setUsePrinterFont(document().printing() || !settings-&gt;screenFontSubstitutionEnabled());
</span><span class="cx">     fontDescription.setOneFamily(standardFamily);
</span><del>-    fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1);
</del><ins>+    fontDescription.setKeywordSizeFromIdentifier(CSSValueMedium);
</ins><span class="cx">     setFontSize(fontDescription, Style::fontSizeForKeyword(CSSValueMedium, false, document()));
</span><span class="cx">     m_state.style()-&gt;setLineHeight(RenderStyle::initialLineHeight());
</span><span class="cx">     m_state.setLineHeightValue(0);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFontDescriptionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/FontDescription.h (177865 => 177866)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/FontDescription.h        2015-01-02 18:32:38 UTC (rev 177865)
+++ trunk/Source/WebCore/platform/graphics/FontDescription.h        2015-01-02 19:53:38 UTC (rev 177866)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> #ifndef FontDescription_h
</span><span class="cx"> #define FontDescription_h
</span><span class="cx"> 
</span><ins>+#include &quot;CSSValueKeywords.h&quot;
</ins><span class="cx"> #include &quot;FontFeatureSettings.h&quot;
</span><span class="cx"> #include &quot;FontOrientation.h&quot;
</span><span class="cx"> #include &quot;FontRenderingMode.h&quot;
</span><span class="lines">@@ -124,6 +125,12 @@
</span><span class="cx">     LigaturesState discretionaryLigaturesState() const { return static_cast&lt;LigaturesState&gt;(m_discretionaryLigaturesState); }
</span><span class="cx">     LigaturesState historicalLigaturesState() const { return static_cast&lt;LigaturesState&gt;(m_historicalLigaturesState); }
</span><span class="cx">     unsigned keywordSize() const { return m_keywordSize; }
</span><ins>+    CSSValueID keywordSizeAsIdentifier() const
+    {
+        CSSValueID identifier = m_keywordSize ? static_cast&lt;CSSValueID&gt;(CSSValueXxSmall + m_keywordSize - 1) : CSSValueInvalid;
+        ASSERT(identifier == CSSValueInvalid || (identifier &gt;= CSSValueXxSmall &amp;&amp; identifier &lt;= CSSValueWebkitXxxLarge));
+        return identifier;
+    }
</ins><span class="cx">     FontSmoothingMode fontSmoothing() const { return static_cast&lt;FontSmoothingMode&gt;(m_fontSmoothing); }
</span><span class="cx">     TextRenderingMode textRenderingMode() const { return static_cast&lt;TextRenderingMode&gt;(m_textRendering); }
</span><span class="cx">     UScriptCode script() const { return static_cast&lt;UScriptCode&gt;(m_script); }
</span><span class="lines">@@ -153,7 +160,19 @@
</span><span class="cx">     void setCommonLigaturesState(LigaturesState commonLigaturesState) { m_commonLigaturesState = commonLigaturesState; }
</span><span class="cx">     void setDiscretionaryLigaturesState(LigaturesState discretionaryLigaturesState) { m_discretionaryLigaturesState = discretionaryLigaturesState; }
</span><span class="cx">     void setHistoricalLigaturesState(LigaturesState historicalLigaturesState) { m_historicalLigaturesState = historicalLigaturesState; }
</span><del>-    void setKeywordSize(unsigned s) { m_keywordSize = s; }
</del><ins>+    void setKeywordSize(unsigned size)
+    {
+        ASSERT(size &lt;= 8);
+        m_keywordSize = size;
+        ASSERT(m_keywordSize == size); // Make sure it fits in the bitfield.
+    }
+    void setKeywordSizeFromIdentifier(CSSValueID identifier)
+    {
+        ASSERT(!identifier || (identifier &gt;= CSSValueXxSmall &amp;&amp; identifier &lt;= CSSValueWebkitXxxLarge));
+        static_assert(CSSValueWebkitXxxLarge - CSSValueXxSmall + 1 == 8, &quot;Maximum keyword size should be 8.&quot;);
+        setKeywordSize(identifier ? identifier - CSSValueXxSmall + 1 : 0);
+    }
+
</ins><span class="cx">     void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = smoothing; }
</span><span class="cx">     void setTextRenderingMode(TextRenderingMode rendering) { m_textRendering = rendering; }
</span><span class="cx">     void setIsSpecifiedFont(bool isSpecifiedFont) { m_isSpecifiedFont = isSpecifiedFont; }
</span></span></pre></div>
<a id="trunkSourceWebCorestyleStyleResolveForDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/StyleResolveForDocument.cpp (177865 => 177866)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StyleResolveForDocument.cpp        2015-01-02 18:32:38 UTC (rev 177865)
+++ trunk/Source/WebCore/style/StyleResolveForDocument.cpp        2015-01-02 19:53:38 UTC (rev 177866)
</span><span class="lines">@@ -101,7 +101,7 @@
</span><span class="cx">     fontDescription.setRenderingMode(settings.fontRenderingMode());
</span><span class="cx">     fontDescription.setOneFamily(standardFamily);
</span><span class="cx"> 
</span><del>-    fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1);
</del><ins>+    fontDescription.setKeywordSizeFromIdentifier(CSSValueMedium);
</ins><span class="cx">     int size = fontSizeForKeyword(CSSValueMedium, false, document);
</span><span class="cx">     fontDescription.setSpecifiedSize(size);
</span><span class="cx">     bool useSVGZoomRules = document.isSVGDocument();
</span></span></pre>
</div>
</div>

</body>
</html>