Changeset 126275 in webkit


Ignore:
Timestamp:
Aug 22, 2012 1:20:40 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Dynamically styling ShadowDom content on a node distributed to another shadow insertion point fails.
https://bugs.webkit.org/show_bug.cgi?id=92899

Patch by Takashi Sakamoto <tasak@google.com> on 2012-08-22
Reviewed by Hajime Morita.

Source/WebCore:

Since childNeedsStyleRecalc is not cleared when parent nodes are
attached, setNeedsStyleRecalc flag is not reached Document. So,
document() doesn't run re-layout.

Test: fast/dom/shadow/shadowdom-dynamic-styling.html

  • dom/ContainerNode.h:

(ContainerNode):
(WebCore::ContainerNode::detachAsNode):
Removed detachAsNode, because the below change made the method
not-used.

  • dom/Element.cpp:

(WebCore::Element::detach):
Modify to invoke ContainerNode::detach when any shadow subtree is
attached. ContainerNode::detach takes care of childNeedsStyleRecalc
flag.

  • dom/ElementShadow.cpp:

(WebCore::ElementShadow::invalidateDistribution):
Use SetAttached for lazyAttach instead of DoNotSetAttached, because
it is reuired to invoke ContainerNode::detach. If not, attached() is
false and reattach() invokes only attach(). This causes to leave
shadow host's childNeedsStyleRecalc flag true after
Element::recalcStyle.

LayoutTests:

  • fast/dom/shadow/shadowdom-dynamic-styling-expected.txt: Added.
  • fast/dom/shadow/shadowdom-dynamic-styling.html: Added.
  • editing/shadow/delete-characters-in-distributed-node-crash.html:

Made the layout test robust. This patch causes commit-queue- and the
failed test is delete-characters-in-distributed-node-crash.html.
However the layout test passes when locally running run_webkit_test
i.e. no difference between actual and expected texts. And looking at
the commit-queue's report, the actual text has "PASS" message (no
crash messages).

Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r126271 r126275  
     12012-08-22  Takashi Sakamoto  <tasak@google.com>
     2
     3        Dynamically styling ShadowDom content on a node distributed to another shadow insertion point fails.
     4        https://bugs.webkit.org/show_bug.cgi?id=92899
     5
     6        Reviewed by Hajime Morita.
     7
     8        * fast/dom/shadow/shadowdom-dynamic-styling-expected.txt: Added.
     9        * fast/dom/shadow/shadowdom-dynamic-styling.html: Added.
     10        * editing/shadow/delete-characters-in-distributed-node-crash.html:
     11        Made the layout test robust. This patch causes commit-queue- and the
     12        failed test is delete-characters-in-distributed-node-crash.html.
     13        However the layout test passes when locally running run_webkit_test
     14        i.e. no difference between actual and expected texts. And looking at
     15        the commit-queue's report, the actual text has "PASS" message (no
     16        crash messages).
     17
    1182012-08-22  Dominic Cooney  <dominicc@chromium.org>
    219
  • trunk/LayoutTests/editing/shadow/delete-characters-in-distributed-node-crash-expected.txt

    r120896 r126275  
    11This tests the deletion of text in distributed node does not crash. To run it outside of DRT, you must delete text, 'foo', manually.
    22
    3 
    43PASS
  • trunk/LayoutTests/editing/shadow/delete-characters-in-distributed-node-crash.html

    r124685 r126275  
    33<body>
    44<p id="description">This tests the deletion of text in distributed node does not crash. To run it outside of DRT, you must delete text, 'foo', manually.</p>
    5 <div id="shadowhost" contenteditable><div>foo</div></div>
     5<div id="wrapper"><div id="shadowhost" contenteditable><div>foo</div></div></div>
    66<script>
    77if (window.testRunner)
     
    1414document.execCommand('Delete');
    1515
    16 document.write('PASS');
     16document.getElementById("wrapper").innerHTML = "PASS";
    1717</script>
    1818</body>
  • trunk/Source/WebCore/ChangeLog

    r126273 r126275  
     12012-08-22  Takashi Sakamoto  <tasak@google.com>
     2
     3        Dynamically styling ShadowDom content on a node distributed to another shadow insertion point fails.
     4        https://bugs.webkit.org/show_bug.cgi?id=92899
     5
     6        Reviewed by Hajime Morita.
     7
     8        Since childNeedsStyleRecalc is not cleared when parent nodes are
     9        attached, setNeedsStyleRecalc flag is not reached Document. So,
     10        document() doesn't run re-layout.
     11
     12        Test: fast/dom/shadow/shadowdom-dynamic-styling.html
     13
     14        * dom/ContainerNode.h:
     15        (ContainerNode):
     16        (WebCore::ContainerNode::detachAsNode):
     17        Removed detachAsNode, because the below change made the method
     18        not-used.
     19        * dom/Element.cpp:
     20        (WebCore::Element::detach):
     21        Modify to invoke ContainerNode::detach when any shadow subtree is
     22        attached. ContainerNode::detach takes care of childNeedsStyleRecalc
     23        flag.
     24        * dom/ElementShadow.cpp:
     25        (WebCore::ElementShadow::invalidateDistribution):
     26        Use SetAttached for lazyAttach instead of DoNotSetAttached, because
     27        it is reuired to invoke ContainerNode::detach. If not, attached() is
     28        false and reattach() invokes only attach(). This causes to leave
     29        shadow host's childNeedsStyleRecalc flag true after
     30        Element::recalcStyle.
     31
    1322012-08-22  Taiju Tsuiki  <tzik@chromium.org>
    233
  • trunk/Source/WebCore/dom/ContainerNode.h

    r125006 r126275  
    9393    void attachChildrenIfNeeded();
    9494    void attachChildrenLazily();
    95     void detachAsNode();
    9695    void detachChildren();
    9796    void detachChildrenIfNeeded();
     
    187186        if (!child->attached())
    188187            child->lazyAttach();
    189 }
    190 
    191 inline void ContainerNode::detachAsNode()
    192 {
    193     Node::detach();
    194188}
    195189
  • trunk/Source/WebCore/dom/Element.cpp

    r126258 r126275  
    10001000        detachChildrenIfNeeded();
    10011001        shadow->detach();
    1002         detachAsNode();
    1003     } else
    1004         ContainerNode::detach();
     1002    }
     1003    ContainerNode::detach();
    10051004
    10061005    RenderWidget::resumeWidgetHierarchyUpdates();
  • trunk/Source/WebCore/dom/ElementShadow.cpp

    r124196 r126275  
    207207    if (needsReattach && host->attached()) {
    208208        host->detach();
    209         host->lazyAttach(Node::DoNotSetAttached);
     209        host->lazyAttach();
    210210    }
    211211
Note: See TracChangeset for help on using the changeset viewer.