Title: [111950] trunk
Revision
111950
Author
[email protected]
Date
2012-03-23 17:58:06 -0700 (Fri, 23 Mar 2012)

Log Message

[MutationObservers] attributeFilter should be case sensitive at all times
https://bugs.webkit.org/show_bug.cgi?id=81822

Reviewed by Ryosuke Niwa.

Source/WebCore:

This removes the behavior in MutationObserverRegistration which treats
attributeFilter as case insensitive for HTML elements in HTML documents.

Relevant tests have been updated.

* dom/MutationObserverRegistration.cpp:
(WebCore::MutationObserverRegistration::resetObservation):
(WebCore::MutationObserverRegistration::shouldReceiveMutationFrom):
* dom/MutationObserverRegistration.h:
(MutationObserverRegistration):

LayoutTests:

* fast/mutation/observe-attributes-expected.txt:
* fast/mutation/observe-attributes.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (111949 => 111950)


--- trunk/LayoutTests/ChangeLog	2012-03-24 00:55:59 UTC (rev 111949)
+++ trunk/LayoutTests/ChangeLog	2012-03-24 00:58:06 UTC (rev 111950)
@@ -1,3 +1,13 @@
+2012-03-23  Rafael Weinstein  <[email protected]>
+
+        [MutationObservers] attributeFilter should be case sensitive at all times
+        https://bugs.webkit.org/show_bug.cgi?id=81822
+
+        Reviewed by Ryosuke Niwa.
+
+        * fast/mutation/observe-attributes-expected.txt:
+        * fast/mutation/observe-attributes.html:
+
 2012-03-23  Parag Radke  <[email protected]>
 
         REGRESSION: can select text of an input button

Modified: trunk/LayoutTests/fast/mutation/observe-attributes-expected.txt (111949 => 111950)


--- trunk/LayoutTests/fast/mutation/observe-attributes-expected.txt	2012-03-24 00:55:59 UTC (rev 111949)
+++ trunk/LayoutTests/fast/mutation/observe-attributes-expected.txt	2012-03-24 00:58:06 UTC (rev 111950)
@@ -101,18 +101,15 @@
 PASS mutations[2].attributeName is "id"
 PASS mutations[2].oldValue is "bar"
 
-Testing that attributeFilter works as expected and ignores case with HTML elements.
-...only foo, bar & boom should be received.
-PASS mutations.length is 3
+Testing that attributeFilter works as expected and observes case with HTML elements.
+...only foo and bar should be received.
+PASS mutations.length is 2
 PASS mutations[0].type is "attributes"
 PASS mutations[0].attributeName is "foo"
 PASS mutations[0].attributeNamespace is null
 PASS mutations[1].type is "attributes"
 PASS mutations[1].attributeName is "bar"
 PASS mutations[1].attributeNamespace is null
-PASS mutations[2].type is "attributes"
-PASS mutations[2].attributeName is "boom"
-PASS mutations[2].attributeNamespace is null
 
 Testing the behavior of attributeFilter when the same observer observes at multiple nodes in a subtree with different filter options.
 ...only foo, bar & bat should be received.

Modified: trunk/LayoutTests/fast/mutation/observe-attributes.html (111949 => 111950)


