Title: [163840] trunk
Revision
163840
Author
d...@apple.com
Date
2014-02-10 17:20:28 -0800 (Mon, 10 Feb 2014)

Log Message

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:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (163839 => 163840)


--- trunk/LayoutTests/ChangeLog	2014-02-11 01:10:18 UTC (rev 163839)
+++ trunk/LayoutTests/ChangeLog	2014-02-11 01:20:28 UTC (rev 163840)
@@ -1,3 +1,18 @@
+2014-02-09  Dean Jackson  <d...@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:
+
 2014-02-10  Mark Lam  <mark....@apple.com>
 
         REGRESSION(r163660-r163664): js/dom/stack-trace.html fails.

Modified: trunk/LayoutTests/fast/css/aspect-ratio-inheritance-expected.txt (163839 => 163840)


--- 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)
@@ -1,6 +1,10 @@
-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"
+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"
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/css/aspect-ratio-inheritance.html (163839 => 163840)


--- 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)
@@ -1,8 +1,14 @@
 <!DOCTYPE html>
 <script src=""
 <div style="-webkit-aspect-ratio: 1 / 2;">
-  <div id="aspectRatioTest"></div>
+  <div id="aspectRatioTest1"></div>
 </div>
+<div style="-webkit-aspect-ratio: from-dimensions;">
+  <div id="aspectRatioTest2"></div>
+</div>
+<div style="-webkit-aspect-ratio: from-intrinsic;">
+  <div id="aspectRatioTest3"></div>
+</div>
 <script>
     function testComputedValue(elementId, value, styleAttribute)
     {
@@ -11,8 +17,12 @@
         var computedValue = window.getComputedStyle(div)[styleAttribute];
         return computedValue;
     }
-    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');
+    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');
 </script>
 <script src=""

Modified: trunk/LayoutTests/fast/css/aspect-ratio-parsing-tests-expected.txt (163839 => 163840)


--- 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)
@@ -10,18 +10,21 @@
 PASS testParsing("aspectRatioTest", "1.2 / 2", "-webkit-aspect-ratio") is "1.2/2"
 PASS testParsing("aspectRatioTest", "2 / 0.5", "-webkit-aspect-ratio") is "2/0.5"
 PASS testParsing("aspectRatioTest", "inherit", "-webkit-aspect-ratio") is "inherit"
-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"
+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"
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/css/aspect-ratio-parsing-tests.html (163839 => 163840)


--- 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)
@@ -23,20 +23,23 @@
       shouldBeEqualToString('testParsing("aspectRatioTest", "1.2 / 2", "-webkit-aspect-ratio")', '1.2/2');
       shouldBeEqualToString('testParsing("aspectRatioTest", "2 / 0.5", "-webkit-aspect-ratio")', '2/0.5');
       shouldBeEqualToString('testParsing("aspectRatioTest", "inherit", "-webkit-aspect-ratio")', 'inherit');
-      shouldBeEqualToString('testParsing("aspectRatioTest", "none", "-webkit-aspect-ratio")', 'none');
+      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');
 
       // The following are invalid and should get ignored.
-      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');
+      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');
     </script>
     <script src=""
   </body>

Modified: trunk/Source/WebCore/ChangeLog (163839 => 163840)


--- 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)
@@ -1,3 +1,35 @@
+2014-02-09  Dean Jackson  <d...@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:
+
 2014-02-10  Benjamin Poulain  <bpoul...@apple.com>
 
         [WK2] Add support for image document viewport configuration

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (163839 => 163840)


--- 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)
@@ -2583,8 +2583,12 @@
         case CSSPropertyWebkitAppearance:
             return cssValuePool().createValue(style->appearance());
         case CSSPropertyWebkitAspectRatio:
