Diff
Modified: trunk/Source/WebCore/ChangeLog (103678 => 103679)
--- trunk/Source/WebCore/ChangeLog 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/ChangeLog 2011-12-26 07:05:00 UTC (rev 103679)
@@ -1,3 +1,72 @@
+2011-12-25 Hajime Morrita <[email protected]>
+
+ https://bugs.webkit.org/show_bug.cgi?id=74067
+ Refactoring: Unitfy willMoveToNewDocument() and didMoveToNewDocument()
+
+ Reviewed by Darin Adler.
+
+ No new tests. No behavior change.
+
+ This change combines two method Node::willMoveToNewOwnerDocument() and Node::didMoveToNewOwnerDocument()
+ into Node::didMoveToNewDocument(Document* oldDocument).
+
+ The intention of this change is:
+ - Making upcoming refactoring (Bug 59816) possible. The refactoring will turn Node::m_document into
+ Node::m_treeScope, and we will no longer have Node::setDocument() where we can invoke both
+ willMoveToNewDocument() and didMoveToNewDocument() at once.
+ - Killing one extra virtual method call.
+ - Making the concept of "move" clearer by keeping such an operation into the single method.
+
+ * dom/Node.cpp:
+ (WebCore::setWillMoveToNewDocumentWasCalled):
+ (WebCore::setDidMoveToNewDocumentWasCalled):
+ (WebCore::Node::setDocument):
+ (WebCore::Node::didMoveToNewDocument):
+ * dom/Node.h:
+ * dom/StyledElement.cpp:
+ (WebCore::StyledElement::attributeChanged):
+ * html/FormAssociatedElement.cpp:
+ (WebCore::FormAssociatedElement::didMoveToNewDocument):
+ * html/FormAssociatedElement.h:
+ * html/HTMLFormControlElement.cpp:
+ (WebCore::HTMLFormControlElement::didMoveToNewDocument):
+ (WebCore::HTMLFormControlElementWithState::didMoveToNewDocument):
+ * html/HTMLFormControlElement.h:
+ * html/HTMLFormElement.cpp:
+ (WebCore::HTMLFormElement::didMoveToNewDocument):
+ * html/HTMLFormElement.h:
+ * html/HTMLImageElement.cpp:
+ (WebCore::HTMLImageElement::didMoveToNewDocument):
+ * html/HTMLImageElement.h:
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::didMoveToNewDocument):
+ * html/HTMLInputElement.h:
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::didMoveToNewDocument):
+ * html/HTMLMediaElement.h:
+ * html/HTMLObjectElement.cpp:
+ (WebCore::HTMLObjectElement::didMoveToNewDocument):
+ * html/HTMLObjectElement.h:
+ * html/HTMLPlugInImageElement.cpp:
+ (WebCore::HTMLPlugInImageElement::didMoveToNewDocument):
+ * html/HTMLPlugInImageElement.h:
+ * html/HTMLVideoElement.cpp:
+ (WebCore::HTMLVideoElement::didMoveToNewDocument):
+ * html/HTMLVideoElement.h:
+ * html/ImageDocument.cpp:
+ (WebCore::ImageDocumentElement::didMoveToNewDocument):
+ * html/ImageInputType.cpp:
+ (WebCore::ImageInputType::willMoveToNewDocument):
+ * loader/ImageLoader.cpp:
+ (WebCore::ImageLoader::elementDidMoveToNewDocument):
+ * loader/ImageLoader.h:
+ * svg/SVGImageElement.cpp:
+ (WebCore::SVGImageElement::didMoveToNewDocument):
+ * svg/SVGImageElement.h:
+ * svg/SVGSVGElement.cpp:
+ (WebCore::SVGSVGElement::didMoveToNewDocument):
+ * svg/SVGSVGElement.h:
+
2011-12-25 Kentaro Hara <[email protected]>
REGRESSION(r102987): Fix the filename prefix of the generated empty .h
Modified: trunk/Source/WebCore/dom/Node.cpp (103678 => 103679)
--- trunk/Source/WebCore/dom/Node.cpp 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/dom/Node.cpp 2011-12-26 07:05:00 UTC (rev 103679)
@@ -419,27 +419,21 @@
#ifdef NDEBUG
-static inline void setWillMoveToNewOwnerDocumentWasCalled(bool)
+static inline void setWillMoveToNewDocumentWasCalled(bool)
{
}
-static inline void setDidMoveToNewOwnerDocumentWasCalled(bool)
+static inline void setDidMoveToNewDocumentWasCalled(bool)
{
}
#else
-
-static bool willMoveToNewOwnerDocumentWasCalled;
-static bool didMoveToNewOwnerDocumentWasCalled;
-static void setWillMoveToNewOwnerDocumentWasCalled(bool wasCalled)
-{
- willMoveToNewOwnerDocumentWasCalled = wasCalled;
-}
+static bool didMoveToNewDocumentWasCalled;
-static void setDidMoveToNewOwnerDocumentWasCalled(bool wasCalled)
+static void setDidMoveToNewDocumentWasCalled(bool wasCalled)
{
- didMoveToNewOwnerDocumentWasCalled = wasCalled;
+ didMoveToNewDocumentWasCalled = wasCalled;
}
#endif
@@ -452,20 +446,17 @@
document->guardRef();
- setWillMoveToNewOwnerDocumentWasCalled(false);
- willMoveToNewOwnerDocument();
- ASSERT(willMoveToNewOwnerDocumentWasCalled);
-
if (m_document) {
m_document->moveNodeIteratorsToNewDocument(this, document);
m_document->guardDeref();
}
+ Document* oldDocument = m_document;
m_document = document;
- setDidMoveToNewOwnerDocumentWasCalled(false);
- didMoveToNewOwnerDocument();
- ASSERT(didMoveToNewOwnerDocumentWasCalled);
+ setDidMoveToNewDocumentWasCalled(false);
+ didMoveToNewDocument(oldDocument);
+ ASSERT(didMoveToNewDocumentWasCalled);
}
TreeScope* Node::treeScope() const
@@ -2497,17 +2488,11 @@
clearInDocument();
}
-void Node::willMoveToNewOwnerDocument()
+void Node::didMoveToNewDocument(Document* oldDocument)
{
- ASSERT(!willMoveToNewOwnerDocumentWasCalled);
- setWillMoveToNewOwnerDocumentWasCalled(true);
-}
+ ASSERT(!didMoveToNewDocumentWasCalled);
+ setDidMoveToNewDocumentWasCalled(true);
-void Node::didMoveToNewOwnerDocument()
-{
- ASSERT(!didMoveToNewOwnerDocumentWasCalled);
- setDidMoveToNewOwnerDocumentWasCalled(true);
-
// FIXME: Event listener types for this node should be set on the new owner document here.
#if ENABLE(MUTATION_OBSERVERS)
@@ -2522,6 +2507,8 @@
document()->addMutationObserverTypes((*iter)->mutationTypes());
}
}
+#else
+ UNUSED_PARAM(oldDocument);
#endif
}
Modified: trunk/Source/WebCore/dom/Node.h (103678 => 103679)
--- trunk/Source/WebCore/dom/Node.h 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/dom/Node.h 2011-12-26 07:05:00 UTC (rev 103679)
@@ -678,8 +678,7 @@
};
Node(Document*, ConstructionType);
- virtual void willMoveToNewOwnerDocument();
- virtual void didMoveToNewOwnerDocument();
+ virtual void didMoveToNewDocument(Document* oldDocument);
virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const { }
void setTabIndexExplicitly(short);
Modified: trunk/Source/WebCore/dom/StyledElement.cpp (103678 => 103679)
--- trunk/Source/WebCore/dom/StyledElement.cpp 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/dom/StyledElement.cpp 2011-12-26 07:05:00 UTC (rev 103679)
@@ -182,7 +182,7 @@
}
// parseMappedAttribute() might create a CSSMappedAttributeDeclaration on the attribute.
- // Normally we would be concerned about reseting the parent of those declarations in StyledElement::didMoveToNewOwnerDocument().
+ // Normally we would be concerned about reseting the parent of those declarations in StyledElement::didMoveToNewDocument().
// But currently we always clear its parent and node below when adding it to the decl table.
// If that changes for some reason moving between documents will be buggy.
// webarchive/adopt-attribute-styled-node-webarchive.html should catch any resulting crashes.
Modified: trunk/Source/WebCore/html/FormAssociatedElement.cpp (103678 => 103679)
--- trunk/Source/WebCore/html/FormAssociatedElement.cpp 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/html/FormAssociatedElement.cpp 2011-12-26 07:05:00 UTC (rev 103679)
@@ -52,11 +52,11 @@
return m_validityState.get();
}
-void FormAssociatedElement::willMoveToNewOwnerDocument()
+void FormAssociatedElement::didMoveToNewDocument(Document* oldDocument)
{
HTMLElement* element = toHTMLElement(this);
- if (element->fastHasAttribute(formAttr))
- element->document()->unregisterFormElementWithFormAttribute(this);
+ if (oldDocument && element->fastHasAttribute(formAttr))
+ oldDocument->unregisterFormElementWithFormAttribute(this);
}
void FormAssociatedElement::insertedIntoDocument()
Modified: trunk/Source/WebCore/html/FormAssociatedElement.h (103678 => 103679)
--- trunk/Source/WebCore/html/FormAssociatedElement.h 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/html/FormAssociatedElement.h 2011-12-26 07:05:00 UTC (rev 103679)
@@ -64,7 +64,7 @@
void removedFromTree();
void insertedIntoDocument();
void removedFromDocument();
- void willMoveToNewOwnerDocument();
+ void didMoveToNewDocument(Document* oldDocument);
void setForm(HTMLFormElement* form) { m_form = form; }
void removeFromForm();
Modified: trunk/Source/WebCore/html/HTMLFormControlElement.cpp (103678 => 103679)
--- trunk/Source/WebCore/html/HTMLFormControlElement.cpp 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/html/HTMLFormControlElement.cpp 2011-12-26 07:05:00 UTC (rev 103679)
@@ -196,10 +196,10 @@
resumePostAttachCallbacks();
}
-void HTMLFormControlElement::willMoveToNewOwnerDocument()
+void HTMLFormControlElement::didMoveToNewDocument(Document* oldDocument)
{
- FormAssociatedElement::willMoveToNewOwnerDocument();
- HTMLElement::willMoveToNewOwnerDocument();
+ FormAssociatedElement::didMoveToNewDocument(oldDocument);
+ HTMLElement::didMoveToNewDocument(oldDocument);
}
void HTMLFormControlElement::insertedIntoTree(bool deep)
@@ -511,16 +511,12 @@
document()->unregisterFormElementWithState(this);
}
-void HTMLFormControlElementWithState::willMoveToNewOwnerDocument()
+void HTMLFormControlElementWithState::didMoveToNewDocument(Document* oldDocument)
{
- document()->unregisterFormElementWithState(this);
- HTMLFormControlElement::willMoveToNewOwnerDocument();
-}
-
-void HTMLFormControlElementWithState::didMoveToNewOwnerDocument()
-{
+ if (oldDocument)
+ oldDocument->unregisterFormElementWithState(this);
document()->registerFormElementWithState(this);
- HTMLFormControlElement::didMoveToNewOwnerDocument();
+ HTMLFormControlElement::didMoveToNewDocument(oldDocument);
}
bool HTMLFormControlElementWithState::shouldAutocomplete() const
Modified: trunk/Source/WebCore/html/HTMLFormControlElement.h (103678 => 103679)
--- trunk/Source/WebCore/html/HTMLFormControlElement.h 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/html/HTMLFormControlElement.h 2011-12-26 07:05:00 UTC (rev 103679)
@@ -120,7 +120,7 @@
virtual void removedFromTree(bool deep);
virtual void insertedIntoDocument();
virtual void removedFromDocument();
- virtual void willMoveToNewOwnerDocument();
+ virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
virtual bool supportsFocus() const;
virtual bool isKeyboardFocusable(KeyboardEvent*) const;
@@ -185,8 +185,7 @@
virtual bool shouldAutocomplete() const;
virtual void finishParsingChildren();
- virtual void willMoveToNewOwnerDocument();
- virtual void didMoveToNewOwnerDocument();
+ virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
};
} // namespace
Modified: trunk/Source/WebCore/html/HTMLFormElement.cpp (103678 => 103679)
--- trunk/Source/WebCore/html/HTMLFormElement.cpp 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/html/HTMLFormElement.cpp 2011-12-26 07:05:00 UTC (rev 103679)
@@ -632,18 +632,15 @@
}
}
-void HTMLFormElement::willMoveToNewOwnerDocument()
+void HTMLFormElement::didMoveToNewDocument(Document* oldDocument)
{
- if (!shouldAutocomplete())
- document()->unregisterForPageCacheSuspensionCallbacks(this);
- HTMLElement::willMoveToNewOwnerDocument();
-}
-
-void HTMLFormElement::didMoveToNewOwnerDocument()
-{
- if (!shouldAutocomplete())
+ if (!shouldAutocomplete()) {
+ if (oldDocument)
+ oldDocument->unregisterForPageCacheSuspensionCallbacks(this);
document()->registerForPageCacheSuspensionCallbacks(this);
- HTMLElement::didMoveToNewOwnerDocument();
+ }
+
+ HTMLElement::didMoveToNewDocument(oldDocument);
}
bool HTMLFormElement::shouldAutocomplete() const
Modified: trunk/Source/WebCore/html/HTMLFormElement.h (103678 => 103679)
--- trunk/Source/WebCore/html/HTMLFormElement.h 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/html/HTMLFormElement.h 2011-12-26 07:05:00 UTC (rev 103679)
@@ -128,8 +128,7 @@
virtual void documentDidResumeFromPageCache();
- virtual void willMoveToNewOwnerDocument();
- virtual void didMoveToNewOwnerDocument();
+ virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
virtual bool shouldRegisterAsNamedItem() const OVERRIDE { return true; }
Modified: trunk/Source/WebCore/html/HTMLImageElement.cpp (103678 => 103679)
--- trunk/Source/WebCore/html/HTMLImageElement.cpp 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/html/HTMLImageElement.cpp 2011-12-26 07:05:00 UTC (rev 103679)
@@ -349,10 +349,10 @@
addSubresourceURL(urls, document()->completeURL(getAttribute(usemapAttr)));
}
-void HTMLImageElement::willMoveToNewOwnerDocument()
+void HTMLImageElement::didMoveToNewDocument(Document* oldDocument)
{
- m_imageLoader.elementWillMoveToNewOwnerDocument();
- HTMLElement::willMoveToNewOwnerDocument();
+ m_imageLoader.elementDidMoveToNewDocument();
+ HTMLElement::didMoveToNewDocument(oldDocument);
}
bool HTMLImageElement::isServerMap() const
Modified: trunk/Source/WebCore/html/HTMLImageElement.h (103678 => 103679)
--- trunk/Source/WebCore/html/HTMLImageElement.h 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/html/HTMLImageElement.h 2011-12-26 07:05:00 UTC (rev 103679)
@@ -80,7 +80,7 @@
protected:
HTMLImageElement(const QualifiedName&, Document*, HTMLFormElement* = 0);
- virtual void willMoveToNewOwnerDocument();
+ virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
private:
virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (103678 => 103679)
--- trunk/Source/WebCore/html/HTMLInputElement.cpp 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp 2011-12-26 07:05:00 UTC (rev 103679)
@@ -1502,26 +1502,23 @@
reset();
}
-void HTMLInputElement::willMoveToNewOwnerDocument()
+void HTMLInputElement::didMoveToNewDocument(Document* oldDocument)
{
m_inputType->willMoveToNewOwnerDocument();
+ bool needsSuspensionCallback = this->needsSuspensionCallback();
+ if (oldDocument) {
+ // Always unregister for cache callbacks when leaving a document, even if we would otherwise like to be registered
+ if (needsSuspensionCallback)
+ oldDocument->unregisterForPageCacheSuspensionCallbacks(this);
+ oldDocument->checkedRadioButtons().removeButton(this);
+ }
- // Always unregister for cache callbacks when leaving a document, even if we would otherwise like to be registered
- if (needsSuspensionCallback())
- document()->unregisterForPageCacheSuspensionCallbacks(this);
+ if (needsSuspensionCallback)
+ document()->registerForPageCacheSuspensionCallbacks(this);
- document()->checkedRadioButtons().removeButton(this);
-
- HTMLTextFormControlElement::willMoveToNewOwnerDocument();
+ HTMLTextFormControlElement::didMoveToNewDocument(oldDocument);
}
-void HTMLInputElement::didMoveToNewOwnerDocument()
-{
- registerForSuspensionCallbackIfNeeded();
-
- HTMLTextFormControlElement::didMoveToNewOwnerDocument();
-}
-
void HTMLInputElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const
{
HTMLTextFormControlElement::addSubresourceAttributeURLs(urls);
Modified: trunk/Source/WebCore/html/HTMLInputElement.h (103678 => 103679)
--- trunk/Source/WebCore/html/HTMLInputElement.h 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/html/HTMLInputElement.h 2011-12-26 07:05:00 UTC (rev 103679)
@@ -249,8 +249,7 @@
enum AutoCompleteSetting { Uninitialized, On, Off };
enum AnyStepHandling { RejectAny, AnyIsDefaultStep };
- virtual void willMoveToNewOwnerDocument();
- virtual void didMoveToNewOwnerDocument();
+ virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
virtual bool isKeyboardFocusable(KeyboardEvent*) const;
virtual bool isMouseFocusable() const;
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (103678 => 103679)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2011-12-26 07:05:00 UTC (rev 103679)
@@ -277,25 +277,29 @@
removeElementFromDocumentMap(this, document());
}
-void HTMLMediaElement::willMoveToNewOwnerDocument()
+void HTMLMediaElement::didMoveToNewDocument(Document* oldDocument)
{
- if (m_isWaitingUntilMediaCanStart)
- document()->removeMediaCanStartListener(this);
- setShouldDelayLoadEvent(false);
- document()->unregisterForMediaVolumeCallbacks(this);
- removeElementFromDocumentMap(this, document());
- HTMLElement::willMoveToNewOwnerDocument();
-}
+ if (m_isWaitingUntilMediaCanStart) {
+ if (oldDocument)
+ oldDocument->removeMediaCanStartListener(this);
+ document()->addMediaCanStartListener(this);
+ }
-void HTMLMediaElement::didMoveToNewOwnerDocument()
-{
- if (m_isWaitingUntilMediaCanStart)
- document()->addMediaCanStartListener(this);
- if (m_readyState < HAVE_CURRENT_DATA)
- setShouldDelayLoadEvent(true);
+ if (m_shouldDelayLoadEvent) {
+ if (oldDocument)
+ oldDocument->decrementLoadEventDelayCount();
+ document()->incrementLoadEventDelayCount();
+ }
+
+ if (oldDocument) {
+ oldDocument->unregisterForMediaVolumeCallbacks(this);
+ removeElementFromDocumentMap(this, oldDocument);
+ }
+
document()->registerForMediaVolumeCallbacks(this);
addElementToDocumentMap(this, document());
- HTMLElement::didMoveToNewOwnerDocument();
+
+ HTMLElement::didMoveToNewDocument(oldDocument);
}
bool HTMLMediaElement::supportsFocus() const
Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (103678 => 103679)
--- trunk/Source/WebCore/html/HTMLMediaElement.h 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h 2011-12-26 07:05:00 UTC (rev 103679)
@@ -282,8 +282,7 @@
virtual bool isURLAttribute(Attribute*) const;
virtual void attach();
- virtual void willMoveToNewOwnerDocument();
- virtual void didMoveToNewOwnerDocument();
+ virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
enum DisplayMode { Unknown, None, Poster, PosterWaitingForVideo, Video };
DisplayMode displayMode() const { return m_displayMode; }
@@ -434,7 +433,6 @@
virtual void mediaCanStart();
void setShouldDelayLoadEvent(bool);
-
void invalidateCachedTime();
void refreshCachedTime() const;
Modified: trunk/Source/WebCore/html/HTMLObjectElement.cpp (103678 => 103679)
--- trunk/Source/WebCore/html/HTMLObjectElement.cpp 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/html/HTMLObjectElement.cpp 2011-12-26 07:05:00 UTC (rev 103679)
@@ -476,10 +476,10 @@
addSubresourceURL(urls, document()->completeURL(useMap));
}
-void HTMLObjectElement::willMoveToNewOwnerDocument()
+void HTMLObjectElement::didMoveToNewDocument(Document* oldDocument)
{
- FormAssociatedElement::willMoveToNewOwnerDocument();
- HTMLPlugInImageElement::willMoveToNewOwnerDocument();
+ FormAssociatedElement::didMoveToNewDocument(oldDocument);
+ HTMLPlugInImageElement::didMoveToNewDocument(oldDocument);
}
void HTMLObjectElement::insertedIntoTree(bool deep)
Modified: trunk/Source/WebCore/html/HTMLObjectElement.h (103678 => 103679)
--- trunk/Source/WebCore/html/HTMLObjectElement.h 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/html/HTMLObjectElement.h 2011-12-26 07:05:00 UTC (rev 103679)
@@ -73,8 +73,8 @@
virtual bool rendererIsNeeded(const NodeRenderingContext&);
virtual void insertedIntoDocument();
virtual void removedFromDocument();
- virtual void willMoveToNewOwnerDocument();
-
+ virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
+
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
virtual bool isURLAttribute(Attribute*) const;
Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp (103678 => 103679)
--- trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp 2011-12-26 07:05:00 UTC (rev 103679)
@@ -202,25 +202,19 @@
setNeedsStyleRecalc();
}
-void HTMLPlugInImageElement::willMoveToNewOwnerDocument()
+void HTMLPlugInImageElement::didMoveToNewDocument(Document* oldDocument)
{
- if (m_needsDocumentActivationCallbacks)
- document()->unregisterForPageCacheSuspensionCallbacks(this);
+ if (m_needsDocumentActivationCallbacks) {
+ if (oldDocument)
+ oldDocument->unregisterForPageCacheSuspensionCallbacks(this);
+ document()->registerForPageCacheSuspensionCallbacks(this);
+ }
if (m_imageLoader)
- m_imageLoader->elementWillMoveToNewOwnerDocument();
-
- HTMLPlugInElement::willMoveToNewOwnerDocument();
+ m_imageLoader->elementDidMoveToNewDocument();
+ HTMLPlugInElement::didMoveToNewDocument(oldDocument);
}
-void HTMLPlugInImageElement::didMoveToNewOwnerDocument()
-{
- if (m_needsDocumentActivationCallbacks)
- document()->registerForPageCacheSuspensionCallbacks(this);
-
- HTMLPlugInElement::didMoveToNewOwnerDocument();
-}
-
void HTMLPlugInImageElement::documentWillSuspendForPageCache()
{
if (RenderStyle* rs = renderStyle()) {
Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.h (103678 => 103679)
--- trunk/Source/WebCore/html/HTMLPlugInImageElement.h 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.h 2011-12-26 07:05:00 UTC (rev 103679)
@@ -74,8 +74,7 @@
bool allowedToLoadFrameURL(const String& url);
bool wouldLoadAsNetscapePlugin(const String& url, const String& serviceType);
- virtual void willMoveToNewOwnerDocument() OVERRIDE;
- virtual void didMoveToNewOwnerDocument() OVERRIDE;
+ virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
virtual void documentWillSuspendForPageCache() OVERRIDE;
virtual void documentDidResumeFromPageCache() OVERRIDE;
Modified: trunk/Source/WebCore/html/HTMLVideoElement.cpp (103678 => 103679)
--- trunk/Source/WebCore/html/HTMLVideoElement.cpp 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/html/HTMLVideoElement.cpp 2011-12-26 07:05:00 UTC (rev 103679)
@@ -271,11 +271,11 @@
return isFullscreen();
}
-void HTMLVideoElement::willMoveToNewOwnerDocument()
+void HTMLVideoElement::didMoveToNewDocument(Document* oldDocument)
{
if (m_imageLoader)
- m_imageLoader->elementWillMoveToNewOwnerDocument();
- HTMLMediaElement::willMoveToNewOwnerDocument();
+ m_imageLoader->elementDidMoveToNewDocument();
+ HTMLMediaElement::didMoveToNewDocument(oldDocument);
}
#if ENABLE(MEDIA_STATISTICS)
Modified: trunk/Source/WebCore/html/HTMLVideoElement.h (103678 => 103679)
--- trunk/Source/WebCore/html/HTMLVideoElement.h 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/html/HTMLVideoElement.h 2011-12-26 07:05:00 UTC (rev 103679)
@@ -84,9 +84,7 @@
virtual bool hasAvailableVideoFrame() const;
virtual void updateDisplayState();
-
- virtual void willMoveToNewOwnerDocument();
-
+ virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
virtual void setDisplayMode(DisplayMode);
OwnPtr<HTMLImageLoader> m_imageLoader;
Modified: trunk/Source/WebCore/html/ImageDocument.cpp (103678 => 103679)
--- trunk/Source/WebCore/html/ImageDocument.cpp 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/html/ImageDocument.cpp 2011-12-26 07:05:00 UTC (rev 103679)
@@ -106,7 +106,7 @@
}
virtual ~ImageDocumentElement();
- virtual void willMoveToNewOwnerDocument();
+ virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
ImageDocument* m_imageDocument;
};
@@ -407,13 +407,13 @@
m_imageDocument->disconnectImageElement();
}
-void ImageDocumentElement::willMoveToNewOwnerDocument()
+void ImageDocumentElement::didMoveToNewDocument(Document* oldDocument)
{
if (m_imageDocument) {
m_imageDocument->disconnectImageElement();
m_imageDocument = 0;
}
- HTMLImageElement::willMoveToNewOwnerDocument();
+ HTMLImageElement::didMoveToNewDocument(oldDocument);
}
}
Modified: trunk/Source/WebCore/html/ImageInputType.cpp (103678 => 103679)
--- trunk/Source/WebCore/html/ImageInputType.cpp 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/html/ImageInputType.cpp 2011-12-26 07:05:00 UTC (rev 103679)
@@ -146,7 +146,7 @@
{
BaseButtonInputType::willMoveToNewOwnerDocument();
if (m_imageLoader)
- m_imageLoader->elementWillMoveToNewOwnerDocument();
+ m_imageLoader->elementDidMoveToNewDocument();
}
bool ImageInputType::shouldRespectAlignAttribute()
Modified: trunk/Source/WebCore/loader/ImageLoader.cpp (103678 => 103679)
--- trunk/Source/WebCore/loader/ImageLoader.cpp 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/loader/ImageLoader.cpp 2011-12-26 07:05:00 UTC (rev 103679)
@@ -349,7 +349,7 @@
loadEventSender().dispatchPendingEvents();
}
-void ImageLoader::elementWillMoveToNewOwnerDocument()
+void ImageLoader::elementDidMoveToNewDocument()
{
setImage(0);
}
Modified: trunk/Source/WebCore/loader/ImageLoader.h (103678 => 103679)
--- trunk/Source/WebCore/loader/ImageLoader.h 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/loader/ImageLoader.h 2011-12-26 07:05:00 UTC (rev 103679)
@@ -46,7 +46,7 @@
// doesn't change; starts new load unconditionally (matches Firefox and Opera behavior).
void updateFromElementIgnoringPreviousError();
- void elementWillMoveToNewOwnerDocument();
+ void elementDidMoveToNewDocument();
Element* element() const { return m_element; }
bool imageComplete() const { return m_imageComplete; }
Modified: trunk/Source/WebCore/svg/SVGImageElement.cpp (103678 => 103679)
--- trunk/Source/WebCore/svg/SVGImageElement.cpp 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/svg/SVGImageElement.cpp 2011-12-26 07:05:00 UTC (rev 103679)
@@ -215,10 +215,10 @@
addSubresourceURL(urls, document()->completeURL(href()));
}
-void SVGImageElement::willMoveToNewOwnerDocument()
+void SVGImageElement::didMoveToNewDocument(Document* oldDocument)
{
- m_imageLoader.elementWillMoveToNewOwnerDocument();
- SVGStyledTransformableElement::willMoveToNewOwnerDocument();
+ m_imageLoader.elementDidMoveToNewDocument();
+ SVGStyledTransformableElement::didMoveToNewDocument(oldDocument);
}
}
Modified: trunk/Source/WebCore/svg/SVGImageElement.h (103678 => 103679)
--- trunk/Source/WebCore/svg/SVGImageElement.h 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/svg/SVGImageElement.h 2011-12-26 07:05:00 UTC (rev 103679)
@@ -63,7 +63,7 @@
virtual bool haveLoadedRequiredResources();
virtual bool selfHasRelativeLengths() const;
- virtual void willMoveToNewOwnerDocument();
+ virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGImageElement)
DECLARE_ANIMATED_LENGTH(X, x)
Modified: trunk/Source/WebCore/svg/SVGSVGElement.cpp (103678 => 103679)
--- trunk/Source/WebCore/svg/SVGSVGElement.cpp 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/svg/SVGSVGElement.cpp 2011-12-26 07:05:00 UTC (rev 103679)
@@ -106,16 +106,15 @@
document()->accessSVGExtensions()->removeTimeContainer(this);
}
-void SVGSVGElement::willMoveToNewOwnerDocument()
+void SVGSVGElement::didMoveToNewDocument(Document* oldDocument)
{
- document()->unregisterForPageCacheSuspensionCallbacks(this);
- SVGStyledLocatableElement::willMoveToNewOwnerDocument();
-}
+ document()->registerForPageCacheSuspensionCallbacks(this);
+ SVGStyledLocatableElement::didMoveToNewDocument(oldDocument);
-void SVGSVGElement::didMoveToNewOwnerDocument()
-{
+ if (oldDocument)
+ oldDocument->unregisterForPageCacheSuspensionCallbacks(this);
document()->registerForPageCacheSuspensionCallbacks(this);
- SVGStyledLocatableElement::didMoveToNewOwnerDocument();
+ SVGStyledLocatableElement::didMoveToNewDocument(oldDocument);
}
const AtomicString& SVGSVGElement::contentScriptType() const
Modified: trunk/Source/WebCore/svg/SVGSVGElement.h (103678 => 103679)
--- trunk/Source/WebCore/svg/SVGSVGElement.h 2011-12-26 06:16:15 UTC (rev 103678)
+++ trunk/Source/WebCore/svg/SVGSVGElement.h 2011-12-26 07:05:00 UTC (rev 103679)
@@ -126,8 +126,7 @@
Element* getElementById(const AtomicString&) const;
protected:
- virtual void willMoveToNewOwnerDocument();
- virtual void didMoveToNewOwnerDocument();
+ virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
private:
SVGSVGElement(const QualifiedName&, Document*);