<!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>[184103] releases/WebKitGTK/webkit-2.8</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/184103">184103</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2015-05-11 08:47:11 -0700 (Mon, 11 May 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/183436">r183436</a> - Form control may be associated with the wrong HTML Form element after form id change
https://bugs.webkit.org/show_bug.cgi?id=133456
&lt;rdar://problem/17095055&gt;

Reviewed by Andy Estes.

Source/WebCore:

Fixes an issue where a form control may be associated with the wrong HTML Form element
after the id of the HTML Form element associated with the form control is changed when
there is more than one HTML Form element with the same id in the document. Specifically,
a form control that has an HTML form attribute value X will always be associated with
some HTML Form element f where f.id = X regardless of whether f.id is subsequently
changed.

Tests: fast/forms/change-form-id-to-be-unique-then-submit-form.html
       fast/forms/change-form-id-to-be-unique.html

* dom/Element.cpp:
(WebCore::Element::attributeChanged): Notify observers when the id of an element changed.
(WebCore::Element::updateId): Added parameter NotifyObservers (defaults to NotifyObservers::Yes),
as to whether we should notify observers of the id change.
(WebCore::Element::updateIdForTreeScope): Ditto.
(WebCore::Element::willModifyAttribute): Do not notify observers of the id change immediately. As
indicated by the name of this method, we plan to modify the DOM attribute id of the element, but
we have not actually modified it when this method is called. Instead we will notify observers
in Element::attributeChanged(), which is called after the DOM attribute id is modified.
(WebCore::Element::cloneAttributesFromElement): Ditto.
* dom/Element.h: Defined enum class NotifyObservers.
* dom/TreeScope.cpp:
(WebCore::TreeScope::addElementById): Added boolean parameter notifyObservers (defaults to true)
as to whether we should dispatch a notification to all observers.
(WebCore::TreeScope::removeElementById): Ditto.
* dom/TreeScope.h:

LayoutTests:

Add tests to ensure that we associate the correct HTML Form element with a
&lt;select&gt; after changing the id of its associated HTML form element.