-            if (!style->hasAspectRatio())
-                return cssValuePool().createIdentifierValue(CSSValueNone);
+            if (style->aspectRatioType() == AspectRatioAuto)
+                return cssValuePool().createIdentifierValue(CSSValueAuto);
+            if (style->aspectRatioType() == AspectRatioFromDimensions)
+                return cssValuePool().createIdentifierValue(CSSValueFromDimensions);
+            if (style->aspectRatioType() == AspectRatioFromIntrinsic)
+                return cssValuePool().createIdentifierValue(CSSValueFromIntrinsic);
             return CSSAspectRatioValue::create(style->aspectRatioNumerator(), style->aspectRatioDenominator());
         case CSSPropertyWebkitBackfaceVisibility:
             return cssValuePool().createIdentifierValue((style->backfaceVisibility() == BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible);

Modified: trunk/Source/WebCore/css/CSSParser.cpp (163839 => 163840)


--- 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)
@@ -7707,9 +7707,12 @@
 bool CSSParser::parseAspectRatio(bool important)
 {
     unsigned num = m_valueList->size();
-    if (num == 1 && m_valueList->valueAt(0)->id == CSSValueNone) {
-        addProperty(CSSPropertyWebkitAspectRatio, cssValuePool().createIdentifierValue(CSSValueNone), important);
-        return true;
+    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;
+        }
     }
 
     if (num != 3)

Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (163839 => 163840)


--- 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)
@@ -1050,3 +1050,7 @@
 
 // -webkit-column-fill
 balance
+
+// -webkit-aspect-ratio
+from-dimensions
+from-intrinsic

Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (163839 => 163840)


--- 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)
@@ -1982,28 +1982,40 @@
 public:
     static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
     {
-        if (!styleResolver->parentStyle()->hasAspectRatio())
+        if (styleResolver->parentStyle()->aspectRatioType() == AspectRatioAuto)
             return;
-        styleResolver->style()->setHasAspectRatio(true);
+        styleResolver->style()->setAspectRatioType(styleResolver->parentStyle()->aspectRatioType());
         styleResolver->style()->setAspectRatioDenominator(styleResolver->parentStyle()->aspectRatioDenominator());
         styleResolver->style()->setAspectRatioNumerator(styleResolver->parentStyle()->aspectRatioNumerator());
     }
 
     static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
     {
-        styleResolver->style()->setHasAspectRatio(RenderStyle::initialHasAspectRatio());
+        styleResolver->style()->setAspectRatioType(RenderStyle::initialAspectRatioType());
         styleResolver->style()->setAspectRatioDenominator(RenderStyle::initialAspectRatioDenominator());
         styleResolver->style()->setAspectRatioNumerator(RenderStyle::initialAspectRatioNumerator());
     }
 
     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
     {
+        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);
+        }
+
         if (!value->isAspectRatioValue()) {
-            styleResolver->style()->setHasAspectRatio(false);
+            styleResolver->style()->setAspectRatioType(AspectRatioAuto);
             return;
         }
+
         CSSAspectRatioValue* aspectRatioValue = toCSSAspectRatioValue(value);
-        styleResolver->style()->setHasAspectRatio(true);
+        styleResolver->style()->setAspectRatioType(AspectRatioSpecified);
         styleResolver->style()->setAspectRatioDenominator(aspectRatioValue->denominatorValue());
         styleResolver->style()->setAspectRatioNumerator(aspectRatioValue->numeratorValue());
     }

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (163839 => 163840)


--- 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)
@@ -743,8 +743,7 @@
     ColorSpace colorSpace() const { return static_cast<ColorSpace>(rareInheritedData->colorSpace); }
     float opacity() const { return rareNonInheritedData->opacity; }
     ControlPart appearance() const { return static_cast<ControlPart>(rareNonInheritedData->m_appearance); }
-    // aspect ratio convenience method
-    bool hasAspectRatio() const { return rareNonInheritedData->m_hasAspectRatio; }
+    AspectRatioType aspectRatioType() const { return static_cast<AspectRatioType>(rareNonInheritedData->m_aspectRatioType); }
     float aspectRatio() const { return aspectRatioNumerator() / aspectRatioDenominator(); }
     float aspectRatioDenominator() const { return rareNonInheritedData->m_aspectRatioDenominator; }
     float aspectRatioNumerator() const { return rareNonInheritedData->m_aspectRatioNumerator; }
