Changeset 55532 in webkit


Ignore:
Timestamp:
Mar 4, 2010 10:17:26 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-03-04 Antoine Quint <ml@graougraou.com>

Reviewed by Darin Adler.

DOM insertion mutation events should dispatch after a node is attached to the render tree
https://bugs.webkit.org/show_bug.cgi?id=35590

  • fast/events/domnodeinsertedintodocument-dispatched-post-rendering-expected.txt: Added.
  • fast/events/domnodeinsertedintodocument-dispatched-post-rendering.html: Added.

2010-03-04 Antoine Quint <ml@graougraou.com>

Reviewed by Darin Adler.

DOM insertion mutation events should dispatch after a node is attached to the render tree
https://bugs.webkit.org/show_bug.cgi?id=35590

Test: fast/events/domnodeinsertedintodocument-dispatched-post-rendering.html

Split off the internal-to-WebCore node insertion notification code from the DOM mutation
event dispatching, originally in dispatchChildInsertionEvents(), to a new static function
called notifyChildInserted(). This allows us to dispatch the mutation events at a later
time upon insertion of a child into to the tree, specifically _after_ attachment to the render
tree.

  • dom/ContainerNode.cpp: (WebCore::ContainerNode::insertBefore): (WebCore::ContainerNode::replaceChild): (WebCore::ContainerNode::appendChild): (WebCore::notifyChildInserted): (WebCore::dispatchChildInsertionEvents):
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r55527 r55532  
     12010-03-04  Antoine Quint  <ml@graougraou.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        DOM insertion mutation events should dispatch after a node is attached to the render tree
     6        https://bugs.webkit.org/show_bug.cgi?id=35590
     7
     8        * fast/events/domnodeinsertedintodocument-dispatched-post-rendering-expected.txt: Added.
     9        * fast/events/domnodeinsertedintodocument-dispatched-post-rendering.html: Added.
     10
    1112010-03-04  Csaba Osztrogonác  <ossy@webkit.org>
    212
  • trunk/WebCore/ChangeLog

    r55531 r55532  
     12010-03-04  Antoine Quint  <ml@graougraou.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        DOM insertion mutation events should dispatch after a node is attached to the render tree
     6        https://bugs.webkit.org/show_bug.cgi?id=35590
     7
     8        Test: fast/events/domnodeinsertedintodocument-dispatched-post-rendering.html
     9
     10        Split off the internal-to-WebCore node insertion notification code from the DOM mutation
     11        event dispatching, originally in dispatchChildInsertionEvents(), to a new static function
     12        called notifyChildInserted(). This allows us to dispatch the mutation events at a later
     13        time upon insertion of a child into to the tree, specifically _after_ attachment to the render
     14        tree.
     15
     16        * dom/ContainerNode.cpp:
     17        (WebCore::ContainerNode::insertBefore):
     18        (WebCore::ContainerNode::replaceChild):
     19        (WebCore::ContainerNode::appendChild):
     20        (WebCore::notifyChildInserted):
     21        (WebCore::dispatchChildInsertionEvents):
     22
    1232010-03-04  Fridrich Strba  <fridrich.strba@bluewin.ch>
    224
  • trunk/WebCore/dom/ContainerNode.cpp

    r55465 r55532  
    4444namespace WebCore {
    4545
     46static void notifyChildInserted(Node*);
    4647static void dispatchChildInsertionEvents(Node*);
    4748static void dispatchChildRemovalEvents(Node*);
     
    145146        allowEventDispatch();
    146147
    147         // Dispatch the mutation events.
     148        // Send notification about the children change.
    148149        childrenChanged(false, refChildPreviousSibling.get(), next.get(), 1);
    149         dispatchChildInsertionEvents(child.get());
     150        notifyChildInserted(child.get());
    150151               
    151152        // Add child to the rendering tree.
     
    156157                child->attach();
    157158        }
     159
     160        // Now that the child is attached to the render tree, dispatch
     161        // the relevant mutation events.
     162        dispatchChildInsertionEvents(child.get());
    158163
    159164        child = nextChild.release();
     
    257262        allowEventDispatch();
    258263
    259         // Dispatch the mutation events
    260         dispatchChildInsertionEvents(child.get());
     264        notifyChildInserted(child.get());
    261265               
    262266        // Add child to the rendering tree
     
    267271                child->attach();
    268272        }
     273
     274        // Now that the child is attached to the render tree, dispatch
     275        // the relevant mutation events.
     276        dispatchChildInsertionEvents(child.get());
    269277
    270278        prev = child;
     
    491499        allowEventDispatch();
    492500
    493         // Dispatch the mutation events
     501        // Send notification about the children change.
    494502        childrenChanged(false, prev.get(), 0, 1);
    495         dispatchChildInsertionEvents(child.get());
     503        notifyChildInserted(child.get());
    496504
    497505        // Add child to the rendering tree
     
    502510                child->attach();
    503511        }
     512
     513        // Now that the child is attached to the render tree, dispatch
     514        // the relevant mutation events.
     515        dispatchChildInsertionEvents(child.get());
    504516       
    505517        child = nextChild.release();
     
    877889}
    878890
    879 static void dispatchChildInsertionEvents(Node* child)
     891static void notifyChildInserted(Node* child)
    880892{
    881893    ASSERT(!eventDispatchForbidden());
     
    897909
    898910    document->incDOMTreeVersion();
     911}
     912
     913static void dispatchChildInsertionEvents(Node* child)
     914{
     915    ASSERT(!eventDispatchForbidden());
     916
     917    RefPtr<Node> c = child;
     918    RefPtr<Document> document = child->document();
    899919
    900920    if (c->parentNode() && document->hasListenerType(Document::DOMNODEINSERTED_LISTENER))
Note: See TracChangeset for help on using the changeset viewer.