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