* fast/forms/change-form-id-to-be-unique-expected.txt: Added.
* fast/forms/change-form-id-to-be-unique-then-submit-form-expected.txt: Added.
* fast/forms/change-form-id-to-be-unique-then-submit-form.html: Added.
* fast/forms/change-form-id-to-be-unique.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit28LayoutTestsChangeLog">releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebCoredomElementcpp">releases/WebKitGTK/webkit-2.8/Source/WebCore/dom/Element.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebCoredomElementh">releases/WebKitGTK/webkit-2.8/Source/WebCore/dom/Element.h</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebCoredomTreeScopecpp">releases/WebKitGTK/webkit-2.8/Source/WebCore/dom/TreeScope.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebCoredomTreeScopeh">releases/WebKitGTK/webkit-2.8/Source/WebCore/dom/TreeScope.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit28LayoutTestsfastformschangeformidtobeuniqueexpectedtxt">releases/WebKitGTK/webkit-2.8/LayoutTests/fast/forms/change-form-id-to-be-unique-expected.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit28LayoutTestsfastformschangeformidtobeuniquethensubmitformexpectedtxt">releases/WebKitGTK/webkit-2.8/LayoutTests/fast/forms/change-form-id-to-be-unique-then-submit-form-expected.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit28LayoutTestsfastformschangeformidtobeuniquethensubmitformhtml">releases/WebKitGTK/webkit-2.8/LayoutTests/fast/forms/change-form-id-to-be-unique-then-submit-form.html</a></li>
<li><a href="#releasesWebKitGTKwebkit28LayoutTestsfastformschangeformidtobeuniquehtml">releases/WebKitGTK/webkit-2.8/LayoutTests/fast/forms/change-form-id-to-be-unique.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit28LayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog (184102 => 184103)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog        2015-05-11 15:40:47 UTC (rev 184102)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog        2015-05-11 15:47:11 UTC (rev 184103)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2015-04-27  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        Form control may be associated with the wrong HTML Form element after form id change
+        https://bugs.webkit.org/show_bug.cgi?id=133456
+        &lt;rdar://problem/17095055&gt;
+
+        Reviewed by Andy Estes.
+
+        Add tests to ensure that we associate the correct HTML Form element with a
+        &lt;select&gt; after changing the id of its associated HTML form element.
+
+        * fast/forms/change-form-id-to-be-unique-expected.txt: Added.
+        * fast/forms/change-form-id-to-be-unique-then-submit-form-expected.txt: Added.
+        * fast/forms/change-form-id-to-be-unique-then-submit-form.html: Added.
+        * fast/forms/change-form-id-to-be-unique.html: Added.
+
</ins><span class="cx"> 2015-04-27  Yoav Weiss  &lt;yoav@yoav.ws&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix viewport units in Media Queries
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28LayoutTestsfastformschangeformidtobeuniqueexpectedtxt"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.8/LayoutTests/fast/forms/change-form-id-to-be-unique-expected.txt (0 => 184103)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/LayoutTests/fast/forms/change-form-id-to-be-unique-expected.txt                                (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/fast/forms/change-form-id-to-be-unique-expected.txt        2015-05-11 15:47:11 UTC (rev 184103)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+PASS did not cause an assertion failure.
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit28LayoutTestsfastformschangeformidtobeuniquethensubmitformexpectedtxt"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.8/LayoutTests/fast/forms/change-form-id-to-be-unique-then-submit-form-expected.txt (0 => 184103)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/LayoutTests/fast/forms/change-form-id-to-be-unique-then-submit-form-expected.txt                                (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/fast/forms/change-form-id-to-be-unique-then-submit-form-expected.txt        2015-05-11 15:47:11 UTC (rev 184103)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+This tests that we submit the form element associated with id &quot;a&quot; after changing the id of one of the &lt;form id=&quot;a&quot;&gt;s in a document that contains two such HTML Form elements.
+
+PASS submitted second &lt;form&gt;.
+
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit28LayoutTestsfastformschangeformidtobeuniquethensubmitformhtml"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.8/LayoutTests/fast/forms/change-form-id-to-be-unique-then-submit-form.html (0 => 184103)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/LayoutTests/fast/forms/change-form-id-to-be-unique-then-submit-form.html                                (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/fast/forms/change-form-id-to-be-unique-then-submit-form.html        2015-05-11 15:47:11 UTC (rev 184103)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+#test-container { visibility: hidden; }
+&lt;/style&gt;
+&lt;script&gt;
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+function logMessageAndDone(message)
+{
+    document.getElementById(&quot;console&quot;).textContent = message;
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+function runTest()
+{
+    var search = document.location.search;
+    if (search === &quot;?submitted=secondFormElement&quot;)
+        logMessageAndDone(&quot;PASS submitted second &lt;form&gt;.&quot;);
+    else if (search === &quot;?submitted=firstFormElement&quot;)
+        logMessageAndDone(&quot;FAIL should have submitted second &lt;form&gt;, but submitted first &lt;form&gt;.&quot;);
+    else {
+        document.getElementById(&quot;a&quot;).id = &quot;y&quot;; // Changes the id of the first &lt;form&gt; (traversing the DOM from top-to-bottom).
+        document.getElementById(&quot;submit&quot;).click();
+    }
+}
+
+window.onload = runTest;
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;p&gt;This tests that we submit the form element associated with id &amp;quot;a&amp;quot; after changing the id of one of the &amp;lt;form id=&amp;quot;a&amp;quot;&amp;gt;s in a document that contains two such HTML Form elements.&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+&lt;div id=&quot;test-container&quot;&gt;
+    &lt;form id=&quot;a&quot;&gt;&lt;input type=&quot;hidden&quot; name=&quot;submitted&quot; value=&quot;firstFormElement&quot;&gt;&lt;/form&gt;
+    &lt;form id=&quot;a&quot;&gt;&lt;input type=&quot;hidden&quot; name=&quot;submitted&quot; value=&quot;secondFormElement&quot;&gt;&lt;/form&gt;
+    &lt;input id=&quot;submit&quot; type=&quot;submit&quot; form=&quot;a&quot; value=&quot;Submit&quot;&gt;
+&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit28LayoutTestsfastformschangeformidtobeuniquehtml"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.8/LayoutTests/fast/forms/change-form-id-to-be-unique.html (0 => 184103)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/LayoutTests/fast/forms/change-form-id-to-be-unique.html                                (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/fast/forms/change-form-id-to-be-unique.html        2015-05-11 15:47:11 UTC (rev 184103)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script&gt;
+if (window.testRunner)
+    testRunner.dumpAsText();
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;document.body.removeChild(document.getElementById('x'));&quot;&gt;
+&lt;p&gt;PASS did not cause an assertion failure.&lt;/p&gt;
+&lt;div id=&quot;x&quot;&gt;
+    &lt;form id=&quot;a&quot;&gt;&lt;/form&gt;
+    &lt;form id=&quot;a&quot;&gt;
+        &lt;select form=&quot;a&quot;&gt;&lt;/select&gt;
+    &lt;/form&gt;
+&lt;/div&gt;
+&lt;script&gt;
+document.getElementById(&quot;a&quot;).setAttribute(&quot;id&quot;, &quot;y&quot;);
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog (184102 => 184103)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog        2015-05-11 15:40:47 UTC (rev 184102)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog        2015-05-11 15:47:11 UTC (rev 184103)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2015-04-27  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        Form control may be associated with the wrong HTML Form element after form id change
+        https://bugs.webkit.org/show_bug.cgi?id=133456
+        &lt;rdar://problem/17095055&gt;
+
+        Reviewed by Andy Estes.
+
+        Fixes an issue where a form control may be associated with the wrong HTML Form element
+        after the id of the HTML Form element associated with the form control is changed when
+        there is more than one HTML Form element with the same id in the document. Specifically,
+        a form control that has an HTML form attribute value X will always be associated with
+        some HTML Form element f where f.id = X regardless of whether f.id is subsequently
+        changed.
+
+        Tests: fast/forms/change-form-id-to-be-unique-then-submit-form.html
+               fast/forms/change-form-id-to-be-unique.html
+
+        * dom/Element.cpp:
+        (WebCore::Element::attributeChanged): Notify observers when the id of an element changed.
+        (WebCore::Element::updateId): Added parameter NotifyObservers (defaults to NotifyObservers::Yes),
+        as to whether we should notify observers of the id change.
+        (WebCore::Element::updateIdForTreeScope): Ditto.
+        (WebCore::Element::willModifyAttribute): Do not notify observers of the id change immediately. As
+        indicated by the name of this method, we plan to modify the DOM attribute id of the element, but
+        we have not actually modified it when this method is called. Instead we will notify observers
+        in Element::attributeChanged(), which is called after the DOM attribute id is modified.
+        (WebCore::Element::cloneAttributesFromElement): Ditto.
+        * dom/Element.h: Defined enum class NotifyObservers.
+        * dom/TreeScope.cpp:
+        (WebCore::TreeScope::addElementById): Added boolean parameter notifyObservers (defaults to true)
+        as to whether we should dispatch a notification to all observers.
+        (WebCore::TreeScope::removeElementById): Ditto.
+        * dom/TreeScope.h:
+
</ins><span class="cx"> 2015-04-27  Yoav Weiss  &lt;yoav@yoav.ws&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix viewport units in Media Queries
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/dom/Element.cpp (184102 => 184103)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebCore/dom/Element.cpp        2015-05-11 15:40:47 UTC (rev 184102)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/dom/Element.cpp        2015-05-11 15:47:11 UTC (rev 184103)
</span><span class="lines">@@ -55,6 +55,7 @@
</span><span class="cx"> #include &quot;HTMLSelectElement.h&quot;
</span><span class="cx"> #include &quot;HTMLTableRowsCollection.h&quot;
</span><span class="cx"> #include &quot;HTMLTemplateElement.h&quot;
</span><ins>+#include &quot;IdTargetObserverRegistry.h&quot;
</ins><span class="cx"> #include &quot;InsertionPoint.h&quot;
</span><span class="cx"> #include &quot;KeyboardEvent.h&quot;
</span><span class="cx"> #include &quot;MutationObserverInterestGroup.h&quot;
</span><span class="lines">@@ -1085,6 +1086,11 @@
</span><span class="cx">     bool shouldInvalidateStyle = false;
</span><span class="cx"> 
</span><span class="cx">     if (name == HTMLNames::idAttr) {
</span><ins>+        if (!oldValue.isEmpty())
+            treeScope().idTargetObserverRegistry().notifyObservers(*oldValue.impl());
+        if (!newValue.isEmpty())
+            treeScope().idTargetObserverRegistry().notifyObservers(*newValue.impl());
+
</ins><span class="cx">         AtomicString oldId = elementData()-&gt;idForStyleResolution();
</span><span class="cx">         AtomicString newId = makeIdForStyleResolution(newValue, document().inQuirksMode());
</span><span class="cx">         if (newId != oldId) {
</span><span class="lines">@@ -2800,7 +2806,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline void Element::updateId(const AtomicString&amp; oldId, const AtomicString&amp; newId)
</del><ins>+inline void Element::updateId(const AtomicString&amp; oldId, const AtomicString&amp; newId, NotifyObservers notifyObservers)
</ins><span class="cx"> {
</span><span class="cx">     if (!isInTreeScope())
</span><span class="cx">         return;
</span><span class="lines">@@ -2808,7 +2814,7 @@
</span><span class="cx">     if (oldId == newId)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    updateIdForTreeScope(treeScope(), oldId, newId);
</del><ins>+    updateIdForTreeScope(treeScope(), oldId, newId, notifyObservers);
</ins><span class="cx"> 
</span><span class="cx">     if (!inDocument())
</span><span class="cx">         return;
</span><span class="lines">@@ -2817,15 +2823,15 @@
</span><span class="cx">     updateIdForDocument(downcast&lt;HTMLDocument&gt;(document()), oldId, newId, UpdateHTMLDocumentNamedItemMapsOnlyIfDiffersFromNameAttribute);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Element::updateIdForTreeScope(TreeScope&amp; scope, const AtomicString&amp; oldId, const AtomicString&amp; newId)
</del><ins>+void Element::updateIdForTreeScope(TreeScope&amp; scope, const AtomicString&amp; oldId, const AtomicString&amp; newId, NotifyObservers notifyObservers)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(isInTreeScope());
</span><span class="cx">     ASSERT(oldId != newId);
</span><span class="cx"> 
</span><span class="cx">     if (!oldId.isEmpty())
</span><del>-        scope.removeElementById(*oldId.impl(), *this);
</del><ins>+        scope.removeElementById(*oldId.impl(), *this, notifyObservers == NotifyObservers::Yes);
</ins><span class="cx">     if (!newId.isEmpty())
</span><del>-        scope.addElementById(*newId.impl(), *this);
</del><ins>+        scope.addElementById(*newId.impl(), *this, notifyObservers == NotifyObservers::Yes);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void Element::updateIdForDocument(HTMLDocument&amp; document, const AtomicString&amp; oldId, const AtomicString&amp; newId, HTMLDocumentNamedItemMapsUpdatingCondition condition)
</span><span class="lines">@@ -2869,7 +2875,7 @@
</span><span class="cx"> void Element::willModifyAttribute(const QualifiedName&amp; name, const AtomicString&amp; oldValue, const AtomicString&amp; newValue)
</span><span class="cx"> {
</span><span class="cx">     if (name == HTMLNames::idAttr)
</span><del>-        updateId(oldValue, newValue);
</del><ins>+        updateId(oldValue, newValue, NotifyObservers::No); // Will notify observers after the attribute is actually changed.
</ins><span class="cx">     else if (name == HTMLNames::nameAttr)
</span><span class="cx">         updateName(oldValue, newValue);
</span><span class="cx">     else if (name == HTMLNames::forAttr &amp;&amp; hasTagName(labelTag)) {
</span><span class="lines">@@ -3098,7 +3104,7 @@
</span><span class="cx">     const AtomicString&amp; newID = other.getIdAttribute();
</span><span class="cx"> 
</span><span class="cx">     if (!oldID.isNull() || !newID.isNull())
</span><del>-        updateId(oldID, newID);
</del><ins>+        updateId(oldID, newID, NotifyObservers::No); // Will notify observers after the attribute is actually changed.
</ins><span class="cx"> 
</span><span class="cx">     const AtomicString&amp; oldName = getNameAttribute();
</span><span class="cx">     const AtomicString&amp; newName = other.getNameAttribute();
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebCoredomElementh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/dom/Element.h (184102 => 184103)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebCore/dom/Element.h        2015-05-11 15:40:47 UTC (rev 184102)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/dom/Element.h        2015-05-11 15:47:11 UTC (rev 184103)
</span><span class="lines">@@ -607,8 +607,11 @@
</span><span class="cx">     void updateName(const AtomicString&amp; oldName, const AtomicString&amp; newName);
</span><span class="cx">     void updateNameForTreeScope(TreeScope&amp;, const AtomicString&amp; oldName, const AtomicString&amp; newName);
</span><span class="cx">     void updateNameForDocument(HTMLDocument&amp;, const AtomicString&amp; oldName, const AtomicString&amp; newName);
</span><del>-    void updateId(const AtomicString&amp; oldId, const AtomicString&amp; newId);
-    void updateIdForTreeScope(TreeScope&amp;, const AtomicString&amp; oldId, const AtomicString&amp; newId);
</del><ins>+
+    enum class NotifyObservers { No, Yes };
+    void updateId(const AtomicString&amp; oldId, const AtomicString&amp; newId, NotifyObservers = NotifyObservers::Yes);
+    void updateIdForTreeScope(TreeScope&amp;, const AtomicString&amp; oldId, const AtomicString&amp; newId, NotifyObservers = NotifyObservers::Yes);
+
</ins><span class="cx">     enum HTMLDocumentNamedItemMapsUpdatingCondition { AlwaysUpdateHTMLDocumentNamedItemMaps, UpdateHTMLDocumentNamedItemMapsOnlyIfDiffersFromNameAttribute };
</span><span class="cx">     void updateIdForDocument(HTMLDocument&amp;, const AtomicString&amp; oldId, const AtomicString&amp; newId, HTMLDocumentNamedItemMapsUpdatingCondition);
</span><span class="cx">     void updateLabel(TreeScope&amp;, const AtomicString&amp; oldForAttributeValue, const AtomicString&amp; newForAttributeValue);
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebCoredomTreeScopecpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/dom/TreeScope.cpp (184102 => 184103)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebCore/dom/TreeScope.cpp        2015-05-11 15:40:47 UTC (rev 184102)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/dom/TreeScope.cpp        2015-05-11 15:47:11 UTC (rev 184103)
</span><span class="lines">@@ -127,20 +127,22 @@
</span><span class="cx">     return m_elementsById-&gt;getAllElementsById(*elementId.impl(), *this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TreeScope::addElementById(const AtomicStringImpl&amp; elementId, Element&amp; element)
</del><ins>+void TreeScope::addElementById(const AtomicStringImpl&amp; elementId, Element&amp; element, bool notifyObservers)
</ins><span class="cx"> {
</span><span class="cx">     if (!m_elementsById)
</span><span class="cx">         m_elementsById = std::make_unique&lt;DocumentOrderedMap&gt;();
</span><span class="cx">     m_elementsById-&gt;add(elementId, element, *this);
</span><del>-    m_idTargetObserverRegistry-&gt;notifyObservers(elementId);
</del><ins>+    if (notifyObservers)
+        m_idTargetObserverRegistry-&gt;notifyObservers(elementId);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TreeScope::removeElementById(const AtomicStringImpl&amp; elementId, Element&amp; element)
</del><ins>+void TreeScope::removeElementById(const AtomicStringImpl&amp; elementId, Element&amp; element, bool notifyObservers)
</ins><span class="cx"> {
</span><span class="cx">     if (!m_elementsById)
</span><span class="cx">         return;
</span><span class="cx">     m_elementsById-&gt;remove(elementId, element);
</span><del>-    m_idTargetObserverRegistry-&gt;notifyObservers(elementId);
</del><ins>+    if (notifyObservers)
+        m_idTargetObserverRegistry-&gt;notifyObservers(elementId);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Element* TreeScope::getElementByName(const AtomicString&amp; name) const
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebCoredomTreeScopeh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/dom/TreeScope.h (184102 => 184103)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebCore/dom/TreeScope.h        2015-05-11 15:40:47 UTC (rev 184102)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/dom/TreeScope.h        2015-05-11 15:47:11 UTC (rev 184103)
</span><span class="lines">@@ -59,8 +59,8 @@
</span><span class="cx">     const Vector&lt;Element*&gt;* getAllElementsById(const AtomicString&amp;) const;
</span><span class="cx">     bool hasElementWithId(const AtomicStringImpl&amp;) const;
</span><span class="cx">     bool containsMultipleElementsWithId(const AtomicString&amp; id) const;
</span><del>-    void addElementById(const AtomicStringImpl&amp; elementId, Element&amp;);
-    void removeElementById(const AtomicStringImpl&amp; elementId, Element&amp;);
</del><ins>+    void addElementById(const AtomicStringImpl&amp; elementId, Element&amp;, bool notifyObservers = true);
+    void removeElementById(const AtomicStringImpl&amp; elementId, Element&amp;, bool notifyObservers = true);
</ins><span class="cx"> 
</span><span class="cx">     Element* getElementByName(const AtomicString&amp;) const;
</span><span class="cx">     bool hasElementWithName(const AtomicStringImpl&amp;) const;
</span></span></pre>
</div>
</div>

</body>
</html>