Changeset 103679 in webkit


Ignore:
Timestamp:
Dec 25, 2011 11:05:00 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

https://bugs.webkit.org/show_bug.cgi?id=74067
Refactoring: Unitfy willMoveToNewDocument() and didMoveToNewDocument()

Patch by Hajime Morrita <morrita@chromium.org> on 2011-12-25
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:
Location:
trunk/Source/WebCore
Files:
30 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r103678 r103679  
     12011-12-25  Hajime Morrita  <morrita@chromium.org>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=74067
     4        Refactoring: Unitfy willMoveToNewDocument() and didMoveToNewDocument()
     5
     6        Reviewed by Darin Adler.
     7
     8        No new tests. No behavior change.
     9
     10        This change combines two method Node::willMoveToNewOwnerDocument() and Node::didMoveToNewOwnerDocument()
     11        into Node::didMoveToNewDocument(Document* oldDocument).
     12
     13        The intention of this change is:
     14        - Making upcoming refactoring (Bug 59816) possible. The refactoring will turn Node::m_document into
     15          Node::m_treeScope, and we will no longer have Node::setDocument() where we can invoke both
     16          willMoveToNewDocument() and didMoveToNewDocument() at once.
     17        - Killing one extra virtual method call.
     18        - Making the concept of "move" clearer by keeping such an operation into the single method.
     19
     20        * dom/Node.cpp:
     21        (WebCore::setWillMoveToNewDocumentWasCalled):
     22        (WebCore::setDidMoveToNewDocumentWasCalled):
     23        (WebCore::Node::setDocument):
     24        (WebCore::Node::didMoveToNewDocument):
     25        * dom/Node.h:
     26        * dom/StyledElement.cpp:
     27        (WebCore::StyledElement::attributeChanged):
     28        * html/FormAssociatedElement.cpp:
     29        (WebCore::FormAssociatedElement::didMoveToNewDocument):
     30        * html/FormAssociatedElement.h:
     31        * html/HTMLFormControlElement.cpp:
     32        (WebCore::HTMLFormControlElement::didMoveToNewDocument):
     33        (WebCore::HTMLFormControlElementWithState::didMoveToNewDocument):
     34        * html/HTMLFormControlElement.h:
     35        * html/HTMLFormElement.cpp:
     36        (WebCore::HTMLFormElement::didMoveToNewDocument):
     37        * html/HTMLFormElement.h:
     38        * html/HTMLImageElement.cpp:
     39        (WebCore::HTMLImageElement::didMoveToNewDocument):
     40        * html/HTMLImageElement.h:
     41        * html/HTMLInputElement.cpp:
     42        (WebCore::HTMLInputElement::didMoveToNewDocument):
     43        * html/HTMLInputElement.h:
     44        * html/HTMLMediaElement.cpp:
     45        (WebCore::HTMLMediaElement::didMoveToNewDocument):
     46        * html/HTMLMediaElement.h:
     47        * html/HTMLObjectElement.cpp:
     48        (WebCore::HTMLObjectElement::didMoveToNewDocument):
     49        * html/HTMLObjectElement.h:
     50        * html/HTMLPlugInImageElement.cpp:
     51        (WebCore::HTMLPlugInImageElement::didMoveToNewDocument):
     52        * html/HTMLPlugInImageElement.h:
     53        * html/HTMLVideoElement.cpp:
     54        (WebCore::HTMLVideoElement::didMoveToNewDocument):
     55        * html/HTMLVideoElement.h:
     56        * html/ImageDocument.cpp:
     57        (WebCore::ImageDocumentElement::didMoveToNewDocument):
     58        * html/ImageInputType.cpp:
     59        (WebCore::ImageInputType::willMoveToNewDocument):
     60        * loader/ImageLoader.cpp:
     61        (WebCore::ImageLoader::elementDidMoveToNewDocument):
     62        * loader/ImageLoader.h:
     63        * svg/SVGImageElement.cpp:
     64        (WebCore::SVGImageElement::didMoveToNewDocument):
     65        * svg/SVGImageElement.h:
     66        * svg/SVGSVGElement.cpp:
     67        (WebCore::SVGSVGElement::didMoveToNewDocument):
     68        * svg/SVGSVGElement.h:
     69
    1702011-12-25  Kentaro Hara  <haraken@chromium.org>
    271
  • trunk/Source/WebCore/dom/Node.cpp

    r103116 r103679  
    420420#ifdef NDEBUG
    421421
    422 static inline void setWillMoveToNewOwnerDocumentWasCalled(bool)
    423 {
    424 }
    425 
    426 static inline void setDidMoveToNewOwnerDocumentWasCalled(bool)
     422static inline void setWillMoveToNewDocumentWasCalled(bool)
     423{
     424}
     425
     426static inline void setDidMoveToNewDocumentWasCalled(bool)
    427427{
    428428}
    429429
    430430#else
    431    
    432 static bool willMoveToNewOwnerDocumentWasCalled;
    433 static bool didMoveToNewOwnerDocumentWasCalled;
    434 
    435 static void setWillMoveToNewOwnerDocumentWasCalled(bool wasCalled)
    436 {
    437     willMoveToNewOwnerDocumentWasCalled = wasCalled;
    438 }
    439 
    440 static void setDidMoveToNewOwnerDocumentWasCalled(bool wasCalled)
    441 {
    442     didMoveToNewOwnerDocumentWasCalled = wasCalled;
     431
     432static bool didMoveToNewDocumentWasCalled;
     433
     434static void setDidMoveToNewDocumentWasCalled(bool wasCalled)
     435{
     436    didMoveToNewDocumentWasCalled = wasCalled;
    443437}
    444438   
     
    452446
    453447    document->guardRef();
    454 
    455     setWillMoveToNewOwnerDocumentWasCalled(false);
    456     willMoveToNewOwnerDocument();
    457     ASSERT(willMoveToNewOwnerDocumentWasCalled);
    458448
    459449    if (m_document) {
     
    462452    }
    463453
     454    Document* oldDocument = m_document;
    464455    m_document = document;
    465456
    466     setDidMoveToNewOwnerDocumentWasCalled(false);
    467     didMoveToNewOwnerDocument();
    468     ASSERT(didMoveToNewOwnerDocumentWasCalled);
     457    setDidMoveToNewDocumentWasCalled(false);
     458    didMoveToNewDocument(oldDocument);
     459    ASSERT(didMoveToNewDocumentWasCalled);
    469460}
    470461
     
    24982489}
    24992490
    2500 void Node::willMoveToNewOwnerDocument()
    2501 {
    2502     ASSERT(!willMoveToNewOwnerDocumentWasCalled);
    2503     setWillMoveToNewOwnerDocumentWasCalled(true);
    2504 }
    2505 
    2506 void Node::didMoveToNewOwnerDocument()
    2507 {
    2508     ASSERT(!didMoveToNewOwnerDocumentWasCalled);
    2509     setDidMoveToNewOwnerDocumentWasCalled(true);
     2491void Node::didMoveToNewDocument(Document* oldDocument)
     2492{
     2493    ASSERT(!didMoveToNewDocumentWasCalled);
     2494    setDidMoveToNewDocumentWasCalled(true);
    25102495
    25112496    // FIXME: Event listener types for this node should be set on the new owner document here.
     
    25232508        }
    25242509    }
     2510#else
     2511    UNUSED_PARAM(oldDocument);
    25252512#endif
    25262513}
  • trunk/Source/WebCore/dom/Node.h

    r103638 r103679  
    679679    Node(Document*, ConstructionType);
    680680
    681     virtual void willMoveToNewOwnerDocument();
    682     virtual void didMoveToNewOwnerDocument();
     681    virtual void didMoveToNewDocument(Document* oldDocument);
    683682   
    684683    virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const { }
  • trunk/Source/WebCore/dom/StyledElement.cpp

    r103664 r103679  
    183183
    184184    // parseMappedAttribute() might create a CSSMappedAttributeDeclaration on the attribute. 
    185     // Normally we would be concerned about reseting the parent of those declarations in StyledElement::didMoveToNewOwnerDocument().
     185    // Normally we would be concerned about reseting the parent of those declarations in StyledElement::didMoveToNewDocument().
    186186    // But currently we always clear its parent and node below when adding it to the decl table. 
    187187    // If that changes for some reason moving between documents will be buggy.
  • trunk/Source/WebCore/html/FormAssociatedElement.cpp

    r91048 r103679  
    5353}
    5454
    55 void FormAssociatedElement::willMoveToNewOwnerDocument()
     55void FormAssociatedElement::didMoveToNewDocument(Document* oldDocument)
    5656{
    5757    HTMLElement* element = toHTMLElement(this);
    58     if (element->fastHasAttribute(formAttr))
    59         element->document()->unregisterFormElementWithFormAttribute(this);
     58    if (oldDocument && element->fastHasAttribute(formAttr))
     59        oldDocument->unregisterFormElementWithFormAttribute(this);
    6060}
    6161
  • trunk/Source/WebCore/html/FormAssociatedElement.h

    r91048 r103679  
    6565    void insertedIntoDocument();
    6666    void removedFromDocument();
    67     void willMoveToNewOwnerDocument();
     67    void didMoveToNewDocument(Document* oldDocument);
    6868
    6969    void setForm(HTMLFormElement* form) { m_form = form; }
  • trunk/Source/WebCore/html/HTMLFormControlElement.cpp

    r103494 r103679  
    197197}
    198198
    199 void HTMLFormControlElement::willMoveToNewOwnerDocument()
    200 {
    201     FormAssociatedElement::willMoveToNewOwnerDocument();
    202     HTMLElement::willMoveToNewOwnerDocument();
     199void HTMLFormControlElement::didMoveToNewDocument(Document* oldDocument)
     200{
     201    FormAssociatedElement::didMoveToNewDocument(oldDocument);
     202    HTMLElement::didMoveToNewDocument(oldDocument);
    203203}
    204204
     
    512512}
    513513
    514 void HTMLFormControlElementWithState::willMoveToNewOwnerDocument()
    515 {
    516     document()->unregisterFormElementWithState(this);
    517     HTMLFormControlElement::willMoveToNewOwnerDocument();
    518 }
    519 
    520 void HTMLFormControlElementWithState::didMoveToNewOwnerDocument()
    521 {
     514void HTMLFormControlElementWithState::didMoveToNewDocument(Document* oldDocument)
     515{
     516    if (oldDocument)
     517        oldDocument->unregisterFormElementWithState(this);
    522518    document()->registerFormElementWithState(this);
    523     HTMLFormControlElement::didMoveToNewOwnerDocument();
     519    HTMLFormControlElement::didMoveToNewDocument(oldDocument);
    524520}
    525521
  • trunk/Source/WebCore/html/HTMLFormControlElement.h

    r103491 r103679  
    121121    virtual void insertedIntoDocument();
    122122    virtual void removedFromDocument();
    123     virtual void willMoveToNewOwnerDocument();
     123    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
    124124
    125125    virtual bool supportsFocus() const;
     
    186186    virtual bool shouldAutocomplete() const;
    187187    virtual void finishParsingChildren();
    188     virtual void willMoveToNewOwnerDocument();
    189     virtual void didMoveToNewOwnerDocument();
     188    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
    190189};
    191190
  • trunk/Source/WebCore/html/HTMLFormElement.cpp

    r103638 r103679  
    633633}
    634634
    635 void HTMLFormElement::willMoveToNewOwnerDocument()
    636 {
    637     if (!shouldAutocomplete())
    638         document()->unregisterForPageCacheSuspensionCallbacks(this);
    639     HTMLElement::willMoveToNewOwnerDocument();
    640 }
    641 
    642 void HTMLFormElement::didMoveToNewOwnerDocument()
    643 {
    644     if (!shouldAutocomplete())
     635void HTMLFormElement::didMoveToNewDocument(Document* oldDocument)
     636{
     637    if (!shouldAutocomplete()) {
     638        if (oldDocument)
     639            oldDocument->unregisterForPageCacheSuspensionCallbacks(this);
    645640        document()->registerForPageCacheSuspensionCallbacks(this);
    646     HTMLElement::didMoveToNewOwnerDocument();
     641    }
     642
     643    HTMLElement::didMoveToNewDocument(oldDocument);
    647644}
    648645
  • trunk/Source/WebCore/html/HTMLFormElement.h

    r103638 r103679  
    129129    virtual void documentDidResumeFromPageCache();
    130130
    131     virtual void willMoveToNewOwnerDocument();
    132     virtual void didMoveToNewOwnerDocument();
     131    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
    133132
    134133    virtual bool shouldRegisterAsNamedItem() const OVERRIDE { return true; }
  • trunk/Source/WebCore/html/HTMLImageElement.cpp

    r103638 r103679  
    350350}
    351351
    352 void HTMLImageElement::willMoveToNewOwnerDocument()
    353 {
    354     m_imageLoader.elementWillMoveToNewOwnerDocument();
    355     HTMLElement::willMoveToNewOwnerDocument();
     352void HTMLImageElement::didMoveToNewDocument(Document* oldDocument)
     353{
     354    m_imageLoader.elementDidMoveToNewDocument();
     355    HTMLElement::didMoveToNewDocument(oldDocument);
    356356}
    357357
  • trunk/Source/WebCore/html/HTMLImageElement.h

    r103638 r103679  
    8181    HTMLImageElement(const QualifiedName&, Document*, HTMLFormElement* = 0);
    8282
    83     virtual void willMoveToNewOwnerDocument();
     83    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
    8484
    8585private:
  • trunk/Source/WebCore/html/HTMLInputElement.cpp

    r103491 r103679  
    15031503}
    15041504
    1505 void HTMLInputElement::willMoveToNewOwnerDocument()
     1505void HTMLInputElement::didMoveToNewDocument(Document* oldDocument)
    15061506{
    15071507    m_inputType->willMoveToNewOwnerDocument();
    1508 
    1509     // Always unregister for cache callbacks when leaving a document, even if we would otherwise like to be registered
    1510     if (needsSuspensionCallback())
    1511         document()->unregisterForPageCacheSuspensionCallbacks(this);
    1512 
    1513     document()->checkedRadioButtons().removeButton(this);
    1514 
    1515     HTMLTextFormControlElement::willMoveToNewOwnerDocument();
    1516 }
    1517 
    1518 void HTMLInputElement::didMoveToNewOwnerDocument()
    1519 {
    1520     registerForSuspensionCallbackIfNeeded();
    1521 
    1522     HTMLTextFormControlElement::didMoveToNewOwnerDocument();
     1508    bool needsSuspensionCallback = this->needsSuspensionCallback();
     1509    if (oldDocument) {
     1510        // Always unregister for cache callbacks when leaving a document, even if we would otherwise like to be registered
     1511        if (needsSuspensionCallback)
     1512            oldDocument->unregisterForPageCacheSuspensionCallbacks(this);
     1513        oldDocument->checkedRadioButtons().removeButton(this);
     1514    }
     1515
     1516    if (needsSuspensionCallback)
     1517        document()->registerForPageCacheSuspensionCallbacks(this);
     1518
     1519    HTMLTextFormControlElement::didMoveToNewDocument(oldDocument);
    15231520}
    15241521
  • trunk/Source/WebCore/html/HTMLInputElement.h

    r103130 r103679  
    250250    enum AnyStepHandling { RejectAny, AnyIsDefaultStep };
    251251
    252     virtual void willMoveToNewOwnerDocument();
    253     virtual void didMoveToNewOwnerDocument();
     252    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
    254253
    255254    virtual bool isKeyboardFocusable(KeyboardEvent*) const;
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r103428 r103679  
    278278}
    279279
    280 void HTMLMediaElement::willMoveToNewOwnerDocument()
    281 {
    282     if (m_isWaitingUntilMediaCanStart)
    283         document()->removeMediaCanStartListener(this);
    284     setShouldDelayLoadEvent(false);
    285     document()->unregisterForMediaVolumeCallbacks(this);
    286     removeElementFromDocumentMap(this, document());
    287     HTMLElement::willMoveToNewOwnerDocument();
    288 }
    289 
    290 void HTMLMediaElement::didMoveToNewOwnerDocument()
    291 {
    292     if (m_isWaitingUntilMediaCanStart)
     280void HTMLMediaElement::didMoveToNewDocument(Document* oldDocument)
     281{
     282    if (m_isWaitingUntilMediaCanStart) {
     283        if (oldDocument)
     284            oldDocument->removeMediaCanStartListener(this);
    293285        document()->addMediaCanStartListener(this);
    294     if (m_readyState < HAVE_CURRENT_DATA)
    295         setShouldDelayLoadEvent(true);
     286    }
     287
     288    if (m_shouldDelayLoadEvent) {
     289        if (oldDocument)
     290            oldDocument->decrementLoadEventDelayCount();
     291        document()->incrementLoadEventDelayCount();
     292    }
     293
     294    if (oldDocument) {
     295        oldDocument->unregisterForMediaVolumeCallbacks(this);
     296        removeElementFromDocumentMap(this, oldDocument);
     297    }
     298
    296299    document()->registerForMediaVolumeCallbacks(this);
    297300    addElementToDocumentMap(this, document());
    298     HTMLElement::didMoveToNewOwnerDocument();
     301
     302    HTMLElement::didMoveToNewDocument(oldDocument);
    299303}
    300304
  • trunk/Source/WebCore/html/HTMLMediaElement.h

    r103242 r103679  
    283283    virtual void attach();
    284284
    285     virtual void willMoveToNewOwnerDocument();
    286     virtual void didMoveToNewOwnerDocument();
     285    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
    287286
    288287    enum DisplayMode { Unknown, None, Poster, PosterWaitingForVideo, Video };
     
    435434
    436435    void setShouldDelayLoadEvent(bool);
    437 
    438436    void invalidateCachedTime();
    439437    void refreshCachedTime() const;
  • trunk/Source/WebCore/html/HTMLObjectElement.cpp

    r103638 r103679  
    477477}
    478478
    479 void HTMLObjectElement::willMoveToNewOwnerDocument()
    480 {
    481     FormAssociatedElement::willMoveToNewOwnerDocument();
    482     HTMLPlugInImageElement::willMoveToNewOwnerDocument();
     479void HTMLObjectElement::didMoveToNewDocument(Document* oldDocument)
     480{
     481    FormAssociatedElement::didMoveToNewDocument(oldDocument);
     482    HTMLPlugInImageElement::didMoveToNewDocument(oldDocument);
    483483}
    484484
  • trunk/Source/WebCore/html/HTMLObjectElement.h

    r103638 r103679  
    7474    virtual void insertedIntoDocument();
    7575    virtual void removedFromDocument();
    76     virtual void willMoveToNewOwnerDocument();
    77    
     76    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
     77
    7878    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
    7979
  • trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp

    r103130 r103679  
    203203}
    204204
    205 void HTMLPlugInImageElement::willMoveToNewOwnerDocument()
    206 {
    207     if (m_needsDocumentActivationCallbacks)
    208         document()->unregisterForPageCacheSuspensionCallbacks(this);
     205void HTMLPlugInImageElement::didMoveToNewDocument(Document* oldDocument)
     206{
     207    if (m_needsDocumentActivationCallbacks) {
     208        if (oldDocument)
     209            oldDocument->unregisterForPageCacheSuspensionCallbacks(this);
     210        document()->registerForPageCacheSuspensionCallbacks(this);
     211    }
    209212
    210213    if (m_imageLoader)
    211         m_imageLoader->elementWillMoveToNewOwnerDocument();
    212 
    213     HTMLPlugInElement::willMoveToNewOwnerDocument();
    214 }
    215 
    216 void HTMLPlugInImageElement::didMoveToNewOwnerDocument()
    217 {
    218     if (m_needsDocumentActivationCallbacks)
    219         document()->registerForPageCacheSuspensionCallbacks(this);   
    220    
    221     HTMLPlugInElement::didMoveToNewOwnerDocument();
     214        m_imageLoader->elementDidMoveToNewDocument();
     215    HTMLPlugInElement::didMoveToNewDocument(oldDocument);
    222216}
    223217
  • trunk/Source/WebCore/html/HTMLPlugInImageElement.h

    r103130 r103679  
    7575    bool wouldLoadAsNetscapePlugin(const String& url, const String& serviceType);
    7676
    77     virtual void willMoveToNewOwnerDocument() OVERRIDE;
    78     virtual void didMoveToNewOwnerDocument() OVERRIDE;
     77    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
    7978   
    8079    virtual void documentWillSuspendForPageCache() OVERRIDE;
  • trunk/Source/WebCore/html/HTMLVideoElement.cpp

    r102968 r103679  
    272272}
    273273
    274 void HTMLVideoElement::willMoveToNewOwnerDocument()
     274void HTMLVideoElement::didMoveToNewDocument(Document* oldDocument)
    275275{
    276276    if (m_imageLoader)
    277         m_imageLoader->elementWillMoveToNewOwnerDocument();
    278     HTMLMediaElement::willMoveToNewOwnerDocument();
     277        m_imageLoader->elementDidMoveToNewDocument();
     278    HTMLMediaElement::didMoveToNewDocument(oldDocument);
    279279}
    280280
  • trunk/Source/WebCore/html/HTMLVideoElement.h

    r102968 r103679  
    8585    virtual bool hasAvailableVideoFrame() const;
    8686    virtual void updateDisplayState();
    87 
    88     virtual void willMoveToNewOwnerDocument();
    89 
     87    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
    9088    virtual void setDisplayMode(DisplayMode);
    9189
  • trunk/Source/WebCore/html/ImageDocument.cpp

    r102262 r103679  
    107107
    108108    virtual ~ImageDocumentElement();
    109     virtual void willMoveToNewOwnerDocument();
     109    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
    110110
    111111    ImageDocument* m_imageDocument;
     
    408408}
    409409
    410 void ImageDocumentElement::willMoveToNewOwnerDocument()
     410void ImageDocumentElement::didMoveToNewDocument(Document* oldDocument)
    411411{
    412412    if (m_imageDocument) {
     
    414414        m_imageDocument = 0;
    415415    }
    416     HTMLImageElement::willMoveToNewOwnerDocument();
    417 }
    418 
    419 }
     416    HTMLImageElement::didMoveToNewDocument(oldDocument);
     417}
     418
     419}
  • trunk/Source/WebCore/html/ImageInputType.cpp

    r95901 r103679  
    147147    BaseButtonInputType::willMoveToNewOwnerDocument();
    148148    if (m_imageLoader)
    149         m_imageLoader->elementWillMoveToNewOwnerDocument();
     149        m_imageLoader->elementDidMoveToNewDocument();
    150150}
    151151
  • trunk/Source/WebCore/loader/ImageLoader.cpp

    r101753 r103679  
    350350}
    351351
    352 void ImageLoader::elementWillMoveToNewOwnerDocument()
     352void ImageLoader::elementDidMoveToNewDocument()
    353353{
    354354    setImage(0);
  • trunk/Source/WebCore/loader/ImageLoader.h

    r97113 r103679  
    4747    void updateFromElementIgnoringPreviousError();
    4848
    49     void elementWillMoveToNewOwnerDocument();
     49    void elementDidMoveToNewDocument();
    5050
    5151    Element* element() const { return m_element; }
  • trunk/Source/WebCore/svg/SVGImageElement.cpp

    r96307 r103679  
    216216}
    217217
    218 void SVGImageElement::willMoveToNewOwnerDocument()
    219 {
    220     m_imageLoader.elementWillMoveToNewOwnerDocument();
    221     SVGStyledTransformableElement::willMoveToNewOwnerDocument();
     218void SVGImageElement::didMoveToNewDocument(Document* oldDocument)
     219{
     220    m_imageLoader.elementDidMoveToNewDocument();
     221    SVGStyledTransformableElement::didMoveToNewDocument(oldDocument);
    222222}
    223223
  • trunk/Source/WebCore/svg/SVGImageElement.h

    r90680 r103679  
    6464
    6565    virtual bool selfHasRelativeLengths() const;
    66     virtual void willMoveToNewOwnerDocument();
     66    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
    6767
    6868    BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGImageElement)
  • trunk/Source/WebCore/svg/SVGSVGElement.cpp

    r103130 r103679  
    107107}
    108108
    109 void SVGSVGElement::willMoveToNewOwnerDocument()
    110 {
    111     document()->unregisterForPageCacheSuspensionCallbacks(this);
    112     SVGStyledLocatableElement::willMoveToNewOwnerDocument();
    113 }
    114 
    115 void SVGSVGElement::didMoveToNewOwnerDocument()
     109void SVGSVGElement::didMoveToNewDocument(Document* oldDocument)
    116110{
    117111    document()->registerForPageCacheSuspensionCallbacks(this);
    118     SVGStyledLocatableElement::didMoveToNewOwnerDocument();
     112    SVGStyledLocatableElement::didMoveToNewDocument(oldDocument);
     113
     114    if (oldDocument)
     115        oldDocument->unregisterForPageCacheSuspensionCallbacks(this);
     116    document()->registerForPageCacheSuspensionCallbacks(this);
     117    SVGStyledLocatableElement::didMoveToNewDocument(oldDocument);
    119118}
    120119
  • trunk/Source/WebCore/svg/SVGSVGElement.h

    r103130 r103679  
    127127
    128128protected:
    129     virtual void willMoveToNewOwnerDocument();
    130     virtual void didMoveToNewOwnerDocument();
     129    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
    131130
    132131private:
Note: See TracChangeset for help on using the changeset viewer.