Diff
Modified: trunk/LayoutTests/ChangeLog (203794 => 203795)
--- trunk/LayoutTests/ChangeLog 2016-07-27 21:18:50 UTC (rev 203794)
+++ trunk/LayoutTests/ChangeLog 2016-07-27 21:33:57 UTC (rev 203795)
@@ -1,3 +1,26 @@
+2016-07-27 Chris Dumez <[email protected]>
+
+ Align MediaList with the CSSOM specification
+ https://bugs.webkit.org/show_bug.cgi?id=160257
+
+ Reviewed by Ryosuke Niwa.
+
+ * fast/css/MediaList-mediaText-null-expected.txt: Added.
+ * fast/css/MediaList-mediaText-null.html: Added.
+ Add test coverage for MediaList.mediaText to make sure it is not nullable
+ and treats null as the empty string. Our IDL did not match the
+ specification here but our behavior was correct. Therefore, this test is
+ passing with and without my change. I just wanted to make sure we had
+ good coverage since I updated our IDL to match the specification.
+
+ * fast/css/MediaList-parameters-expected.txt: Added.
+ * fast/css/MediaList-parameters.html: Added.
+ Add test coverage for mandatory parameters.
+
+ * fast/dom/non-numeric-values-numeric-parameters-expected.txt:
+ * fast/dom/script-tests/non-numeric-values-numeric-parameters.js:
+ Update existing test to reflect behavior change.
+
2016-07-27 Ryan Haddad <[email protected]>
Correct the syntax used to skip js/regress/script-tests/bigswitch-indirect-symbol.js
Added: trunk/LayoutTests/fast/css/MediaList-mediaText-null-expected.txt (0 => 203795)
--- trunk/LayoutTests/fast/css/MediaList-mediaText-null-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/MediaList-mediaText-null-expected.txt 2016-07-27 21:33:57 UTC (rev 203795)
@@ -0,0 +1,18 @@
+Tests that MediaList.mediaText is not nullable and treats null as the empty string.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS mediaList.__proto__ is MediaList.prototype
+PASS mediaList.length is 1
+PASS mediaList.mediaText is "screen and (min-width: 480px)"
+PASS mediaList.mediaText = null did not throw exception.
+PASS mediaList.mediaText is ""
+PASS mediaList.mediaText = 'screen and (min-width: 480px)' did not throw exception.
+PASS mediaList.mediaText is "screen and (min-width: 480px)"
+PASS style.removeAttribute('media') did not throw exception.
+PASS mediaList.mediaText is ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/css/MediaList-mediaText-null.html (0 => 203795)
--- trunk/LayoutTests/fast/css/MediaList-mediaText-null.html (rev 0)
+++ trunk/LayoutTests/fast/css/MediaList-mediaText-null.html 2016-07-27 21:33:57 UTC (rev 203795)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style media="screen and (min-width: 480px)">
+</style>
+</head>
+<body>
+<script src=""
+<script>
+description("Tests that MediaList.mediaText is not nullable and treats null as the empty string.");
+
+var style = document.getElementsByTagName("style")[0];
+var mediaList = style.sheet.media;
+shouldBe("mediaList.__proto__", "MediaList.prototype");
+shouldBe("mediaList.length", "1");
+
+shouldBeEqualToString("mediaList.mediaText", "screen and (min-width: 480px)");
+shouldNotThrow("mediaList.mediaText = null");
+shouldBeEqualToString("mediaList.mediaText", "");
+shouldNotThrow("mediaList.mediaText = 'screen and (min-width: 480px)'");
+shouldBeEqualToString("mediaList.mediaText", "screen and (min-width: 480px)");
+shouldNotThrow("style.removeAttribute('media')");
+shouldBeEqualToString("mediaList.mediaText", "");
+</script>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/MediaList-parameters-expected.txt (0 => 203795)
--- trunk/LayoutTests/fast/css/MediaList-parameters-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/MediaList-parameters-expected.txt 2016-07-27 21:33:57 UTC (rev 203795)
@@ -0,0 +1,13 @@
+Tests that the parameters to MediaList.item() / deleteMedium() / appendMedium() are mandatory.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS mediaList.__proto__ is MediaList.prototype
+PASS mediaList.item() threw exception TypeError: Not enough arguments.
+PASS mediaList.deleteMedium() threw exception TypeError: Not enough arguments.
+PASS mediaList.appendMedium() threw exception TypeError: Not enough arguments.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/css/MediaList-parameters.html (0 => 203795)
--- trunk/LayoutTests/fast/css/MediaList-parameters.html (rev 0)
+++ trunk/LayoutTests/fast/css/MediaList-parameters.html 2016-07-27 21:33:57 UTC (rev 203795)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+@media screen { a { text-weight: bold } }
+</style>
+</head>
+<body>
+<script src=""
+<script>
+description("Tests that the parameters to MediaList.item() / deleteMedium() / appendMedium() are mandatory.");
+
+var mediaList = document.getElementsByTagName("style")[0].sheet.media;
+shouldBe("mediaList.__proto__", "MediaList.prototype");
+
+shouldThrow("mediaList.item()", "'TypeError: Not enough arguments'");
+shouldThrow("mediaList.deleteMedium()", "'TypeError: Not enough arguments'");
+shouldThrow("mediaList.appendMedium()", "'TypeError: Not enough arguments'");
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt (203794 => 203795)
--- trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt 2016-07-27 21:18:50 UTC (rev 203794)
+++ trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt 2016-07-27 21:33:57 UTC (rev 203795)
@@ -42,7 +42,7 @@
PASS nonNumericPolicy('document.createElement("textarea").setSelectionRange(x, 0)') is 'any type allowed'
PASS nonNumericPolicy('document.createElement("textarea").setSelectionRange(0, x)') is 'any type allowed'
PASS nonNumericPolicy('document.createEvent("KeyboardEvent").initKeyboardEvent("a", false, false, null, "b", x, false, false, false, false, false)') is 'any type allowed'
-PASS nonNumericPolicy('createMediaList().item(x)') is 'any type allowed'
+PASS nonNumericPolicy('createMediaList().item(x)') is 'any type allowed (but not omitted)'
PASS nonNumericPolicy('document.createEvent("MouseEvent").initMouseEvent("a", false, false, null, x, 0, 0, 0, 0, false, false, false, false, 0, null)') is 'any type allowed'
PASS nonNumericPolicy('document.createEvent("MouseEvent").initMouseEvent("a", false, false, null, 0, x, 0, 0, 0, false, false, false, false, 0, null)') is 'any type allowed'
PASS nonNumericPolicy('document.createEvent("MouseEvent").initMouseEvent("a", false, false, null, 0, 0, x, 0, 0, false, false, false, false, 0, null)') is 'any type allowed'
Modified: trunk/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js (203794 => 203795)
--- trunk/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js 2016-07-27 21:18:50 UTC (rev 203794)
+++ trunk/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js 2016-07-27 21:33:57 UTC (rev 203795)
@@ -278,7 +278,7 @@
// MediaList
-shouldBe("nonNumericPolicy('createMediaList().item(x)')", "'any type allowed'");
+shouldBe("nonNumericPolicy('createMediaList().item(x)')", "'any type allowed (but not omitted)'");
// MouseEvent
Modified: trunk/Source/WebCore/ChangeLog (203794 => 203795)
--- trunk/Source/WebCore/ChangeLog 2016-07-27 21:18:50 UTC (rev 203794)
+++ trunk/Source/WebCore/ChangeLog 2016-07-27 21:33:57 UTC (rev 203795)
@@ -1,3 +1,23 @@
+2016-07-27 Chris Dumez <[email protected]>
+
+ Align MediaList with the CSSOM specification
+ https://bugs.webkit.org/show_bug.cgi?id=160257
+
+ Reviewed by Ryosuke Niwa.
+
+ Align MediaList with the CSSOM specification:
+ - https://www.w3.org/TR/cssom-1/#the-medialist-interface
+
+ In particular, the parameter to item() / deleteMedium() and
+ appendMedium() is now mandatory.
+
+ Firefox and Chrome agree with the specification.
+
+ Test: fast/css/MediaList-mediaText-null.html
+ fast/css/MediaList-parameters.html
+
+ * css/MediaList.idl:
+
2016-07-27 Jeremy Jones <[email protected]>
Fullscreen video zoom button does not work after rotating when aspect ratio matches display.
Modified: trunk/Source/WebCore/css/MediaList.idl (203794 => 203795)
--- trunk/Source/WebCore/css/MediaList.idl 2016-07-27 21:18:50 UTC (rev 203794)
+++ trunk/Source/WebCore/css/MediaList.idl 2016-07-27 21:33:57 UTC (rev 203795)
@@ -30,14 +30,13 @@
ImplementationLacksVTable,
] interface MediaList {
- [SetterRaisesException] attribute DOMString? mediaText;
+ [SetterRaisesException, TreatNullAs=EmptyString] attribute DOMString mediaText;
readonly attribute unsigned long length;
- getter DOMString? item(optional unsigned long index = 0);
+ getter DOMString? item(unsigned long index);
- // FIXME: Using "undefined" as default parameter value is wrong.
- [RaisesException] void deleteMedium(optional DOMString oldMedium = "undefined");
- [RaisesException] void appendMedium(optional DOMString newMedium = "undefined");
+ [RaisesException] void deleteMedium(DOMString oldMedium);
+ [RaisesException] void appendMedium(DOMString newMedium);
};