@@ -1214,7 +1213,7 @@
     void setEmptyCells(EEmptyCell v) { inherited_flags._empty_cells = v; }
     void setCaptionSide(ECaptionSide v) { inherited_flags._caption_side = v; }
 
-    void setHasAspectRatio(bool b) { SET_VAR(rareNonInheritedData, m_hasAspectRatio, b); }
+    void setAspectRatioType(AspectRatioType aspectRatioType) { SET_VAR(rareNonInheritedData, m_aspectRatioType, aspectRatioType); }
     void setAspectRatioDenominator(float v) { SET_VAR(rareNonInheritedData, m_aspectRatioDenominator, v); }
     void setAspectRatioNumerator(float v) { SET_VAR(rareNonInheritedData, m_aspectRatioNumerator, v); }
 
@@ -1723,7 +1722,7 @@
     static EBorderFit initialBorderFit() { return BorderFitBorder; }
     static EResize initialResize() { return RESIZE_NONE; }
     static ControlPart initialAppearance() { return NoControlPart; }
-    static bool initialHasAspectRatio() { return false; }
+    static AspectRatioType initialAspectRatioType() { return AspectRatioAuto; }
     static float initialAspectRatioDenominator() { return 1; }
     static float initialAspectRatioNumerator() { return 1; }
     static Order initialRTLOrdering() { return LogicalOrder; }

Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.h (163839 => 163840)


--- 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)
@@ -214,6 +214,10 @@
     ObjectFitFill, ObjectFitContain, ObjectFitCover, ObjectFitNone, ObjectFitScaleDown
 };
 
+enum AspectRatioType {
+    AspectRatioAuto, AspectRatioFromIntrinsic, AspectRatioFromDimensions, AspectRatioSpecified
+};
+
 // Word Break Values. Matches WinIE, rather than CSS3
 
 enum EWordBreak {

Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp (163839 => 163840)


--- 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)
@@ -89,7 +89,7 @@
     , m_wrapFlow(RenderStyle::initialWrapFlow())
     , m_wrapThrough(RenderStyle::initialWrapThrough())
     , m_runningAcceleratedAnimation(false)
-    , m_hasAspectRatio(false)
+    , m_aspectRatioType(RenderStyle::initialAspectRatioType())
 #if ENABLE(CSS_COMPOSITING)
     , m_effectiveBlendMode(RenderStyle::initialBlendMode())
 #endif
@@ -169,7 +169,7 @@
     , m_wrapFlow(o.m_wrapFlow)
     , m_wrapThrough(o.m_wrapThrough)
     , m_runningAcceleratedAnimation(o.m_runningAcceleratedAnimation)
-    , m_hasAspectRatio(o.m_hasAspectRatio)
+    , m_aspectRatioType(o.m_aspectRatioType)
 #if ENABLE(CSS_COMPOSITING)
     , m_effectiveBlendMode(o.m_effectiveBlendMode)
 #endif
@@ -263,7 +263,7 @@
 #if ENABLE(CSS_COMPOSITING)
         && m_effectiveBlendMode == o.m_effectiveBlendMode
 #endif
-        && m_hasAspectRatio == o.m_hasAspectRatio
+        && m_aspectRatioType == o.m_aspectRatioType
         && m_objectFit == o.m_objectFit;
 }
 

Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h (163839 => 163840)


--- 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)
@@ -190,7 +190,7 @@
 
     unsigned m_runningAcceleratedAnimation : 1;
 
-    unsigned m_hasAspectRatio : 1; // Whether or not an aspect ratio has been specified.
+    unsigned m_aspectRatioType : 2;
 
 #if ENABLE(CSS_COMPOSITING)
     unsigned m_effectiveBlendMode: 5; // EBlendMode
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to