diff options
| author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-08-12 09:27:39 +0200 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-08-12 09:27:39 +0200 |
| commit | 3749d61e1f7a59f5ec5067e560af1eb610c82015 (patch) | |
| tree | 73dc228333948738bbe02976cacca8cd382bc978 /Source/WebCore/dom/ContainerNode.cpp | |
| parent | b32b4dcd9a51ab8de6afc53d9e17f8707e1f7a5e (diff) | |
| download | qtwebkit-3749d61e1f7a59f5ec5067e560af1eb610c82015.tar.gz | |
Imported WebKit commit a77350243e054f3460d1137301d8b3faee3d2052 (http://svn.webkit.org/repository/webkit/trunk@125365)
New snapshot with build fixes for latest API changes in Qt and all WK1 Win MSVC fixes upstream
Diffstat (limited to 'Source/WebCore/dom/ContainerNode.cpp')
| -rw-r--r-- | Source/WebCore/dom/ContainerNode.cpp | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/Source/WebCore/dom/ContainerNode.cpp b/Source/WebCore/dom/ContainerNode.cpp index fd53a2fad..add53ce9a 100644 --- a/Source/WebCore/dom/ContainerNode.cpp +++ b/Source/WebCore/dom/ContainerNode.cpp @@ -60,6 +60,8 @@ static NodeCallbackQueue* s_postAttachCallbackQueue; static size_t s_attachDepth; static bool s_shouldReEnableMemoryCacheCallsAfterAttach; +ChildNodesLazySnapshot* ChildNodesLazySnapshot::latestSnapshot = 0; + static void collectTargetNodes(Node* node, NodeVector& nodes) { if (node->nodeType() != Node::DOCUMENT_FRAGMENT_NODE) { @@ -271,11 +273,21 @@ bool ContainerNode::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, Exce if (next && (next->previousSibling() == newChild || next == newChild)) // nothing to do return true; + // Does this one more time because removeChild() fires a MutationEvent. + checkReplaceChild(newChild.get(), oldChild, ec); + if (ec) + return false; + NodeVector targets; collectChildrenAndRemoveFromOldParent(newChild.get(), targets, ec); if (ec) return false; + // Does this yet another check because collectChildrenAndRemoveFromOldParent() fires a MutationEvent. + checkReplaceChild(newChild.get(), oldChild, ec); + if (ec) + return false; + InspectorInstrumentation::willInsertDOMNode(document(), this); // Add the new child(ren) @@ -685,22 +697,16 @@ void ContainerNode::childrenChanged(bool changedByParser, Node*, Node*, int chil void ContainerNode::cloneChildNodes(ContainerNode *clone) { - // disable the delete button so it's elements are not serialized into the markup - bool isEditorEnabled = false; - if (document()->frame() && document()->frame()->editor()->canEdit()) { - FrameSelection* selection = document()->frame()->selection(); - Element* root = selection ? selection->rootEditableElement() : 0; - isEditorEnabled = root && isDescendantOf(root); + HTMLElement* deleteButtonContainerElement = 0; + if (Frame* frame = document()->frame()) + deleteButtonContainerElement = frame->editor()->deleteButtonController()->containerElement(); - if (isEditorEnabled) - document()->frame()->editor()->deleteButtonController()->disable(); - } - ExceptionCode ec = 0; - for (Node* n = firstChild(); n && !ec; n = n->nextSibling()) + for (Node* n = firstChild(); n && !ec; n = n->nextSibling()) { + if (n == deleteButtonContainerElement) + continue; clone->appendChild(n->cloneNode(true), ec); - if (isEditorEnabled && document()->frame()) - document()->frame()->editor()->deleteButtonController()->enable(); + } } bool ContainerNode::getUpperLeftCorner(FloatPoint& point) const |
