Diff
Modified: trunk/LayoutTests/ChangeLog (101274 => 101275)
--- trunk/LayoutTests/ChangeLog 2011-11-28 20:48:23 UTC (rev 101274)
+++ trunk/LayoutTests/ChangeLog 2011-11-28 20:55:26 UTC (rev 101275)
@@ -1,3 +1,19 @@
+2011-11-28 Fady Samuel <fsam...@chromium.org>
+
+ Fix Aspect Ratio Property Inheritance And Make the Computed Value Equal the Specified Value
+ https://bugs.webkit.org/show_bug.cgi?id=73038
+
+ Reviewed by Ojan Vafai.
+
+ Updated the parsing test to make sure that the -webkit-aspect-ratio property accepts inherit as a possible value.
+
+ Added an inheritance test that checks the computed value is correctly inherited.
+
+ * fast/css/aspect-ratio-inheritance-expected.txt: Added.
+ * fast/css/aspect-ratio-inheritance.html: Added.
+ * fast/css/aspect-ratio-parsing-tests-expected.txt:
+ * fast/css/aspect-ratio-parsing-tests.html:
+
2011-11-28 Ken Buchanan <ke...@chromium.org>
Crash due to bidi style in isolated run
Added: trunk/LayoutTests/fast/css/aspect-ratio-inheritance-expected.txt (0 => 101275)
--- trunk/LayoutTests/fast/css/aspect-ratio-inheritance-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/aspect-ratio-inheritance-expected.txt 2011-11-28 20:55:26 UTC (rev 101275)
@@ -0,0 +1,7 @@
+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 successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/css/aspect-ratio-inheritance.html (0 => 101275)
--- trunk/LayoutTests/fast/css/aspect-ratio-inheritance.html (rev 0)
+++ trunk/LayoutTests/fast/css/aspect-ratio-inheritance.html 2011-11-28 20:55:26 UTC (rev 101275)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<script src=""
+<div style="-webkit-aspect-ratio: 1 / 2;">
+ <div id="aspectRatioTest"></div>
+</div>
+<script>
+ function testComputedValue(elementId, value, styleAttribute)
+ {
+ var div = document.getElementById(elementId);
+ div.style[styleAttribute] = value;
+ 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');
+</script>
+<script src=""
Modified: trunk/LayoutTests/fast/css/aspect-ratio-parsing-tests-expected.txt (101274 => 101275)
--- trunk/LayoutTests/fast/css/aspect-ratio-parsing-tests-expected.txt 2011-11-28 20:48:23 UTC (rev 101274)
+++ trunk/LayoutTests/fast/css/aspect-ratio-parsing-tests-expected.txt 2011-11-28 20:55:26 UTC (rev 101275)
@@ -9,6 +9,7 @@
PASS testParsing("aspectRatioTest", "1 / 2", "-webkit-aspect-ratio") is "1/2"
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"
Modified: trunk/LayoutTests/fast/css/aspect-ratio-parsing-tests.html (101274 => 101275)
--- trunk/LayoutTests/fast/css/aspect-ratio-parsing-tests.html 2011-11-28 20:48:23 UTC (rev 101274)
+++ trunk/LayoutTests/fast/css/aspect-ratio-parsing-tests.html 2011-11-28 20:55:26 UTC (rev 101275)
@@ -23,6 +23,7 @@
shouldBeEqualToString('testParsing("aspectRatioTest", "1 / 2", "-webkit-aspect-ratio")', '1/2');
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');
// The following are invalid and should get ignored.
Modified: trunk/Source/WebCore/ChangeLog (101274 => 101275)
--- trunk/Source/WebCore/ChangeLog 2011-11-28 20:48:23 UTC (rev 101274)
+++ trunk/Source/WebCore/ChangeLog 2011-11-28 20:55:26 UTC (rev 101275)
@@ -1,3 +1,21 @@
+2011-11-28 Fady Samuel <fsam...@chromium.org>
+
+ Fix Aspect Ratio Property Inheritance And Make the Computed Value Equal the Specified Value
+ https://bugs.webkit.org/show_bug.cgi?id=73038
+
+ Reviewed by Ojan Vafai.
+
+ hasAspectRatio was not being set if the -webkit-aspect-ratio property was inherited from the parent.
+
+ Additionally, the computed value of -webkit-aspect-ratio was returning a number instead of a ratio.
+
+ Test: fast/css/aspect-ratio-inheritance.html
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+ * css/CSSStyleApplyProperty.cpp:
+ (WebCore::ApplyPropertyAspectRatio::applyInheritValue):
+
2011-11-28 Ken Buchanan <ke...@chromium.org>
Crash due to bidi style in isolated run
Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (101274 => 101275)
--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2011-11-28 20:48:23 UTC (rev 101274)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2011-11-28 20:55:26 UTC (rev 101275)
@@ -25,9 +25,7 @@
#include "CSSComputedStyleDeclaration.h"
#include "AnimationController.h"
-#include "ContentData.h"
-#include "CounterContent.h"
-#include "CursorList.h"
+#include "CSSAspectRatioValue.h"
#include "CSSBorderImageValue.h"
#include "CSSLineBoxContainValue.h"
#include "CSSMutableStyleDeclaration.h"
@@ -40,6 +38,9 @@
#include "CSSSelector.h"
#include "CSSTimingFunctionValue.h"
#include "CSSValueList.h"
+#include "ContentData.h"
+#include "CounterContent.h"
+#include "CursorList.h"
#if ENABLE(CSS_SHADERS)
#include "CustomFilterOperation.h"
#endif
@@ -52,6 +53,7 @@
#include "Rect.h"
#include "RenderBox.h"
#include "RenderLayer.h"
+#include "RenderStyle.h"
#include "ShadowValue.h"
#if ENABLE(CSS_FILTERS)
#include "WebKitCSSFilterValue.h"
@@ -1895,7 +1897,7 @@
case CSSPropertyWebkitAspectRatio:
if (!style->hasAspectRatio())
return primitiveValueCache->createIdentifierValue(CSSValueNone);
- return primitiveValueCache->createValue(style->aspectRatio(), CSSPrimitiveValue::CSS_NUMBER);
+ return CSSAspectRatioValue::create(style->aspectRatioNumerator(), style->aspectRatioDenominator());
case CSSPropertyWebkitBackfaceVisibility:
return primitiveValueCache->createIdentifierValue((style->backfaceVisibility() == BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible);
case CSSPropertyWebkitBorderImage:
Modified: trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp (101274 => 101275)
--- trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp 2011-11-28 20:48:23 UTC (rev 101274)
+++ trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp 2011-11-28 20:55:26 UTC (rev 101275)
@@ -949,6 +949,7 @@
{
if (!selector->parentStyle()->hasAspectRatio())
return;
+ selector->style()->setHasAspectRatio(true);
selector->style()->setAspectRatioDenominator(selector->parentStyle()->aspectRatioDenominator());
selector->style()->setAspectRatioNumerator(selector->parentStyle()->aspectRatioNumerator());
}