<!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>[203740] 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/203740">203740</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-07-26 15:00:20 -0700 (Tue, 26 Jul 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Parameters to CSSStyleSheet.insertRule() / deleteRule() should be mandatory
https://bugs.webkit.org/show_bug.cgi?id=160210
Reviewed by Darin Adler.
Source/WebCore:
Parameters to CSSStyleSheet.insertRule() / deleteRule() should be mandatory:
- https://drafts.csswg.org/cssom/#cssstylesheet
They are mandatory in Firefox.
They are mandatory in Chrome except for the second parameter of insertRule()
which merely logs a deprecation warning.
This patch aligns our behavior with Chrome to move towards to specification
while limiting the risk of breakage.
Test: fast/css/stylesheet-parameters.html
* css/CSSStyleSheet.cpp:
(WebCore::CSSStyleSheet::deprecatedInsertRule):
* css/CSSStyleSheet.h:
* css/CSSStyleSheet.idl:
LayoutTests:
* fast/css/stylesheet-parameters-expected.txt: Added.
* fast/css/stylesheet-parameters.html: Added.
Add layout test coverage.
* editing/selection/first-letter-selection-crash.html:
* fast/css/counters/asterisk-counter-update-after-layout-crash.html:
* fast/dom/HTMLElement/dynamic-editability-change.html:
* fast/dom/non-numeric-values-numeric-parameters-expected.txt:
* fast/dom/script-tests/non-numeric-values-numeric-parameters.js:
Update existing tests to reflect the behavior change.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestseditingselectionfirstletterselectioncrashhtml">trunk/LayoutTests/editing/selection/first-letter-selection-crash.html</a></li>
<li><a href="#trunkLayoutTestsfastcsscountersasteriskcounterupdateafterlayoutcrashhtml">trunk/LayoutTests/fast/css/counters/asterisk-counter-update-after-layout-crash.html</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLElementdynamiceditabilitychangeexpectedtxt">trunk/LayoutTests/fast/dom/HTMLElement/dynamic-editability-change-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLElementdynamiceditabilitychangehtml">trunk/LayoutTests/fast/dom/HTMLElement/dynamic-editability-change.html</a></li>
<li><a href="#trunkLayoutTestsfastdomnonnumericvaluesnumericparametersexpectedtxt">trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomscripttestsnonnumericvaluesnumericparametersjs">trunk/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSStyleSheetcpp">trunk/Source/WebCore/css/CSSStyleSheet.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSStyleSheeth">trunk/Source/WebCore/css/CSSStyleSheet.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSStyleSheetidl">trunk/Source/WebCore/css/CSSStyleSheet.idl</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastcssstylesheetparametersexpectedtxt">trunk/LayoutTests/fast/css/stylesheet-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcssstylesheetparametershtml">trunk/LayoutTests/fast/css/stylesheet-parameters.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (203739 => 203740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-07-26 21:52:27 UTC (rev 203739)
+++ trunk/LayoutTests/ChangeLog        2016-07-26 22:00:20 UTC (rev 203740)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2016-07-26 Chris Dumez <cdumez@apple.com>
+
+ Parameters to CSSStyleSheet.insertRule() / deleteRule() should be mandatory
+ https://bugs.webkit.org/show_bug.cgi?id=160210
+
+ Reviewed by Darin Adler.
+
+ * fast/css/stylesheet-parameters-expected.txt: Added.
+ * fast/css/stylesheet-parameters.html: Added.
+ Add layout test coverage.
+
+ * editing/selection/first-letter-selection-crash.html:
+ * fast/css/counters/asterisk-counter-update-after-layout-crash.html:
+ * fast/dom/HTMLElement/dynamic-editability-change.html:
+ * fast/dom/non-numeric-values-numeric-parameters-expected.txt:
+ * fast/dom/script-tests/non-numeric-values-numeric-parameters.js:
+ Update existing tests to reflect the behavior change.
+
</ins><span class="cx"> 2016-07-26 George Ruan <gruan@apple.com>
</span><span class="cx">
</span><span class="cx"> HTMLVideoElement frames do not update on iOS when src is a MediaStream blob
</span></span></pre></div>
<a id="trunkLayoutTestseditingselectionfirstletterselectioncrashhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/selection/first-letter-selection-crash.html (203739 => 203740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/selection/first-letter-selection-crash.html        2016-07-26 21:52:27 UTC (rev 203739)
+++ trunk/LayoutTests/editing/selection/first-letter-selection-crash.html        2016-07-26 22:00:20 UTC (rev 203740)
</span><span class="lines">@@ -19,7 +19,7 @@
</span><span class="cx"> test1.appendChild(document.createTextNode('a'));
</span><span class="cx"> document.execCommand('selectall');
</span><span class="cx"> document.body.offsetTop;
</span><del>- document.styleSheets[0].insertRule("#test2 { text-transform: uppercase }");
</del><ins>+ document.styleSheets[0].insertRule("#test2 { text-transform: uppercase }", 0);
</ins><span class="cx"> document.body.offsetTop;
</span><span class="cx"> document.body.innerHTML = "PASS";
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkLayoutTestsfastcsscountersasteriskcounterupdateafterlayoutcrashhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css/counters/asterisk-counter-update-after-layout-crash.html (203739 => 203740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/counters/asterisk-counter-update-after-layout-crash.html        2016-07-26 21:52:27 UTC (rev 203739)
+++ trunk/LayoutTests/fast/css/counters/asterisk-counter-update-after-layout-crash.html        2016-07-26 22:00:20 UTC (rev 203740)
</span><span class="lines">@@ -3,7 +3,7 @@
</span><span class="cx"> </style>
</span><span class="cx"> <script>
</span><span class="cx"> function runTest() {
</span><del>- document.styleSheets[0].insertRule("div { counter-reset: c 141170 }");
</del><ins>+ document.styleSheets[0].insertRule("div { counter-reset: c 141170 }", 0);
</ins><span class="cx"> if (window.testRunner)
</span><span class="cx"> testRunner.dumpAsText();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkLayoutTestsfastcssstylesheetparametersexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/stylesheet-parameters-expected.txt (0 => 203740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/stylesheet-parameters-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/css/stylesheet-parameters-expected.txt        2016-07-26 22:00:20 UTC (rev 203740)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+CONSOLE MESSAGE: line 1: Calling CSSStyleSheet.insertRule() with one argument is deprecated. Please pass the index argument as well: insertRule(x, 0).
+Tests that the parameters to CSSStyleSheet.insertRule() / deleteRule() are mandatory.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS stylesheet.__proto__ is CSSStyleSheet.prototype
+PASS stylesheet.deleteRule() threw exception TypeError: Not enough arguments.
+PASS stylesheet.insertRule() threw exception TypeError: Not enough arguments.
+FAIL stylesheet.insertRule('body { margin: 0; }') should throw TypeError: Not enough arguments. Was 0.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssstylesheetparametershtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/stylesheet-parameters.html (0 => 203740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/stylesheet-parameters.html         (rev 0)
+++ trunk/LayoutTests/fast/css/stylesheet-parameters.html        2016-07-26 22:00:20 UTC (rev 203740)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<body>
+<script src="../../resources/js-test-pre.js"></script>
+<script>
+description("Tests that the parameters to CSSStyleSheet.insertRule() / deleteRule() are mandatory.");
+
+var styleElement = document.createElement("style");
+document.head.appendChild(styleElement);
+var stylesheet = styleElement.sheet;
+shouldBe("stylesheet.__proto__", "CSSStyleSheet.prototype");
+shouldThrow("stylesheet.deleteRule()", "'TypeError: Not enough arguments'");
+shouldThrow("stylesheet.insertRule()", "'TypeError: Not enough arguments'");
+shouldThrow("stylesheet.insertRule('body { margin: 0; }')", "'TypeError: Not enough arguments'");
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLElementdynamiceditabilitychangeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/HTMLElement/dynamic-editability-change-expected.txt (203739 => 203740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLElement/dynamic-editability-change-expected.txt        2016-07-26 21:52:27 UTC (rev 203739)
+++ trunk/LayoutTests/fast/dom/HTMLElement/dynamic-editability-change-expected.txt        2016-07-26 22:00:20 UTC (rev 203740)
</span><span class="lines">@@ -17,8 +17,8 @@
</span><span class="cx"> PASS newDoc("<div></div>"); style = element("style", "* { -webkit-user-modify: read-write }"); $("div").isContentEditable is false
</span><span class="cx"> PASS $("body").appendChild(style); $("div").isContentEditable is true
</span><span class="cx"> PASS newDoc("<div></div><style></style>"); $("div").isContentEditable is false
</span><del>-PASS $("style").sheet.insertRule("* { -webkit-user-modify: read-write; }"); $("div").isContentEditable is true
-PASS $("style").sheet.insertRule("* { -webkit-user-modify: read-only !important; }"); $("div").isContentEditable is false
</del><ins>+PASS $("style").sheet.insertRule("* { -webkit-user-modify: read-write; }", 0); $("div").isContentEditable is true
+PASS $("style").sheet.insertRule("* { -webkit-user-modify: read-only !important; }", 0); $("div").isContentEditable is false
</ins><span class="cx">
</span><span class="cx"> Inline styles
</span><span class="cx"> PASS newDoc("<div style='-webkit-user-modify:read-write'></div>"); $("div").isContentEditable is true
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLElementdynamiceditabilitychangehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/HTMLElement/dynamic-editability-change.html (203739 => 203740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLElement/dynamic-editability-change.html        2016-07-26 21:52:27 UTC (rev 203739)
+++ trunk/LayoutTests/fast/dom/HTMLElement/dynamic-editability-change.html        2016-07-26 22:00:20 UTC (rev 203740)
</span><span class="lines">@@ -36,8 +36,8 @@
</span><span class="cx"> shouldBeFalse('newDoc("<div></div>"); style = element("style", "* { -webkit-user-modify: read-write }"); $("div").isContentEditable');
</span><span class="cx"> shouldBeTrue('$("body").appendChild(style); $("div").isContentEditable');
</span><span class="cx"> shouldBeFalse('newDoc("<div></div><style></style>"); $("div").isContentEditable');
</span><del>-shouldBeTrue('$("style").sheet.insertRule("* { -webkit-user-modify: read-write; }"); $("div").isContentEditable');
-shouldBeFalse('$("style").sheet.insertRule("* { -webkit-user-modify: read-only !important; }"); $("div").isContentEditable');
</del><ins>+shouldBeTrue('$("style").sheet.insertRule("* { -webkit-user-modify: read-write; }", 0); $("div").isContentEditable');
+shouldBeFalse('$("style").sheet.insertRule("* { -webkit-user-modify: read-only !important; }", 0); $("div").isContentEditable');
</ins><span class="cx">
</span><span class="cx"> debug('');
</span><span class="cx"> debug('Inline styles');
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomnonnumericvaluesnumericparametersexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt (203739 => 203740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt        2016-07-26 21:52:27 UTC (rev 203739)
+++ trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt        2016-07-26 22:00:20 UTC (rev 203740)
</span><span class="lines">@@ -1,3 +1,4 @@
</span><ins>+CONSOLE MESSAGE: line 1: Calling CSSStyleSheet.insertRule() with one argument is deprecated. Please pass the index argument as well: insertRule(x, 0).
</ins><span class="cx"> This tests the behavior of non-numeric values in contexts where the DOM has a numeric parameter.
</span><span class="cx">
</span><span class="cx"> On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
</span><span class="lines">@@ -15,7 +16,7 @@
</span><span class="cx"> PASS nonNumericPolicy('createCSSRuleList().item(x)') is 'any type allowed'
</span><span class="cx"> PASS nonNumericPolicy('createCSSStyleDeclaration().item(x)') is 'any type allowed'
</span><span class="cx"> PASS nonNumericPolicy('createCSSStyleSheet().insertRule(ruleText, x)') is 'any type allowed'
</span><del>-PASS nonNumericPolicy('createCSSStyleSheet().deleteRule(x)') is 'any type allowed'
</del><ins>+PASS nonNumericPolicy('createCSSStyleSheet().deleteRule(x)') is 'any type allowed (but not omitted)'
</ins><span class="cx"> PASS nonNumericPolicy('createCSSStyleSheet().addRule(selector, styleText, x)') is 'any type allowed'
</span><span class="cx"> PASS nonNumericPolicy('createCSSStyleSheet().removeRule(x)') is 'any type allowed'
</span><span class="cx"> PASS nonNumericPolicy('createCSSValueList().item(x)') is 'any type allowed'
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomscripttestsnonnumericvaluesnumericparametersjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js (203739 => 203740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js        2016-07-26 21:52:27 UTC (rev 203739)
+++ trunk/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js        2016-07-26 22:00:20 UTC (rev 203740)
</span><span class="lines">@@ -209,7 +209,7 @@
</span><span class="cx"> // CSSStyleSheet
</span><span class="cx">
</span><span class="cx"> shouldBe("nonNumericPolicy('createCSSStyleSheet().insertRule(ruleText, x)')", "'any type allowed'");
</span><del>-shouldBe("nonNumericPolicy('createCSSStyleSheet().deleteRule(x)')", "'any type allowed'");
</del><ins>+shouldBe("nonNumericPolicy('createCSSStyleSheet().deleteRule(x)')", "'any type allowed (but not omitted)'");
</ins><span class="cx"> shouldBe("nonNumericPolicy('createCSSStyleSheet().addRule(selector, styleText, x)')", "'any type allowed'");
</span><span class="cx"> shouldBe("nonNumericPolicy('createCSSStyleSheet().removeRule(x)')", "'any type allowed'");
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (203739 => 203740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-07-26 21:52:27 UTC (rev 203739)
+++ trunk/Source/WebCore/ChangeLog        2016-07-26 22:00:20 UTC (rev 203740)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2016-07-26 Chris Dumez <cdumez@apple.com>
+
+ Parameters to CSSStyleSheet.insertRule() / deleteRule() should be mandatory
+ https://bugs.webkit.org/show_bug.cgi?id=160210
+
+ Reviewed by Darin Adler.
+
+ Parameters to CSSStyleSheet.insertRule() / deleteRule() should be mandatory:
+ - https://drafts.csswg.org/cssom/#cssstylesheet
+
+ They are mandatory in Firefox.
+ They are mandatory in Chrome except for the second parameter of insertRule()
+ which merely logs a deprecation warning.
+
+ This patch aligns our behavior with Chrome to move towards to specification
+ while limiting the risk of breakage.
+
+ Test: fast/css/stylesheet-parameters.html
+
+ * css/CSSStyleSheet.cpp:
+ (WebCore::CSSStyleSheet::deprecatedInsertRule):
+ * css/CSSStyleSheet.h:
+ * css/CSSStyleSheet.idl:
+
</ins><span class="cx"> 2016-07-26 George Ruan <gruan@apple.com>
</span><span class="cx">
</span><span class="cx"> HTMLVideoElement frames do not update on iOS when src is a MediaStream blob
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSStyleSheetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSStyleSheet.cpp (203739 => 203740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSStyleSheet.cpp        2016-07-26 21:52:27 UTC (rev 203739)
+++ trunk/Source/WebCore/css/CSSStyleSheet.cpp        2016-07-26 22:00:20 UTC (rev 203740)
</span><span class="lines">@@ -287,6 +287,14 @@
</span><span class="cx"> return nonCharsetRules;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+unsigned CSSStyleSheet::deprecatedInsertRule(const String& ruleString, ExceptionCode& ec)
+{
+ if (auto* document = ownerDocument())
+ document->addConsoleMessage(MessageSource::JS, MessageLevel::Warning, ASCIILiteral("Calling CSSStyleSheet.insertRule() with one argument is deprecated. Please pass the index argument as well: insertRule(x, 0)."));
+
+ return insertRule(ruleString, 0, ec);
+}
+
</ins><span class="cx"> unsigned CSSStyleSheet::insertRule(const String& ruleString, unsigned index, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(m_childRuleCSSOMWrappers.isEmpty() || m_childRuleCSSOMWrappers.size() == m_contents->ruleCount());
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSStyleSheeth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSStyleSheet.h (203739 => 203740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSStyleSheet.h        2016-07-26 21:52:27 UTC (rev 203739)
+++ trunk/Source/WebCore/css/CSSStyleSheet.h        2016-07-26 22:00:20 UTC (rev 203740)
</span><span class="lines">@@ -65,6 +65,7 @@
</span><span class="cx">
</span><span class="cx"> RefPtr<CSSRuleList> cssRules();
</span><span class="cx"> unsigned insertRule(const String& rule, unsigned index, ExceptionCode&);
</span><ins>+ unsigned deprecatedInsertRule(const String& rule, ExceptionCode&);
</ins><span class="cx"> void deleteRule(unsigned index, ExceptionCode&);
</span><span class="cx">
</span><span class="cx"> // IE Extensions
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSStyleSheetidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSStyleSheet.idl (203739 => 203740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSStyleSheet.idl        2016-07-26 21:52:27 UTC (rev 203739)
+++ trunk/Source/WebCore/css/CSSStyleSheet.idl        2016-07-26 22:00:20 UTC (rev 203740)
</span><span class="lines">@@ -23,18 +23,18 @@
</span><span class="cx"> readonly attribute CSSRule ownerRule;
</span><span class="cx"> readonly attribute CSSRuleList cssRules;
</span><span class="cx">
</span><del>- // FIXME: Using "undefined" as default parameter value is wrong.
- [ObjCLegacyUnnamedParameters, RaisesException] unsigned long insertRule(optional DOMString rule = "undefined",
- optional unsigned long index = 0);
- [RaisesException] void deleteRule(optional unsigned long index = 0);
</del><ins>+ [ObjCLegacyUnnamedParameters, RaisesException] unsigned long insertRule(DOMString rule, unsigned long index);
+#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
+ [RaisesException, ImplementedAs=deprecatedInsertRule] unsigned long insertRule(DOMString rule); // Deprecated.
+#endif
</ins><span class="cx">
</span><ins>+ [RaisesException] void deleteRule(unsigned long index);
+
</ins><span class="cx"> // IE Extensions
</span><span class="cx"> readonly attribute CSSRuleList rules;
</span><span class="cx">
</span><del>- // FIXME: Using "undefined" as default parameter value is wrong.
- [RaisesException] long addRule(optional DOMString selector = "undefined",
- optional DOMString style = "undefined",
- optional unsigned long index);
</del><ins>+ // FIXME: Those operations are WebKit-specific.
+ [RaisesException] long addRule(optional DOMString selector = "undefined", optional DOMString style = "undefined", optional unsigned long index);
</ins><span class="cx"> [RaisesException] void removeRule(optional unsigned long index = 0);
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>