Source/WebCore/ChangeLog

 12011-12-08 Hajime Morrita <morrita@chromium.org>
 2
 3 https://bugs.webkit.org/show_bug.cgi?id=74067
 4 Refactoring: Unitfy willMoveToNewOwnerDocument() and didMoveToNewOwnerDocument()
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 No new tests. No behavior change.
 9
 10 This change combines two method Node::willMoveToNewOwnerDocument() and Node::didMoveToNewOwnerDocument()
 11 into Node::didMoveToNewOwnerDocument(const NodeOwnerChange&).
 12 Note that newly introduced NodeOwnerChange object holds both old and new owner documents.
 13
 14 The intention of this change is:
 15 - Making upcoming refactoring (Bug 59816) possible. The refactoring will turn Node::m_document into
 16 Node::m_treeScope, and we will no longer have Node::setDocument() where we can invoke both
 17 willMoveToNewOwnerDocument() and didMoveToNewOwnerDocument() at once.
 18 - Killing one extra virtual method call.
 19 - Making the concept of "ownership move" clearer by keeping such an operation into the single method.
 20
 21 * dom/Node.cpp:
 22 (WebCore::Node::setDocument): Unified the call.
 23 (WebCore::Node::didMoveToNewOwnerDocument):
 24 * dom/Node.h:
 25 (WebCore::NodeOwnerChange::NodeOwnerChange): Added.
 26 (WebCore::NodeOwnerChange::oldDocument):
 27 (WebCore::NodeOwnerChange::newDocument):
 28 * html/FormAssociatedElement.cpp:
 29 (WebCore::FormAssociatedElement::didMoveToNewOwnerDocument):
 30 * html/FormAssociatedElement.h:
 31 * html/HTMLFormControlElement.cpp:
 32 (WebCore::HTMLFormControlElement::didMoveToNewOwnerDocument):
 33 (WebCore::HTMLFormControlElementWithState::didMoveToNewOwnerDocument):
 34 * html/HTMLFormControlElement.h:
 35 * html/HTMLFormElement.cpp:
 36 (WebCore::HTMLFormElement::didMoveToNewOwnerDocument):
 37 * html/HTMLFormElement.h:
 38 * html/HTMLImageElement.cpp:
 39 (WebCore::HTMLImageElement::didMoveToNewOwnerDocument):
 40 * html/HTMLImageElement.h:
 41 * html/HTMLInputElement.cpp:
 42 (WebCore::HTMLInputElement::didMoveToNewOwnerDocument):
 43 * html/HTMLInputElement.h:
 44 * html/HTMLMediaElement.cpp:
 45 (WebCore::HTMLMediaElement::didMoveToNewOwnerDocument):
 46 (WebCore::HTMLMediaElement::setShouldDelayLoadEvent):
 47 - Pass Document as a parameter instead of accessing it by the document() getter.
 48 * html/HTMLMediaElement.h:
 49 * html/HTMLObjectElement.cpp:
 50 (WebCore::HTMLObjectElement::didMoveToNewOwnerDocument):
 51 * html/HTMLObjectElement.h:
 52 * html/HTMLPlugInImageElement.cpp:
 53 (WebCore::HTMLPlugInImageElement::didMoveToNewOwnerDocument):
 54 * html/HTMLPlugInImageElement.h:
 55 * html/HTMLVideoElement.cpp:
 56 (WebCore::HTMLVideoElement::didMoveToNewOwnerDocument):
 57 * html/HTMLVideoElement.h:
 58 * html/ImageDocument.cpp:
 59 (WebCore::ImageDocumentElement::didMoveToNewOwnerDocument):
 60 * html/ImageInputType.cpp:
 61 (WebCore::ImageInputType::willMoveToNewOwnerDocument):
 62 * loader/ImageLoader.cpp:
 63 (WebCore::ImageLoader::elementDidMoveToNewOwnerDocument):
 64 - Renamed from elementWillMoveToNewOwnerDocument
 65 * loader/ImageLoader.h:
 66 * svg/SVGImageElement.cpp:
 67 (WebCore::SVGImageElement::didMoveToNewOwnerDocument):
 68 * svg/SVGImageElement.h:
 69 * svg/SVGSVGElement.cpp:
 70 (WebCore::SVGSVGElement::didMoveToNewOwnerDocument):
 71 * svg/SVGSVGElement.h:
 72
