<!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>[163840] trunk</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/163840">163840</a></dd>
<dt>Author</dt> <dd>dino@apple.com</dd>
<dt>Date</dt> <dd>2014-02-10 17:20:28 -0800 (Mon, 10 Feb 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Update aspect-ratio property to have constraining keywords
https://bugs.webkit.org/show_bug.cgi?id=128262
Reviewed by Simon Fraser.
Source/WebCore:
Add support for "from-dimensions" and "from-intrinsic"
property values to "-webkit-aspect-ratio". I also changed
the default value from "none" to "auto", because "none" doesn't
make sense any more.
Covered by enhancing existing tests.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue): New keywords.
* css/CSSParser.cpp:
(WebCore::CSSParser::parseAspectRatio): Support new keywords.
* css/CSSValueKeywords.in: Add from-dimensions and from-intrinsic.
* css/DeprecatedStyleBuilder.cpp: This now has to handle the new
values. I also changed "none" to "auto".
(WebCore::ApplyPropertyAspectRatio::applyInheritValue):
(WebCore::ApplyPropertyAspectRatio::applyInitialValue):
(WebCore::ApplyPropertyAspectRatio::applyValue):
* rendering/style/RenderStyle.h: hasAspectRatio is now aspectRatioType
and indicates one of the three keywords, or a specified number.
* rendering/style/RenderStyleConstants.h: New enum.
* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator==):
* rendering/style/StyleRareNonInheritedData.h:
LayoutTests:
Add tests for new from-intrinsic and from-dimensions
property values.
* fast/css/aspect-ratio-inheritance-expected.txt:
* fast/css/aspect-ratio-inheritance.html:
* fast/css/aspect-ratio-parsing-tests-expected.txt:
* fast/css/aspect-ratio-parsing-tests.html:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastcssaspectratioinheritanceexpectedtxt">trunk/LayoutTests/fast/css/aspect-ratio-inheritance-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcssaspectratioinheritancehtml">trunk/LayoutTests/fast/css/aspect-ratio-inheritance.html</a></li>
<li><a href="#trunkLayoutTestsfastcssaspectratioparsingtestsexpectedtxt">trunk/LayoutTests/fast/css/aspect-ratio-parsing-tests-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcssaspectratioparsingtestshtml">trunk/LayoutTests/fast/css/aspect-ratio-parsing-tests.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSComputedStyleDeclarationcpp">trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSParsercpp">trunk/Source/WebCore/css/CSSParser.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSValueKeywordsin">trunk/Source/WebCore/css/CSSValueKeywords.in</a></li>
<li><a href="#trunkSourceWebCorecssDeprecatedStyleBuildercpp">trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleRenderStyleh">trunk/Source/WebCore/rendering/style/RenderStyle.h</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleRenderStyleConstantsh">trunk/Source/WebCore/rendering/style/RenderStyleConstants.h</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleStyleRareNonInheritedDatacpp">trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleStyleRareNonInheritedDatah">trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (163839 => 163840)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-02-11 01:10:18 UTC (rev 163839)
+++ trunk/LayoutTests/ChangeLog        2014-02-11 01:20:28 UTC (rev 163840)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-02-09 Dean Jackson <dino@apple.com>
+
+ Update aspect-ratio property to have constraining keywords
+ https://bugs.webkit.org/show_bug.cgi?id=128262
+
+ Reviewed by Simon Fraser.
+
+ Add tests for new from-intrinsic and from-dimensions
+ property values.
+
+ * fast/css/aspect-ratio-inheritance-expected.txt:
+ * fast/css/aspect-ratio-inheritance.html:
+ * fast/css/aspect-ratio-parsing-tests-expected.txt:
+ * fast/css/aspect-ratio-parsing-tests.html:
+
</ins><span class="cx"> 2014-02-10 Mark Lam <mark.lam@apple.com>
</span><span class="cx">
</span><span class="cx"> REGRESSION(r163660-r163664): js/dom/stack-trace.html fails.
</span></span></pre></div>
<a id="trunkLayoutTestsfastcssaspectratioinheritanceexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css/aspect-ratio-inheritance-expected.txt (163839 => 163840)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/aspect-ratio-inheritance-expected.txt        2014-02-11 01:10:18 UTC (rev 163839)
+++ trunk/LayoutTests/fast/css/aspect-ratio-inheritance-expected.txt        2014-02-11 01:20:28 UTC (rev 163840)
</span><span class="lines">@@ -1,6 +1,10 @@
</span><del>-PASS testComputedValue("aspectRatioTest", "1 / 4", "-webkit-aspect-ratio") is "1/4"
-PASS testComputedValue("aspectRatioTest", "inherit", "-webkit-aspect-ratio") is "1/2"
-PASS testComputedValue("aspectRatioTest", "none", "-webkit-aspect-ratio") is "none"
</del><ins>+PASS testComputedValue("aspectRatioTest1", "1 / 4", "-webkit-aspect-ratio") is "1/4"
+PASS testComputedValue("aspectRatioTest1", "inherit", "-webkit-aspect-ratio") is "1/2"
+PASS testComputedValue("aspectRatioTest1", "auto", "-webkit-aspect-ratio") is "auto"
+PASS testComputedValue("aspectRatioTest2", "1 / 4", "-webkit-aspect-ratio") is "1/4"
+PASS testComputedValue("aspectRatioTest2", "inherit", "-webkit-aspect-ratio") is "from-dimensions"
+PASS testComputedValue("aspectRatioTest3", "1 / 4", "-webkit-aspect-ratio") is "1/4"
+PASS testComputedValue("aspectRatioTest3", "inherit", "-webkit-aspect-ratio") is "from-intrinsic"
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsfastcssaspectratioinheritancehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css/aspect-ratio-inheritance.html (163839 => 163840)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/aspect-ratio-inheritance.html        2014-02-11 01:10:18 UTC (rev 163839)
+++ trunk/LayoutTests/fast/css/aspect-ratio-inheritance.html        2014-02-11 01:20:28 UTC (rev 163840)
</span><span class="lines">@@ -1,8 +1,14 @@
</span><span class="cx"> <!DOCTYPE html>
</span><span class="cx"> <script src="../../resources/js-test-pre.js"></script>
</span><span class="cx"> <div style="-webkit-aspect-ratio: 1 / 2;">
</span><del>- <div id="aspectRatioTest"></div>
</del><ins>+ <div id="aspectRatioTest1"></div>
</ins><span class="cx"> </div>
</span><ins>+<div style="-webkit-aspect-ratio: from-dimensions;">
+ <div id="aspectRatioTest2"></div>
+</div>
+<div style="-webkit-aspect-ratio: from-intrinsic;">
+ <div id="aspectRatioTest3"></div>
+</div>
</ins><span class="cx"> <script>
</span><span class="cx"> function testComputedValue(elementId, value, styleAttribute)
</span><span class="cx"> {
</span><span class="lines">@@ -11,8 +17,12 @@
</span><span class="cx"> var computedValue = window.getComputedStyle(div)[styleAttribute];
</span><span class="cx"> return computedValue;
</span><span class="cx"> }
</span><del>- shouldBeEqualToString('testComputedValue("aspectRatioTest", "1 / 4", "-webkit-aspect-ratio")', '1/4');
- shouldBeEqualToString('testComputedValue("aspectRatioTest", "inherit", "-webkit-aspect-ratio")', '1/2');
- shouldBeEqualToString('testComputedValue("aspectRatioTest", "none", "-webkit-aspect-ratio")', 'none');
</del><ins>+ shouldBeEqualToString('testComputedValue("aspectRatioTest1", "1 / 4", "-webkit-aspect-ratio")', '1/4');
+ shouldBeEqualToString('testComputedValue("aspectRatioTest1", "inherit", "-webkit-aspect-ratio")', '1/2');
+ shouldBeEqualToString('testComputedValue("aspectRatioTest1", "auto", "-webkit-aspect-ratio")', 'auto');
+ shouldBeEqualToString('testComputedValue("aspectRatioTest2", "1 / 4", "-webkit-aspect-ratio")', '1/4');
+ shouldBeEqualToString('testComputedValue("aspectRatioTest2", "inherit", "-webkit-aspect-ratio")', 'from-dimensions');
+ shouldBeEqualToString('testComputedValue("aspectRatioTest3", "1 / 4", "-webkit-aspect-ratio")', '1/4');
+ shouldBeEqualToString('testComputedValue("aspectRatioTest3", "inherit", "-webkit-aspect-ratio")', 'from-intrinsic');
</ins><span class="cx"> </script>
</span><span class="cx"> <script src="../../resources/js-test-post.js"></script>
</span></span></pre></div>
<a id="trunkLayoutTestsfastcssaspectratioparsingtestsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css/aspect-ratio-parsing-tests-expected.txt (163839 => 163840)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/aspect-ratio-parsing-tests-expected.txt        2014-02-11 01:10:18 UTC (rev 163839)
+++ trunk/LayoutTests/fast/css/aspect-ratio-parsing-tests-expected.txt        2014-02-11 01:20:28 UTC (rev 163840)
</span><span class="lines">@@ -10,18 +10,21 @@
</span><span class="cx"> PASS testParsing("aspectRatioTest", "1.2 / 2", "-webkit-aspect-ratio") is "1.2/2"
</span><span class="cx"> PASS testParsing("aspectRatioTest", "2 / 0.5", "-webkit-aspect-ratio") is "2/0.5"
</span><span class="cx"> PASS testParsing("aspectRatioTest", "inherit", "-webkit-aspect-ratio") is "inherit"
</span><del>-PASS testParsing("aspectRatioTest", "none", "-webkit-aspect-ratio") is "none"
-PASS testParsing("aspectRatioTest", "1 2", "-webkit-aspect-ratio") is "none"
-PASS testParsing("aspectRatioTest", "a/1", "-webkit-aspect-ratio") is "none"
-PASS testParsing("aspectRatioTest", "1/a", "-webkit-aspect-ratio") is "none"
-PASS testParsing("aspectRatioTest", "abc123", "-webkit-aspect-ratio") is "none"
-PASS testParsing("aspectRatioTest", "1", "-webkit-aspect-ratio") is "none"
-PASS testParsing("aspectRatioTest", "1 / 0", "-webkit-aspect-ratio") is "none"
-PASS testParsing("aspectRatioTest", "0 / 1", "-webkit-aspect-ratio") is "none"
-PASS testParsing("aspectRatioTest", "0 / 0", "-webkit-aspect-ratio") is "none"
-PASS testParsing("aspectRatioTest", "-1 / 8", "-webkit-aspect-ratio") is "none"
-PASS testParsing("aspectRatioTest", "1 / -9", "-webkit-aspect-ratio") is "none"
-PASS testParsing("aspectRatioTest", "-1 / -4", "-webkit-aspect-ratio") is "none"
</del><ins>+PASS testParsing("aspectRatioTest", "from-dimensions", "-webkit-aspect-ratio") is "from-dimensions"
+PASS testParsing("aspectRatioTest", "from-intrinsic", "-webkit-aspect-ratio") is "from-intrinsic"
+PASS testParsing("aspectRatioTest", "auto", "-webkit-aspect-ratio") is "auto"
+PASS testParsing("aspectRatioTest", "none", "-webkit-aspect-ratio") is "auto"
+PASS testParsing("aspectRatioTest", "1 2", "-webkit-aspect-ratio") is "auto"
+PASS testParsing("aspectRatioTest", "a/1", "-webkit-aspect-ratio") is "auto"
+PASS testParsing("aspectRatioTest", "1/a", "-webkit-aspect-ratio") is "auto"
+PASS testParsing("aspectRatioTest", "abc123", "-webkit-aspect-ratio") is "auto"
+PASS testParsing("aspectRatioTest", "1", "-webkit-aspect-ratio") is "auto"
+PASS testParsing("aspectRatioTest", "1 / 0", "-webkit-aspect-ratio") is "auto"
+PASS testParsing("aspectRatioTest", "0 / 1", "-webkit-aspect-ratio") is "auto"
+PASS testParsing("aspectRatioTest", "0 / 0", "-webkit-aspect-ratio") is "auto"
+PASS testParsing("aspectRatioTest", "-1 / 8", "-webkit-aspect-ratio") is "auto"
+PASS testParsing("aspectRatioTest", "1 / -9", "-webkit-aspect-ratio") is "auto"
+PASS testParsing("aspectRatioTest", "-1 / -4", "-webkit-aspect-ratio") is "auto"
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsfastcssaspectratioparsingtestshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css/aspect-ratio-parsing-tests.html (163839 => 163840)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/aspect-ratio-parsing-tests.html        2014-02-11 01:10:18 UTC (rev 163839)
+++ trunk/LayoutTests/fast/css/aspect-ratio-parsing-tests.html        2014-02-11 01:20:28 UTC (rev 163840)
</span><span class="lines">@@ -23,20 +23,23 @@
</span><span class="cx"> shouldBeEqualToString('testParsing("aspectRatioTest", "1.2 / 2", "-webkit-aspect-ratio")', '1.2/2');
</span><span class="cx"> shouldBeEqualToString('testParsing("aspectRatioTest", "2 / 0.5", "-webkit-aspect-ratio")', '2/0.5');
</span><span class="cx"> shouldBeEqualToString('testParsing("aspectRatioTest", "inherit", "-webkit-aspect-ratio")', 'inherit');
</span><del>- shouldBeEqualToString('testParsing("aspectRatioTest", "none", "-webkit-aspect-ratio")', 'none');
</del><ins>+ shouldBeEqualToString('testParsing("aspectRatioTest", "from-dimensions", "-webkit-aspect-ratio")', 'from-dimensions');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "from-intrinsic", "-webkit-aspect-ratio")', 'from-intrinsic');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "auto", "-webkit-aspect-ratio")', 'auto');
</ins><span class="cx">
</span><span class="cx"> // The following are invalid and should get ignored.
</span><del>- shouldBeEqualToString('testParsing("aspectRatioTest", "1 2", "-webkit-aspect-ratio")', 'none');
- shouldBeEqualToString('testParsing("aspectRatioTest", "a/1", "-webkit-aspect-ratio")', 'none');
- shouldBeEqualToString('testParsing("aspectRatioTest", "1/a", "-webkit-aspect-ratio")', 'none');
- shouldBeEqualToString('testParsing("aspectRatioTest", "abc123", "-webkit-aspect-ratio")', 'none');
- shouldBeEqualToString('testParsing("aspectRatioTest", "1", "-webkit-aspect-ratio")', 'none');
- shouldBeEqualToString('testParsing("aspectRatioTest", "1 / 0", "-webkit-aspect-ratio")', 'none');
- shouldBeEqualToString('testParsing("aspectRatioTest", "0 / 1", "-webkit-aspect-ratio")', 'none');
- shouldBeEqualToString('testParsing("aspectRatioTest", "0 / 0", "-webkit-aspect-ratio")', 'none');
- shouldBeEqualToString('testParsing("aspectRatioTest", "-1 / 8", "-webkit-aspect-ratio")', 'none');
- shouldBeEqualToString('testParsing("aspectRatioTest", "1 / -9", "-webkit-aspect-ratio")', 'none');
- shouldBeEqualToString('testParsing("aspectRatioTest", "-1 / -4", "-webkit-aspect-ratio")', 'none');
</del><ins>+ shouldBeEqualToString('testParsing("aspectRatioTest", "none", "-webkit-aspect-ratio")', 'auto');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "1 2", "-webkit-aspect-ratio")', 'auto');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "a/1", "-webkit-aspect-ratio")', 'auto');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "1/a", "-webkit-aspect-ratio")', 'auto');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "abc123", "-webkit-aspect-ratio")', 'auto');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "1", "-webkit-aspect-ratio")', 'auto');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "1 / 0", "-webkit-aspect-ratio")', 'auto');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "0 / 1", "-webkit-aspect-ratio")', 'auto');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "0 / 0", "-webkit-aspect-ratio")', 'auto');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "-1 / 8", "-webkit-aspect-ratio")', 'auto');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "1 / -9", "-webkit-aspect-ratio")', 'auto');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "-1 / -4", "-webkit-aspect-ratio")', 'auto');
</ins><span class="cx"> </script>
</span><span class="cx"> <script src="../../resources/js-test-post.js"></script>
</span><span class="cx"> </body>
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (163839 => 163840)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-11 01:10:18 UTC (rev 163839)
+++ trunk/Source/WebCore/ChangeLog        2014-02-11 01:20:28 UTC (rev 163840)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2014-02-09 Dean Jackson <dino@apple.com>
+
+ Update aspect-ratio property to have constraining keywords
+ https://bugs.webkit.org/show_bug.cgi?id=128262
+
+ Reviewed by Simon Fraser.
+
+ Add support for "from-dimensions" and "from-intrinsic"
+ property values to "-webkit-aspect-ratio". I also changed
+ the default value from "none" to "auto", because "none" doesn't
+ make sense any more.
+
+ Covered by enhancing existing tests.
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::ComputedStyleExtractor::propertyValue): New keywords.
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseAspectRatio): Support new keywords.
+ * css/CSSValueKeywords.in: Add from-dimensions and from-intrinsic.
+ * css/DeprecatedStyleBuilder.cpp: This now has to handle the new
+ values. I also changed "none" to "auto".
+ (WebCore::ApplyPropertyAspectRatio::applyInheritValue):
+ (WebCore::ApplyPropertyAspectRatio::applyInitialValue):
+ (WebCore::ApplyPropertyAspectRatio::applyValue):
+ * rendering/style/RenderStyle.h: hasAspectRatio is now aspectRatioType
+ and indicates one of the three keywords, or a specified number.
+ * rendering/style/RenderStyleConstants.h: New enum.
+ * rendering/style/StyleRareNonInheritedData.cpp:
+ (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
+ (WebCore::StyleRareNonInheritedData::operator==):
+ * rendering/style/StyleRareNonInheritedData.h:
+
</ins><span class="cx"> 2014-02-10 Benjamin Poulain <bpoulain@apple.com>
</span><span class="cx">
</span><span class="cx"> [WK2] Add support for image document viewport configuration
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSComputedStyleDeclarationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (163839 => 163840)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp        2014-02-11 01:10:18 UTC (rev 163839)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp        2014-02-11 01:20:28 UTC (rev 163840)
</span><span class="lines">@@ -2583,8 +2583,12 @@
</span><span class="cx"> case CSSPropertyWebkitAppearance:
</span><span class="cx"> return cssValuePool().createValue(style->appearance());
</span><span class="cx"> case CSSPropertyWebkitAspectRatio:
</span><del>- if (!style->hasAspectRatio())
- return cssValuePool().createIdentifierValue(CSSValueNone);
</del><ins>+ if (style->aspectRatioType() == AspectRatioAuto)
+ return cssValuePool().createIdentifierValue(CSSValueAuto);
+ if (style->aspectRatioType() == AspectRatioFromDimensions)
+ return cssValuePool().createIdentifierValue(CSSValueFromDimensions);
+ if (style->aspectRatioType() == AspectRatioFromIntrinsic)
+ return cssValuePool().createIdentifierValue(CSSValueFromIntrinsic);
</ins><span class="cx"> return CSSAspectRatioValue::create(style->aspectRatioNumerator(), style->aspectRatioDenominator());
</span><span class="cx"> case CSSPropertyWebkitBackfaceVisibility:
</span><span class="cx"> return cssValuePool().createIdentifierValue((style->backfaceVisibility() == BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible);
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSParser.cpp (163839 => 163840)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSParser.cpp        2014-02-11 01:10:18 UTC (rev 163839)
+++ trunk/Source/WebCore/css/CSSParser.cpp        2014-02-11 01:20:28 UTC (rev 163840)
</span><span class="lines">@@ -7707,9 +7707,12 @@
</span><span class="cx"> bool CSSParser::parseAspectRatio(bool important)
</span><span class="cx"> {
</span><span class="cx"> unsigned num = m_valueList->size();
</span><del>- if (num == 1 && m_valueList->valueAt(0)->id == CSSValueNone) {
- addProperty(CSSPropertyWebkitAspectRatio, cssValuePool().createIdentifierValue(CSSValueNone), important);
- return true;
</del><ins>+ if (num == 1) {
+ CSSValueID valueId = m_valueList->valueAt(0)->id;
+ if (valueId == CSSValueAuto || valueId == CSSValueFromDimensions || valueId == CSSValueFromIntrinsic) {
+ addProperty(CSSPropertyWebkitAspectRatio, cssValuePool().createIdentifierValue(valueId), important);
+ return true;
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (num != 3)
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSValueKeywordsin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (163839 => 163840)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSValueKeywords.in        2014-02-11 01:10:18 UTC (rev 163839)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in        2014-02-11 01:20:28 UTC (rev 163840)
</span><span class="lines">@@ -1050,3 +1050,7 @@
</span><span class="cx">
</span><span class="cx"> // -webkit-column-fill
</span><span class="cx"> balance
</span><ins>+
+// -webkit-aspect-ratio
+from-dimensions
+from-intrinsic
</ins></span></pre></div>
<a id="trunkSourceWebCorecssDeprecatedStyleBuildercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (163839 => 163840)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp        2014-02-11 01:10:18 UTC (rev 163839)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp        2014-02-11 01:20:28 UTC (rev 163840)
</span><span class="lines">@@ -1982,28 +1982,40 @@
</span><span class="cx"> public:
</span><span class="cx"> static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
</span><span class="cx"> {
</span><del>- if (!styleResolver->parentStyle()->hasAspectRatio())
</del><ins>+ if (styleResolver->parentStyle()->aspectRatioType() == AspectRatioAuto)
</ins><span class="cx"> return;
</span><del>- styleResolver->style()->setHasAspectRatio(true);
</del><ins>+ styleResolver->style()->setAspectRatioType(styleResolver->parentStyle()->aspectRatioType());
</ins><span class="cx"> styleResolver->style()->setAspectRatioDenominator(styleResolver->parentStyle()->aspectRatioDenominator());
</span><span class="cx"> styleResolver->style()->setAspectRatioNumerator(styleResolver->parentStyle()->aspectRatioNumerator());
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
</span><span class="cx"> {
</span><del>- styleResolver->style()->setHasAspectRatio(RenderStyle::initialHasAspectRatio());
</del><ins>+ styleResolver->style()->setAspectRatioType(RenderStyle::initialAspectRatioType());
</ins><span class="cx"> styleResolver->style()->setAspectRatioDenominator(RenderStyle::initialAspectRatioDenominator());
</span><span class="cx"> styleResolver->style()->setAspectRatioNumerator(RenderStyle::initialAspectRatioNumerator());
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
</span><span class="cx"> {
</span><ins>+ if (value->isPrimitiveValue()) {
+ CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+
+ if (primitiveValue->getValueID() == CSSValueAuto)
+ return styleResolver->style()->setAspectRatioType(AspectRatioAuto);
+ if (primitiveValue->getValueID() == CSSValueFromDimensions)
+ return styleResolver->style()->setAspectRatioType(AspectRatioFromDimensions);
+ if (primitiveValue->getValueID() == CSSValueFromIntrinsic)
+ return styleResolver->style()->setAspectRatioType(AspectRatioFromIntrinsic);
+ }
+
</ins><span class="cx"> if (!value->isAspectRatioValue()) {
</span><del>- styleResolver->style()->setHasAspectRatio(false);
</del><ins>+ styleResolver->style()->setAspectRatioType(AspectRatioAuto);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> CSSAspectRatioValue* aspectRatioValue = toCSSAspectRatioValue(value);
</span><del>- styleResolver->style()->setHasAspectRatio(true);
</del><ins>+ styleResolver->style()->setAspectRatioType(AspectRatioSpecified);
</ins><span class="cx"> styleResolver->style()->setAspectRatioDenominator(aspectRatioValue->denominatorValue());
</span><span class="cx"> styleResolver->style()->setAspectRatioNumerator(aspectRatioValue->numeratorValue());
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleRenderStyleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (163839 => 163840)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/RenderStyle.h        2014-02-11 01:10:18 UTC (rev 163839)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h        2014-02-11 01:20:28 UTC (rev 163840)
</span><span class="lines">@@ -743,8 +743,7 @@
</span><span class="cx"> ColorSpace colorSpace() const { return static_cast<ColorSpace>(rareInheritedData->colorSpace); }
</span><span class="cx"> float opacity() const { return rareNonInheritedData->opacity; }
</span><span class="cx"> ControlPart appearance() const { return static_cast<ControlPart>(rareNonInheritedData->m_appearance); }
</span><del>- // aspect ratio convenience method
- bool hasAspectRatio() const { return rareNonInheritedData->m_hasAspectRatio; }
</del><ins>+ AspectRatioType aspectRatioType() const { return static_cast<AspectRatioType>(rareNonInheritedData->m_aspectRatioType); }
</ins><span class="cx"> float aspectRatio() const { return aspectRatioNumerator() / aspectRatioDenominator(); }
</span><span class="cx"> float aspectRatioDenominator() const { return rareNonInheritedData->m_aspectRatioDenominator; }
</span><span class="cx"> float aspectRatioNumerator() const { return rareNonInheritedData->m_aspectRatioNumerator; }
</span><span class="lines">@@ -1214,7 +1213,7 @@
</span><span class="cx"> void setEmptyCells(EEmptyCell v) { inherited_flags._empty_cells = v; }
</span><span class="cx"> void setCaptionSide(ECaptionSide v) { inherited_flags._caption_side = v; }
</span><span class="cx">
</span><del>- void setHasAspectRatio(bool b) { SET_VAR(rareNonInheritedData, m_hasAspectRatio, b); }
</del><ins>+ void setAspectRatioType(AspectRatioType aspectRatioType) { SET_VAR(rareNonInheritedData, m_aspectRatioType, aspectRatioType); }
</ins><span class="cx"> void setAspectRatioDenominator(float v) { SET_VAR(rareNonInheritedData, m_aspectRatioDenominator, v); }
</span><span class="cx"> void setAspectRatioNumerator(float v) { SET_VAR(rareNonInheritedData, m_aspectRatioNumerator, v); }
</span><span class="cx">
</span><span class="lines">@@ -1723,7 +1722,7 @@
</span><span class="cx"> static EBorderFit initialBorderFit() { return BorderFitBorder; }
</span><span class="cx"> static EResize initialResize() { return RESIZE_NONE; }
</span><span class="cx"> static ControlPart initialAppearance() { return NoControlPart; }
</span><del>- static bool initialHasAspectRatio() { return false; }
</del><ins>+ static AspectRatioType initialAspectRatioType() { return AspectRatioAuto; }
</ins><span class="cx"> static float initialAspectRatioDenominator() { return 1; }
</span><span class="cx"> static float initialAspectRatioNumerator() { return 1; }
</span><span class="cx"> static Order initialRTLOrdering() { return LogicalOrder; }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleRenderStyleConstantsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.h (163839 => 163840)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/RenderStyleConstants.h        2014-02-11 01:10:18 UTC (rev 163839)
+++ trunk/Source/WebCore/rendering/style/RenderStyleConstants.h        2014-02-11 01:20:28 UTC (rev 163840)
</span><span class="lines">@@ -214,6 +214,10 @@
</span><span class="cx"> ObjectFitFill, ObjectFitContain, ObjectFitCover, ObjectFitNone, ObjectFitScaleDown
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+enum AspectRatioType {
+ AspectRatioAuto, AspectRatioFromIntrinsic, AspectRatioFromDimensions, AspectRatioSpecified
+};
+
</ins><span class="cx"> // Word Break Values. Matches WinIE, rather than CSS3
</span><span class="cx">
</span><span class="cx"> enum EWordBreak {
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleStyleRareNonInheritedDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp (163839 => 163840)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp        2014-02-11 01:10:18 UTC (rev 163839)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp        2014-02-11 01:20:28 UTC (rev 163840)
</span><span class="lines">@@ -89,7 +89,7 @@
</span><span class="cx"> , m_wrapFlow(RenderStyle::initialWrapFlow())
</span><span class="cx"> , m_wrapThrough(RenderStyle::initialWrapThrough())
</span><span class="cx"> , m_runningAcceleratedAnimation(false)
</span><del>- , m_hasAspectRatio(false)
</del><ins>+ , m_aspectRatioType(RenderStyle::initialAspectRatioType())
</ins><span class="cx"> #if ENABLE(CSS_COMPOSITING)
</span><span class="cx"> , m_effectiveBlendMode(RenderStyle::initialBlendMode())
</span><span class="cx"> #endif
</span><span class="lines">@@ -169,7 +169,7 @@
</span><span class="cx"> , m_wrapFlow(o.m_wrapFlow)
</span><span class="cx"> , m_wrapThrough(o.m_wrapThrough)
</span><span class="cx"> , m_runningAcceleratedAnimation(o.m_runningAcceleratedAnimation)
</span><del>- , m_hasAspectRatio(o.m_hasAspectRatio)
</del><ins>+ , m_aspectRatioType(o.m_aspectRatioType)
</ins><span class="cx"> #if ENABLE(CSS_COMPOSITING)
</span><span class="cx"> , m_effectiveBlendMode(o.m_effectiveBlendMode)
</span><span class="cx"> #endif
</span><span class="lines">@@ -263,7 +263,7 @@
</span><span class="cx"> #if ENABLE(CSS_COMPOSITING)
</span><span class="cx"> && m_effectiveBlendMode == o.m_effectiveBlendMode
</span><span class="cx"> #endif
</span><del>- && m_hasAspectRatio == o.m_hasAspectRatio
</del><ins>+ && m_aspectRatioType == o.m_aspectRatioType
</ins><span class="cx"> && m_objectFit == o.m_objectFit;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleStyleRareNonInheritedDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h (163839 => 163840)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h        2014-02-11 01:10:18 UTC (rev 163839)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h        2014-02-11 01:20:28 UTC (rev 163840)
</span><span class="lines">@@ -190,7 +190,7 @@
</span><span class="cx">
</span><span class="cx"> unsigned m_runningAcceleratedAnimation : 1;
</span><span class="cx">
</span><del>- unsigned m_hasAspectRatio : 1; // Whether or not an aspect ratio has been specified.
</del><ins>+ unsigned m_aspectRatioType : 2;
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(CSS_COMPOSITING)
</span><span class="cx"> unsigned m_effectiveBlendMode: 5; // EBlendMode
</span></span></pre>
</div>
</div>
</body>
</html>