Diff
Modified: trunk/Source/WebCore/ChangeLog (116628 => 116629)
--- trunk/Source/WebCore/ChangeLog 2012-05-10 11:25:53 UTC (rev 116628)
+++ trunk/Source/WebCore/ChangeLog 2012-05-10 11:37:09 UTC (rev 116629)
@@ -1,3 +1,97 @@
+2012-05-10 MORITA Hajime <[email protected]>
+
+ Remove support for Node::willRemove()
+ https://bugs.webkit.org/show_bug.cgi?id=55209
+
+ Reviewed by Ryosuke Niwa.
+
+ This change de-virtualizes Node::willRemove(), gains
+ 5% speedup on Dromaeo dom-modify.
+
+ Originally there were 5 willRemove() overrides:
+ - Element
+ - HTMLStyleElement
+ - HTMLSourceElement
+ - HTMLTrackElement
+ - HTMLFrameOwnerElement
+
+ For first 4 items, this change moves their implementations to
+ Node::removedFrom() overrides.
+
+ Then HTMLFrameOwnerElement is the only class which needs the
+ notification. Because it emits the "unload" event, it needs some
+ notification _before_ its removal. To handle that, this change
+ introduces ChildFrameDisconnector which collects
+ corresponding decendant elements and disconnect their content frame.
+
+ Even though this approach doesn't kill pre-removal tree traversal
+ completely, it's a bit more efficient due to the de-virtualization.
+
+ No new tests. Covered by existing test.
+
+ * dom/ContainerNode.cpp:
+ (WebCore::willRemoveChild): Replaced willRemove() call with ChildFrameDisconnector.
+ (WebCore::willRemoveChildren): Ditto.
+ (WebCore::ContainerNode::disconnectDescendantFrames): Added. Used from FrameLoader to replace Document::willRemove() call.
+ (WebCore):
+ * dom/ContainerNode.h:
+ (ContainerNode):
+ * dom/ContainerNodeAlgorithms.cpp:
+ (WebCore::ChildFrameDisconnector::collectDescendant):
+ (WebCore):
+ (WebCore::ChildFrameDisconnector::Target::disconnect):
+ * dom/ContainerNodeAlgorithms.h:
+ (ChildFrameDisconnector):
+ (Target):
+ (WebCore::ChildFrameDisconnector::Target::Target):
+ (WebCore::ChildFrameDisconnector::Target::isValid):
+ (WebCore):
+ (WebCore::ChildFrameDisconnector::ChildFrameDisconnector):
+ (WebCore::ChildFrameDisconnector::collectDescendant):
+ (WebCore::ChildFrameDisconnector::disconnect):
+ * dom/Element.cpp:
+ (WebCore::Element::removedFrom):
+ * dom/Element.h:
+ * dom/ElementShadow.cpp:
+ * dom/ElementShadow.h:
+ (ElementShadow):
+ * dom/Node.cpp:
+ * dom/Node.h: Added IsFrameOwnerElement flag to de-virtualize IsFrameOwnerElement().
+ (WebCore::Node::isFrameOwnerElement): De-virtualized.
+ (Node):
+ * html/HTMLElement.h:
+ (HTMLElement):
+ (WebCore::HTMLElement::HTMLElement):
+ * html/HTMLFrameOwnerElement.cpp:
+ (WebCore::HTMLFrameOwnerElement::HTMLFrameOwnerElement):
+ (WebCore::HTMLFrameOwnerElement::disconnectContentFrame): Extracted from original willRemove().
+ * html/HTMLFrameOwnerElement.h:
+ (HTMLFrameOwnerElement):
+ (WebCore::toFrameOwnerElement):
+ (WebCore):
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::sourceWasRemoved): Renamed from sourceWillBeRemoved(), dealing with the timing change.
+ * html/HTMLMediaElement.h:
+ (HTMLMediaElement):
+ (WebCore::isMediaElement):
+ (WebCore):
+ (WebCore::toMediaElement):
+ * html/HTMLSourceElement.cpp:
+ (WebCore::HTMLSourceElement::removedFrom): Moved some code from willRemove().
+ * html/HTMLSourceElement.h:
+ (HTMLSourceElement):
+ * html/HTMLStyleElement.cpp:
+ (WebCore::HTMLStyleElement::removedFrom):
+ (WebCore):
+ * html/HTMLStyleElement.h:
+ (HTMLStyleElement):
+ * html/HTMLTrackElement.cpp:
+ (WebCore::HTMLTrackElement::removedFrom): Moved some code from willRemove().
+ * html/HTMLTrackElement.h:
+ (HTMLTrackElement):
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::clear):
+
2012-05-10 Kinuko Yasuda <[email protected]>
Change the return type of Entry.toURL() back to String from KURL
Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (116628 => 116629)
--- trunk/Source/WebCore/dom/ContainerNode.cpp 2012-05-10 11:25:53 UTC (rev 116628)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp 2012-05-10 11:37:09 UTC (rev 116629)
@@ -307,21 +307,6 @@
return true;
}
-void ContainerNode::willRemove()
-{
- RefPtr<Node> protect(this);
-
- NodeVector children;
- getChildNodes(this, children);
- for (size_t i = 0; i < children.size(); ++i) {
- if (children[i]->parentNode() != this) // Check for child being removed from subtree while removing.
- continue;
- children[i]->willRemove();
- }
-
- Node::willRemove();
-}
-
static void willRemoveChild(Node* child)
{
#if ENABLE(MUTATION_OBSERVERS)
@@ -332,7 +317,7 @@
dispatchChildRemovalEvents(child);
child->document()->nodeWillBeRemoved(child); // e.g. mutation event listener can create a new range.
- child->willRemove();
+ ChildFrameDisconnector(child).disconnect();
}
static void willRemoveChildren(ContainerNode* container)
@@ -356,10 +341,15 @@
// fire removed from document mutation events.
dispatchChildRemovalEvents(child);
- child->willRemove();
+ ChildFrameDisconnector(child).disconnect();
}
}
+void ContainerNode::disconnectDescendantFrames()
+{
+ ChildFrameDisconnector(this).disconnect();
+}
+
bool ContainerNode::removeChild(Node* oldChild, ExceptionCode& ec)
{
// Check that this node is not "floating".
Modified: trunk/Source/WebCore/dom/ContainerNode.h (116628 => 116629)
--- trunk/Source/WebCore/dom/ContainerNode.h 2012-05-10 11:25:53 UTC (rev 116628)
+++ trunk/Source/WebCore/dom/ContainerNode.h 2012-05-10 11:37:09 UTC (rev 116629)
@@ -72,7 +72,6 @@
virtual void attach() OVERRIDE;
virtual void detach() OVERRIDE;
- virtual void willRemove() OVERRIDE;
virtual LayoutRect getRect() const OVERRIDE;
virtual void setFocus(bool = true) OVERRIDE;
virtual void setActive(bool active = true, bool pause = false) OVERRIDE;
@@ -94,6 +93,8 @@
void detachChildren();
void detachChildrenIfNeeded();
+ void disconnectDescendantFrames();
+
protected:
ContainerNode(Document*, ConstructionType = CreateContainer);
Modified: trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp (116628 => 116629)
--- trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp 2012-05-10 11:25:53 UTC (rev 116628)
+++ trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp 2012-05-10 11:37:09 UTC (rev 116629)
@@ -28,6 +28,7 @@
#include "Element.h"
#include "ElementShadow.h"
+#include "HTMLFrameOwnerElement.h"
namespace WebCore {
@@ -111,4 +112,16 @@
}
}
+void ChildFrameDisconnector::collectDescendant(ElementShadow* shadow)
+{
+ for (ShadowRoot* root = shadow->youngestShadowRoot(); root; root = root->olderShadowRoot())
+ collectDescendant(root);
}
+
+void ChildFrameDisconnector::Target::disconnect()
+{
+ ASSERT(isValid());
+ toFrameOwnerElement(m_owner.get())->disconnectContentFrame();
+}
+
+}
Modified: trunk/Source/WebCore/dom/ContainerNodeAlgorithms.h (116628 => 116629)
--- trunk/Source/WebCore/dom/ContainerNodeAlgorithms.h 2012-05-10 11:25:53 UTC (rev 116628)
+++ trunk/Source/WebCore/dom/ContainerNodeAlgorithms.h 2012-05-10 11:37:09 UTC (rev 116629)
@@ -265,6 +265,61 @@
notifyNodeRemovedFromTree(toContainerNode(node));
}
+class ChildFrameDisconnector {
+public:
+ explicit ChildFrameDisconnector(Node* root);
+ void disconnect();
+
+private:
+ void collectDescendant(Node* root);
+ void collectDescendant(ElementShadow*);
+
+ class Target {
+ public:
+ Target(Node* element)
+ : m_owner(element)
+ , m_ownerParent(element->parentNode())
+ { }
+
+ bool isValid() const { return m_owner->parentNode() == m_ownerParent; }
+ void disconnect();
+
+ private:
+ RefPtr<Node> m_owner;
+ Node* m_ownerParent;
+ };
+
+ Vector<Target, 10> m_list;
+};
+
+inline ChildFrameDisconnector::ChildFrameDisconnector(Node* root)
+{
+ collectDescendant(root);
+}
+
+inline void ChildFrameDisconnector::collectDescendant(Node* root)
+{
+ for (Node* node = root; node; node = node->traverseNextNode(root)) {
+ if (!node->isElementNode())
+ continue;
+ Element* element = toElement(node);
+ if (element->isFrameOwnerElement())
+ m_list.append(node);
+ if (element->hasShadowRoot())
+ collectDescendant(element->shadow());
+ }
+}
+
+inline void ChildFrameDisconnector::disconnect()
+{
+ unsigned size = m_list.size();
+ for (unsigned i = 0; i < size; ++i) {
+ Target& target = m_list[i];
+ if (target.isValid())
+ target.disconnect();
+ };
+}
+
} // namespace WebCore
#endif // ContainerNodeAlgorithms_h
Modified: trunk/Source/WebCore/dom/Document.cpp (116628 => 116629)
--- trunk/Source/WebCore/dom/Document.cpp 2012-05-10 11:25:53 UTC (rev 116628)
+++ trunk/Source/WebCore/dom/Document.cpp 2012-05-10 11:37:09 UTC (rev 116629)
@@ -2072,6 +2072,7 @@
void Document::prepareForDestruction()
{
+ disconnectDescendantFrames();
if (DOMWindow* window = this->domWindow())
window->willDetachDocumentFromFrame();
detach();
Modified: trunk/Source/WebCore/dom/Element.cpp (116628 => 116629)
--- trunk/Source/WebCore/dom/Element.cpp 2012-05-10 11:25:53 UTC (rev 116628)
+++ trunk/Source/WebCore/dom/Element.cpp 2012-05-10 11:37:09 UTC (rev 116629)
@@ -892,17 +892,6 @@
{
}
-void Element::willRemove()
-{
-#if ENABLE(FULLSCREEN_API)
- if (containsFullScreenElement())
- setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false);
-#endif
- if (ElementShadow* shadow = this->shadow())
- shadow->willRemove();
- ContainerNode::willRemove();
-}
-
Node::InsertionNotificationRequest Element::insertedInto(Node* insertionPoint)
{
// need to do superclass processing first so inDocument() is true
@@ -935,6 +924,11 @@
void Element::removedFrom(Node* insertionPoint)
{
+#if ENABLE(FULLSCREEN_API)
+ if (containsFullScreenElement())
+ setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false);
+#endif
+
setSavedLayerScrollOffset(IntSize());
if (insertionPoint->inDocument()) {
Modified: trunk/Source/WebCore/dom/Element.h (116628 => 116629)
--- trunk/Source/WebCore/dom/Element.h 2012-05-10 11:25:53 UTC (rev 116628)
+++ trunk/Source/WebCore/dom/Element.h 2012-05-10 11:37:09 UTC (rev 116629)
@@ -420,7 +420,6 @@
{
}
- virtual void willRemove();
virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
virtual void removedFrom(Node*) OVERRIDE;
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
Modified: trunk/Source/WebCore/dom/ElementShadow.cpp (116628 => 116629)
--- trunk/Source/WebCore/dom/ElementShadow.cpp 2012-05-10 11:25:53 UTC (rev 116628)
+++ trunk/Source/WebCore/dom/ElementShadow.cpp 2012-05-10 11:37:09 UTC (rev 116629)
@@ -115,13 +115,6 @@
shadowHost->attachChildrenLazily();
}
-void ElementShadow::willRemove()
-{
- ShadowRootVector roots(this);
- for (size_t i = 0; i < roots.size(); ++i)
- roots[i]->willRemove();
-}
-
void ElementShadow::setParentTreeScope(TreeScope* scope)
{
for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadowRoot())
Modified: trunk/Source/WebCore/dom/ElementShadow.h (116628 => 116629)
--- trunk/Source/WebCore/dom/ElementShadow.h 2012-05-10 11:25:53 UTC (rev 116628)
+++ trunk/Source/WebCore/dom/ElementShadow.h 2012-05-10 11:37:09 UTC (rev 116629)
@@ -58,8 +58,6 @@
void addShadowRoot(Element* shadowHost, PassRefPtr<ShadowRoot>, ExceptionCode&);
void removeAllShadowRoots();
- void willRemove();
-
void setParentTreeScope(TreeScope*);
void attach();
Modified: trunk/Source/WebCore/dom/Node.cpp (116628 => 116629)
--- trunk/Source/WebCore/dom/Node.cpp 2012-05-10 11:25:53 UTC (rev 116628)
+++ trunk/Source/WebCore/dom/Node.cpp 2012-05-10 11:37:09 UTC (rev 116629)
@@ -1342,10 +1342,6 @@
clearNeedsStyleRecalc();
}
-void Node::willRemove()
-{
-}
-
void Node::detach()
{
setFlag(InDetachFlag);
Modified: trunk/Source/WebCore/dom/Node.h (116628 => 116629)
--- trunk/Source/WebCore/dom/Node.h 2012-05-10 11:25:53 UTC (rev 116628)
+++ trunk/Source/WebCore/dom/Node.h 2012-05-10 11:37:09 UTC (rev 116629)
@@ -211,13 +211,13 @@
virtual bool isMediaControlElement() const { return false; }
virtual bool isMediaControls() const { return false; }
bool isStyledElement() const { return getFlag(IsStyledElementFlag); }
- virtual bool isFrameOwnerElement() const { return false; }
virtual bool isAttributeNode() const { return false; }
virtual bool isCharacterDataNode() const { return false; }
bool isDocumentNode() const;
bool isShadowRoot() const { return getFlag(IsShadowRootFlag); }
bool inNamedFlow() const { return getFlag(InNamedFlowFlag); }
bool hasAttrList() const { return getFlag(HasAttrListFlag); }
+ bool isFrameOwnerElement() const { return getFlag(IsFrameOwnerElementFlag); }
Node* shadowAncestorNode() const;
// Returns 0, a ShadowRoot, or a legacy shadow root.
@@ -496,8 +496,6 @@
void reattach();
void reattachIfAttached();
-
- virtual void willRemove();
void createRendererIfNeeded();
virtual bool rendererIsNeeded(const NodeRenderingContext&);
virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const { return true; }
@@ -696,10 +694,11 @@
DefaultNodeFlags = IsParsingChildrenFinishedFlag | IsStyleAttributeValidFlag,
#endif
InNamedFlowFlag = 1 << 29,
- HasAttrListFlag = 1 << 30
+ HasAttrListFlag = 1 << 30,
+ IsFrameOwnerElementFlag = 1 << 31
};
- // 2 bits remaining
+ // 1 bits remaining
bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; }
void setFlag(bool f, NodeFlags mask) const { m_nodeFlags = (m_nodeFlags & ~mask) | (-(int32_t)f & mask); }
@@ -715,6 +714,7 @@
CreateShadowRoot = CreateContainer | IsShadowRootFlag,
CreateStyledElement = CreateElement | IsStyledElementFlag,
CreateHTMLElement = CreateStyledElement | IsHTMLFlag,
+ CreateFrameOwnerElement = CreateHTMLElement | IsFrameOwnerElementFlag,
CreateSVGElement = CreateStyledElement | IsSVGFlag,
CreateDocument = CreateContainer | InDocumentFlag
};
Modified: trunk/Source/WebCore/html/HTMLElement.h (116628 => 116629)
--- trunk/Source/WebCore/html/HTMLElement.h 2012-05-10 11:25:53 UTC (rev 116628)
+++ trunk/Source/WebCore/html/HTMLElement.h 2012-05-10 11:37:09 UTC (rev 116629)
@@ -106,7 +106,7 @@
virtual bool isLabelable() const { return false; }
protected:
- HTMLElement(const QualifiedName& tagName, Document*);
+ HTMLElement(const QualifiedName& tagName, Document*, ConstructionType);
void addHTMLLengthToStyle(StylePropertySet*, CSSPropertyID, const String& value);
void addHTMLColorToStyle(StylePropertySet*, CSSPropertyID, const String& color);
@@ -161,8 +161,8 @@
// This will catch anyone doing an unnecessary cast.
void toHTMLElement(const HTMLElement*);
-inline HTMLElement::HTMLElement(const QualifiedName& tagName, Document* document)
- : StyledElement(tagName, document, CreateHTMLElement)
+inline HTMLElement::HTMLElement(const QualifiedName& tagName, Document* document, ConstructionType type = CreateHTMLElement)
+ : StyledElement(tagName, document, type)
{
ASSERT(tagName.localName().impl());
}
Modified: trunk/Source/WebCore/html/HTMLFrameOwnerElement.cpp (116628 => 116629)
--- trunk/Source/WebCore/html/HTMLFrameOwnerElement.cpp 2012-05-10 11:25:53 UTC (rev 116628)
+++ trunk/Source/WebCore/html/HTMLFrameOwnerElement.cpp 2012-05-10 11:37:09 UTC (rev 116629)
@@ -34,7 +34,7 @@
namespace WebCore {
HTMLFrameOwnerElement::HTMLFrameOwnerElement(const QualifiedName& tagName, Document* document)
- : HTMLElement(tagName, document)
+ : HTMLElement(tagName, document, CreateFrameOwnerElement)
, m_contentFrame(0)
, m_sandboxFlags(SandboxNone)
{
@@ -49,17 +49,14 @@
return toRenderPart(renderer());
}
-void HTMLFrameOwnerElement::willRemove()
+void HTMLFrameOwnerElement::disconnectContentFrame()
{
- // FIXME: It is unclear why this can't be moved to removedFromDocument()
- // this is the only implementation of willRemove in WebCore!
+ // This causes an unload event thus cannot be a part of removedFrom().
if (Frame* frame = contentFrame()) {
RefPtr<Frame> protect(frame);
frame->loader()->frameDetached();
frame->disconnectOwnerElement();
}
-
- HTMLElement::willRemove();
}
HTMLFrameOwnerElement::~HTMLFrameOwnerElement()
Modified: trunk/Source/WebCore/html/HTMLFrameOwnerElement.h (116628 => 116629)
--- trunk/Source/WebCore/html/HTMLFrameOwnerElement.h 2012-05-10 11:25:53 UTC (rev 116628)
+++ trunk/Source/WebCore/html/HTMLFrameOwnerElement.h 2012-05-10 11:37:09 UTC (rev 116629)
@@ -54,24 +54,27 @@
virtual ScrollbarMode scrollingMode() const { return ScrollbarAuto; }
SandboxFlags sandboxFlags() const { return m_sandboxFlags; }
+ void disconnectContentFrame();
protected:
HTMLFrameOwnerElement(const QualifiedName& tagName, Document*);
-
void setSandboxFlags(SandboxFlags);
- virtual void willRemove();
-
private:
friend class Frame;
- virtual bool isFrameOwnerElement() const { return true; }
virtual bool isKeyboardFocusable(KeyboardEvent*) const;
Frame* m_contentFrame;
SandboxFlags m_sandboxFlags;
};
+inline HTMLFrameOwnerElement* toFrameOwnerElement(Node* node)
+{
+ ASSERT(!node || node->isFrameOwnerElement());
+ return static_cast<HTMLFrameOwnerElement*>(node);
+}
+
} // namespace WebCore
#endif // HTMLFrameOwnerElement_h
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (116628 => 116629)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2012-05-10 11:25:53 UTC (rev 116628)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2012-05-10 11:37:09 UTC (rev 116629)
@@ -3189,14 +3189,14 @@
scheduleNextSourceChild();
}
-void HTMLMediaElement::sourceWillBeRemoved(HTMLSourceElement* source)
+void HTMLMediaElement::sourceWasRemoved(HTMLSourceElement* source)
{
- LOG(Media, "HTMLMediaElement::sourceWillBeRemoved(%p)", source);
+ LOG(Media, "HTMLMediaElement::sourceWasRemoved(%p)", source);
#if !LOG_DISABLED
if (source->hasTagName(sourceTag)) {
KURL url = ""
- LOG(Media, "HTMLMediaElement::sourceWillBeRemoved - 'src' is %s", urlForLogging(url).utf8().data());
+ LOG(Media, "HTMLMediaElement::sourceWasRemoved - 'src' is %s", urlForLogging(url).utf8().data());
}
#endif
@@ -3204,9 +3204,8 @@
return;
if (source == m_nextChildNodeToConsider) {
- m_nextChildNodeToConsider = m_nextChildNodeToConsider->nextSibling();
- if (!m_nextChildNodeToConsider)
- m_nextChildNodeToConsider = 0;
+ if (m_currentSourceNode)
+ m_nextChildNodeToConsider = m_currentSourceNode->nextSibling();
LOG(Media, "HTMLMediaElement::sourceRemoved - m_nextChildNodeToConsider set to %p", m_nextChildNodeToConsider.get());
} else if (source == m_currentSourceNode) {
// Clear the current source node pointer, but don't change the movie as the spec says:
Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (116628 => 116629)
--- trunk/Source/WebCore/html/HTMLMediaElement.h 2012-05-10 11:25:53 UTC (rev 116628)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h 2012-05-10 11:37:09 UTC (rev 116629)
@@ -287,7 +287,7 @@
MediaControls* mediaControls();
- void sourceWillBeRemoved(HTMLSourceElement*);
+ void sourceWasRemoved(HTMLSourceElement*);
void sourceWasAdded(HTMLSourceElement*);
void privateBrowsingStateDidChange();
@@ -679,6 +679,17 @@
#endif
#endif
+inline bool isMediaElement(Node* node)
+{
+ return node && node->isElementNode() && toElement(node)->isMediaElement();
+}
+
+inline HTMLMediaElement* toMediaElement(Node* node)
+{
+ ASSERT(!node || isMediaElement(node));
+ return static_cast<HTMLMediaElement*>(node);
+}
+
} //namespace
#endif
Modified: trunk/Source/WebCore/html/HTMLSourceElement.cpp (116628 => 116629)
--- trunk/Source/WebCore/html/HTMLSourceElement.cpp 2012-05-10 11:25:53 UTC (rev 116628)
+++ trunk/Source/WebCore/html/HTMLSourceElement.cpp 2012-05-10 11:37:09 UTC (rev 116629)
@@ -63,14 +63,16 @@
return InsertionDone;
}
-void HTMLSourceElement::willRemove()
+void HTMLSourceElement::removedFrom(Node* removalRoot)
{
Element* parent = parentElement();
+ if (!parent && removalRoot->isElementNode())
+ parent = toElement(removalRoot);
if (parent && parent->isMediaElement())
- static_cast<HTMLMediaElement*>(parentNode())->sourceWillBeRemoved(this);
- HTMLElement::willRemove();
+ toMediaElement(parent)->sourceWasRemoved(this);
+ HTMLElement::removedFrom(removalRoot);
}
-
+
void HTMLSourceElement::setSrc(const String& url)
{
setAttribute(srcAttr, url);
Modified: trunk/Source/WebCore/html/HTMLSourceElement.h (116628 => 116629)
--- trunk/Source/WebCore/html/HTMLSourceElement.h 2012-05-10 11:25:53 UTC (rev 116628)
+++ trunk/Source/WebCore/html/HTMLSourceElement.h 2012-05-10 11:37:09 UTC (rev 116629)
@@ -50,7 +50,7 @@
HTMLSourceElement(const QualifiedName&, Document*);
virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
- virtual void willRemove();
+ virtual void removedFrom(Node*) OVERRIDE;
virtual bool isURLAttribute(const Attribute&) const OVERRIDE;
void errorEventTimerFired(Timer<HTMLSourceElement>*);
Modified: trunk/Source/WebCore/html/HTMLStyleElement.cpp (116628 => 116629)
--- trunk/Source/WebCore/html/HTMLStyleElement.cpp 2012-05-10 11:25:53 UTC (rev 116628)
+++ trunk/Source/WebCore/html/HTMLStyleElement.cpp 2012-05-10 11:37:09 UTC (rev 116629)
@@ -166,32 +166,19 @@
{
HTMLElement::removedFrom(insertionPoint);
- if (insertionPoint->inDocument()) {
#if ENABLE(STYLE_SCOPED)
- // In come cases on teardown willRemove is not called - test here for unregistering again
- // FIXME: Do we need to bother?
- if (m_isRegisteredWithScopingNode)
- unregisterWithScopingNode();
-#endif
- StyleElement::removedFromDocument(document(), this);
- }
-}
-
-
-#if ENABLE(STYLE_SCOPED)
-void HTMLStyleElement::willRemove()
-{
// In the current implementation, <style scoped> is only registered if the node is in the document.
// That is, because willRemove() is also called if an ancestor is removed from the document.
// Now, if we want to register <style scoped> even if it's not inDocument,
// we'd need to find a way to discern whether that is the case, or whether <style scoped> itself is about to be removed.
- ASSERT(!scoped() || !inDocument() || m_isRegisteredWithScopingNode || !RuntimeEnabledFeatures::styleScopedEnabled());
if (m_isRegisteredWithScopingNode)
unregisterWithScopingNode();
- HTMLElement::willRemove();
-}
#endif
+ if (insertionPoint->inDocument())
+ StyleElement::removedFromDocument(document(), this);
+}
+
void HTMLStyleElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
{
HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
Modified: trunk/Source/WebCore/html/HTMLStyleElement.h (116628 => 116629)
--- trunk/Source/WebCore/html/HTMLStyleElement.h 2012-05-10 11:25:53 UTC (rev 116628)
+++ trunk/Source/WebCore/html/HTMLStyleElement.h 2012-05-10 11:37:09 UTC (rev 116629)
@@ -62,9 +62,6 @@
virtual void parseAttribute(Attribute*) OVERRIDE;
virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
virtual void removedFrom(Node*) OVERRIDE;
-#if ENABLE(STYLE_SCOPED)
- virtual void willRemove();
-#endif
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
virtual void finishParsingChildren();
Modified: trunk/Source/WebCore/html/HTMLTrackElement.cpp (116628 => 116629)
--- trunk/Source/WebCore/html/HTMLTrackElement.cpp 2012-05-10 11:25:53 UTC (rev 116628)
+++ trunk/Source/WebCore/html/HTMLTrackElement.cpp 2012-05-10 11:37:09 UTC (rev 116629)
@@ -83,12 +83,15 @@
return InsertionDone;
}
-void HTMLTrackElement::willRemove()
+void HTMLTrackElement::removedFrom(Node* insertionPoint)
{
- if (HTMLMediaElement* parent = mediaElement())
+ HTMLMediaElement* parent = mediaElement();
+ if (!parent && WebCore::isMediaElement(insertionPoint))
+ parent = toMediaElement(insertionPoint);
+ if (parent)
parent->willRemoveTrack(this);
- HTMLElement::willRemove();
+ HTMLElement::removedFrom(insertionPoint);
}
void HTMLTrackElement::parseAttribute(Attribute* attribute)
Modified: trunk/Source/WebCore/html/HTMLTrackElement.h (116628 => 116629)
--- trunk/Source/WebCore/html/HTMLTrackElement.h 2012-05-10 11:25:53 UTC (rev 116628)
+++ trunk/Source/WebCore/html/HTMLTrackElement.h 2012-05-10 11:37:09 UTC (rev 116629)
@@ -78,7 +78,8 @@
virtual void parseAttribute(Attribute*) OVERRIDE;
virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
- virtual void willRemove() OVERRIDE;
+
+ virtual void removedFrom(Node*) OVERRIDE;
virtual bool isURLAttribute(const Attribute&) const OVERRIDE;
#if ENABLE(MICRODATA)
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (116628 => 116629)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2012-05-10 11:25:53 UTC (rev 116628)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2012-05-10 11:37:09 UTC (rev 116629)
@@ -515,9 +515,7 @@
m_frame->document()->cancelParsing();
m_frame->document()->stopActiveDOMObjects();
if (m_frame->document()->attached()) {
- m_frame->document()->willRemove();
m_frame->document()->prepareForDestruction();
-
m_frame->document()->removeFocusedNodeOfSubtree(m_frame->document());
}
}