--- trunk/LayoutTests/fast/mutation/observe-attributes.html	2012-03-24 00:55:59 UTC (rev 111949)
+++ trunk/LayoutTests/fast/mutation/observe-attributes.html	2012-03-24 00:58:06 UTC (rev 111950)
@@ -451,7 +451,7 @@
     var observer;
 
     function start() {
-        debug('Testing that attributeFilter works as expected and ignores case with HTML elements.');
+        debug('Testing that attributeFilter works as expected and observes case with HTML elements.');
 
         mutations = null;
         observer = new WebKitMutationObserver(function(m) {
@@ -469,18 +469,15 @@
     }
 
     function finish() {
-        debug('...only foo, bar & boom should be received.');
+        debug('...only foo and bar should be received.');
 
-        shouldBe('mutations.length', '3');
+        shouldBe('mutations.length', '2');
         shouldBe('mutations[0].type', '"attributes"');
         shouldBe('mutations[0].attributeName', '"foo"');
         shouldBe('mutations[0].attributeNamespace', 'null');
         shouldBe('mutations[1].type', '"attributes"');
         shouldBe('mutations[1].attributeName', '"bar"');
         shouldBe('mutations[1].attributeNamespace', 'null');
-        shouldBe('mutations[2].type', '"attributes"');
-        shouldBe('mutations[2].attributeName', '"boom"');
-        shouldBe('mutations[2].attributeNamespace', 'null');
         observer.disconnect();
         debug('');
         runNextTest();

Modified: trunk/Source/WebCore/ChangeLog (111949 => 111950)


--- trunk/Source/WebCore/ChangeLog	2012-03-24 00:55:59 UTC (rev 111949)
+++ trunk/Source/WebCore/ChangeLog	2012-03-24 00:58:06 UTC (rev 111950)
@@ -1,3 +1,21 @@
+2012-03-23  Rafael Weinstein  <[email protected]>
+
+        [MutationObservers] attributeFilter should be case sensitive at all times
+        https://bugs.webkit.org/show_bug.cgi?id=81822
+
+        Reviewed by Ryosuke Niwa.
+
+        This removes the behavior in MutationObserverRegistration which treats
+        attributeFilter as case insensitive for HTML elements in HTML documents.
+
+        Relevant tests have been updated.
+
+        * dom/MutationObserverRegistration.cpp:
+        (WebCore::MutationObserverRegistration::resetObservation):
+        (WebCore::MutationObserverRegistration::shouldReceiveMutationFrom):
+        * dom/MutationObserverRegistration.h:
+        (MutationObserverRegistration):
+
 2012-03-23  Kentaro Hara  <[email protected]>
 
         Move WebSocket APIs from WorkerContext.idl to WorkerContextWebSocket.idl

Modified: trunk/Source/WebCore/dom/MutationObserverRegistration.cpp (111949 => 111950)


--- trunk/Source/WebCore/dom/MutationObserverRegistration.cpp	2012-03-24 00:55:59 UTC (rev 111949)
+++ trunk/Source/WebCore/dom/MutationObserverRegistration.cpp	2012-03-24 00:58:06 UTC (rev 111950)
@@ -63,7 +63,6 @@
     clearTransientRegistrations();
     m_options = options;
     m_attributeFilter = attributeFilter;
-    m_caseInsensitiveAttributeFilter.clear();
 }
 
 void MutationObserverRegistration::observedSubtreeNodeWillDetach(PassRefPtr<Node> node)
@@ -115,30 +114,9 @@
     if (type != WebKitMutationObserver::Attributes || !(m_options & WebKitMutationObserver::AttributeFilter))
         return true;
 
-    if (m_attributeFilter.contains(attributeName))
-        return true;
-
-    if (node->document()->isHTMLDocument() && node->isHTMLElement())
-        return caseInsensitiveAttributeFilter().contains(attributeName);
-
-    return false;
+    return m_attributeFilter.contains(attributeName);
 }
 
-const HashSet<AtomicString>& MutationObserverRegistration::caseInsensitiveAttributeFilter()
-{
-    if (m_caseInsensitiveAttributeFilter)
-        return *m_caseInsensitiveAttributeFilter;
-
-    m_caseInsensitiveAttributeFilter = adoptPtr(new HashSet<AtomicString>());
-    for (HashSet<AtomicString>::const_iterator iter = m_attributeFilter.begin(); iter != m_attributeFilter.end(); ++iter) {
-        AtomicString attributeNameLower = iter->lower();
-        if ((*iter) != attributeNameLower)
-             m_caseInsensitiveAttributeFilter->add(attributeNameLower);
-    }
-
-    return *m_caseInsensitiveAttributeFilter;
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(MUTATION_OBSERVERS)

Modified: trunk/Source/WebCore/dom/MutationObserverRegistration.h (111949 => 111950)


--- trunk/Source/WebCore/dom/MutationObserverRegistration.h	2012-03-24 00:55:59 UTC (rev 111949)
+++ trunk/Source/WebCore/dom/MutationObserverRegistration.h	2012-03-24 00:58:06 UTC (rev 111950)
@@ -72,7 +72,6 @@
 
     MutationObserverOptions m_options;
     HashSet<AtomicString> m_attributeFilter;
-    OwnPtr<HashSet<AtomicString> > m_caseInsensitiveAttributeFilter;
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to