Changeset 207864 in webkit


Ignore:
Timestamp:
Oct 25, 2016 9:45:04 PM (7 years ago)
Author:
rniwa@webkit.org
Message:

Updating attribute by textContent must create a single mutation record and custom element reaction
https://bugs.webkit.org/show_bug.cgi?id=164003

Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

Rebaselined the test now that all test cases are passing.

  • web-platform-tests/custom-elements/reactions/Node-expected.txt:

Source/WebCore:

The bug was caused by setTextContent not invoking setNodeValue for Attr nodes.
Use setNodeValue to match the specification: https://dom.spec.whatwg.org/#dom-node-textcontent

Test: fast/dom/MutationObserver/text-content-on-attr.html

  • dom/Node.cpp:

(WebCore::Node::setTextContent):

LayoutTests:

Added a test for ensuring mutating the attribute by nodeValue and textContent creates exactly one mutation record.

  • fast/custom-elements/reactions-for-webkit-extensions.html: Updated the description.
  • fast/dom/MutationObserver/text-content-on-attr-expected.txt: Added.
  • fast/dom/MutationObserver/text-content-on-attr.html: Added.
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r207862 r207864  
     12016-10-25  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Updating attribute by textContent must create a single mutation record and custom element reaction
     4        https://bugs.webkit.org/show_bug.cgi?id=164003
     5
     6        Reviewed by Chris Dumez.
     7
     8        Added a test for ensuring mutating the attribute by nodeValue and textContent creates exactly one mutation record.
     9
     10        * fast/custom-elements/reactions-for-webkit-extensions.html: Updated the description.
     11        * fast/dom/MutationObserver/text-content-on-attr-expected.txt: Added.
     12        * fast/dom/MutationObserver/text-content-on-attr.html: Added.
     13
    1142016-10-25  Michael Catanzaro  <mcatanzaro@igalia.com>
    215
  • trunk/LayoutTests/fast/custom-elements/reactions-for-webkit-extensions.html

    r207571 r207864  
    22<html>
    33<head>
    4 <title>Custom Elements: CEReactions on Attr interface</title>
     4<title>Custom Elements: CEReactions on HTMLElement interface</title>
    55<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
    6 <meta name="assert" content="value of Attr interface must have CEReactions">
     6<meta name="assert" content="webkitdropzone of HTMLElement interface must have CEReactions">
    77<meta name="help" content="https://dom.spec.whatwg.org/#node">
    88<script src="../../resources/testharness.js"></script>
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r207845 r207864  
     12016-10-25  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Updating attribute by textContent must create a single mutation record and custom element reaction
     4        https://bugs.webkit.org/show_bug.cgi?id=164003
     5
     6        Reviewed by Chris Dumez.
     7
     8        Rebaselined the test now that all test cases are passing.
     9
     10        * web-platform-tests/custom-elements/reactions/Node-expected.txt:
     11
    1122016-10-25  Brady Eidson  <beidson@apple.com>
    213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Node-expected.txt

    r207710 r207864  
    22PASS nodeValue on Node must enqueue an attributeChanged reaction when replacing an existing attribute
    33PASS nodeValue on Node must not enqueue an attributeChanged reaction when replacing an existing unobserved attribute
    4 FAIL textContent on Node must enqueue an attributeChanged reaction when replacing an existing attribute assert_array_equals: lengths differ, expected 1 got 2
     4PASS textContent on Node must enqueue an attributeChanged reaction when replacing an existing attribute
    55PASS textContent on Node must not enqueue an attributeChanged reaction when replacing an existing unobserved attribute
    66PASS cloneNode on Node must enqueue an attributeChanged reaction when cloning an element with an observed attribute
  • trunk/Source/WebCore/ChangeLog

    r207863 r207864  
     12016-10-25  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Updating attribute by textContent must create a single mutation record and custom element reaction
     4        https://bugs.webkit.org/show_bug.cgi?id=164003
     5
     6        Reviewed by Chris Dumez.
     7
     8        The bug was caused by setTextContent not invoking setNodeValue for Attr nodes.
     9        Use setNodeValue to match the specification: https://dom.spec.whatwg.org/#dom-node-textcontent
     10
     11        Test: fast/dom/MutationObserver/text-content-on-attr.html
     12
     13        * dom/Node.cpp:
     14        (WebCore::Node::setTextContent):
     15
    1162016-10-25  Brent Fulgham  <bfulgham@apple.com>
    217
  • trunk/Source/WebCore/dom/Node.cpp

    r207841 r207864  
    14761476{           
    14771477    switch (nodeType()) {
    1478         case TEXT_NODE:
    1479         case CDATA_SECTION_NODE:
    1480         case COMMENT_NODE:
    1481         case PROCESSING_INSTRUCTION_NODE:
    1482             setNodeValue(text, ec);
    1483             return;
    1484         case ELEMENT_NODE:
    1485         case ATTRIBUTE_NODE:
    1486         case DOCUMENT_FRAGMENT_NODE: {
    1487             auto container = makeRef(downcast<ContainerNode>(*this));
    1488             ChildListMutationScope mutation(container);
    1489             container->removeChildren();
    1490             if (!text.isEmpty())
    1491                 container->appendChild(document().createTextNode(text), ec);
    1492             return;
    1493         }
    1494         case DOCUMENT_NODE:
    1495         case DOCUMENT_TYPE_NODE:
    1496             // Do nothing.
    1497             return;
     1478    case ATTRIBUTE_NODE:
     1479    case TEXT_NODE:
     1480    case CDATA_SECTION_NODE:
     1481    case COMMENT_NODE:
     1482    case PROCESSING_INSTRUCTION_NODE:
     1483        setNodeValue(text, ec);
     1484        return;
     1485    case ELEMENT_NODE:
     1486    case DOCUMENT_FRAGMENT_NODE: {
     1487        auto container = makeRef(downcast<ContainerNode>(*this));
     1488        ChildListMutationScope mutation(container);
     1489        container->removeChildren();
     1490        if (!text.isEmpty())
     1491            container->appendChild(document().createTextNode(text), ec);
     1492        return;
     1493    }
     1494    case DOCUMENT_NODE:
     1495    case DOCUMENT_TYPE_NODE:
     1496        // Do nothing.
     1497        return;
    14981498    }
    14991499    ASSERT_NOT_REACHED();
Note: See TracChangeset for help on using the changeset viewer.