Example #1
0
static void updateTreeAfterInsertion(ContainerNode* parent, Node* child, bool shouldLazyAttach)
{
    ASSERT(parent->refCount());
    ASSERT(child->refCount());

#if ENABLE(MUTATION_OBSERVERS)
    ChildListMutationScope(parent).childAdded(child);
#endif

#if ENABLE(UNDO_MANAGER)
    if (UndoManager::isRecordingAutomaticTransaction(parent))
        UndoManager::addTransactionStep(NodeInsertingDOMTransactionStep::create(parent, child));
#endif

    parent->childrenChanged(false, child->previousSibling(), child->nextSibling(), 1);

    ChildNodeInsertionNotifier(parent).notify(child);

    // FIXME: Attachment should be the first operation in this function, but some code
    // (for example, HTMLFormControlElement's autofocus support) requires this ordering.
    if (parent->attached() && !child->attached() && child->parentNode() == parent) {
        if (shouldLazyAttach)
            child->lazyAttach();
        else
            child->attach();
    }

    dispatchChildInsertionEvents(child);
}
Example #2
0
static void updateTreeAfterInsertion(ContainerNode* parent, Node* child, AttachBehavior attachBehavior)
{
    ASSERT(parent->refCount());
    ASSERT(child->refCount());

    ChildListMutationScope(parent).childAdded(child);

    parent->childrenChanged(false, child->previousSibling(), child->nextSibling(), 1);

    ChildNodeInsertionNotifier(parent).notify(child);

    // FIXME: Attachment should be the first operation in this function, but some code
    // (for example, HTMLFormControlElement's autofocus support) requires this ordering.
    if (parent->attached() && !child->attached() && child->parentNode() == parent) {
        if (attachBehavior == AttachLazily) {
            if (child->isElementNode())
                toElement(child)->lazyAttach();
            else if (child->isTextNode()) {
                child->setAttached(true);
                child->setNeedsStyleRecalc();
            }
        } else
            attachChild(child);
    }

    dispatchChildInsertionEvents(child);
}
Example #3
0
void ContainerNode::updateTreeAfterInsertion(Node& child)
{
    ASSERT(child.refCount());

    ChildListMutationScope(*this).childAdded(child);

    notifyChildInserted(child, ChildChangeSourceAPI);

    ChildNodeInsertionNotifier(*this).notify(child);

    child.setNeedsStyleRecalc(ReconstructRenderTree);

    dispatchChildInsertionEvents(child);
}