1732011-12-21 Darin Adler <darin@apple.com>
274
375 Make ~CSSParserSelector use Vector<OwnPtr>

Source/WebCore/dom/Node.cpp

@@static inline void setDidMoveToNewOwnerDocumentWasCalled(bool)
428428}
429429
430430#else
431 
432 static bool willMoveToNewOwnerDocumentWasCalled;
433 static bool didMoveToNewOwnerDocumentWasCalled;
434431
435 static void setWillMoveToNewOwnerDocumentWasCalled(bool wasCalled)
436 {
437  willMoveToNewOwnerDocumentWasCalled = wasCalled;
438 }
 432static bool didMoveToNewOwnerDocumentWasCalled;
439433
440434static void setDidMoveToNewOwnerDocumentWasCalled(bool wasCalled)
441435{

@@void Node::setDocument(Document* document)
452446
453447 document->guardRef();
454448
455  setWillMoveToNewOwnerDocumentWasCalled(false);
456  willMoveToNewOwnerDocument();
457  ASSERT(willMoveToNewOwnerDocumentWasCalled);
458 
459449 if (m_document) {
460450 m_document->moveNodeIteratorsToNewDocument(this, document);
461451 m_document->guardDeref();
462452 }
463453
 454 Document* oldDocument = m_document;
464455 m_document = document;
465456
466457 setDidMoveToNewOwnerDocumentWasCalled(false);
467  didMoveToNewOwnerDocument();
 458 didMoveToNewOwnerDocument(NodeOwnerChange(oldDocument, document));
468459 ASSERT(didMoveToNewOwnerDocumentWasCalled);
469460}
470461

@@void Node::removedFromDocument()
24972488 clearInDocument();
24982489}
24992490
2500 void Node::willMoveToNewOwnerDocument()
2501 {
2502  ASSERT(!willMoveToNewOwnerDocumentWasCalled);
2503  setWillMoveToNewOwnerDocumentWasCalled(true);
2504 }
2505 
2506 void Node::didMoveToNewOwnerDocument()
 2491void Node::didMoveToNewOwnerDocument(const NodeOwnerChange& change)
25072492{
25082493 ASSERT(!didMoveToNewOwnerDocumentWasCalled);
25092494 setDidMoveToNewOwnerDocumentWasCalled(true);

@@void Node::didMoveToNewOwnerDocument()
25122497
25132498#if ENABLE(MUTATION_OBSERVERS)
25142499 if (Vector<OwnPtr<MutationObserverRegistration> >* registry = mutationObserverRegistry()) {
2515  for (size_t i = 0; i < registry->size(); ++i) {
2516  document()->addMutationObserverTypes(registry->at(i)->mutationTypes());
2517  }
 2500 for (size_t i = 0; i < registry->size(); ++i)
 2501 change.newDocument()->addMutationObserverTypes(registry->at(i)->mutationTypes());
25182502 }
25192503
25202504 if (HashSet<MutationObserverRegistration*>* transientRegistry = transientMutationObserverRegistry()) {
2521  for (HashSet<MutationObserverRegistration*>::iterator iter = transientRegistry->begin(); iter != transientRegistry->end(); ++iter) {
2522  document()->addMutationObserverTypes((*iter)->mutationTypes());
2523  }
 2505 for (HashSet<MutationObserverRegistration*>::iterator iter = transientRegistry->begin(); iter != transientRegistry->end(); ++iter)
 2506 change.newDocument()->addMutationObserverTypes((*iter)->mutationTypes());
25242507 }
 2508#else
 2509 UNUSED_PARAM(change)
25252510#endif
 2511
25262512}
25272513
25282514#if ENABLE(SVG)

Source/WebCore/dom/Node.h

@@enum StyleChangeType {
101101 SyntheticStyleChange = 3 << nodeStyleChangeShift
102102};
103103
 104class NodeOwnerChange {
 105public:
 106 NodeOwnerChange(Document* oldDocument, Document* newDocument)
 107 : m_oldDocument(oldDocument)
 108 , m_newDocument(newDocument)
 109 {
 110 }
 111
 112 Document* oldDocument() const { return m_oldDocument; }
 113 Document* newDocument() const { return m_newDocument; }
 114
 115private:
 116 Document* m_oldDocument;
 117 Document* m_newDocument;
 118};
 119
