<!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>[193559] branches/safari-601.1.46-branch</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/193559">193559</a></dd>
<dt>Author</dt> <dd>bshafiei@apple.com</dd>
<dt>Date</dt> <dd>2015-12-05 22:23:15 -0800 (Sat, 05 Dec 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/191128">r191128</a>. rdar://problem/23221179</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari601146branchLayoutTestsChangeLog">branches/safari-601.1.46-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari601146branchLayoutTestsTestExpectations">branches/safari-601.1.46-branch/LayoutTests/TestExpectations</a></li>
<li><a href="#branchessafari601146branchSourceWebCoreCMakeListstxt">branches/safari-601.1.46-branch/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#branchessafari601146branchSourceWebCoreChangeLog">branches/safari-601.1.46-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari601146branchSourceWebCoreWebCorexcodeprojprojectpbxproj">branches/safari-601.1.46-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssCSSCalculationValuecpp">branches/safari-601.1.46-branch/Source/WebCore/css/CSSCalculationValue.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssCSSComputedStyleDeclarationcpp">branches/safari-601.1.46-branch/Source/WebCore/css/CSSComputedStyleDeclaration.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssCSSCustomPropertyValueh">branches/safari-601.1.46-branch/Source/WebCore/css/CSSCustomPropertyValue.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssCSSFunctionValuecpp">branches/safari-601.1.46-branch/Source/WebCore/css/CSSFunctionValue.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssCSSFunctionValueh">branches/safari-601.1.46-branch/Source/WebCore/css/CSSFunctionValue.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssCSSGrammaryin">branches/safari-601.1.46-branch/Source/WebCore/css/CSSGrammar.y.in</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssCSSParsercpp">branches/safari-601.1.46-branch/Source/WebCore/css/CSSParser.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssCSSParserh">branches/safari-601.1.46-branch/Source/WebCore/css/CSSParser.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssCSSParserValuescpp">branches/safari-601.1.46-branch/Source/WebCore/css/CSSParserValues.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssCSSParserValuesh">branches/safari-601.1.46-branch/Source/WebCore/css/CSSParserValues.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssCSSPrimitiveValuecpp">branches/safari-601.1.46-branch/Source/WebCore/css/CSSPrimitiveValue.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssCSSPrimitiveValueh">branches/safari-601.1.46-branch/Source/WebCore/css/CSSPrimitiveValue.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssCSSValuecpp">branches/safari-601.1.46-branch/Source/WebCore/css/CSSValue.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssCSSValueh">branches/safari-601.1.46-branch/Source/WebCore/css/CSSValue.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssCSSValueListcpp">branches/safari-601.1.46-branch/Source/WebCore/css/CSSValueList.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssCSSValueListh">branches/safari-601.1.46-branch/Source/WebCore/css/CSSValueList.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssStylePropertiescpp">branches/safari-601.1.46-branch/Source/WebCore/css/StyleProperties.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssStylePropertiesh">branches/safari-601.1.46-branch/Source/WebCore/css/StyleProperties.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssStyleResolvercpp">branches/safari-601.1.46-branch/Source/WebCore/css/StyleResolver.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssStyleResolverh">branches/safari-601.1.46-branch/Source/WebCore/css/StyleResolver.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssmakeproppl">branches/safari-601.1.46-branch/Source/WebCore/css/makeprop.pl</a></li>
<li><a href="#branchessafari601146branchSourceWebCorerenderingstyleRenderStylecpp">branches/safari-601.1.46-branch/Source/WebCore/rendering/style/RenderStyle.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCorerenderingstyleRenderStyleh">branches/safari-601.1.46-branch/Source/WebCore/rendering/style/RenderStyle.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCorerenderingstyleStyleCustomPropertyDatah">branches/safari-601.1.46-branch/Source/WebCore/rendering/style/StyleCustomPropertyData.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari601146branchLayoutTestsfastcsscustompropertiesinheritanceexpectedhtml">branches/safari-601.1.46-branch/LayoutTests/fast/css/custom-properties/inheritance-expected.html</a></li>
<li><a href="#branchessafari601146branchLayoutTestsfastcsscustompropertiesinheritancehtml">branches/safari-601.1.46-branch/LayoutTests/fast/css/custom-properties/inheritance.html</a></li>
<li>branches/safari-601.1.46-branch/LayoutTests/fast/css/variables/</li>
<li><a href="#branchessafari601146branchSourceWebCorecssCSSVariableDependentValuecpp">branches/safari-601.1.46-branch/Source/WebCore/css/CSSVariableDependentValue.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssCSSVariableDependentValueh">branches/safari-601.1.46-branch/Source/WebCore/css/CSSVariableDependentValue.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssCSSVariableValuecpp">branches/safari-601.1.46-branch/Source/WebCore/css/CSSVariableValue.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssCSSVariableValueh">branches/safari-601.1.46-branch/Source/WebCore/css/CSSVariableValue.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari601146branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/LayoutTests/ChangeLog (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/ChangeLog        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/LayoutTests/ChangeLog        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -1,5 +1,36 @@
</span><span class="cx"> 2015-12-05 Babak Shafiei <bshafiei@apple.com>
</span><span class="cx">
</span><ins>+ Merge r191128.
+
+ 2015-10-14 David Hyatt <hyatt@apple.com>
+
+ Implement CSS Variables.
+ https://bugs.webkit.org/show_bug.cgi?id=19660
+
+ Reviewed by Dean Jackson.
+
+ * fast/css/custom-properties/inheritance-expected.html: Added.
+ * fast/css/custom-properties/inheritance.html: Added.
+ * fast/css/variables: Added.
+ * fast/css/variables/custom-property-computed-style-access-expected.html: Added.
+ * fast/css/variables/custom-property-computed-style-access.html: Added.
+ * fast/css/variables/custom-property-dynamic-update-expected.html: Added.
+ * fast/css/variables/custom-property-dynamic-update.html: Added.
+ * fast/css/variables/custom-property-simple-cycle-expected.html: Added.
+ * fast/css/variables/custom-property-simple-cycle.html: Added.
+ * fast/css/variables/inherited-fallback-expected.html: Added.
+ * fast/css/variables/inherited-fallback.html: Added.
+ * fast/css/variables/invalid-reference-expected.html: Added.
+ * fast/css/variables/invalid-reference.html: Added.
+ * fast/css/variables/rule-property-get-css-value-expected.html: Added.
+ * fast/css/variables/rule-property-get-css-value.html: Added.
+ * fast/css/variables/rule-property-get-expected.html: Added.
+ * fast/css/variables/rule-property-get.html: Added.
+ * fast/css/variables/rule-serialization-expected.html: Added.
+ * fast/css/variables/rule-serialization.html: Added.
+
+2015-12-05 Babak Shafiei <bshafiei@apple.com>
+
</ins><span class="cx"> Merge r190209.
</span><span class="cx">
</span><span class="cx"> 2015-09-24 David Hyatt <hyatt@apple.com>
</span></span></pre></div>
<a id="branchessafari601146branchLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/LayoutTests/TestExpectations (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/TestExpectations        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/LayoutTests/TestExpectations        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -550,3 +550,33 @@
</span><span class="cx"> js/arrowfunction-syntax-endings.html [ Skip ]
</span><span class="cx"> js/arrowfunction-syntax-errors.html [ Skip ]
</span><span class="cx"> js/arrowfunction-syntax.html [ Skip ]
</span><ins>+
+# Known failures on CSS Variables Test Suite
+webkit.org/b/150183 fast/css/variables/test-suite/failures/024.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/025.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/026.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/028.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/030.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/054.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/055.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/056.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/058.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/071.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/081.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/082.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/085.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/086.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/087.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/091.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/103.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/111.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/115.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/126.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/129.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/130.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/134.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/152.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/159.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/161.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/163.html [ ImageOnlyFailure ]
+webkit.org/b/150183 fast/css/variables/test-suite/failures/169.html [ ImageOnlyFailure ]
</ins></span></pre></div>
<a id="branchessafari601146branchLayoutTestsfastcsscustompropertiesinheritanceexpectedhtmlfromrev193503branchessafari601branchLayoutTestsfastcsscustompropertiesinheritanceexpectedhtml"></a>
<div class="copfile"><h4>Copied: branches/safari-601.1.46-branch/LayoutTests/fast/css/custom-properties/inheritance-expected.html (from rev 193503, branches/safari-601-branch/LayoutTests/fast/css/custom-properties/inheritance-expected.html) (0 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/fast/css/custom-properties/inheritance-expected.html         (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/fast/css/custom-properties/inheritance-expected.html        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+<html>
+<head>
+<body>
+10px
+</body>
+</html>
</ins></span></pre></div>
<a id="branchessafari601146branchLayoutTestsfastcsscustompropertiesinheritancehtmlfromrev193503branchessafari601branchLayoutTestsfastcsscustompropertiesinheritancehtml"></a>
<div class="copfile"><h4>Copied: branches/safari-601.1.46-branch/LayoutTests/fast/css/custom-properties/inheritance.html (from rev 193503, branches/safari-601-branch/LayoutTests/fast/css/custom-properties/inheritance.html) (0 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/fast/css/custom-properties/inheritance.html         (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/fast/css/custom-properties/inheritance.html        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+<html>
+<head>
+<style>
+html { --one: 10px; }
+body { --one: 50px; --one: inherit; }
+</style>
+<body>
+<script>
+document.write(getComputedStyle(document.body).getPropertyValue("--one"))
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="branchessafari601146branchSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/CMakeLists.txt (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/CMakeLists.txt        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/CMakeLists.txt        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -1316,6 +1316,8 @@
</span><span class="cx"> css/CSSValue.cpp
</span><span class="cx"> css/CSSValueList.cpp
</span><span class="cx"> css/CSSValuePool.cpp
</span><ins>+ css/CSSVariableDependentValue.cpp
+ css/CSSVariableValue.cpp
</ins><span class="cx"> css/DOMWindowCSS.cpp
</span><span class="cx"> css/DocumentRuleSets.cpp
</span><span class="cx"> css/ElementRuleCollector.cpp
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -1,5 +1,226 @@
</span><span class="cx"> 2015-12-05 Babak Shafiei <bshafiei@apple.com>
</span><span class="cx">
</span><ins>+ Merge r191128.
+
+ 2015-10-14 David Hyatt <hyatt@apple.com>
+
+ Implement CSS Variables.
+ https://bugs.webkit.org/show_bug.cgi?id=19660
+
+ Reviewed by Dean Jackson.
+
+ Added new tests in fast/css/custom-properties and fast/css/variables.
+
+ * CMakeLists.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ Add CSSVariableValue.cpp and CSSVariableDependentValue.cpp to builds.
+
+ * css/CSSCalculationValue.cpp:
+ (WebCore::hasDoubleValue):
+ Handle the new CSS_PARSER_WHITESPACE value.
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::ComputedStyleExtractor::customPropertyValue):
+ Patched to make sure style is updated so that dynamic changes to custom properties are reflected
+ immediately when querying values.
+
+ (WebCore::CSSComputedStyleDeclaration::length):
+ (WebCore::CSSComputedStyleDeclaration::item):
+ The custom properties table is a reference and not a pointer now.
+
+ * css/CSSCustomPropertyValue.h:
+ (WebCore::CSSCustomPropertyValue::create):
+ (WebCore::CSSCustomPropertyValue::createInvalid):
+ (WebCore::CSSCustomPropertyValue::customCSSText):
+ (WebCore::CSSCustomPropertyValue::equals):
+ (WebCore::CSSCustomPropertyValue::isInvalid):
+ (WebCore::CSSCustomPropertyValue::containsVariables):
+ (WebCore::CSSCustomPropertyValue::value):
+ (WebCore::CSSCustomPropertyValue::CSSCustomPropertyValue):
+ The CSSCustomPropertyValue represents a custom property/value pair in the back end. It holds on
+ to both the property name and a CSSValueList that has the original parser terms. This class also
+ doubles as the invalid-at-compute-time value for custom properties when they contain cycles, etc.
+
+ * css/CSSFunctionValue.cpp:
+ (WebCore::CSSFunctionValue::buildParserValueSubstitutingVariables):
+ * css/CSSFunctionValue.h:
+ (WebCore::CSSFunctionValue::buildParserValueSubstitutingVariables):
+ Hands back a CSSParserValue for a function with variables replaced with their real values (or fallback).
+
+ * css/CSSGrammar.y.in:
+ Many changes to support the var() syntax and to handle error conditions and cases.
+
+ * css/CSSParser.cpp:
+ (WebCore::filterProperties):
+ Null check the value here. Shouldn't happen, but being paranoid.
+
+ (WebCore::CSSParser::parseVariableDependentValue):
+ This function converts a CSSValueList back into a CSSParserValueList and then passes
+ it off to the parser. If the result parses, successfully, then the parsed CSSValue is handed back.
+
+ (WebCore::CSSParser::parseValue):
+ Detect when a property value contains variables and simply make a CSSVariableDependentValue to hold
+ a copy of the parser value list (as a CSSValueList). We defer parsing the list until compute-time
+ when we know the values of the variables to use.
+
+ (WebCore::CSSParser::parseCustomPropertyDeclaration):
+ Add support for inherit, initial and variable references in custom properties.
+
+ (WebCore::CSSParser::detectFunctionTypeToken):
+ Add support for detection of the "var" token.
+
+ (WebCore::CSSParser::realLex):
+ Fix the parsing of custom properties to allow "--" and to allow them to start with digits, e.g., "--0".
+
+ * css/CSSParser.h:
+ Add parseVariableDependentValue function for handling variable substitution and subsequent parsing
+ of the resolved parser value list.
+
+ * css/CSSParserValues.cpp:
+ (WebCore::CSSParserValueList::containsVariables):
+ Get rid of the toString() function (no longer needed) and replace it with containsVariables(). This
+ check is used to figure out if a parser value list has variables and thus needs to defer parsing
+ until later.
+
+ (WebCore::CSSParserValue::createCSSValue):
+ Add support for the creation of values for variables, CSSVariableValues.
+
+ (WebCore::CSSParserValueList::toString): Deleted.
+ No longer needed.
+
+ * css/CSSParserValues.h:
+ Add CSSParserVariable as a new kind of parser value. This represents a var() that is encountered
+ during parsing. It is similar to a function except it has to hold both the reference (custom property name)
+ and fallback arguments.
+
+ * css/CSSPrimitiveValue.cpp:
+ (WebCore::isValidCSSUnitTypeForDoubleConversion):
+ (WebCore::CSSPrimitiveValue::cleanup):
+ (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText):
+ (WebCore::CSSPrimitiveValue::cloneForCSSOM):
+ (WebCore::CSSPrimitiveValue::equals):
+ Add support for CSS_PARSER_WHITESPACE as a way of preserving whitespace as a parsed item (variables can
+ be only whitespace, and this has to be retained).
+
+ (WebCore::CSSPrimitiveValue::buildParserValue):
+ Conversion from a CSSPrimitiveValue back into a parser value is handled by this function.
+
+ * css/CSSPrimitiveValue.h:
+ (WebCore::CSSPrimitiveValue::isParserOperator):
+ (WebCore::CSSPrimitiveValue::parserOperator):
+ Add ability to get parser operator info. Add the buildParserValue declaration.
+
+ * css/CSSValue.cpp:
+ (WebCore::CSSValue::equals):
+ (WebCore::CSSValue::cssText):
+ (WebCore::CSSValue::destroy):
+ (WebCore::CSSValue::cloneForCSSOM):
+ (WebCore::CSSValue::isInvalidCustomPropertyValue):
+ * css/CSSValue.h:
+ Add support for variable values and variable dependent values.
+
+ * css/CSSValueList.cpp:
+ (WebCore::CSSValueList::customCSSText):
+ Improve serialization to not output extra spaces when a comma operator is a value.
+
+ (WebCore::CSSValueList::containsVariables):
+ Whether or not a CSSVariableValue can be found somewhere within the list (or its descendants).
+
+ (WebCore::CSSValueList::checkVariablesForCycles):
+ Called to check variables for cycles.
+
+ (WebCore::CSSValueList::buildParserValueSubstitutingVariables):
+ (WebCore::CSSValueList::buildParserValueListSubstitutingVariables):
+ Functions that handle converting the value list to a parser value list while making
+ variable substitutions along the way.
+
+ * css/CSSValueList.h:
+ Add the new buildParserXXX functions.
+
+ * css/CSSVariableDependentValue.cpp: Added.
+ (WebCore::CSSVariableDependentValue::checkVariablesForCycles):
+ * css/CSSVariableDependentValue.h: Added.
+ (WebCore::CSSVariableDependentValue::create):
+ (WebCore::CSSVariableDependentValue::customCSSText):
+ (WebCore::CSSVariableDependentValue::equals):
+ (WebCore::CSSVariableDependentValue::propertyID):
+ (WebCore::CSSVariableDependentValue::valueList):
+ (WebCore::CSSVariableDependentValue::CSSVariableDependentValue):
+ This value represents a list of terms that have not had variables substituted yet. The list
+ is held by the value so that it can be converted back into a parser value list once the
+ variable values are known.
+
+ * css/CSSVariableValue.cpp: Added.
+ (WebCore::CSSVariableValue::CSSVariableValue):
+ (WebCore::CSSVariableValue::customCSSText):
+ (WebCore::CSSVariableValue::equals):
+ (WebCore::CSSVariableValue::buildParserValueListSubstitutingVariables):
+ * css/CSSVariableValue.h: Added.
+ (WebCore::CSSVariableValue::create):
+ (WebCore::CSSVariableValue::name):
+ (WebCore::CSSVariableValue::fallbackArguments):
+ This value represents a var() itself. It knows how to do the substitution of the variable
+ value and to apply fallback if that value is not present.
+
+ * css/StyleProperties.cpp:
+ (WebCore::StyleProperties::getPropertyValue):
+ (WebCore::StyleProperties::borderSpacingValue):
+ (WebCore::StyleProperties::getLayeredShorthandValue):
+ (WebCore::StyleProperties::getShorthandValue):
+ (WebCore::StyleProperties::getCommonValue):
+ (WebCore::StyleProperties::getPropertyCSSValue):
+ (WebCore::StyleProperties::getPropertyCSSValueInternal):
+ (WebCore::StyleProperties::asText):
+ (WebCore::StyleProperties::copyPropertiesInSet):
+ * css/StyleProperties.h:
+ Patched to factor property fetching into an internal method so that variables can work with shorthands
+ in the CSS OM.
+
+ * css/StyleResolver.cpp:
+ (WebCore::StyleResolver::applyProperty):
+ Resolve variable values at compute time. If they fail to resolve, use inherit or initial as the
+ value (depending on whether the property inherits by default).
+
+ (WebCore::StyleResolver::resolvedVariableValue):
+ Helper function that calls parseVariableDependentValue and gets the resolved result.
+
+ (WebCore::StyleResolver::applyCascadedProperties):
+ After custom properties have been collected, we check for cycles and perform variable substitutions.
+ This way we get all the variables replaced before we inherit down the style tree.
+
+ * css/StyleResolver.h:
+ Add resolvedVariableValue declaration.
+
+ * css/makeprop.pl:
+ Make sure custom properties are inherited by default.
+
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle::checkVariablesInCustomProperties):
+ This function handles updating variables with cycles to be invalid in the RenderStyle. It then also
+ handles the replacement of variables found in custom properties with resolved values. All custom
+ properties are either invalid or are real non-variable-dependent value lists after this function
+ completes.
+
+ * rendering/style/RenderStyle.h:
+ Add checkVariablesInCustomProperties declaration.
+
+ * rendering/style/StyleCustomPropertyData.h:
+ (WebCore::StyleCustomPropertyData::create):
+ (WebCore::StyleCustomPropertyData::copy):
+ (WebCore::StyleCustomPropertyData::operator==):
+ (WebCore::StyleCustomPropertyData::operator!=):
+ (WebCore::StyleCustomPropertyData::setCustomPropertyValue):
+ (WebCore::StyleCustomPropertyData::getCustomPropertyValue):
+ (WebCore::StyleCustomPropertyData::values):
+ (WebCore::StyleCustomPropertyData::hasCustomProperty):
+ (WebCore::StyleCustomPropertyData::containsVariables):
+ (WebCore::StyleCustomPropertyData::setContainsVariables):
+ (WebCore::StyleCustomPropertyData::StyleCustomPropertyData):
+ Miscellaneous cleanup, and the addition of whether or not the properties still contain variable
+ dependent values that need to be resolved.
+
+2015-12-05 Babak Shafiei <bshafiei@apple.com>
+
</ins><span class="cx"> Merge r190231.
</span><span class="cx">
</span><span class="cx"> 2015-09-24 David Hyatt <hyatt@apple.com>
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -2548,6 +2548,8 @@
</span><span class="cx">                 7C48A6D1191C9D6500026674 /* WebKitNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C48A6CF191C9D6500026674 /* WebKitNamespace.h */; };
</span><span class="cx">                 7C4902A218B825F8007D9298 /* DOMWheelEventInternal.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 85989DCA0ACC8BBD00A0BC51 /* DOMWheelEventInternal.h */; };
</span><span class="cx">                 7C4C96DC1AD4483500365A50 /* JSReadableStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4C96D81AD4483500365A50 /* JSReadableStream.cpp */; };
</span><ins>+                7C4C96DC1AD4483500365A51 /* ReadableStreamBuiltins.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4C96D81AD4483500365A51 /* ReadableStreamBuiltins.cpp */; };
+                7C4C96DC1AD4483500365A52 /* CountQueuingStrategyBuiltins.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4C96D81AD4483500365A52 /* CountQueuingStrategyBuiltins.cpp */; };
</ins><span class="cx">                 7C4C96DD1AD4483500365A50 /* JSReadableStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C4C96D91AD4483500365A50 /* JSReadableStream.h */; };
</span><span class="cx">                 7C4C96DE1AD4483500365A50 /* JSReadableStreamReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4C96DA1AD4483500365A50 /* JSReadableStreamReader.cpp */; };
</span><span class="cx">                 7C4C96DF1AD4483500365A50 /* JSReadableStreamReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C4C96DB1AD4483500365A50 /* JSReadableStreamReader.h */; };
</span><span class="lines">@@ -5172,6 +5174,10 @@
</span><span class="cx">                 BC128B01137C8D4600CAC845 /* RenderGrid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC128B00137C8D4600CAC845 /* RenderGrid.cpp */; };
</span><span class="cx">                 BC14028A0E83680800319717 /* ScrollbarThemeComposite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC1402880E83680800319717 /* ScrollbarThemeComposite.cpp */; };
</span><span class="cx">                 BC14028B0E83680800319717 /* ScrollbarThemeComposite.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1402890E83680800319717 /* ScrollbarThemeComposite.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                BC1790BB1BB5AB3F0006D13E /* CSSVariableDependentValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1790BA1BB5AB3F0006D13E /* CSSVariableDependentValue.h */; settings = {ASSET_TAGS = (); }; };
+                BC1790BD1BBB36A80006D13E /* CSSVariableDependentValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC1790BC1BBB36A80006D13E /* CSSVariableDependentValue.cpp */; settings = {ASSET_TAGS = (); }; };
+                BC1790C01BBF2C430006D13E /* CSSVariableValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC1790BE1BBF2C430006D13E /* CSSVariableValue.cpp */; settings = {ASSET_TAGS = (); }; };
+                BC1790C11BBF2C430006D13E /* CSSVariableValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1790BF1BBF2C430006D13E /* CSSVariableValue.h */; settings = {ASSET_TAGS = (); }; };
</ins><span class="cx">                 BC17F9660B64EBB8004A65CB /* JSHTMLSelectElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC17F9650B64EBB8004A65CB /* JSHTMLSelectElementCustom.cpp */; };
</span><span class="cx">                 BC1A37AD097C715F0019F3D8 /* DOM.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1A3797097C715F0019F3D8 /* DOM.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 BC1A37AE097C715F0019F3D8 /* DOM.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC1A3798097C715F0019F3D8 /* DOM.mm */; };
</span><span class="lines">@@ -9870,6 +9876,8 @@
</span><span class="cx">                 7C48A6CF191C9D6500026674 /* WebKitNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitNamespace.h; sourceTree = "<group>"; };
</span><span class="cx">                 7C48A6D2191C9D8E00026674 /* WebKitNamespace.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebKitNamespace.idl; sourceTree = "<group>"; };
</span><span class="cx">                 7C4C96D81AD4483500365A50 /* JSReadableStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSReadableStream.cpp; sourceTree = "<group>"; };
</span><ins>+                7C4C96D81AD4483500365A51 /* ReadableStreamBuiltins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReadableStreamBuiltins.cpp; sourceTree = "<group>"; };
+                7C4C96D81AD4483500365A52 /* CountQueuingStrategyBuiltins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CountQueuingStrategyBuiltins.cpp; sourceTree = "<group>"; };
</ins><span class="cx">                 7C4C96D91AD4483500365A50 /* JSReadableStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSReadableStream.h; sourceTree = "<group>"; };
</span><span class="cx">                 7C4C96DA1AD4483500365A50 /* JSReadableStreamReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSReadableStreamReader.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 7C4C96DB1AD4483500365A50 /* JSReadableStreamReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSReadableStreamReader.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -12723,6 +12731,10 @@
</span><span class="cx">                 BC128B00137C8D4600CAC845 /* RenderGrid.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderGrid.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 BC1402880E83680800319717 /* ScrollbarThemeComposite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollbarThemeComposite.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 BC1402890E83680800319717 /* ScrollbarThemeComposite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollbarThemeComposite.h; sourceTree = "<group>"; };
</span><ins>+                BC1790BA1BB5AB3F0006D13E /* CSSVariableDependentValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSVariableDependentValue.h; sourceTree = "<group>"; };
+                BC1790BC1BBB36A80006D13E /* CSSVariableDependentValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSVariableDependentValue.cpp; sourceTree = "<group>"; };
+                BC1790BE1BBF2C430006D13E /* CSSVariableValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSVariableValue.cpp; sourceTree = "<group>"; };
+                BC1790BF1BBF2C430006D13E /* CSSVariableValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSVariableValue.h; sourceTree = "<group>"; };
</ins><span class="cx">                 BC17F9650B64EBB8004A65CB /* JSHTMLSelectElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLSelectElementCustom.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 BC1A3797097C715F0019F3D8 /* DOM.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOM.h; sourceTree = "<group>"; };
</span><span class="cx">                 BC1A3798097C715F0019F3D8 /* DOM.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DOM.mm; sourceTree = "<group>"; };
</span><span class="lines">@@ -22646,6 +22658,10 @@
</span><span class="cx">                                 A8D0651C0A23C1FE005E7203 /* CSSValueList.idl */,
</span><span class="cx">                                 E49BDA0A131FD3E5003C56F0 /* CSSValuePool.cpp */,
</span><span class="cx">                                 E49BD9F9131FD2ED003C56F0 /* CSSValuePool.h */,
</span><ins>+                                BC1790BC1BBB36A80006D13E /* CSSVariableDependentValue.cpp */,
+                                BC1790BA1BB5AB3F0006D13E /* CSSVariableDependentValue.h */,
+                                BC1790BE1BBF2C430006D13E /* CSSVariableValue.cpp */,
+                                BC1790BF1BBF2C430006D13E /* CSSVariableValue.h */,
</ins><span class="cx">                                 A80E6CE10A1989CA007FB8C5 /* DashboardRegion.h */,
</span><span class="cx">                                 4A4F48A716B0DFC000EDBB29 /* DocumentRuleSets.cpp */,
</span><span class="cx">                                 4A4F48A816B0DFC000EDBB29 /* DocumentRuleSets.h */,
</span><span class="lines">@@ -23878,6 +23894,7 @@
</span><span class="cx">                                 29A812410FBB9C1D00510293 /* AccessibilityTableColumn.h in Headers */,
</span><span class="cx">                                 29A8123F0FBB9C1D00510293 /* AccessibilityTableHeaderContainer.h in Headers */,
</span><span class="cx">                                 29A812310FBB9C1D00510293 /* AccessibilityTableRow.h in Headers */,
</span><ins>+                                BC1790C11BBF2C430006D13E /* CSSVariableValue.h in Headers */,
</ins><span class="cx">                                 B5D31DFB11CF610B009F22B4 /* ActiveDOMCallback.h in Headers */,
</span><span class="cx">                                 E1C4DE690EA75C1E0023CCD6 /* ActiveDOMObject.h in Headers */,
</span><span class="cx">                                 BCF7E491137CD7C7001DDAE7 /* AdjustViewSizeOrNot.h in Headers */,
</span><span class="lines">@@ -27014,6 +27031,7 @@
</span><span class="cx">                                 5D5975B319635F1100D00878 /* SystemVersion.h in Headers */,
</span><span class="cx">                                 A8CFF0510A154F09000A4234 /* TableLayout.h in Headers */,
</span><span class="cx">                                 BCE3BEC30D222B1D007E06E4 /* TagNodeList.h in Headers */,
</span><ins>+                                BC1790BB1BB5AB3F0006D13E /* CSSVariableDependentValue.h in Headers */,
</ins><span class="cx">                                 F55B3DD61251F12D003EF269 /* TelephoneInputType.h in Headers */,
</span><span class="cx">                                 7CC564B818BABEA6001B9652 /* TelephoneNumberDetector.h in Headers */,
</span><span class="cx">                                 C65046A9167BFB5500CC2A4D /* TemplateContentDocumentFragment.h in Headers */,
</span><span class="lines">@@ -27787,6 +27805,7 @@
</span><span class="cx">                                 AAA728F916D1D8BC00D3BBC6 /* AXObjectCacheIOS.mm in Sources */,
</span><span class="cx">                                 29A8124B0FBB9CA900510293 /* AXObjectCacheMac.mm in Sources */,
</span><span class="cx">                                 BCA8C81F11E3D36900812FB7 /* BackForwardController.cpp in Sources */,
</span><ins>+                                BC1790C01BBF2C430006D13E /* CSSVariableValue.cpp in Sources */,
</ins><span class="cx">                                 BCA8CA5F11E4E6D100812FB7 /* BackForwardList.cpp in Sources */,
</span><span class="cx">                                 BC124EE70C2641CD009E2349 /* BarProp.cpp in Sources */,
</span><span class="cx">                                 379E61C9126CA5C300B63E8D /* BaseButtonInputType.cpp in Sources */,
</span><span class="lines">@@ -30376,6 +30395,7 @@
</span><span class="cx">                                 E180811216FCF42F00B80D07 /* SynchronousLoaderClient.cpp in Sources */,
</span><span class="cx">                                 E180811616FCF9CB00B80D07 /* SynchronousLoaderClient.mm in Sources */,
</span><span class="cx">                                 442ABCD617D9262F00D30715 /* SynchronousLoaderClientCFNet.cpp in Sources */,
</span><ins>+                                BC1790BD1BBB36A80006D13E /* CSSVariableDependentValue.cpp in Sources */,
</ins><span class="cx">                                 26FAE4CE1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.cpp in Sources */,
</span><span class="cx">                                 E45390AE0EAFF4B5003695C8 /* SystemMemoryIOS.cpp in Sources */,
</span><span class="cx">                                 CDA07FBD18E0A16A004699FA /* SystemSleepListener.cpp in Sources */,
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssCSSCalculationValuecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/css/CSSCalculationValue.cpp (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSCalculationValue.cpp        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSCalculationValue.cpp        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -137,6 +137,7 @@
</span><span class="cx"> case CSSPrimitiveValue::CSS_PARSER_OPERATOR:
</span><span class="cx"> case CSSPrimitiveValue::CSS_PARSER_HEXCOLOR:
</span><span class="cx"> case CSSPrimitiveValue::CSS_PARSER_IDENTIFIER:
</span><ins>+ case CSSPrimitiveValue::CSS_PARSER_WHITESPACE:
</ins><span class="cx"> case CSSPrimitiveValue::CSS_COUNTER_NAME:
</span><span class="cx"> case CSSPrimitiveValue::CSS_SHAPE:
</span><span class="cx"> case CSSPrimitiveValue::CSS_QUAD:
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssCSSComputedStyleDeclarationcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSComputedStyleDeclaration.cpp        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSComputedStyleDeclaration.cpp        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -1888,6 +1888,12 @@
</span><span class="cx"> Node* styledNode = this->styledNode();
</span><span class="cx"> if (!styledNode)
</span><span class="cx"> return nullptr;
</span><ins>+
+ if (updateStyleIfNeededForNode(*styledNode)) {
+ // The style recalc could have caused the styled node to be discarded or replaced
+ // if it was a PseudoElement so we need to update it.
+ styledNode = this->styledNode();
+ }
</ins><span class="cx">
</span><span class="cx"> RefPtr<RenderStyle> style = computeRenderStyleForProperty(styledNode, m_pseudoElementSpecifier, CSSPropertyCustom);
</span><span class="cx"> if (!style || !style->hasCustomProperty(propertyName))
</span><span class="lines">@@ -3391,8 +3397,7 @@
</span><span class="cx"> if (!style)
</span><span class="cx"> return 0;
</span><span class="cx">
</span><del>- const HashMap<AtomicString, RefPtr<CSSValue>>* customProperties = style->customProperties();
- return numComputedProperties + (customProperties ? customProperties->size() : 0);
</del><ins>+ return numComputedProperties + style->customProperties().size();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> String CSSComputedStyleDeclaration::item(unsigned i) const
</span><span class="lines">@@ -3413,12 +3418,12 @@
</span><span class="cx">
</span><span class="cx"> unsigned index = i - numComputedProperties;
</span><span class="cx">
</span><del>- const auto* customProperties = style->customProperties();
- if (!customProperties || index >= customProperties->size())
</del><ins>+ const auto& customProperties = style->customProperties();
+ if (index >= customProperties.size())
</ins><span class="cx"> return emptyString();
</span><span class="cx">
</span><span class="cx"> Vector<String, 4> results;
</span><del>- copyKeysToVector(*customProperties, results);
</del><ins>+ copyKeysToVector(customProperties, results);
</ins><span class="cx"> return results.at(index);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssCSSCustomPropertyValueh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/css/CSSCustomPropertyValue.h (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSCustomPropertyValue.h        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSCustomPropertyValue.h        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -28,22 +28,28 @@
</span><span class="cx">
</span><span class="cx"> #include "CSSParserValues.h"
</span><span class="cx"> #include "CSSValue.h"
</span><ins>+#include <wtf/RefPtr.h>
</ins><span class="cx"> #include <wtf/text/WTFString.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class CSSCustomPropertyValue : public CSSValue {
</span><span class="cx"> public:
</span><del>- static Ref<CSSCustomPropertyValue> create(const AtomicString& name, std::unique_ptr<CSSParserValueList>& valueList)
</del><ins>+ static Ref<CSSCustomPropertyValue> create(const AtomicString& name, RefPtr<CSSValue>& value)
</ins><span class="cx"> {
</span><del>- return adoptRef(*new CSSCustomPropertyValue(name, valueList));
</del><ins>+ return adoptRef(*new CSSCustomPropertyValue(name, value));
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ static Ref<CSSCustomPropertyValue> createInvalid()
+ {
+ return adoptRef(*new CSSCustomPropertyValue(emptyString(), emptyString()));
+ }
+
</ins><span class="cx"> String customCSSText() const
</span><span class="cx"> {
</span><span class="cx"> if (!m_serialized) {
</span><span class="cx"> m_serialized = true;
</span><del>- m_stringValue = m_parserValue ? m_parserValue->toString() : "";
</del><ins>+ m_stringValue = m_value ? m_value->cssText() : emptyString();
</ins><span class="cx"> }
</span><span class="cx"> return m_stringValue;
</span><span class="cx"> }
</span><span class="lines">@@ -54,18 +60,33 @@
</span><span class="cx"> // is rarely used, so serialization to compare is probably fine.
</span><span class="cx"> bool equals(const CSSCustomPropertyValue& other) const { return m_name == other.m_name && customCSSText() == other.customCSSText(); }
</span><span class="cx">
</span><ins>+ bool isInvalid() const { return !m_value; }
+ bool containsVariables() const { return m_containsVariables; }
+
+ const RefPtr<CSSValue> value() const { return m_value.get(); }
+
</ins><span class="cx"> private:
</span><del>- CSSCustomPropertyValue(const AtomicString& name, std::unique_ptr<CSSParserValueList>& valueList)
</del><ins>+ CSSCustomPropertyValue(const AtomicString& name, RefPtr<CSSValue>& value)
</ins><span class="cx"> : CSSValue(CustomPropertyClass)
</span><span class="cx"> , m_name(name)
</span><del>- , m_parserValue(WTF::move(valueList))
- , m_serialized(false)
</del><ins>+ , m_value(value)
+ , m_containsVariables(value && value->isVariableDependentValue())
+ , m_serialized(!value)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><ins>+
+ CSSCustomPropertyValue(const AtomicString& name, const String& serializedValue)
+ : CSSValue(CustomPropertyClass)
+ , m_name(name)
+ , m_stringValue(serializedValue)
+ , m_serialized(true)
+ {
+ }
</ins><span class="cx">
</span><span class="cx"> const AtomicString m_name;
</span><del>- std::unique_ptr<CSSParserValueList> m_parserValue;
</del><ins>+ RefPtr<CSSValue> m_value;
</ins><span class="cx"> mutable String m_stringValue;
</span><ins>+ bool m_containsVariables { false };
</ins><span class="cx"> mutable bool m_serialized;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssCSSFunctionValuecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/css/CSSFunctionValue.cpp (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSFunctionValue.cpp        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSFunctionValue.cpp        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -62,4 +62,19 @@
</span><span class="cx"> return m_name == other.m_name && compareCSSValuePtr(m_args, other.m_args);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool CSSFunctionValue::buildParserValueSubstitutingVariables(CSSParserValue* result, const CustomPropertyValueMap& customProperties) const
+{
+ result->id = CSSValueInvalid;
+ result->unit = CSSParserValue::Function;
+ result->function = new CSSParserFunction;
+ result->function->name.init(m_name);
+ bool success = true;
+ if (m_args) {
+ CSSParserValueList* argList = new CSSParserValueList;
+ success = m_args->buildParserValueListSubstitutingVariables(argList, customProperties);
+ result->function->args.reset(argList);
+ }
+ return success;
</ins><span class="cx"> }
</span><ins>+
+}
</ins></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssCSSFunctionValueh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/css/CSSFunctionValue.h (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSFunctionValue.h        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSFunctionValue.h        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx">
</span><span class="cx"> class CSSValueList;
</span><span class="cx"> struct CSSParserFunction;
</span><ins>+struct CSSParserValue;
</ins><span class="cx">
</span><span class="cx"> class CSSFunctionValue : public CSSValue {
</span><span class="cx"> public:
</span><span class="lines">@@ -51,6 +52,8 @@
</span><span class="cx">
</span><span class="cx"> CSSValueList* arguments() const { return m_args.get(); }
</span><span class="cx">
</span><ins>+ bool buildParserValueSubstitutingVariables(CSSParserValue*, const CustomPropertyValueMap& customProperties) const;
+
</ins><span class="cx"> private:
</span><span class="cx"> explicit CSSFunctionValue(CSSParserFunction*);
</span><span class="cx"> CSSFunctionValue(const String&, PassRefPtr<CSSValueList>);
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssCSSGrammaryin"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/css/CSSGrammar.y.in (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSGrammar.y.in        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSGrammar.y.in        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -63,6 +63,7 @@
</span><span class="cx"> case NTHCHILDFUNCTIONS:
</span><span class="cx"> case NTHCHILDSELECTORSEPARATOR:
</span><span class="cx"> case LANGFUNCTION:
</span><ins>+ case VARFUNCTION:
</ins><span class="cx"> #if ENABLE_CSS_SELECTORS_LEVEL4
</span><span class="cx"> case DIRFUNCTION:
</span><span class="cx"> case ROLEFUNCTION:
</span><span class="lines">@@ -103,9 +104,9 @@
</span><span class="cx"> %}
</span><span class="cx">
</span><span class="cx"> #if ENABLE_CSS_GRID_LAYOUT
</span><del>-%expect 32
</del><ins>+%expect 39
</ins><span class="cx"> #else
</span><del>-%expect 31
</del><ins>+%expect 37
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> %nonassoc LOWEST_PREC
</span><span class="lines">@@ -218,6 +219,7 @@
</span><span class="cx"> %token <string> MINFUNCTION
</span><span class="cx"> %token <string> NTHCHILDFUNCTIONS
</span><span class="cx"> %token <string> LANGFUNCTION
</span><ins>+%token <string> VARFUNCTION
</ins><span class="cx">
</span><span class="cx"> #if ENABLE_CSS_SELECTORS_LEVEL4
</span><span class="cx"> %token <string> DIRFUNCTION
</span><span class="lines">@@ -286,8 +288,8 @@
</span><span class="cx"> %type <value> calc_func_term key unary_term
</span><span class="cx">
</span><span class="cx"> // These parser values need to be destroyed because they might be functions.
</span><del>-%type <value> calc_function function min_or_max_function term
-%destructor { destroy($$); } calc_function function min_or_max_function term
</del><ins>+%type <value> calc_function function variable_function min_or_max_function term
+%destructor { destroy($$); } calc_function function variable_function min_or_max_function term
</ins><span class="cx">
</span><span class="cx"> %union { CSSPropertyID id; }
</span><span class="cx"> %type <id> property
</span><span class="lines">@@ -314,8 +316,8 @@
</span><span class="cx"> %type <character> operator calc_func_operator
</span><span class="cx">
</span><span class="cx"> %union { CSSParserValueList* valueList; }
</span><del>-%type <valueList> calc_func_expr calc_func_expr_list calc_func_paren_expr expr key_list maybe_media_value valid_calc_func_expr valid_expr
-%destructor { delete $$; } calc_func_expr calc_func_expr_list calc_func_paren_expr expr key_list maybe_media_value valid_calc_func_expr valid_expr
</del><ins>+%type <valueList> calc_func_expr calc_func_expr_list calc_func_paren_expr expr key_list maybe_media_value valid_calc_func_expr valid_expr whitespace_or_expr maybe_expr
+%destructor { delete $$; } calc_func_expr calc_func_expr_list calc_func_paren_expr expr key_list maybe_media_value valid_calc_func_expr valid_expr whitespace_or_expr maybe_expr
</ins><span class="cx">
</span><span class="cx"> %type <string> lang_range
</span><span class="cx"> %union { Vector<CSSParserString>* stringList; }
</span><span class="lines">@@ -771,6 +773,22 @@
</span><span class="cx"> }
</span><span class="cx"> p->markPropertyEnd($7, false);
</span><span class="cx"> }
</span><ins>+ |
+ '(' maybe_space CUSTOM_PROPERTY maybe_space ':' whitespace_or_expr priority ')' maybe_space {
+ $$ = false;
+ CSSParser* p = static_cast<CSSParser*>(parser);
+ std::unique_ptr<CSSParserValueList> propertyValue($6);
+ if (propertyValue) {
+ parser->m_valueList = WTF::move(propertyValue);
+ int oldParsedProperties = p->m_parsedProperties.size();
+ p->setCustomPropertyName($3);
+ $$ = p->parseValue(CSSPropertyCustom, $7);
+ if ($$)
+ p->rollbackLastProperties(p->m_parsedProperties.size() - oldParsedProperties);
+ p->m_valueList = nullptr;
+ }
+ p->markPropertyEnd($7, false);
+ }
</ins><span class="cx"> ;
</span><span class="cx">
</span><span class="cx"> before_keyframes_rule:
</span><span class="lines">@@ -1538,22 +1556,22 @@
</span><span class="cx"> ;
</span><span class="cx">
</span><span class="cx"> declaration:
</span><del>- CUSTOM_PROPERTY maybe_space ':' maybe_space expr priority {
</del><ins>+ CUSTOM_PROPERTY maybe_space ':' whitespace_or_expr priority {
</ins><span class="cx"> $$ = false;
</span><span class="cx"> bool isPropertyParsed = false;
</span><del>- std::unique_ptr<CSSParserValueList> propertyValue($5);
</del><ins>+ std::unique_ptr<CSSParserValueList> propertyValue($4);
</ins><span class="cx"> if (propertyValue) {
</span><span class="cx"> parser->m_valueList = WTF::move(propertyValue);
</span><span class="cx"> int oldParsedProperties = parser->m_parsedProperties.size();
</span><span class="cx"> parser->setCustomPropertyName($1);
</span><del>- $$ = parser->parseValue(CSSPropertyCustom, $6);
</del><ins>+ $$ = parser->parseValue(CSSPropertyCustom, $5);
</ins><span class="cx"> if (!$$)
</span><span class="cx"> parser->rollbackLastProperties(parser->m_parsedProperties.size() - oldParsedProperties);
</span><span class="cx"> else
</span><span class="cx"> isPropertyParsed = true;
</span><span class="cx"> parser->m_valueList = nullptr;
</span><span class="cx"> }
</span><del>- parser->markPropertyEnd($6, isPropertyParsed);
</del><ins>+ parser->markPropertyEnd($5, isPropertyParsed);
</ins><span class="cx"> }
</span><span class="cx"> | property ':' maybe_space expr priority {
</span><span class="cx"> $$ = false;
</span><span class="lines">@@ -1624,6 +1642,24 @@
</span><span class="cx">
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+whitespace_or_expr:
+ WHITESPACE maybe_expr {
+ if ($2)
+ $$ = $2;
+ else {
+ CSSParserValue val;
+ val.id = CSSValueInvalid;
+ val.unit = CSSPrimitiveValue::CSS_PARSER_WHITESPACE;
+ val.string.init(emptyString());
+ $$ = new CSSParserValueList;
+ $$->addValue(val);
+ }
+ }
+ | maybe_space expr { $$ = $2; }
+ ;
+
+maybe_expr: /* empty */ { $$ = nullptr; } | expr { $$ = $1; };
+
</ins><span class="cx"> expr: valid_expr | valid_expr expr_recovery { $$ = nullptr; delete $1; } ;
</span><span class="cx">
</span><span class="cx"> valid_expr:
</span><span class="lines">@@ -1667,6 +1703,7 @@
</span><span class="cx"> /* FIXME: according to the specs a function can have a unary_operator in front. I know no case where this makes sense */
</span><span class="cx"> | function maybe_space
</span><span class="cx"> | calc_function maybe_space
</span><ins>+ | variable_function maybe_space
</ins><span class="cx"> | min_or_max_function maybe_space
</span><span class="cx"> | '%' maybe_space { /* Handle width: %; */
</span><span class="cx"> $$.id = CSSValueInvalid; $$.unit = 0;
</span><span class="lines">@@ -1742,8 +1779,65 @@
</span><span class="cx"> }
</span><span class="cx"> ;
</span><span class="cx">
</span><ins>+variable_function:
+ VARFUNCTION maybe_space CUSTOM_PROPERTY maybe_space closing_parenthesis {
+ CSSParserVariable* var = new CSSParserVariable;
+ var->name = $3;
+ var->args = nullptr;
+ $$.id = CSSValueInvalid;
+ $$.unit = CSSParserValue::Variable;
+ $$.variable = var;
+ }
+ | VARFUNCTION maybe_space CUSTOM_PROPERTY maybe_space ',' maybe_space expr closing_parenthesis {
+ CSSParserVariable* var = new CSSParserVariable;
+ var->name = $3;
+ var->args = std::unique_ptr<CSSParserValueList>($7);
+ $$.id = CSSValueInvalid;
+ $$.unit = CSSParserValue::Variable;
+ $$.variable = var;
+ }
+ | VARFUNCTION maybe_space CUSTOM_PROPERTY maybe_space ',' maybe_space closing_parenthesis {
+ CSSParserVariable* var = new CSSParserVariable;
+ var->name = $3;
+ var->args = std::unique_ptr<CSSParserValueList>(new CSSParserValueList());
+ $$.id = CSSValueInvalid;
+ $$.unit = CSSParserValue::Variable;
+ $$.variable = var;
+ }
+ // Error handling cases
+ | VARFUNCTION maybe_space CUSTOM_PROPERTY maybe_space ',' closing_parenthesis {
+ $$.id = CSSValueInvalid;
+ $$.unit = 0;
+ YYERROR;
+ }
+ | VARFUNCTION maybe_space CUSTOM_PROPERTY maybe_space ',' maybe_space invalid_var_fallback maybe_space closing_parenthesis {
+ $$.id = CSSValueInvalid;
+ $$.unit = 0;
+ YYERROR;
+ }
+ | VARFUNCTION maybe_space CUSTOM_PROPERTY maybe_space ',' maybe_space priority closing_parenthesis {
+ $$.id = CSSValueInvalid;
+ $$.unit = 0;
+ YYERROR;
+ }
+ | VARFUNCTION maybe_space expr closing_parenthesis {
+ $$.id = CSSValueInvalid;
+ $$.unit = 0;
+ YYERROR;
+ }
+ | VARFUNCTION maybe_space expr_recovery closing_parenthesis {
+ $$.id = CSSValueInvalid;
+ $$.unit = 0;
+ YYERROR;
+ }
+ ;
+
+invalid_var_fallback:
+ '!' | ';';
+
</ins><span class="cx"> calc_func_term:
</span><span class="cx"> unary_term
</span><ins>+ | variable_function { $$ = $1; }
</ins><span class="cx"> | unary_operator unary_term { $$ = $2; $$.fValue *= $1; }
</span><span class="cx"> ;
</span><span class="cx">
</span><span class="lines">@@ -1893,7 +1987,7 @@
</span><span class="cx"> invalid_parentheses_block: opening_parenthesis error_recovery closing_parenthesis;
</span><span class="cx">
</span><span class="cx"> opening_parenthesis:
</span><del>- '(' | FUNCTION | CALCFUNCTION | MATCHESFUNCTION | MAXFUNCTION | MINFUNCTION | ANYFUNCTION | NOTFUNCTION | LANGFUNCTION
</del><ins>+ '(' | FUNCTION | VARFUNCTION | CALCFUNCTION | MATCHESFUNCTION | MAXFUNCTION | MINFUNCTION | ANYFUNCTION | NOTFUNCTION | LANGFUNCTION
</ins><span class="cx"> #if ENABLE_CSS_SELECTORS_LEVEL4
</span><span class="cx"> | DIRFUNCTION | ROLEFUNCTION
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssCSSParsercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/css/CSSParser.cpp (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSParser.cpp        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSParser.cpp        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -65,6 +65,7 @@
</span><span class="cx"> #include "CSSValueKeywords.h"
</span><span class="cx"> #include "CSSValueList.h"
</span><span class="cx"> #include "CSSValuePool.h"
</span><ins>+#include "CSSVariableDependentValue.h"
</ins><span class="cx"> #include "Counter.h"
</span><span class="cx"> #include "Document.h"
</span><span class="cx"> #include "FloatConversion.h"
</span><span class="lines">@@ -1591,11 +1592,13 @@
</span><span class="cx"> continue;
</span><span class="cx">
</span><span class="cx"> if (property.id() == CSSPropertyCustom) {
</span><del>- const AtomicString& name = downcast<CSSCustomPropertyValue>(*property.value()).name();
- if (seenCustomProperties.contains(name))
- continue;
- seenCustomProperties.add(name);
- output[--unusedEntries] = property;
</del><ins>+ if (property.value()) {
+ const AtomicString& name = downcast<CSSCustomPropertyValue>(*property.value()).name();
+ if (seenCustomProperties.contains(name))
+ continue;
+ seenCustomProperties.add(name);
+ output[--unusedEntries] = property;
+ }
</ins><span class="cx"> continue;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1897,20 +1900,38 @@
</span><span class="cx"> addProperty(longhands[i], value, important);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+RefPtr<CSSValue> CSSParser::parseVariableDependentValue(CSSPropertyID propID, const CSSVariableDependentValue& dependentValue, const CustomPropertyValueMap& customProperties)
+{
+ m_valueList.reset(new CSSParserValueList());
+ if (!dependentValue.valueList()->buildParserValueListSubstitutingVariables(m_valueList.get(), customProperties))
+ return nullptr;
+ bool parsed = parseValue(dependentValue.propertyID(), false);
+ if (!parsed)
+ return nullptr;
+ for (size_t i = 0; i < m_parsedProperties.size(); ++i) {
+ if (m_parsedProperties[i].id() == propID)
+ return m_parsedProperties[i].value();
+ }
+ return nullptr;
+}
+
</ins><span class="cx"> bool CSSParser::parseValue(CSSPropertyID propId, bool important)
</span><span class="cx"> {
</span><span class="cx"> if (!m_valueList || !m_valueList->current())
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (propId == CSSPropertyCustom) {
- // FIXME: For now put this ahead of inherit/initial processing.
- // Eventually we want to support initial and inherit.
- return parseCustomPropertyDeclaration(important);
- }
-
</del><span class="cx"> ValueWithCalculation valueWithCalculation(*m_valueList->current());
</span><span class="cx"> CSSValueID id = valueWithCalculation.value().id;
</span><ins>+
+ if (propId == CSSPropertyCustom)
+ return parseCustomPropertyDeclaration(important, id);
</ins><span class="cx">
</span><ins>+ if (m_valueList->containsVariables()) {
+ RefPtr<CSSValueList> valueList = CSSValueList::createFromParserValueList(*m_valueList);
+ addExpandedPropertyForValue(propId, CSSVariableDependentValue::create(valueList, propId), important);
+ return true;
+ }
+
</ins><span class="cx"> unsigned num = inShorthand() ? 1 : m_valueList->size();
</span><span class="cx">
</span><span class="cx"> if (id == CSSValueInherit) {
</span><span class="lines">@@ -4128,11 +4149,26 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool CSSParser::parseCustomPropertyDeclaration(bool important)
</del><ins>+bool CSSParser::parseCustomPropertyDeclaration(bool important, CSSValueID id)
</ins><span class="cx"> {
</span><span class="cx"> if (m_customPropertyName.isEmpty() || !m_valueList)
</span><span class="cx"> return false;
</span><del>- addProperty(CSSPropertyCustom, CSSCustomPropertyValue::create(m_customPropertyName, m_valueList), important, false);
</del><ins>+
+ auto& cssValuePool = CSSValuePool::singleton();
+ RefPtr<CSSValue> value;
+ if (id == CSSValueInherit)
+ value = cssValuePool.createInheritedValue();
+ else if (id == CSSValueInitial)
+ value = cssValuePool.createExplicitInitialValue();
+ else {
+ RefPtr<CSSValueList> valueList = CSSValueList::createFromParserValueList(*m_valueList);
+ if (m_valueList->containsVariables())
+ value = CSSVariableDependentValue::create(valueList, CSSPropertyCustom);
+ else
+ value = valueList;
+ }
+
+ addProperty(CSSPropertyCustom, CSSCustomPropertyValue::create(m_customPropertyName, value), important, false);
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -11280,6 +11316,10 @@
</span><span class="cx"> m_token = URI;
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><ins>+ if (isASCIIAlphaCaselessEqual(name[0], 'v') && isASCIIAlphaCaselessEqual(name[1], 'a') && isASCIIAlphaCaselessEqual(name[2], 'r')) {
+ m_token = VARFUNCTION;
+ return true;
+ }
</ins><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx"> if (isASCIIAlphaCaselessEqual(name[0], 'c') && isASCIIAlphaCaselessEqual(name[1], 'u') && isASCIIAlphaCaselessEqual(name[2], 'e')) {
</span><span class="cx"> m_token = CUEFUNCTION;
</span><span class="lines">@@ -11968,14 +12008,14 @@
</span><span class="cx"> }
</span><span class="cx"> resultString.setLength(result - tokenStart<SrcCharacterType>());
</span><span class="cx"> yylval->string = resultString;
</span><del>- } else if (currentCharacter<SrcCharacterType>()[0] == '-' && isIdentifierStartAfterDash(currentCharacter<SrcCharacterType>() + 1)) {
</del><ins>+ } else if (currentCharacter<SrcCharacterType>()[0] == '-' && currentCharacter<SrcCharacterType>()[1] == '>') {
+ currentCharacter<SrcCharacterType>() += 2;
+ m_token = SGML_CD;
+ } else if (currentCharacter<SrcCharacterType>()[0] == '-') {
</ins><span class="cx"> --currentCharacter<SrcCharacterType>();
</span><span class="cx"> parseIdentifier(result, resultString, hasEscape);
</span><span class="cx"> m_token = CUSTOM_PROPERTY;
</span><span class="cx"> yylval->string = resultString;
</span><del>- } else if (currentCharacter<SrcCharacterType>()[0] == '-' && currentCharacter<SrcCharacterType>()[1] == '>') {
- currentCharacter<SrcCharacterType>() += 2;
- m_token = SGML_CD;
</del><span class="cx"> } else if (UNLIKELY(m_parsingMode == NthChildMode)) {
</span><span class="cx"> // "-[0-9]+n" is always an NthChild.
</span><span class="cx"> if (parseNthChild<SrcCharacterType>()) {
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssCSSParserh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/css/CSSParser.h (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSParser.h        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSParser.h        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -57,6 +57,7 @@
</span><span class="cx"> class CSSBasicShape;
</span><span class="cx"> class CSSBasicShapeInset;
</span><span class="cx"> class CSSGridLineNamesValue;
</span><ins>+class CSSVariableDependentValue;
</ins><span class="cx"> class Document;
</span><span class="cx"> class Element;
</span><span class="cx"> class ImmutableStyleProperties;
</span><span class="lines">@@ -144,7 +145,7 @@
</span><span class="cx"> bool parseQuotes(CSSPropertyID, bool important);
</span><span class="cx"> bool parseAlt(CSSPropertyID, bool important);
</span><span class="cx">
</span><del>- bool parseCustomPropertyDeclaration(bool important);
</del><ins>+ bool parseCustomPropertyDeclaration(bool important, CSSValueID);
</ins><span class="cx">
</span><span class="cx"> PassRefPtr<CSSValue> parseAttr(CSSParserValueList& args);
</span><span class="cx"> PassRefPtr<CSSValue> parseBackgroundColor();
</span><span class="lines">@@ -467,6 +468,8 @@
</span><span class="cx">
</span><span class="cx"> void setCustomPropertyName(const AtomicString& propertyName) { m_customPropertyName = propertyName; }
</span><span class="cx">
</span><ins>+ RefPtr<CSSValue> parseVariableDependentValue(CSSPropertyID, const CSSVariableDependentValue&, const CustomPropertyValueMap& customProperties);
+
</ins><span class="cx"> private:
</span><span class="cx"> bool is8BitSource() { return m_is8BitSource; }
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssCSSParserValuescpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/css/CSSParserValues.cpp (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSParserValues.cpp        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSParserValues.cpp        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -21,10 +21,12 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "CSSParserValues.h"
</span><span class="cx">
</span><ins>+#include "CSSCustomPropertyValue.h"
</ins><span class="cx"> #include "CSSPrimitiveValue.h"
</span><span class="cx"> #include "CSSFunctionValue.h"
</span><span class="cx"> #include "CSSSelector.h"
</span><span class="cx"> #include "CSSSelectorList.h"
</span><ins>+#include "CSSVariableValue.h"
</ins><span class="cx"> #include "SelectorPseudoTypeMap.h"
</span><span class="cx"> #include <wtf/text/StringBuilder.h>
</span><span class="cx">
</span><span class="lines">@@ -67,22 +69,19 @@
</span><span class="cx"> m_values.append(*(valueList.valueAt(i)));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-String CSSParserValueList::toString()
</del><ins>+bool CSSParserValueList::containsVariables() const
</ins><span class="cx"> {
</span><del>- // Build up a set of CSSValues and serialize them using cssText, separating multiple values
- // with spaces.
- // FIXME: Teach CSSParserValues how to serialize so that we don't have to create CSSValues
- // just to perform this serialization.
- StringBuilder builder;
</del><span class="cx"> for (unsigned i = 0; i < size(); i++) {
</span><del>- if (i)
- builder.append(' ');
- RefPtr<CSSValue> cssValue = valueAt(i)->createCSSValue();
- if (!cssValue)
- return "";
- builder.append(cssValue->cssText());
</del><ins>+ auto* parserValue = &m_values[i];
+ if (parserValue->unit == CSSParserValue::Variable)
+ return true;
+ if (parserValue->unit == CSSParserValue::Function && parserValue->function->args
+ && parserValue->function->args->containsVariables())
+ return true;
+ if (parserValue->unit == CSSParserValue::ValueList && parserValue->valueList->containsVariables())
+ return true;
</ins><span class="cx"> }
</span><del>- return builder.toString().lower();
</del><ins>+ return false;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> PassRefPtr<CSSValue> CSSParserValue::createCSSValue()
</span><span class="lines">@@ -98,8 +97,11 @@
</span><span class="cx"> }
</span><span class="cx"> if (unit == CSSParserValue::Function)
</span><span class="cx"> return CSSFunctionValue::create(function);
</span><ins>+ if (unit == CSSParserValue::Variable)
+ return CSSVariableValue::create(variable);
</ins><span class="cx"> if (unit == CSSParserValue::ValueList)
</span><span class="cx"> return CSSValueList::createFromParserValueList(*valueList);
</span><ins>+
</ins><span class="cx"> if (unit >= CSSParserValue::Q_EMS)
</span><span class="cx"> return CSSPrimitiveValue::createAllowingMarginQuirk(fValue, CSSPrimitiveValue::CSS_EMS);
</span><span class="cx">
</span><span class="lines">@@ -114,6 +116,9 @@
</span><span class="cx"> case CSSPrimitiveValue::CSS_STRING:
</span><span class="cx"> case CSSPrimitiveValue::CSS_URI:
</span><span class="cx"> case CSSPrimitiveValue::CSS_PARSER_HEXCOLOR:
</span><ins>+ case CSSPrimitiveValue::CSS_DIMENSION:
+ case CSSPrimitiveValue::CSS_UNICODE_RANGE:
+ case CSSPrimitiveValue::CSS_PARSER_WHITESPACE:
</ins><span class="cx"> return CSSPrimitiveValue::create(string, primitiveUnit);
</span><span class="cx"> case CSSPrimitiveValue::CSS_PERCENTAGE:
</span><span class="cx"> case CSSPrimitiveValue::CSS_EMS:
</span><span class="lines">@@ -141,7 +146,6 @@
</span><span class="cx"> case CSSPrimitiveValue::CSS_FR:
</span><span class="cx"> return CSSPrimitiveValue::create(fValue, primitiveUnit);
</span><span class="cx"> case CSSPrimitiveValue::CSS_UNKNOWN:
</span><del>- case CSSPrimitiveValue::CSS_DIMENSION:
</del><span class="cx"> case CSSPrimitiveValue::CSS_ATTR:
</span><span class="cx"> case CSSPrimitiveValue::CSS_COUNTER:
</span><span class="cx"> case CSSPrimitiveValue::CSS_RECT:
</span><span class="lines">@@ -153,7 +157,6 @@
</span><span class="cx"> #if ENABLE(DASHBOARD_SUPPORT)
</span><span class="cx"> case CSSPrimitiveValue::CSS_DASHBOARD_REGION:
</span><span class="cx"> #endif
</span><del>- case CSSPrimitiveValue::CSS_UNICODE_RANGE:
</del><span class="cx"> case CSSPrimitiveValue::CSS_PARSER_OPERATOR:
</span><span class="cx"> case CSSPrimitiveValue::CSS_PARSER_INTEGER:
</span><span class="cx"> case CSSPrimitiveValue::CSS_PARSER_IDENTIFIER:
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssCSSParserValuesh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/css/CSSParserValues.h (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSParserValues.h        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSParserValues.h        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> #include "CSSValueKeywords.h"
</span><span class="cx"> #include "CSSValueList.h"
</span><span class="cx"> #include <wtf/text/AtomicString.h>
</span><ins>+#include <wtf/text/AtomicStringHash.h>
</ins><span class="cx"> #include <wtf/text/WTFString.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -104,6 +105,7 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> struct CSSParserFunction;
</span><ins>+struct CSSParserVariable;
</ins><span class="cx">
</span><span class="cx"> struct CSSParserValue {
</span><span class="cx"> CSSValueID id;
</span><span class="lines">@@ -113,6 +115,7 @@
</span><span class="cx"> int iValue;
</span><span class="cx"> CSSParserString string;
</span><span class="cx"> CSSParserFunction* function;
</span><ins>+ CSSParserVariable* variable;
</ins><span class="cx"> CSSParserValueList* valueList;
</span><span class="cx"> };
</span><span class="cx"> enum {
</span><span class="lines">@@ -120,6 +123,7 @@
</span><span class="cx"> Function = 0x100001,
</span><span class="cx"> ValueList = 0x100002,
</span><span class="cx"> Q_EMS = 0x100003,
</span><ins>+ Variable = 0x100004
</ins><span class="cx"> };
</span><span class="cx"> int unit;
</span><span class="cx">
</span><span class="lines">@@ -167,6 +171,8 @@
</span><span class="cx"> void clear() { m_values.clear(); }
</span><span class="cx">
</span><span class="cx"> String toString();
</span><ins>+
+ bool containsVariables() const;
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> unsigned m_current;
</span><span class="lines">@@ -180,6 +186,13 @@
</span><span class="cx"> std::unique_ptr<CSSParserValueList> args;
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+struct CSSParserVariable {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ CSSParserString name; // The custom property name
+ std::unique_ptr<CSSParserValueList> args; // The fallback args
+};
+
</ins><span class="cx"> enum class CSSParserSelectorCombinator {
</span><span class="cx"> Child,
</span><span class="cx"> DescendantSpace,
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssCSSPrimitiveValuecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/css/CSSPrimitiveValue.cpp (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSPrimitiveValue.cpp        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSPrimitiveValue.cpp        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -117,6 +117,7 @@
</span><span class="cx"> case CSSPrimitiveValue::CSS_PARSER_IDENTIFIER:
</span><span class="cx"> case CSSPrimitiveValue::CSS_PARSER_INTEGER:
</span><span class="cx"> case CSSPrimitiveValue::CSS_PARSER_OPERATOR:
</span><ins>+ case CSSPrimitiveValue::CSS_PARSER_WHITESPACE:
</ins><span class="cx"> case CSSPrimitiveValue::CSS_RECT:
</span><span class="cx"> case CSSPrimitiveValue::CSS_QUAD:
</span><span class="cx"> #if ENABLE(CSS_SCROLL_SNAP)
</span><span class="lines">@@ -452,6 +453,7 @@
</span><span class="cx"> case CSS_ATTR:
</span><span class="cx"> case CSS_COUNTER_NAME:
</span><span class="cx"> case CSS_PARSER_HEXCOLOR:
</span><ins>+ case CSS_PARSER_WHITESPACE:
</ins><span class="cx"> if (m_value.string)
</span><span class="cx"> m_value.string->deref();
</span><span class="cx"> break;
</span><span class="lines">@@ -1169,7 +1171,9 @@
</span><span class="cx"> return String(&c, 1U);
</span><span class="cx"> }
</span><span class="cx"> case CSS_PARSER_IDENTIFIER:
</span><del>- return quoteCSSStringIfNeeded(m_value.string);
</del><ins>+ return m_value.string;
+ case CSS_PARSER_WHITESPACE:
+ return " ";
</ins><span class="cx"> case CSS_CALC:
</span><span class="cx"> return m_value.calc->cssText();
</span><span class="cx"> case CSS_SHAPE:
</span><span class="lines">@@ -1304,6 +1308,7 @@
</span><span class="cx"> case CSS_UNKNOWN:
</span><span class="cx"> case CSS_PARSER_OPERATOR:
</span><span class="cx"> case CSS_PARSER_IDENTIFIER:
</span><ins>+ case CSS_PARSER_WHITESPACE:
</ins><span class="cx"> case CSS_PARSER_HEXCOLOR:
</span><span class="cx"> ASSERT_NOT_REACHED();
</span><span class="cx"> break;
</span><span class="lines">@@ -1363,6 +1368,7 @@
</span><span class="cx"> case CSS_COUNTER_NAME:
</span><span class="cx"> case CSS_PARSER_IDENTIFIER:
</span><span class="cx"> case CSS_PARSER_HEXCOLOR:
</span><ins>+ case CSS_PARSER_WHITESPACE:
</ins><span class="cx"> return equal(m_value.string, other.m_value.string);
</span><span class="cx"> case CSS_COUNTER:
</span><span class="cx"> return m_value.counter && other.m_value.counter && m_value.counter->equals(*other.m_value.counter);
</span><span class="lines">@@ -1394,4 +1400,76 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool CSSPrimitiveValue::buildParserValue(CSSParserValue* result) const
+{
+ switch (m_primitiveUnitType) {
+ case CSS_VALUE_ID:
+ result->id = m_value.valueID;
+ result->unit = CSSPrimitiveValue::CSS_IDENT;
+ result->string.init(valueName(m_value.valueID));
+ break;
+ case CSS_PARSER_IDENTIFIER:
+ result->id = CSSValueInvalid;
+ result->unit = CSSPrimitiveValue::CSS_IDENT;
+ result->string.init(m_value.string);
+ break;
+ case CSS_NUMBER:
+ case CSS_PERCENTAGE:
+ case CSS_EMS:
+ case CSS_EXS:
+ case CSS_REMS:
+ case CSS_PX:
+ case CSS_CM:
+#if ENABLE(CSS_IMAGE_RESOLUTION) || ENABLE(RESOLUTION_MEDIA_QUERY)
+ case CSS_DPPX:
+ case CSS_DPI:
+ case CSS_DPCM:
+#endif
+ case CSS_MM:
+ case CSS_IN:
+ case CSS_PT:
+ case CSS_PC:
+ case CSS_DEG:
+ case CSS_RAD:
+ case CSS_GRAD:
+ case CSS_MS:
+ case CSS_S:
+ case CSS_HZ:
+ case CSS_KHZ:
+ case CSS_TURN:
+ case CSS_VW:
+ case CSS_VH:
+ case CSS_VMIN:
+ case CSS_DIMENSION:
+ case CSS_FR:
+ result->fValue = m_value.num;
+ result->unit = m_primitiveUnitType;
+ break;
+ case CSS_PARSER_INTEGER:
+ result->fValue = m_value.num;
+ result->unit = CSSPrimitiveValue::CSS_NUMBER;
+ result->isInt = true;
+ break;
+ case CSS_PARSER_OPERATOR:
+ result->iValue = m_value.parserOperator;
+ result->unit = CSSParserValue::Operator;
+ break;
+ case CSS_STRING:
+ case CSS_URI:
+ case CSS_ATTR:
+ case CSS_COUNTER_NAME:
+ case CSS_PARSER_HEXCOLOR:
+ result->string.init(m_value.string);
+ result->unit = m_primitiveUnitType;
+ break;
+ case CSS_PARSER_WHITESPACE:
+ return false;
+ default:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+
+ return true;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssCSSPrimitiveValueh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/css/CSSPrimitiveValue.h (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSPrimitiveValue.h        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSPrimitiveValue.h        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> class Rect;
</span><span class="cx"> class RenderStyle;
</span><span class="cx"> class CSSBasicShape;
</span><ins>+struct CSSParserValue;
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(CSS_SCROLL_SNAP)
</span><span class="cx"> class LengthRepeat;
</span><span class="lines">@@ -153,7 +154,10 @@
</span><span class="cx"> CSS_FONT_FAMILY = 116,
</span><span class="cx">
</span><span class="cx"> CSS_PROPERTY_ID = 117,
</span><del>- CSS_VALUE_ID = 118
</del><ins>+ CSS_VALUE_ID = 118,
+
+ // More internal parse stuff for CSS variables
+ CSS_PARSER_WHITESPACE = 119
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> // This enum follows the CSSParser::Units enum augmented with UNIT_FREQUENCY for frequencies.
</span><span class="lines">@@ -232,6 +236,9 @@
</span><span class="cx"> bool isViewportPercentageMin() const { return m_primitiveUnitType == CSS_VMIN; }
</span><span class="cx"> bool isValueID() const { return m_primitiveUnitType == CSS_VALUE_ID; }
</span><span class="cx"> bool isFlex() const { return primitiveType() == CSS_FR; }
</span><ins>+
+ bool isParserOperator() const { return primitiveType() == CSS_PARSER_OPERATOR; }
+ int parserOperator() const { return isParserOperator() ? m_value.parserOperator : 0; }
</ins><span class="cx">
</span><span class="cx"> static Ref<CSSPrimitiveValue> createIdentifier(CSSValueID valueID) { return adoptRef(*new CSSPrimitiveValue(valueID)); }
</span><span class="cx"> static Ref<CSSPrimitiveValue> createIdentifier(CSSPropertyID propertyID) { return adoptRef(*new CSSPrimitiveValue(propertyID)); }
</span><span class="lines">@@ -266,7 +273,9 @@
</span><span class="cx"> unsigned short primitiveType() const;
</span><span class="cx">
</span><span class="cx"> double computeDegrees() const;
</span><del>-
</del><ins>+
+ bool buildParserValue(CSSParserValue*) const;
+
</ins><span class="cx"> enum TimeUnit { Seconds, Milliseconds };
</span><span class="cx"> template <typename T, TimeUnit timeUnit> T computeTime() const
</span><span class="cx"> {
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssCSSValuecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/css/CSSValue.cpp (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSValue.cpp        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSValue.cpp        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -55,6 +55,8 @@
</span><span class="cx"> #include "CSSTimingFunctionValue.h"
</span><span class="cx"> #include "CSSUnicodeRangeValue.h"
</span><span class="cx"> #include "CSSValueList.h"
</span><ins>+#include "CSSVariableDependentValue.h"
+#include "CSSVariableValue.h"
</ins><span class="cx"> #include "SVGColor.h"
</span><span class="cx"> #include "SVGPaint.h"
</span><span class="cx"> #include "WebKitCSSFilterValue.h"
</span><span class="lines">@@ -239,7 +241,10 @@
</span><span class="cx"> return compareCSSValues<CSSContentDistributionValue>(*this, other);
</span><span class="cx"> case CustomPropertyClass:
</span><span class="cx"> return compareCSSValues<CSSCustomPropertyValue>(*this, other);
</span><del>-
</del><ins>+ case VariableDependentClass:
+ return compareCSSValues<CSSVariableDependentValue>(*this, other);
+ case VariableClass:
+ return compareCSSValues<CSSVariableValue>(*this, other);
</ins><span class="cx"> default:
</span><span class="cx"> ASSERT_NOT_REACHED();
</span><span class="cx"> return false;
</span><span class="lines">@@ -336,6 +341,10 @@
</span><span class="cx"> return downcast<CSSContentDistributionValue>(*this).customCSSText();
</span><span class="cx"> case CustomPropertyClass:
</span><span class="cx"> return downcast<CSSCustomPropertyValue>(*this).customCSSText();
</span><ins>+ case VariableDependentClass:
+ return downcast<CSSVariableDependentValue>(*this).customCSSText();
+ case VariableClass:
+ return downcast<CSSVariableValue>(*this).customCSSText();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ASSERT_NOT_REACHED();
</span><span class="lines">@@ -463,6 +472,12 @@
</span><span class="cx"> case CustomPropertyClass:
</span><span class="cx"> delete downcast<CSSCustomPropertyValue>(this);
</span><span class="cx"> return;
</span><ins>+ case VariableDependentClass:
+ delete downcast<CSSVariableDependentValue>(this);
+ return;
+ case VariableClass:
+ delete downcast<CSSVariableValue>(this);
+ return;
</ins><span class="cx"> }
</span><span class="cx"> ASSERT_NOT_REACHED();
</span><span class="cx"> }
</span><span class="lines">@@ -495,4 +510,9 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool CSSValue::isInvalidCustomPropertyValue() const
+{
+ return isCustomPropertyValue() && downcast<CSSCustomPropertyValue>(*this).isInvalid();
</ins><span class="cx"> }
</span><ins>+
+}
</ins></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssCSSValueh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/css/CSSValue.h (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSValue.h        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSValue.h        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -60,6 +60,7 @@
</span><span class="cx"> Type cssValueType() const;
</span><span class="cx">
</span><span class="cx"> String cssText() const;
</span><ins>+
</ins><span class="cx"> void setCssText(const String&, ExceptionCode&) { } // FIXME: Not implemented.
</span><span class="cx">
</span><span class="cx"> bool isPrimitiveValue() const { return m_classType == PrimitiveClass; }
</span><span class="lines">@@ -74,6 +75,9 @@
</span><span class="cx"> bool isCrossfadeValue() const { return m_classType == CrossfadeClass; }
</span><span class="cx"> bool isCursorImageValue() const { return m_classType == CursorImageClass; }
</span><span class="cx"> bool isCustomPropertyValue() const { return m_classType == CustomPropertyClass; }
</span><ins>+ bool isInvalidCustomPropertyValue() const;
+ bool isVariableDependentValue() const { return m_classType == VariableDependentClass; }
+ bool isVariableValue() const { return m_classType == VariableClass; }
</ins><span class="cx"> bool isFunctionValue() const { return m_classType == FunctionClass; }
</span><span class="cx"> bool isFontFeatureValue() const { return m_classType == FontFeatureClass; }
</span><span class="cx"> bool isFontFaceSrcValue() const { return m_classType == FontFaceSrcClass; }
</span><span class="lines">@@ -178,7 +182,9 @@
</span><span class="cx">
</span><span class="cx"> CSSContentDistributionClass,
</span><span class="cx"> CustomPropertyClass,
</span><del>-
</del><ins>+ VariableDependentClass,
+ VariableClass,
+
</ins><span class="cx"> // List class types must appear after ValueListClass.
</span><span class="cx"> ValueListClass,
</span><span class="cx"> #if ENABLE(CSS_IMAGE_SET)
</span><span class="lines">@@ -235,6 +241,8 @@
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> unsigned m_classType : ClassTypeBits; // ClassType
</span><ins>+
+friend class CSSValueList;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> template<typename CSSValueType>
</span><span class="lines">@@ -266,6 +274,8 @@
</span><span class="cx"> return first.get().equals(second);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+typedef HashMap<AtomicString, RefPtr<CSSValue>> CustomPropertyValueMap;
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #define SPECIALIZE_TYPE_TRAITS_CSS_VALUE(ToValueTypeName, predicate) \
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssCSSValueListcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/css/CSSValueList.cpp (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSValueList.cpp        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSValueList.cpp        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -21,7 +21,11 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "CSSValueList.h"
</span><span class="cx">
</span><ins>+#include "CSSFunctionValue.h"
</ins><span class="cx"> #include "CSSParserValues.h"
</span><ins>+#include "CSSPrimitiveValue.h"
+#include "CSSVariableDependentValue.h"
+#include "CSSVariableValue.h"
</ins><span class="cx"> #include <wtf/text/StringBuilder.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -114,7 +118,13 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> for (auto& value : m_values) {
</span><del>- if (!result.isEmpty())
</del><ins>+ bool suppressSeparator = false;
+ if (m_valueListSeparator == SpaceSeparator && value->isPrimitiveValue()) {
+ auto* primitiveValue = &downcast<CSSPrimitiveValue>(*value.ptr());
+ if (primitiveValue->parserOperator() == ',')
+ suppressSeparator = true;
+ }
+ if (!suppressSeparator && !result.isEmpty())
</ins><span class="cx"> result.append(separator);
</span><span class="cx"> result.append(value.get().cssText());
</span><span class="cx"> }
</span><span class="lines">@@ -174,4 +184,100 @@
</span><span class="cx"> return adoptRef(new CSSValueList(*this));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+
+bool CSSValueList::containsVariables() const
+{
+ for (unsigned i = 0; i < m_values.size(); i++) {
+ if (m_values[i]->isVariableValue())
+ return true;
+ if (m_values[i]->isFunctionValue()) {
+ auto& functionValue = downcast<CSSFunctionValue>(*item(i));
+ CSSValueList* args = functionValue.arguments();
+ if (args && args->containsVariables())
+ return true;
+ } else if (m_values[i]->isValueList()) {
+ auto& listValue = downcast<CSSValueList>(*item(i));
+ if (listValue.containsVariables())
+ return true;
+ }
+ }
+ return false;
+}
+
+bool CSSValueList::checkVariablesForCycles(CustomPropertyValueMap& customProperties, HashSet<AtomicString>& seenProperties, HashSet<AtomicString>& invalidProperties) const
+{
+ for (unsigned i = 0; i < m_values.size(); i++) {
+ auto* value = item(i);
+ if (value->isVariableValue()) {
+ auto& variableValue = downcast<CSSVariableValue>(*value);
+ if (seenProperties.contains(variableValue.name()))
+ return false;
+ RefPtr<CSSValue> value = customProperties.get(variableValue.name());
+ if (value && value->isVariableDependentValue() && !downcast<CSSVariableDependentValue>(*value).checkVariablesForCycles(variableValue.name(), customProperties, seenProperties, invalidProperties))
+ return false;
+
+ // Have to check the fallback values.
+ auto* fallbackArgs = variableValue.fallbackArguments();
+ if (!fallbackArgs || !fallbackArgs->length())
+ continue;
+
+ if (!fallbackArgs->checkVariablesForCycles(customProperties, seenProperties, invalidProperties))
+ return false;
+ } else if (value->isFunctionValue()) {
+ auto& functionValue = downcast<CSSFunctionValue>(*value);
+ auto* args = functionValue.arguments();
+ if (args && !args->checkVariablesForCycles(customProperties, seenProperties, invalidProperties))
+ return false;
+ } else if (value->isValueList()) {
+ auto& listValue = downcast<CSSValueList>(*value);
+ if (!listValue.checkVariablesForCycles(customProperties, seenProperties, invalidProperties))
+ return false;
+ }
+ }
+ return true;
+}
+
+bool CSSValueList::buildParserValueSubstitutingVariables(CSSParserValue* result, const CustomPropertyValueMap& customProperties) const
+{
+ result->id = CSSValueInvalid;
+ result->unit = CSSParserValue::ValueList;
+ result->valueList = new CSSParserValueList();
+ return buildParserValueListSubstitutingVariables(result->valueList, customProperties);
+}
+
+bool CSSValueList::buildParserValueListSubstitutingVariables(CSSParserValueList* parserList, const CustomPropertyValueMap& customProperties) const
+{
+ for (unsigned i = 0; i < m_values.size(); ++i) {
+ CSSParserValue result;
+ result.id = CSSValueInvalid;
+ switch (m_values[i]->classType()) {
+ case FunctionClass:
+ if (!downcast<CSSFunctionValue>(*m_values[i].ptr()).buildParserValueSubstitutingVariables(&result, customProperties))
+ return false;
+ parserList->addValue(result);
+ break;
+ case ValueListClass:
+ if (!downcast<CSSValueList>(*m_values[i].ptr()).buildParserValueSubstitutingVariables(&result, customProperties))
+ return false;
+ parserList->addValue(result);
+ break;
+ case VariableClass: {
+ if (!downcast<CSSVariableValue>(*m_values[i].ptr()).buildParserValueListSubstitutingVariables(parserList, customProperties))
+ return false;
+ break;
+ }
+ case PrimitiveClass:
+ // FIXME: Will have to change this if we start preserving invalid tokens.
+ if (downcast<CSSPrimitiveValue>(*m_values[i].ptr()).buildParserValue(&result))
+ parserList->addValue(result);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ break;
+ return false;
+ }
+ }
+ return true;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssCSSValueListh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/css/CSSValueList.h (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSValueList.h        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSValueList.h        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><ins>+struct CSSParserValue;
</ins><span class="cx"> class CSSParserValueList;
</span><span class="cx">
</span><span class="cx"> class CSSValueList : public CSSValue {
</span><span class="lines">@@ -78,6 +79,12 @@
</span><span class="cx">
</span><span class="cx"> PassRefPtr<CSSValueList> cloneForCSSOM() const;
</span><span class="cx">
</span><ins>+ bool containsVariables() const;
+ bool checkVariablesForCycles(CustomPropertyValueMap& customProperties, HashSet<AtomicString>& seenProperties, HashSet<AtomicString>& invalidProperties) const;
+
+ bool buildParserValueListSubstitutingVariables(CSSParserValueList*, const CustomPropertyValueMap& customProperties) const;
+ bool buildParserValueSubstitutingVariables(CSSParserValue*, const CustomPropertyValueMap& customProperties) const;
+
</ins><span class="cx"> protected:
</span><span class="cx"> CSSValueList(ClassType, ValueListSeparator);
</span><span class="cx"> CSSValueList(const CSSValueList& cloneFrom);
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssCSSVariableDependentValuecppfromrev193503branchessafari601branchSourceWebCorecssCSSVariableDependentValuecpp"></a>
<div class="copfile"><h4>Copied: branches/safari-601.1.46-branch/Source/WebCore/css/CSSVariableDependentValue.cpp (from rev 193503, branches/safari-601-branch/Source/WebCore/css/CSSVariableDependentValue.cpp) (0 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSVariableDependentValue.cpp         (rev 0)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSVariableDependentValue.cpp        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CSSVariableDependentValue.h"
+
+#include "CSSCustomPropertyValue.h"
+#include <wtf/text/AtomicStringHash.h>
+
+namespace WebCore {
+
+bool CSSVariableDependentValue::checkVariablesForCycles(const AtomicString& name, CustomPropertyValueMap& customProperties, const HashSet<AtomicString>& seenProperties, HashSet<AtomicString>& invalidProperties)
+{
+ if (invalidProperties.contains(name))
+ return false;
+
+ HashSet<AtomicString> newSeenProperties = seenProperties;
+ newSeenProperties.add(name);
+
+ bool valid = valueList()->checkVariablesForCycles(customProperties, newSeenProperties, invalidProperties);
+ if (!valid)
+ invalidProperties.add(name);
+
+ return valid;
+}
+
+}
</ins></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssCSSVariableDependentValuehfromrev193503branchessafari601branchSourceWebCorecssCSSVariableDependentValueh"></a>
<div class="copfile"><h4>Copied: branches/safari-601.1.46-branch/Source/WebCore/css/CSSVariableDependentValue.h (from rev 193503, branches/safari-601-branch/Source/WebCore/css/CSSVariableDependentValue.h) (0 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSVariableDependentValue.h         (rev 0)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSVariableDependentValue.h        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -0,0 +1,80 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSVariableDependentValue_h
+#define CSSVariableDependentValue_h
+
+#include "CSSParserValues.h"
+#include "CSSPropertyNames.h"
+#include "CSSValueList.h"
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class CSSVariableDependentValue : public CSSValue {
+public:
+ static Ref<CSSVariableDependentValue> create(RefPtr<CSSValueList>& valueList, CSSPropertyID propId)
+ {
+ return adoptRef(*new CSSVariableDependentValue(valueList, propId));
+ }
+
+ String customCSSText() const
+ {
+ if (!m_serialized) {
+ m_serialized = true;
+ m_stringValue = m_valueList ? m_valueList->customCSSText() : emptyString();
+ }
+ return m_stringValue;
+ }
+
+ // FIXME: Should arguably implement equals on all of the CSSParserValues, but CSSValue equivalence
+ // is rarely used, so serialization to compare is probably fine.
+ bool equals(const CSSVariableDependentValue& other) const { return customCSSText() == other.customCSSText(); }
+
+ CSSPropertyID propertyID() const { return m_propertyID; }
+
+ CSSValueList* valueList() const { return m_valueList.get(); }
+
+ bool checkVariablesForCycles(const AtomicString& name, CustomPropertyValueMap& customProperties, const HashSet<AtomicString>& seenProperties, HashSet<AtomicString>& invalidProperties);
+
+private:
+ CSSVariableDependentValue(RefPtr<CSSValueList>& valueList, CSSPropertyID propId)
+ : CSSValue(VariableDependentClass)
+ , m_valueList(valueList)
+ , m_propertyID(propId)
+ {
+ }
+
+ RefPtr<CSSValueList> m_valueList;
+ CSSPropertyID m_propertyID;
+ mutable String m_stringValue;
+ mutable bool m_serialized { false };
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSVariableDependentValue, isVariableDependentValue())
+
+#endif // CSSCustomPropertyValue_h
</ins></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssCSSVariableValuecppfromrev193503branchessafari601branchSourceWebCorecssCSSVariableValuecpp"></a>
<div class="copfile"><h4>Copied: branches/safari-601.1.46-branch/Source/WebCore/css/CSSVariableValue.cpp (from rev 193503, branches/safari-601-branch/Source/WebCore/css/CSSVariableValue.cpp) (0 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSVariableValue.cpp         (rev 0)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSVariableValue.cpp        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -0,0 +1,90 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CSSVariableValue.h"
+
+#include "CSSCustomPropertyValue.h"
+#include "CSSParserValues.h"
+#include "CSSValueList.h"
+#include "CSSVariableDependentValue.h"
+#include <wtf/text/StringBuilder.h>
+
+namespace WebCore {
+
+CSSVariableValue::CSSVariableValue(CSSParserVariable* variable)
+ : CSSValue(VariableClass)
+ , m_name(variable->name)
+{
+ if (variable->args)
+ m_fallbackArguments = CSSValueList::createFromParserValueList(*variable->args);
+}
+
+CSSVariableValue::CSSVariableValue(const String& name, PassRefPtr<CSSValueList> fallbackArgs)
+ : CSSValue(VariableClass)
+ , m_name(name)
+ , m_fallbackArguments(fallbackArgs)
+{
+}
+
+String CSSVariableValue::customCSSText() const
+{
+ StringBuilder result;
+ result.append("var(");
+ result.append(m_name);
+ if (m_fallbackArguments) {
+ result.append(", ");
+ result.append(m_fallbackArguments->cssText());
+ }
+ result.append(")");
+ return result.toString();
+}
+
+bool CSSVariableValue::equals(const CSSVariableValue& other) const
+{
+ return m_name == other.m_name && compareCSSValuePtr(m_fallbackArguments, other.m_fallbackArguments);
+}
+
+bool CSSVariableValue::buildParserValueListSubstitutingVariables(CSSParserValueList* resultList, const CustomPropertyValueMap& customProperties) const
+{
+ RefPtr<CSSValue> value = customProperties.get(m_name);
+ if (value && value->isValueList()) {
+ auto& variableList = downcast<CSSValueList>(*value);
+ return variableList.buildParserValueListSubstitutingVariables(resultList, customProperties);
+ }
+
+ if (value && value->isVariableDependentValue()) {
+ auto* variableList = downcast<CSSVariableDependentValue>(*value).valueList();
+ if (variableList)
+ return variableList->buildParserValueListSubstitutingVariables(resultList, customProperties);
+ }
+
+ // We failed to substitute the variable. If it has fallback arguments, use those instead.
+ if (!fallbackArguments() || !fallbackArguments()->length())
+ return false;
+ return fallbackArguments()->buildParserValueListSubstitutingVariables(resultList, customProperties);
+}
+
+}
</ins></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssCSSVariableValuehfromrev193503branchessafari601branchSourceWebCorecssCSSVariableValueh"></a>
<div class="copfile"><h4>Copied: branches/safari-601.1.46-branch/Source/WebCore/css/CSSVariableValue.h (from rev 193503, branches/safari-601-branch/Source/WebCore/css/CSSVariableValue.h) (0 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSVariableValue.h         (rev 0)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSVariableValue.h        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -0,0 +1,71 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSVariableValue_h
+#define CSSVariableValue_h
+
+#include "CSSValue.h"
+
+namespace WebCore {
+
+class CSSValueList;
+class CSSParserValueList;
+struct CSSParserVariable;
+
+class CSSVariableValue : public CSSValue {
+public:
+ static Ref<CSSVariableValue> create(CSSParserVariable* Variable)
+ {
+ return adoptRef(*new CSSVariableValue(Variable));
+ }
+
+ static Ref<CSSVariableValue> create(const String& name, PassRefPtr<CSSValueList> fallbackArguments)
+ {
+ return adoptRef(*new CSSVariableValue(name, fallbackArguments));
+ }
+
+ String customCSSText() const;
+
+ bool equals(const CSSVariableValue&) const;
+
+ const String& name() const { return m_name; }
+ CSSValueList* fallbackArguments() const { return m_fallbackArguments.get(); }
+
+ bool buildParserValueListSubstitutingVariables(CSSParserValueList*, const CustomPropertyValueMap& customProperties) const;
+
+private:
+ explicit CSSVariableValue(CSSParserVariable*);
+ CSSVariableValue(const String&, PassRefPtr<CSSValueList>);
+
+ String m_name;
+ RefPtr<CSSValueList> m_fallbackArguments;
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSVariableValue, isVariableValue())
+
+#endif
+
</ins></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssStylePropertiescpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/css/StyleProperties.cpp (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/StyleProperties.cpp        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/StyleProperties.cpp        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #include "CSSValueKeywords.h"
</span><span class="cx"> #include "CSSValueList.h"
</span><span class="cx"> #include "CSSValuePool.h"
</span><ins>+#include "CSSVariableDependentValue.h"
</ins><span class="cx"> #include "Document.h"
</span><span class="cx"> #include "PropertySetCSSStyleDeclaration.h"
</span><span class="cx"> #include "StylePropertyShorthand.h"
</span><span class="lines">@@ -209,7 +210,7 @@
</span><span class="cx"> case CSSPropertyWebkitAnimation:
</span><span class="cx"> return getLayeredShorthandValue(webkitAnimationShorthand());
</span><span class="cx"> case CSSPropertyMarker: {
</span><del>- RefPtr<CSSValue> value = getPropertyCSSValue(CSSPropertyMarkerStart);
</del><ins>+ RefPtr<CSSValue> value = getPropertyCSSValueInternal(CSSPropertyMarkerStart);
</ins><span class="cx"> if (value)
</span><span class="cx"> return value->cssText();
</span><span class="cx"> return String();
</span><span class="lines">@@ -231,8 +232,11 @@
</span><span class="cx">
</span><span class="cx"> String StyleProperties::borderSpacingValue(const StylePropertyShorthand& shorthand) const
</span><span class="cx"> {
</span><del>- RefPtr<CSSValue> horizontalValue = getPropertyCSSValue(shorthand.properties()[0]);
- RefPtr<CSSValue> verticalValue = getPropertyCSSValue(shorthand.properties()[1]);
</del><ins>+ RefPtr<CSSValue> horizontalValue = getPropertyCSSValueInternal(shorthand.properties()[0]);
+ if (horizontalValue && horizontalValue->isVariableDependentValue())
+ return horizontalValue->cssText();
+
+ RefPtr<CSSValue> verticalValue = getPropertyCSSValueInternal(shorthand.properties()[1]);
</ins><span class="cx">
</span><span class="cx"> // While standard border-spacing property does not allow specifying border-spacing-vertical without
</span><span class="cx"> // specifying border-spacing-horizontal <http://www.w3.org/TR/CSS21/tables.html#separated-borders>,
</span><span class="lines">@@ -375,8 +379,10 @@
</span><span class="cx"> size_t numLayers = 0;
</span><span class="cx">
</span><span class="cx"> for (unsigned i = 0; i < size; ++i) {
</span><del>- values[i] = getPropertyCSSValue(shorthand.properties()[i]);
</del><ins>+ values[i] = getPropertyCSSValueInternal(shorthand.properties()[i]);
</ins><span class="cx"> if (values[i]) {
</span><ins>+ if (values[i]->isVariableDependentValue())
+ return values[i]->cssText();
</ins><span class="cx"> if (values[i]->isBaseValueList())
</span><span class="cx"> numLayers = std::max(downcast<CSSValueList>(*values[i]).length(), numLayers);
</span><span class="cx"> else
</span><span class="lines">@@ -511,9 +517,11 @@
</span><span class="cx"> StringBuilder result;
</span><span class="cx"> for (unsigned i = 0; i < shorthand.length(); ++i) {
</span><span class="cx"> if (!isPropertyImplicit(shorthand.properties()[i])) {
</span><del>- RefPtr<CSSValue> value = getPropertyCSSValue(shorthand.properties()[i]);
</del><ins>+ RefPtr<CSSValue> value = getPropertyCSSValueInternal(shorthand.properties()[i]);
</ins><span class="cx"> if (!value)
</span><span class="cx"> return String();
</span><ins>+ if (value->isVariableDependentValue())
+ return value->cssText();
</ins><span class="cx"> String valueText = value->cssText();
</span><span class="cx"> if (!i)
</span><span class="cx"> commonValue = valueText;
</span><span class="lines">@@ -540,10 +548,12 @@
</span><span class="cx"> String res;
</span><span class="cx"> bool lastPropertyWasImportant = false;
</span><span class="cx"> for (unsigned i = 0; i < shorthand.length(); ++i) {
</span><del>- RefPtr<CSSValue> value = getPropertyCSSValue(shorthand.properties()[i]);
</del><ins>+ RefPtr<CSSValue> value = getPropertyCSSValueInternal(shorthand.properties()[i]);
</ins><span class="cx"> // FIXME: CSSInitialValue::cssText should generate the right value.
</span><span class="cx"> if (!value)
</span><span class="cx"> return String();
</span><ins>+ if (value->isVariableDependentValue())
+ return value->cssText();
</ins><span class="cx"> String text = value->cssText();
</span><span class="cx"> if (text.isNull())
</span><span class="cx"> return String();
</span><span class="lines">@@ -590,6 +600,17 @@
</span><span class="cx">
</span><span class="cx"> PassRefPtr<CSSValue> StyleProperties::getPropertyCSSValue(CSSPropertyID propertyID) const
</span><span class="cx"> {
</span><ins>+ PassRefPtr<CSSValue> value = getPropertyCSSValueInternal(propertyID);
+ if (value && value->isVariableDependentValue()) {
+ auto& dependentValue = downcast<CSSVariableDependentValue>(*value);
+ if (dependentValue.propertyID() != propertyID)
+ return CSSCustomPropertyValue::createInvalid(); // Have to return special "pending-substitution" value.
+ }
+ return value;
+}
+
+PassRefPtr<CSSValue> StyleProperties::getPropertyCSSValueInternal(CSSPropertyID propertyID) const
+{
</ins><span class="cx"> int foundPropertyIndex = findPropertyIndex(propertyID);
</span><span class="cx"> if (foundPropertyIndex == -1)
</span><span class="cx"> return 0;
</span><span class="lines">@@ -878,153 +899,159 @@
</span><span class="cx"> CSSPropertyID shorthandPropertyID = CSSPropertyInvalid;
</span><span class="cx"> CSSPropertyID borderFallbackShorthandProperty = CSSPropertyInvalid;
</span><span class="cx"> String value;
</span><ins>+
+ if (property.value() && property.value()->isVariableDependentValue()) {
+ auto& dependentValue = downcast<CSSVariableDependentValue>(*property.value());
+ if (dependentValue.propertyID() != propertyID)
+ shorthandPropertyID = dependentValue.propertyID();
+ } else {
+ switch (propertyID) {
+ case CSSPropertyAnimationName:
+ case CSSPropertyAnimationDuration:
+ case CSSPropertyAnimationTimingFunction:
+ case CSSPropertyAnimationDelay:
+ case CSSPropertyAnimationIterationCount:
+ case CSSPropertyAnimationDirection:
+ case CSSPropertyAnimationFillMode:
+ shorthandPropertyID = CSSPropertyAnimation;
+ break;
+ case CSSPropertyBackgroundPositionX:
+ positionXPropertyIndex = n;
+ continue;
+ case CSSPropertyBackgroundPositionY:
+ positionYPropertyIndex = n;
+ continue;
+ case CSSPropertyBackgroundRepeatX:
+ repeatXPropertyIndex = n;
+ continue;
+ case CSSPropertyBackgroundRepeatY:
+ repeatYPropertyIndex = n;
+ continue;
+ case CSSPropertyBorderTopWidth:
+ case CSSPropertyBorderRightWidth:
+ case CSSPropertyBorderBottomWidth:
+ case CSSPropertyBorderLeftWidth:
+ if (!borderFallbackShorthandProperty)
+ borderFallbackShorthandProperty = CSSPropertyBorderWidth;
+ FALLTHROUGH;
+ case CSSPropertyBorderTopStyle:
+ case CSSPropertyBorderRightStyle:
+ case CSSPropertyBorderBottomStyle:
+ case CSSPropertyBorderLeftStyle:
+ if (!borderFallbackShorthandProperty)
+ borderFallbackShorthandProperty = CSSPropertyBorderStyle;
+ FALLTHROUGH;
+ case CSSPropertyBorderTopColor:
+ case CSSPropertyBorderRightColor:
+ case CSSPropertyBorderBottomColor:
+ case CSSPropertyBorderLeftColor:
+ if (!borderFallbackShorthandProperty)
+ borderFallbackShorthandProperty = CSSPropertyBorderColor;
</ins><span class="cx">
</span><del>- switch (propertyID) {
- case CSSPropertyAnimationName:
- case CSSPropertyAnimationDuration:
- case CSSPropertyAnimationTimingFunction:
- case CSSPropertyAnimationDelay:
- case CSSPropertyAnimationIterationCount:
- case CSSPropertyAnimationDirection:
- case CSSPropertyAnimationFillMode:
- shorthandPropertyID = CSSPropertyAnimation;
- break;
- case CSSPropertyBackgroundPositionX:
- positionXPropertyIndex = n;
- continue;
- case CSSPropertyBackgroundPositionY:
- positionYPropertyIndex = n;
- continue;
- case CSSPropertyBackgroundRepeatX:
- repeatXPropertyIndex = n;
- continue;
- case CSSPropertyBackgroundRepeatY:
- repeatYPropertyIndex = n;
- continue;
- case CSSPropertyBorderTopWidth:
- case CSSPropertyBorderRightWidth:
- case CSSPropertyBorderBottomWidth:
- case CSSPropertyBorderLeftWidth:
- if (!borderFallbackShorthandProperty)
- borderFallbackShorthandProperty = CSSPropertyBorderWidth;
- FALLTHROUGH;
- case CSSPropertyBorderTopStyle:
- case CSSPropertyBorderRightStyle:
- case CSSPropertyBorderBottomStyle:
- case CSSPropertyBorderLeftStyle:
- if (!borderFallbackShorthandProperty)
- borderFallbackShorthandProperty = CSSPropertyBorderStyle;
- FALLTHROUGH;
- case CSSPropertyBorderTopColor:
- case CSSPropertyBorderRightColor:
- case CSSPropertyBorderBottomColor:
- case CSSPropertyBorderLeftColor:
- if (!borderFallbackShorthandProperty)
- borderFallbackShorthandProperty = CSSPropertyBorderColor;
-
- // FIXME: Deal with cases where only some of border-(top|right|bottom|left) are specified.
- ASSERT(CSSPropertyBorder - firstCSSProperty < shorthandPropertyAppeared.size());
- if (!shorthandPropertyAppeared[CSSPropertyBorder - firstCSSProperty]) {
- value = borderPropertyValue(ReturnNullOnUncommonValues);
- if (value.isNull())
- shorthandPropertyAppeared.set(CSSPropertyBorder - firstCSSProperty);
- else
</del><ins>+ // FIXME: Deal with cases where only some of border-(top|right|bottom|left) are specified.
+ ASSERT(CSSPropertyBorder - firstCSSProperty < shorthandPropertyAppeared.size());
+ if (!shorthandPropertyAppeared[CSSPropertyBorder - firstCSSProperty]) {
+ value = borderPropertyValue(ReturnNullOnUncommonValues);
+ if (value.isNull())
+ shorthandPropertyAppeared.set(CSSPropertyBorder - firstCSSProperty);
+ else
+ shorthandPropertyID = CSSPropertyBorder;
+ } else if (shorthandPropertyUsed[CSSPropertyBorder - firstCSSProperty])
</ins><span class="cx"> shorthandPropertyID = CSSPropertyBorder;
</span><del>- } else if (shorthandPropertyUsed[CSSPropertyBorder - firstCSSProperty])
- shorthandPropertyID = CSSPropertyBorder;
- if (!shorthandPropertyID)
- shorthandPropertyID = borderFallbackShorthandProperty;
- break;
- case CSSPropertyWebkitBorderHorizontalSpacing:
- case CSSPropertyWebkitBorderVerticalSpacing:
- shorthandPropertyID = CSSPropertyBorderSpacing;
- break;
- case CSSPropertyFontFamily:
- case CSSPropertyLineHeight:
- case CSSPropertyFontSize:
- case CSSPropertyFontStyle:
- case CSSPropertyFontVariant:
- case CSSPropertyFontWeight:
- // Don't use CSSPropertyFont because old UAs can't recognize them but are important for editing.
- break;
- case CSSPropertyListStyleType:
- case CSSPropertyListStylePosition:
- case CSSPropertyListStyleImage:
- shorthandPropertyID = CSSPropertyListStyle;
- break;
- case CSSPropertyMarginTop:
- case CSSPropertyMarginRight:
- case CSSPropertyMarginBottom:
- case CSSPropertyMarginLeft:
- shorthandPropertyID = CSSPropertyMargin;
- break;
- case CSSPropertyOutlineWidth:
- case CSSPropertyOutlineStyle:
- case CSSPropertyOutlineColor:
- shorthandPropertyID = CSSPropertyOutline;
- break;
- case CSSPropertyOverflowX:
- case CSSPropertyOverflowY:
- shorthandPropertyID = CSSPropertyOverflow;
- break;
- case CSSPropertyPaddingTop:
- case CSSPropertyPaddingRight:
- case CSSPropertyPaddingBottom:
- case CSSPropertyPaddingLeft:
- shorthandPropertyID = CSSPropertyPadding;
- break;
- case CSSPropertyTransitionProperty:
- case CSSPropertyTransitionDuration:
- case CSSPropertyTransitionTimingFunction:
- case CSSPropertyTransitionDelay:
- shorthandPropertyID = CSSPropertyTransition;
- break;
- case CSSPropertyWebkitAnimationName:
- case CSSPropertyWebkitAnimationDuration:
- case CSSPropertyWebkitAnimationTimingFunction:
- case CSSPropertyWebkitAnimationDelay:
- case CSSPropertyWebkitAnimationIterationCount:
- case CSSPropertyWebkitAnimationDirection:
- case CSSPropertyWebkitAnimationFillMode:
- shorthandPropertyID = CSSPropertyWebkitAnimation;
- break;
- case CSSPropertyFlexDirection:
- case CSSPropertyFlexWrap:
- shorthandPropertyID = CSSPropertyFlexFlow;
- break;
- case CSSPropertyFlexBasis:
- case CSSPropertyFlexGrow:
- case CSSPropertyFlexShrink:
- shorthandPropertyID = CSSPropertyFlex;
- break;
- case CSSPropertyWebkitMaskPositionX:
- case CSSPropertyWebkitMaskPositionY:
- case CSSPropertyWebkitMaskRepeatX:
- case CSSPropertyWebkitMaskRepeatY:
- case CSSPropertyWebkitMaskImage:
- case CSSPropertyWebkitMaskRepeat:
- case CSSPropertyWebkitMaskPosition:
- case CSSPropertyWebkitMaskClip:
- case CSSPropertyWebkitMaskOrigin:
- shorthandPropertyID = CSSPropertyWebkitMask;
- break;
- case CSSPropertyPerspectiveOriginX:
- case CSSPropertyPerspectiveOriginY:
- shorthandPropertyID = CSSPropertyPerspectiveOrigin;
- break;
- case CSSPropertyTransformOriginX:
- case CSSPropertyTransformOriginY:
- case CSSPropertyTransformOriginZ:
- shorthandPropertyID = CSSPropertyTransformOrigin;
- break;
- case CSSPropertyWebkitTransitionProperty:
- case CSSPropertyWebkitTransitionDuration:
- case CSSPropertyWebkitTransitionTimingFunction:
- case CSSPropertyWebkitTransitionDelay:
- shorthandPropertyID = CSSPropertyWebkitTransition;
- break;
- default:
- break;
</del><ins>+ if (!shorthandPropertyID)
+ shorthandPropertyID = borderFallbackShorthandProperty;
+ break;
+ case CSSPropertyWebkitBorderHorizontalSpacing:
+ case CSSPropertyWebkitBorderVerticalSpacing:
+ shorthandPropertyID = CSSPropertyBorderSpacing;
+ break;
+ case CSSPropertyFontFamily:
+ case CSSPropertyLineHeight:
+ case CSSPropertyFontSize:
+ case CSSPropertyFontStyle:
+ case CSSPropertyFontVariant:
+ case CSSPropertyFontWeight:
+ // Don't use CSSPropertyFont because old UAs can't recognize them but are important for editing.
+ break;
+ case CSSPropertyListStyleType:
+ case CSSPropertyListStylePosition:
+ case CSSPropertyListStyleImage:
+ shorthandPropertyID = CSSPropertyListStyle;
+ break;
+ case CSSPropertyMarginTop:
+ case CSSPropertyMarginRight:
+ case CSSPropertyMarginBottom:
+ case CSSPropertyMarginLeft:
+ shorthandPropertyID = CSSPropertyMargin;
+ break;
+ case CSSPropertyOutlineWidth:
+ case CSSPropertyOutlineStyle:
+ case CSSPropertyOutlineColor:
+ shorthandPropertyID = CSSPropertyOutline;
+ break;
+ case CSSPropertyOverflowX:
+ case CSSPropertyOverflowY:
+ shorthandPropertyID = CSSPropertyOverflow;
+ break;
+ case CSSPropertyPaddingTop:
+ case CSSPropertyPaddingRight:
+ case CSSPropertyPaddingBottom:
+ case CSSPropertyPaddingLeft:
+ shorthandPropertyID = CSSPropertyPadding;
+ break;
+ case CSSPropertyTransitionProperty:
+ case CSSPropertyTransitionDuration:
+ case CSSPropertyTransitionTimingFunction:
+ case CSSPropertyTransitionDelay:
+ shorthandPropertyID = CSSPropertyTransition;
+ break;
+ case CSSPropertyWebkitAnimationName:
+ case CSSPropertyWebkitAnimationDuration:
+ case CSSPropertyWebkitAnimationTimingFunction:
+ case CSSPropertyWebkitAnimationDelay:
+ case CSSPropertyWebkitAnimationIterationCount:
+ case CSSPropertyWebkitAnimationDirection:
+ case CSSPropertyWebkitAnimationFillMode:
+ shorthandPropertyID = CSSPropertyWebkitAnimation;
+ break;
+ case CSSPropertyFlexDirection:
+ case CSSPropertyFlexWrap:
+ shorthandPropertyID = CSSPropertyFlexFlow;
+ break;
+ case CSSPropertyFlexBasis:
+ case CSSPropertyFlexGrow:
+ case CSSPropertyFlexShrink:
+ shorthandPropertyID = CSSPropertyFlex;
+ break;
+ case CSSPropertyWebkitMaskPositionX:
+ case CSSPropertyWebkitMaskPositionY:
+ case CSSPropertyWebkitMaskRepeatX:
+ case CSSPropertyWebkitMaskRepeatY:
+ case CSSPropertyWebkitMaskImage:
+ case CSSPropertyWebkitMaskRepeat:
+ case CSSPropertyWebkitMaskPosition:
+ case CSSPropertyWebkitMaskClip:
+ case CSSPropertyWebkitMaskOrigin:
+ shorthandPropertyID = CSSPropertyWebkitMask;
+ break;
+ case CSSPropertyPerspectiveOriginX:
+ case CSSPropertyPerspectiveOriginY:
+ shorthandPropertyID = CSSPropertyPerspectiveOrigin;
+ break;
+ case CSSPropertyTransformOriginX:
+ case CSSPropertyTransformOriginY:
+ case CSSPropertyTransformOriginZ:
+ shorthandPropertyID = CSSPropertyTransformOrigin;
+ break;
+ case CSSPropertyWebkitTransitionProperty:
+ case CSSPropertyWebkitTransitionDuration:
+ case CSSPropertyWebkitTransitionTimingFunction:
+ case CSSPropertyWebkitTransitionDelay:
+ shorthandPropertyID = CSSPropertyWebkitTransition;
+ break;
+ default:
+ break;
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> unsigned shortPropertyIndex = shorthandPropertyID - firstCSSProperty;
</span><span class="lines">@@ -1318,7 +1345,7 @@
</span><span class="cx"> Vector<CSSProperty, 256> list;
</span><span class="cx"> list.reserveInitialCapacity(length);
</span><span class="cx"> for (unsigned i = 0; i < length; ++i) {
</span><del>- RefPtr<CSSValue> value = getPropertyCSSValue(set[i]);
</del><ins>+ RefPtr<CSSValue> value = getPropertyCSSValueInternal(set[i]);
</ins><span class="cx"> if (value)
</span><span class="cx"> list.append(CSSProperty(set[i], value.release(), false));
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssStylePropertiesh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/css/StyleProperties.h (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/StyleProperties.h        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/StyleProperties.h        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -152,7 +152,9 @@
</span><span class="cx"> String borderSpacingValue(const StylePropertyShorthand&) const;
</span><span class="cx"> String fontValue() const;
</span><span class="cx"> void appendFontLonghandValueIfExplicit(CSSPropertyID, StringBuilder& result, String& value) const;
</span><del>-
</del><ins>+
+ PassRefPtr<CSSValue> getPropertyCSSValueInternal(CSSPropertyID) const;
+
</ins><span class="cx"> friend class PropertySetCSSStyleDeclaration;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssStyleResolvercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/css/StyleResolver.cpp (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/StyleResolver.cpp        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/StyleResolver.cpp        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -41,6 +41,8 @@
</span><span class="cx"> #include "CSSFontSelector.h"
</span><span class="cx"> #include "CSSFontValue.h"
</span><span class="cx"> #include "CSSFunctionValue.h"
</span><ins>+#include "CSSInheritedValue.h"
+#include "CSSInitialValue.h"
</ins><span class="cx"> #include "CSSKeyframeRule.h"
</span><span class="cx"> #include "CSSKeyframesRule.h"
</span><span class="cx"> #include "CSSLineBoxContainValue.h"
</span><span class="lines">@@ -56,6 +58,7 @@
</span><span class="cx"> #include "CSSSupportsRule.h"
</span><span class="cx"> #include "CSSTimingFunctionValue.h"
</span><span class="cx"> #include "CSSValueList.h"
</span><ins>+#include "CSSVariableDependentValue.h"
</ins><span class="cx"> #include "CachedImage.h"
</span><span class="cx"> #include "CachedResourceLoader.h"
</span><span class="cx"> #include "CachedSVGDocument.h"
</span><span class="lines">@@ -1903,15 +1906,32 @@
</span><span class="cx"> ASSERT_WITH_MESSAGE(!isShorthandCSSProperty(id), "Shorthand property id = %d wasn't expanded at parsing time", id);
</span><span class="cx">
</span><span class="cx"> State& state = m_state;
</span><ins>+
+ RefPtr<CSSValue> valueToApply = value;
+ if (value->isVariableDependentValue()) {
+ valueToApply = resolvedVariableValue(id, *downcast<CSSVariableDependentValue>(value));
+ if (!valueToApply) {
+ if (CSSProperty::isInheritedProperty(id))
+ valueToApply = CSSInheritedValue::create();
+ else
+ valueToApply = CSSInitialValue::createExplicit();
+ }
+ }
</ins><span class="cx">
</span><span class="cx"> if (CSSProperty::isDirectionAwareProperty(id)) {
</span><span class="cx"> CSSPropertyID newId = CSSProperty::resolveDirectionAwareProperty(id, state.style()->direction(), state.style()->writingMode());
</span><span class="cx"> ASSERT(newId != id);
</span><del>- return applyProperty(newId, value);
</del><ins>+ return applyProperty(newId, valueToApply.get());
</ins><span class="cx"> }
</span><ins>+
+ CSSValue* valueToCheckForInheritInitial = valueToApply.get();
+ if (id == CSSPropertyCustom) {
+ CSSCustomPropertyValue* customProperty = &downcast<CSSCustomPropertyValue>(*valueToApply);
+ valueToCheckForInheritInitial = customProperty->value().get();
+ }
</ins><span class="cx">
</span><del>- bool isInherit = state.parentStyle() && value->isInheritedValue();
- bool isInitial = value->isInitialValue() || (!state.parentStyle() && value->isInheritedValue());
</del><ins>+ bool isInherit = state.parentStyle() && valueToCheckForInheritInitial->isInheritedValue();
+ bool isInitial = valueToCheckForInheritInitial->isInitialValue() || (!state.parentStyle() && valueToCheckForInheritInitial->isInheritedValue());
</ins><span class="cx">
</span><span class="cx"> ASSERT(!isInherit || !isInitial); // isInherit -> !isInitial && isInitial -> !isInherit
</span><span class="cx">
</span><span class="lines">@@ -1924,15 +1944,29 @@
</span><span class="cx"> state.parentStyle()->setHasExplicitlyInheritedProperties();
</span><span class="cx">
</span><span class="cx"> if (id == CSSPropertyCustom) {
</span><del>- CSSCustomPropertyValue* customProperty = &downcast<CSSCustomPropertyValue>(*value);
- state.style()->setCustomPropertyValue(customProperty->name(), value);
</del><ins>+ CSSCustomPropertyValue* customProperty = &downcast<CSSCustomPropertyValue>(*valueToApply);
+ if (isInherit) {
+ RefPtr<CSSValue> customVal = state.parentStyle()->getCustomPropertyValue(customProperty->name());
+ if (!customVal)
+ customVal = CSSCustomPropertyValue::createInvalid();
+ state.style()->setCustomPropertyValue(customProperty->name(), customVal);
+ } else if (isInitial)
+ state.style()->setCustomPropertyValue(customProperty->name(), CSSCustomPropertyValue::createInvalid());
+ else
+ state.style()->setCustomPropertyValue(customProperty->name(), customProperty->value());
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Use the generated StyleBuilder.
</span><del>- StyleBuilder::applyProperty(id, *this, *value, isInitial, isInherit);
</del><ins>+ StyleBuilder::applyProperty(id, *this, *valueToApply, isInitial, isInherit);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+RefPtr<CSSValue> StyleResolver::resolvedVariableValue(CSSPropertyID propID, const CSSVariableDependentValue& value)
+{
+ CSSParser parser(m_state.document());
+ return parser.parseVariableDependentValue(propID, value, m_state.style()->customProperties());
+}
+
</ins><span class="cx"> PassRefPtr<StyleImage> StyleResolver::styleImage(CSSPropertyID property, CSSValue& value)
</span><span class="cx"> {
</span><span class="cx"> if (is<CSSImageValue>(value))
</span><span class="lines">@@ -2697,6 +2731,9 @@
</span><span class="cx"> ASSERT(!shouldApplyPropertyInParseOrder(propertyID));
</span><span class="cx"> property.apply(*this);
</span><span class="cx"> }
</span><ins>+
+ if (firstProperty == CSSPropertyCustom)
+ m_state.style()->checkVariablesInCustomProperties();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssStyleResolverh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/css/StyleResolver.h (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/StyleResolver.h        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/StyleResolver.h        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -471,6 +471,7 @@
</span><span class="cx"> bool canShareStyleWithControl(StyledElement*) const;
</span><span class="cx">
</span><span class="cx"> void applyProperty(CSSPropertyID, CSSValue*);
</span><ins>+ RefPtr<CSSValue> resolvedVariableValue(CSSPropertyID, const CSSVariableDependentValue&);
</ins><span class="cx">
</span><span class="cx"> void applySVGProperty(CSSPropertyID, CSSValue*);
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssmakeproppl"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/css/makeprop.pl (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/makeprop.pl        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/makeprop.pl        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -236,7 +236,7 @@
</span><span class="cx">
</span><span class="cx"> static const bool isInheritedPropertyTable[numCSSProperties + $numPredefinedProperties] = {
</span><span class="cx"> false, // CSSPropertyInvalid
</span><del>- false, // CSSPropertyCustom
</del><ins>+ true, // CSSPropertyCustom
</ins><span class="cx"> EOF
</span><span class="cx">
</span><span class="cx"> foreach my $name (@names) {
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorerenderingstyleRenderStylecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/rendering/style/RenderStyle.cpp (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/rendering/style/RenderStyle.cpp        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/rendering/style/RenderStyle.cpp        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -24,8 +24,10 @@
</span><span class="cx"> #include "RenderStyle.h"
</span><span class="cx">
</span><span class="cx"> #include "ContentData.h"
</span><ins>+#include "CSSCustomPropertyValue.h"
+#include "CSSPropertyNames.h"
+#include "CSSVariableDependentValue.h"
</ins><span class="cx"> #include "CursorList.h"
</span><del>-#include "CSSPropertyNames.h"
</del><span class="cx"> #include "FloatRoundedRect.h"
</span><span class="cx"> #include "FontCascade.h"
</span><span class="cx"> #include "FontSelector.h"
</span><span class="lines">@@ -1981,4 +1983,54 @@
</span><span class="cx">
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+void RenderStyle::checkVariablesInCustomProperties()
+{
+ if (!rareInheritedData->m_customProperties->containsVariables())
+ return;
+
+ // Our first pass checks the variables for validity and replaces any properties that became
+ // invalid with empty values.
+ auto& customProperties = rareInheritedData.access()->m_customProperties.access()->values();
+ HashSet<AtomicString> invalidProperties;
+ for (auto entry : customProperties) {
+ if (!entry.value->isVariableDependentValue())
+ continue;
+ HashSet<AtomicString> seenProperties;
+ downcast<CSSVariableDependentValue>(*entry.value).checkVariablesForCycles(entry.key, customProperties, seenProperties, invalidProperties);
+ }
+
+ // Now insert invalid values.
+ if (!invalidProperties.isEmpty()) {
+ RefPtr<CSSValue> invalidValue = CSSCustomPropertyValue::createInvalid();
+ for (auto& property : invalidProperties)
+ customProperties.set(property, invalidValue);
+ }
+
+ // Now that all of the properties have been tested for validity and replaced with
+ // invalid values if they failed, we can perform variable substitution on the valid values.
+ Vector<RefPtr<CSSCustomPropertyValue>> resolvedValues;
+ for (auto entry : customProperties) {
+ if (!entry.value->isVariableDependentValue())
+ continue;
+
+ CSSParserValueList parserList;
+ RefPtr<CSSCustomPropertyValue> result;
+ if (!downcast<CSSVariableDependentValue>(*entry.value).valueList()->buildParserValueListSubstitutingVariables(&parserList, customProperties)) {
+ RefPtr<CSSValue> invalidResult = CSSCustomPropertyValue::createInvalid();
+ result = CSSCustomPropertyValue::create(entry.key, invalidResult);
+ } else {
+ RefPtr<CSSValue> newValueList = CSSValueList::createFromParserValueList(parserList);
+ result = CSSCustomPropertyValue::create(entry.key, newValueList);
+ }
+ resolvedValues.append(result);
+ }
+
+ // With all results computed, we can now mutate our table to eliminate the variables and
+ // hold the final values. This way when we inherit, we don't end up resubstituting variables, etc.
+ for (auto& resolvedValue : resolvedValues)
+ customProperties.set(resolvedValue->name(), resolvedValue->value());
+
+ rareInheritedData.access()->m_customProperties.access()->setContainsVariables(false);
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorerenderingstyleRenderStyleh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/rendering/style/RenderStyle.h (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/rendering/style/RenderStyle.h        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/rendering/style/RenderStyle.h        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -516,7 +516,7 @@
</span><span class="cx"> void setCustomPropertyValue(const AtomicString& name, const RefPtr<CSSValue>& value) { rareInheritedData.access()->m_customProperties.access()->setCustomPropertyValue(name, value); }
</span><span class="cx"> RefPtr<CSSValue> getCustomPropertyValue(const AtomicString& name) const { return rareInheritedData->m_customProperties->getCustomPropertyValue(name); }
</span><span class="cx"> bool hasCustomProperty(const AtomicString& name) const { return rareInheritedData->m_customProperties->hasCustomProperty(name); }
</span><del>- const HashMap<AtomicString, RefPtr<CSSValue>>* customProperties() const { return &(rareInheritedData->m_customProperties->m_values); }
</del><ins>+ const CustomPropertyValueMap& customProperties() const { return rareInheritedData->m_customProperties->m_values; }
</ins><span class="cx">
</span><span class="cx"> void setHasViewportUnits(bool hasViewportUnits = true) { noninherited_flags.setHasViewportUnits(hasViewportUnits); }
</span><span class="cx"> bool hasViewportUnits() const { return noninherited_flags.hasViewportUnits(); }
</span><span class="lines">@@ -1198,7 +1198,9 @@
</span><span class="cx"> #if ENABLE(CSS_TRAILING_WORD)
</span><span class="cx"> TrailingWord trailingWord() const { return static_cast<TrailingWord>(rareInheritedData->trailingWord); }
</span><span class="cx"> #endif
</span><del>-
</del><ins>+
+ void checkVariablesInCustomProperties();
+
</ins><span class="cx"> // attribute setter methods
</span><span class="cx">
</span><span class="cx"> void setDisplay(EDisplay v) { noninherited_flags.setEffectiveDisplay(v); }
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorerenderingstyleStyleCustomPropertyDatah"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/rendering/style/StyleCustomPropertyData.h (193558 => 193559)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/rendering/style/StyleCustomPropertyData.h        2015-12-06 06:21:00 UTC (rev 193558)
+++ branches/safari-601.1.46-branch/Source/WebCore/rendering/style/StyleCustomPropertyData.h        2015-12-06 06:23:15 UTC (rev 193559)
</span><span class="lines">@@ -22,6 +22,7 @@
</span><span class="cx"> #ifndef StyleCustomPropertyData_h
</span><span class="cx"> #define StyleCustomPropertyData_h
</span><span class="cx">
</span><ins>+#include "CSSValue.h"
</ins><span class="cx"> #include <wtf/Forward.h>
</span><span class="cx"> #include <wtf/HashMap.h>
</span><span class="cx"> #include <wtf/RefCounted.h>
</span><span class="lines">@@ -30,29 +31,55 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class CSSValue;
-
</del><span class="cx"> class StyleCustomPropertyData : public RefCounted<StyleCustomPropertyData> {
</span><span class="cx"> public:
</span><span class="cx"> static Ref<StyleCustomPropertyData> create() { return adoptRef(*new StyleCustomPropertyData); }
</span><span class="cx"> Ref<StyleCustomPropertyData> copy() const { return adoptRef(*new StyleCustomPropertyData(*this)); }
</span><span class="cx">
</span><del>- bool operator==(const StyleCustomPropertyData& o) const { return m_values == o.m_values; }
</del><ins>+ bool operator==(const StyleCustomPropertyData& o) const
+ {
+ if (m_containsVariables != o.m_containsVariables)
+ return false;
+
+ if (m_values.size() != o.m_values.size())
+ return false;
+
+ for (WTF::KeyValuePair<AtomicString, RefPtr<CSSValue>> entry : m_values) {
+ RefPtr<CSSValue> other = o.m_values.get(entry.key);
+ if (!other || !entry.value->equals(*other))
+ return false;
+ }
+ return true;
+ }
+
</ins><span class="cx"> bool operator!=(const StyleCustomPropertyData &o) const { return !(*this == o); }
</span><span class="cx">
</span><del>- void setCustomPropertyValue(const AtomicString& name, const RefPtr<CSSValue>& value) { m_values.set(name, value); }
</del><ins>+ void setCustomPropertyValue(const AtomicString& name, const RefPtr<CSSValue>& value)
+ {
+ m_values.set(name, value);
+ if (value->isVariableDependentValue())
+ m_containsVariables = true;
+ }
+
</ins><span class="cx"> RefPtr<CSSValue> getCustomPropertyValue(const AtomicString& name) const { return m_values.get(name); }
</span><ins>+ CustomPropertyValueMap& values() { return m_values; }
+
</ins><span class="cx"> bool hasCustomProperty(const AtomicString& name) const { return m_values.contains(name); }
</span><ins>+
+ bool containsVariables() const { return m_containsVariables; }
+ void setContainsVariables(bool containsVariables) { m_containsVariables = containsVariables; }
</ins><span class="cx">
</span><del>- HashMap<AtomicString, RefPtr<CSSValue>> m_values;
-
</del><ins>+ CustomPropertyValueMap m_values;
+ bool m_containsVariables { false };
+
</ins><span class="cx"> private:
</span><span class="cx"> explicit StyleCustomPropertyData()
</span><span class="cx"> : RefCounted<StyleCustomPropertyData>()
</span><span class="cx"> { }
</span><span class="cx"> StyleCustomPropertyData(const StyleCustomPropertyData& other)
</span><span class="cx"> : RefCounted<StyleCustomPropertyData>()
</span><del>- , m_values(HashMap<AtomicString, RefPtr<CSSValue>>(other.m_values))
</del><ins>+ , m_values(CustomPropertyValueMap(other.m_values))
+ , m_containsVariables(other.m_containsVariables)
</ins><span class="cx"> { }
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>