104120class Node : public EventTarget, public ScriptWrappable, public TreeShared<ContainerNode> {
105121 friend class Document;
106122 friend class TreeScope;

@@protected:
674690 };
675691 Node(Document*, ConstructionType);
676692
677  virtual void willMoveToNewOwnerDocument();
678  virtual void didMoveToNewOwnerDocument();
 693 virtual void didMoveToNewOwnerDocument(const NodeOwnerChange&);
679694
680695 virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const { }
681696 void setTabIndexExplicitly(short);

Source/WebCore/html/FormAssociatedElement.cpp

@@ValidityState* FormAssociatedElement::validity()
5252 return m_validityState.get();
5353}
5454
55 void FormAssociatedElement::willMoveToNewOwnerDocument()
 55void FormAssociatedElement::didMoveToNewOwnerDocument(const NodeOwnerChange& change)
5656{
5757 HTMLElement* element = toHTMLElement(this);
5858 if (element->fastHasAttribute(formAttr))
59  element->document()->unregisterFormElementWithFormAttribute(this);
 59 change.oldDocument()->unregisterFormElementWithFormAttribute(this);
6060}
6161
6262void FormAssociatedElement::insertedIntoDocument()

Source/WebCore/html/FormAssociatedElement.h

@@protected:
6464 void removedFromTree();
6565 void insertedIntoDocument();
6666 void removedFromDocument();
67  void willMoveToNewOwnerDocument();
 67 void didMoveToNewOwnerDocument(const NodeOwnerChange&);
6868
6969 void setForm(HTMLFormElement* form) { m_form = form; }
7070 void removeFromForm();

Source/WebCore/html/HTMLFormControlElement.cpp

@@void HTMLFormControlElement::attach()
196196 resumePostAttachCallbacks();
197197}
198198
199 void HTMLFormControlElement::willMoveToNewOwnerDocument()
 199void HTMLFormControlElement::didMoveToNewOwnerDocument(const NodeOwnerChange& change)
200200{
201  FormAssociatedElement::willMoveToNewOwnerDocument();
202  HTMLElement::willMoveToNewOwnerDocument();
 201 FormAssociatedElement::didMoveToNewOwnerDocument(change);
 202 HTMLElement::didMoveToNewOwnerDocument(change);
203203}
204204
205205void HTMLFormControlElement::insertedIntoTree(bool deep)

@@HTMLFormControlElementWithState::~HTMLFormControlElementWithState()
511511 document()->unregisterFormElementWithState(this);
512512}
513513
514 void HTMLFormControlElementWithState::willMoveToNewOwnerDocument()
 514void HTMLFormControlElementWithState::didMoveToNewOwnerDocument(const NodeOwnerChange& change)
515515{
516  document()->unregisterFormElementWithState(this);
517  HTMLFormControlElement::willMoveToNewOwnerDocument();
518 }
519 
520 void HTMLFormControlElementWithState::didMoveToNewOwnerDocument()
521 {
522  document()->registerFormElementWithState(this);
523  HTMLFormControlElement::didMoveToNewOwnerDocument();
 516 if (change.oldDocument())
 517 change.oldDocument()->unregisterFormElementWithState(this);
 518 change.newDocument()->registerFormElementWithState(this);
 519 HTMLFormControlElement::didMoveToNewOwnerDocument(change);
524520}
525521
526522bool HTMLFormControlElementWithState::shouldAutocomplete() const

Source/WebCore/html/HTMLFormControlElement.h

@@protected:
120120 virtual void removedFromTree(bool deep);
121121 virtual void insertedIntoDocument();
122122 virtual void removedFromDocument();
123  virtual void willMoveToNewOwnerDocument();
 123 virtual void didMoveToNewOwnerDocument(const NodeOwnerChange&);
124124
125125 virtual bool supportsFocus() const;
126126 virtual bool isKeyboardFocusable(KeyboardEvent*) const;

@@protected:
185185
186186 virtual bool shouldAutocomplete() const;
187187 virtual void finishParsingChildren();
188  virtual void willMoveToNewOwnerDocument();
189  virtual void didMoveToNewOwnerDocument();
 188 virtual void didMoveToNewOwnerDocument(const NodeOwnerChange&);
190189};
191190
192191} // namespace

Source/WebCore/html/HTMLFormElement.cpp

@@void HTMLFormElement::documentDidResumeFromPageCache()
646646 }
647647}
648648
649 void HTMLFormElement::willMoveToNewOwnerDocument()
 649void HTMLFormElement::didMoveToNewOwnerDocument(const NodeOwnerChange& change)
650650{
651  if (!shouldAutocomplete())
652  document()->unregisterForPageCacheSuspensionCallbacks(this);
653  HTMLElement::willMoveToNewOwnerDocument();
654 }
 651 if (!shouldAutocomplete()) {
 652 if (change.oldDocument())
 653 change.oldDocument()->unregisterForPageCacheSuspensionCallbacks(this);
 654 change.newDocument()->registerForPageCacheSuspensionCallbacks(this)
 655 }
655656
656 void HTMLFormElement::didMoveToNewOwnerDocument()
657 {
658  if (!shouldAutocomplete())
659  document()->registerForPageCacheSuspensionCallbacks(this);
660  HTMLElement::didMoveToNewOwnerDocument();
 657 HTMLElement::didMoveToNewOwnerDocument(change);
661658}
662659
663660bool HTMLFormElement::shouldAutocomplete() const

Source/WebCore/html/HTMLFormElement.h

@@private:
128128
129129 virtual void documentDidResumeFromPageCache();
130130
131  virtual void willMoveToNewOwnerDocument();
132  virtual void didMoveToNewOwnerDocument();
 131 virtual void didMoveToNewOwnerDocument(const NodeOwnerChange&);
133132
134133 void submit(Event*, bool activateSubmitButton, bool processingUserGesture, FormSubmissionTrigger);
135134

Source/WebCore/html/HTMLImageElement.cpp

@@void HTMLImageElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) cons
384384 addSubresourceURL(urls, document()->completeURL(getAttribute(usemapAttr)));
385385}
386386
387 void HTMLImageElement::willMoveToNewOwnerDocument()
 387void HTMLImageElement::didMoveToNewOwnerDocument(const NodeOwnerChange& change)
388388{
389  m_imageLoader.elementWillMoveToNewOwnerDocument();
390  HTMLElement::willMoveToNewOwnerDocument();
 389 m_imageLoader.elementDidMoveToNewOwnerDocument();
 390 HTMLElement::didMoveToNewOwnerDocument(change);
391391}
392392
393393bool HTMLImageElement::isServerMap() const

Source/WebCore/html/HTMLImageElement.h

@@public:
8080protected:
8181 HTMLImageElement(const QualifiedName&, Document*, HTMLFormElement* = 0);
8282
83  virtual void willMoveToNewOwnerDocument();
 83 virtual void didMoveToNewOwnerDocument(const NodeOwnerChange&);
8484
8585private:
8686 virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;

Source/WebCore/html/HTMLInputElement.cpp

@@void HTMLInputElement::documentDidResumeFromPageCache()
15021502 reset();
15031503}
15041504
1505 void HTMLInputElement::willMoveToNewOwnerDocument()
 1505void HTMLInputElement::didMoveToNewOwnerDocument(const NodeOwnerChange& change)
15061506{
15071507 m_inputType->willMoveToNewOwnerDocument();
 1508 if (Document* oldDocument = change.oldDocument()) {
 1509 // Always unregister for cache callbacks when leaving a document, even if we would otherwise like to be registered
 1510 if (needsSuspensionCallback())
 1511 oldDocument->unregisterForPageCacheSuspensionCallbacks(this);
 1512 oldDocument->checkedRadioButtons().removeButton(this);
 1513 }
15081514
1509  // Always unregister for cache callbacks when leaving a document, even if we would otherwise like to be registered
15101515 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();
 1516 change.newDocument()->registerForPageCacheSuspensionCallbacks(this);
15211517
1522  HTMLTextFormControlElement::didMoveToNewOwnerDocument();
 1518 HTMLTextFormControlElement::didMoveToNewOwnerDocument(change);
15231519}
15241520
15251521void HTMLInputElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const

Source/WebCore/html/HTMLInputElement.h

@@private:
249249 enum AutoCompleteSetting { Uninitialized, On, Off };
250250 enum AnyStepHandling { RejectAny, AnyIsDefaultStep };
251251
252  virtual void willMoveToNewOwnerDocument();
253  virtual void didMoveToNewOwnerDocument();
 252 virtual void didMoveToNewOwnerDocument(const NodeOwnerChange&);
254253
255254 virtual bool isKeyboardFocusable(KeyboardEvent*) const;
256255 virtual bool isMouseFocusable() const;

Source/WebCore/html/HTMLMediaElement.cpp

@@HTMLMediaElement::~HTMLMediaElement()
277277 removeElementFromDocumentMap(this, document());
278278}
279279
280 void HTMLMediaElement::willMoveToNewOwnerDocument()
 280void HTMLMediaElement::didMoveToNewOwnerDocument(const NodeOwnerChange& change)
281281{
282  if (m_isWaitingUntilMediaCanStart)
283  document()->removeMediaCanStartListener(this);
284  setShouldDelayLoadEvent(false);
285  document()->unregisterForMediaVolumeCallbacks(this);
286  removeElementFromDocumentMap(this, document());
287  HTMLElement::willMoveToNewOwnerDocument();
288 }
 282 if (Document* oldDocument = change.oldDocument()) {
 283 if (m_isWaitingUntilMediaCanStart)
 284 oldDocument->removeMediaCanStartListener(this);
 285 setShouldDelayLoadEvent(false);
 286 oldDocument->unregisterForMediaVolumeCallbacks(this);
 287 removeElementFromDocumentMap(this, oldDocument);
 288 }
289289
290 void HTMLMediaElement::didMoveToNewOwnerDocument()
291 {
292290 if (m_isWaitingUntilMediaCanStart)
293  document()->addMediaCanStartListener(this);
 291 change.newDocument()->addMediaCanStartListener(this);
294292 if (m_readyState < HAVE_CURRENT_DATA)
295  setShouldDelayLoadEvent(true);
296  document()->registerForMediaVolumeCallbacks(this);
297  addElementToDocumentMap(this, document());
298  HTMLElement::didMoveToNewOwnerDocument();
 293 setShouldDelayLoadEvent(change.newDocument(), true);
 294 change.newDocument()->registerForMediaVolumeCallbacks(this);
 295 addElementToDocumentMap(this, change.newDocument());
 296 HTMLElement::didMoveToNewOwnerDocument(change);
299297}
300298
301299bool HTMLMediaElement::supportsFocus() const

@@bool HTMLMediaElement::isURLAttribute(Attribute* attribute) const
33973395
33983396void HTMLMediaElement::setShouldDelayLoadEvent(bool shouldDelay)
33993397{
 3398 setShouldDelayLoadEvent(document(), shouldDelay);
 3399}
 3400
 3401void HTMLMediaElement::setShouldDelayLoadEvent(Document* doc, bool shouldDelay)
 3402{
34003403 if (m_shouldDelayLoadEvent == shouldDelay)
34013404 return;
34023405

@@void HTMLMediaElement::setShouldDelayLoadEvent(bool shouldDelay)
34043407
34053408 m_shouldDelayLoadEvent = shouldDelay;
34063409 if (shouldDelay)
3407  document()->incrementLoadEventDelayCount();
 3410 doc->incrementLoadEventDelayCount();
34083411 else
3409  document()->decrementLoadEventDelayCount();
 3412 doc->decrementLoadEventDelayCount();
34103413}
34113414
34123415

Source/WebCore/html/HTMLMediaElement.h

@@protected:
282282 virtual bool isURLAttribute(Attribute*) const;
283283 virtual void attach();
284284
285  virtual void willMoveToNewOwnerDocument();
286  virtual void didMoveToNewOwnerDocument();
 285 virtual void didMoveToNewOwnerDocument(const NodeOwnerChange&);
287286
288287 enum DisplayMode { Unknown, None, Poster, PosterWaitingForVideo, Video };
289288 DisplayMode displayMode() const { return m_displayMode; }

@@private:
434433 virtual void mediaCanStart();
435434
436435 void setShouldDelayLoadEvent(bool);
437 
 436 void setShouldDelayLoadEvent(Document*, bool);
438437 void invalidateCachedTime();
439438 void refreshCachedTime() const;
440439

Source/WebCore/html/HTMLObjectElement.cpp

@@void HTMLObjectElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) con
509509 addSubresourceURL(urls, document()->completeURL(useMap));
510510}
511511
512 void HTMLObjectElement::willMoveToNewOwnerDocument()
 512void HTMLObjectElement::didMoveToNewOwnerDocument(const NodeOwnerChange& change)
513513{
514  FormAssociatedElement::willMoveToNewOwnerDocument();
515  HTMLPlugInImageElement::willMoveToNewOwnerDocument();
 514 FormAssociatedElement::didMoveToNewOwnerDocument(change);
 515 HTMLPlugInImageElement::didMoveToNewOwnerDocument(change);
516516}
517517
518518void HTMLObjectElement::insertedIntoTree(bool deep)

Source/WebCore/html/HTMLObjectElement.h

@@private:
7373 virtual bool rendererIsNeeded(const NodeRenderingContext&);
7474 virtual void insertedIntoDocument();
7575 virtual void removedFromDocument();
76  virtual void willMoveToNewOwnerDocument();
77 
 76 virtual void didMoveToNewOwnerDocument(const NodeOwnerChange&);
 77
7878 virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
7979
8080 virtual bool isURLAttribute(Attribute*) const;

Source/WebCore/html/HTMLPlugInImageElement.cpp

@@void HTMLPlugInImageElement::finishParsingChildren()
202202 setNeedsStyleRecalc();
203203}
204204
205 void HTMLPlugInImageElement::willMoveToNewOwnerDocument()
 205void HTMLPlugInImageElement::didMoveToNewOwnerDocument(const NodeOwnerChange& change)
206206{
207  if (m_needsDocumentActivationCallbacks)
208  document()->unregisterForPageCacheSuspensionCallbacks(this);
 207 if (m_needsDocumentActivationCallbacks) {
 208 change.oldDocument()->unregisterForPageCacheSuspensionCallbacks(this);
 209 change.newDocument()->registerForPageCacheSuspensionCallbacks(this);
 210 }
209211
210212 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();
 213 m_imageLoader->elementDidMoveToNewOwnerDocument();
 214 HTMLPlugInElement::didMoveToNewOwnerDocument(change);
222215}
223216
224217void HTMLPlugInImageElement::documentWillSuspendForPageCache()

Source/WebCore/html/HTMLPlugInImageElement.h

@@protected:
7474 bool allowedToLoadFrameURL(const String& url);
7575 bool wouldLoadAsNetscapePlugin(const String& url, const String& serviceType);
7676
77  virtual void willMoveToNewOwnerDocument() OVERRIDE;
78  virtual void didMoveToNewOwnerDocument() OVERRIDE;
 77 virtual void didMoveToNewOwnerDocument(const NodeOwnerChange&) OVERRIDE;
7978
8079 virtual void documentWillSuspendForPageCache() OVERRIDE;
8180 virtual void documentDidResumeFromPageCache() OVERRIDE;

Source/WebCore/html/HTMLVideoElement.cpp

@@bool HTMLVideoElement::webkitDisplayingFullscreen()
271271 return isFullscreen();
272272}
273273
274 void HTMLVideoElement::willMoveToNewOwnerDocument()
 274void HTMLVideoElement::didMoveToNewOwnerDocument(const NodeOwnerChange& change)
275275{
276276 if (m_imageLoader)
277  m_imageLoader->elementWillMoveToNewOwnerDocument();
278  HTMLMediaElement::willMoveToNewOwnerDocument();
 277 m_imageLoader->elementDidMoveToNewOwnerDocument();
 278 HTMLMediaElement::didMoveToNewOwnerDocument(change);
279279}
280280
281281#if ENABLE(MEDIA_STATISTICS)

Source/WebCore/html/HTMLVideoElement.h

@@private:
8484
8585 virtual bool hasAvailableVideoFrame() const;
8686 virtual void updateDisplayState();
87 
88  virtual void willMoveToNewOwnerDocument();
89 
 87 virtual void didMoveToNewOwnerDocument(const NodeOwnerChange&);
9088 virtual void setDisplayMode(DisplayMode);
9189
9290 OwnPtr<HTMLImageLoader> m_imageLoader;

Source/WebCore/html/ImageDocument.cpp

@@private:
106106 }
107107
108108 virtual ~ImageDocumentElement();
109  virtual void willMoveToNewOwnerDocument();
 109 virtual void didMoveToNewOwnerDocument(const NodeOwnerChange&);
110110
111111 ImageDocument* m_imageDocument;
112112};

@@ImageDocumentElement::~ImageDocumentElement()
407407 m_imageDocument->disconnectImageElement();
408408}
409409
410 void ImageDocumentElement::willMoveToNewOwnerDocument()
 410void ImageDocumentElement::didMoveToNewOwnerDocument(const NodeOwnerChange& change)
411411{
412412 if (m_imageDocument) {
413413 m_imageDocument->disconnectImageElement();
414414 m_imageDocument = 0;
415415 }
416  HTMLImageElement::willMoveToNewOwnerDocument();
 416 HTMLImageElement::didMoveToNewOwnerDocument(change);
417417}
418418
419419}

Source/WebCore/html/ImageInputType.cpp

@@void ImageInputType::willMoveToNewOwnerDocument()
146146{
147147 BaseButtonInputType::willMoveToNewOwnerDocument();
148148 if (m_imageLoader)
149  m_imageLoader->elementWillMoveToNewOwnerDocument();
 149 m_imageLoader->elementDidMoveToNewOwnerDocument();
150150}
151151
152152bool ImageInputType::shouldRespectAlignAttribute()

Source/WebCore/loader/ImageLoader.cpp

@@void ImageLoader::dispatchPendingLoadEvents()
349349 loadEventSender().dispatchPendingEvents();
350350}
351351
352 void ImageLoader::elementWillMoveToNewOwnerDocument()
 352void ImageLoader::elementDidMoveToNewOwnerDocument()
353353{
354354 setImage(0);
355355}

Source/WebCore/loader/ImageLoader.h

@@public:
4646 // doesn't change; starts new load unconditionally (matches Firefox and Opera behavior).
4747 void updateFromElementIgnoringPreviousError();
4848
49  void elementWillMoveToNewOwnerDocument();
 49 void elementDidMoveToNewOwnerDocument();
5050
5151 Element* element() const { return m_element; }
5252 bool imageComplete() const { return m_imageComplete; }

Source/WebCore/svg/SVGImageElement.cpp

@@void SVGImageElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const
215215 addSubresourceURL(urls, document()->completeURL(href()));
216216}
217217
218 void SVGImageElement::willMoveToNewOwnerDocument()
 218void SVGImageElement::didMoveToNewOwnerDocument(const NodeOwnerChange& change)
219219{
220  m_imageLoader.elementWillMoveToNewOwnerDocument();
221  SVGStyledTransformableElement::willMoveToNewOwnerDocument();
 220 m_imageLoader.elementDidMoveToNewOwnerDocument();
 221 SVGStyledTransformableElement::didMoveToNewOwnerDocument(change);
222222}
223223
224224}

Source/WebCore/svg/SVGImageElement.h

@@private:
6363 virtual bool haveLoadedRequiredResources();
6464
6565 virtual bool selfHasRelativeLengths() const;
66  virtual void willMoveToNewOwnerDocument();
 66 virtual void didMoveToNewOwnerDocument(const NodeOwnerChange&);
6767
6868 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGImageElement)
6969 DECLARE_ANIMATED_LENGTH(X, x)

Source/WebCore/svg/SVGSVGElement.cpp

@@SVGSVGElement::~SVGSVGElement()
106106 document()->accessSVGExtensions()->removeTimeContainer(this);
107107}
108108
109 void SVGSVGElement::willMoveToNewOwnerDocument()
110 {
111  document()->unregisterForPageCacheSuspensionCallbacks(this);
112  SVGStyledLocatableElement::willMoveToNewOwnerDocument();
113 }
114 
115 void SVGSVGElement::didMoveToNewOwnerDocument()
 109void SVGSVGElement::didMoveToNewOwnerDocument(const NodeOwnerChange& change)
116110{
117111 document()->registerForPageCacheSuspensionCallbacks(this);
118112 SVGStyledLocatableElement::didMoveToNewOwnerDocument();
 113
 114 if (change.oldDocument())
 115 change.oldDocument()->unregisterForPageCacheSuspensionCallbacks(this);
 116 change.newDocument()->registerForPageCacheSuspensionCallbacks(this);
 117 SVGStyledLocatableElement::didMoveToNewOwnerDocument(change);
119118}
120119
121120const AtomicString& SVGSVGElement::contentScriptType() const

Source/WebCore/svg/SVGSVGElement.h

@@public:
126126 Element* getElementById(const AtomicString&) const;
127127
128128protected:
129  virtual void willMoveToNewOwnerDocument();
130  virtual void didMoveToNewOwnerDocument();
 129 virtual void didMoveToNewOwnerDocument(const NodeOwnerChange&);
131130
132131private:
133132 SVGSVGElement(const QualifiedName&, Document*);