| Differences between
and this patch
- a/Source/WebCore/ChangeLog +315 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2012-04-16  Hajime Morrita  <morrita@chromium.org>
2
3
        insertedIntoDocument and insertedIntoTree should be unitifed.
4
        https://bugs.webkit.org/show_bug.cgi?id=82701
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Both Node::insertedIntoTree() and Node::insertedIntoDocument() are
9
        served as lifecycle callbacks which are invoked when a node is
10
        inserted into its new parent. There are also removedFromTree()
11
        and removedFromDocument() respectively. Considering that this pair
12
        of virtual functions are laid onto the hot path, it's worth
13
        merging them into one, to gain some speedup. Such
14
        unification could clarify the semantics as well.
15
16
        This change makes following change to merge these functions.
17
18
        - pulling the tree traversal out from ContainerNode to ChildNodeInsertionNotifier.
19
        - letting new Node::insertInto() do the job for its own, but not
20
          for its children and
21
        - Pass the parent of each insertion root as a parameter of insertedInto().
22
          This root node can tell inserted node where it is inserted,
23
          specifically whetehr the insertion is to the document or not.
24
25
        Same pattern is also applied to Node::removedFromDocument() and
26
        Node::removedFromTree(), which are factored to Node::removedFrom()
27
        and ChildNodeRemovalNotifier respectively.
28
29
        Speed up on Dromaeo/dom-modify.html is about 2%.
30
        Further speed-up by de-virtulization would be possible.
31
32
        Caveat:
33
34
        There is possible situation where a node need to invoke
35
        insertedInto() after its children is nofitied, instead of before
36
        that.  It was represented naturally with previous
37
        traversal-by-ContainerNode pattern, but is no longer simple with
38
        this new external traversal. To support this scenario, we
39
        introduced the InsertionNotificationRequest as a return value of insertedInto()
40
        and a supplemental hook Node::didNotifyDescendantInseretions(). See for
41
        example HTMLFormElement.cpp to learn how it works.
42
43
        No new tests. Covered by existing tests.
44
45
        * CMakeLists.txt:
46
        * GNUmakefile.list.am:
47
        * Target.pri:
48
        * WebCore.gypi:
49
        * WebCore.xcodeproj/project.pbxproj:
50
        * dom/ContainerNode.cpp:
51
        (WebCore::ContainerNode::parserInsertBefore):
52
        (WebCore::ContainerNode::removeChild):
53
        (WebCore::ContainerNode::parserRemoveChild):
54
        (WebCore::ContainerNode::removeChildren):
55
        (WebCore::ContainerNode::parserAddChild):
56
        (WebCore::updateTreeAfterInsertion):
57
        * dom/ContainerNode.h:
58
        (ContainerNode):
59
        (WebCore::Node::highestAncestor):
60
        (WebCore):
61
        * dom/ContainerNodeAlgorithms.cpp: Added.
62
        (WebCore):
63
        (WebCore::ChildNodeInsertionNotifier::notifyDescendantInsertedIntoDocument):
64
        (WebCore::ChildNodeInsertionNotifier::notifyDescendantInsertedIntoTree):
65
        (WebCore::ChildNodeRemovalNotifier::notifyDescendantRemovedFromDocument):
66
        (WebCore::ChildNodeRemovalNotifier::notifyDescendantRemovedFromTree):
67
        * dom/ContainerNodeAlgorithms.h:
68
        (ChildNodeInsertionNotifier):
69
        (WebCore::ChildNodeInsertionNotifier::ChildNodeInsertionNotifier):
70
        (WebCore):
71
        (ChildNodeRemovalNotifier):
72
        (WebCore::ChildNodeRemovalNotifier::ChildNodeRemovalNotifier):
73
        (WebCore::removeAllChildrenInContainer):
74
        (WebCore::appendChildToContainer):
75
        (Private):
76
        (WebCore::ChildNodeInsertionNotifier::notifyNodeInsertedIntoDocument):
77
        (WebCore::ChildNodeInsertionNotifier::notifyNodeInsertedIntoTree):
78
        (WebCore::ChildNodeInsertionNotifier::notifyInsertedIntoDocument):
79
        (WebCore::ChildNodeInsertionNotifier::notify):
80
        (WebCore::ChildNodeRemovalNotifier::notifyNodeRemovedFromDocument):
81
        (WebCore::ChildNodeRemovalNotifier::notifyNodeRemovedFromTree):
82
        (WebCore::ChildNodeRemovalNotifier::notify):
83
        * dom/DOMAllInOne.cpp:
84
        * dom/DocumentType.cpp:
85
        (WebCore::DocumentType::insertedInto):
86
        (WebCore::DocumentType::removedFrom):
87
        * dom/DocumentType.h:
88
        (DocumentType):
89
        * dom/Element.cpp:
90
        (WebCore::Element::insertedInto):
91
        (WebCore::Element::removedFrom):
92
        * dom/Element.h:
93
        (Element):
94
        * dom/Node.cpp:
95
        (WebCore::Node::insertedInto):
96
        (WebCore::Node::removedFrom):
97
        * dom/Node.h:
98
        (Node):
99
        (WebCore::Node::didNotifyDescendantInseretions):
100
        * dom/ProcessingInstruction.cpp:
101
        (WebCore::ProcessingInstruction::insertedInto):
102
        (WebCore::ProcessingInstruction::removedFrom):
103
        * dom/ProcessingInstruction.h:
104
        (ProcessingInstruction):
105
        * dom/ScriptElement.cpp:
106
        (WebCore::ScriptElement::insertedInto):
107
        * dom/ScriptElement.h:
108
        (WebCore):
109
        (ScriptElement):
110
        * dom/ShadowTree.cpp:
111
        (WebCore::ShadowTree::addShadowRoot):
112
        (WebCore::ShadowTree::removeAllShadowRoots):
113
        * dom/ShadowTree.h:
114
        (ShadowTree):
115
        (ShadowRootVector):
116
        (WebCore::ShadowRootVector::ShadowRootVector):
117
        (WebCore):
118
        * html/FormAssociatedElement.cpp:
119
        (WebCore::FormAssociatedElement::insertedInto):
120
        (WebCore::FormAssociatedElement::removedFrom):
121
        (WebCore::FormAssociatedElement::formRemovedFromTree):
122
        * html/FormAssociatedElement.h:
123
        (FormAssociatedElement):
124
        * html/HTMLBaseElement.cpp:
125
        (WebCore::HTMLBaseElement::insertedInto):
126
        (WebCore::HTMLBaseElement::removedFrom):
127
        * html/HTMLBaseElement.h:
128
        (HTMLBaseElement):
129
        * html/HTMLBodyElement.cpp:
130
        (WebCore::HTMLBodyElement::insertedInto):
131
        (WebCore::HTMLBodyElement::didNotifyDescendantInseretions):
132
        * html/HTMLBodyElement.h:
133
        (HTMLBodyElement):
134
        * html/HTMLFormControlElement.cpp:
135
        (WebCore::HTMLFormControlElement::insertedInto):
136
        (WebCore::HTMLFormControlElement::removedFrom):
137
        * html/HTMLFormControlElement.h:
138
        (HTMLFormControlElement):
139
        * html/HTMLFormElement.cpp:
140
        (WebCore::HTMLFormElement::insertedInto):
141
        (WebCore::HTMLFormElement::didNotifyDescendantInseretions):
142
        (WebCore::HTMLFormElement::removedFrom):
143
        * html/HTMLFormElement.h:
144
        (HTMLFormElement):
145
        * html/HTMLFrameElementBase.cpp:
146
        (WebCore::HTMLFrameElementBase::insertedInto):
147
        (WebCore):
148
        (WebCore::HTMLFrameElementBase::didNotifyDescendantInseretions):
149
        * html/HTMLFrameElementBase.h:
150
        (HTMLFrameElementBase):
151
        * html/HTMLFrameSetElement.cpp:
152
        (WebCore::HTMLFrameSetElement::insertedInto):
153
        (WebCore::HTMLFrameSetElement::removedFrom):
154
        * html/HTMLFrameSetElement.h:
155
        (HTMLFrameSetElement):
156
        * html/HTMLIFrameElement.cpp:
157
        (WebCore::HTMLIFrameElement::insertedInto):
158
        (WebCore::HTMLIFrameElement::removedFrom):
159
        * html/HTMLIFrameElement.h:
160
        (HTMLIFrameElement):
161
        * html/HTMLImageElement.cpp:
162
        (WebCore::HTMLImageElement::insertedInto):
163
        (WebCore::HTMLImageElement::removedFrom):
164
        * html/HTMLImageElement.h:
165
        (HTMLImageElement):
166
        * html/HTMLInputElement.cpp:
167
        (WebCore::HTMLInputElement::insertedInto):
168
        (WebCore::HTMLInputElement::removedFrom):
169
        * html/HTMLInputElement.h:
170
        * html/HTMLLinkElement.cpp:
171
        (WebCore::HTMLLinkElement::insertedInto):
172
        (WebCore::HTMLLinkElement::removedFrom):
173
        * html/HTMLLinkElement.h:
174
        (HTMLLinkElement):
175
        * html/HTMLMapElement.cpp:
176
        (WebCore::HTMLMapElement::insertedInto):
177
        (WebCore::HTMLMapElement::removedFrom):
178
        * html/HTMLMapElement.h:
179
        (HTMLMapElement):
180
        * html/HTMLMediaElement.cpp:
181
        (WebCore::HTMLMediaElement::insertedInto):
182
        (WebCore::HTMLMediaElement::removedFrom):
183
        * html/HTMLMediaElement.h:
184
        (HTMLMediaElement):
185
        * html/HTMLMetaElement.cpp:
186
        (WebCore::HTMLMetaElement::insertedInto):
187
        * html/HTMLMetaElement.h:
188
        (HTMLMetaElement):
189
        * html/HTMLObjectElement.cpp:
190
        (WebCore::HTMLObjectElement::insertedInto):
191
        (WebCore::HTMLObjectElement::removedFrom):
192
        * html/HTMLObjectElement.h:
193
        (HTMLObjectElement):
194
        * html/HTMLOptionElement.cpp:
195
        (WebCore::HTMLOptionElement::insertedInto):
196
        * html/HTMLOptionElement.h:
197
        (HTMLOptionElement):
198
        * html/HTMLQuoteElement.cpp:
199
        (WebCore::HTMLQuoteElement::insertedInto):
200
        * html/HTMLQuoteElement.h:
201
        (HTMLQuoteElement):
202
        * html/HTMLScriptElement.cpp:
203
        (WebCore::HTMLScriptElement::insertedInto):
204
        * html/HTMLScriptElement.h:
205
        (HTMLScriptElement):
206
        * html/HTMLSelectElement.cpp:
207
        (WebCore::HTMLSelectElement::insertedInto):
208
        * html/HTMLSelectElement.h:
209
        * html/HTMLSourceElement.cpp:
210
        (WebCore::HTMLSourceElement::insertedInto):
211
        * html/HTMLSourceElement.h:
212
        (HTMLSourceElement):
213
        * html/HTMLStyleElement.cpp:
214
        (WebCore::HTMLStyleElement::insertedInto):
215
        (WebCore::HTMLStyleElement::removedFrom):
216
        * html/HTMLStyleElement.h:
217
        (HTMLStyleElement):
218
        * html/HTMLTextFormControlElement.cpp:
219
        (WebCore::HTMLTextFormControlElement::insertedInto):
220
        * html/HTMLTextFormControlElement.h:
221
        * html/HTMLTitleElement.cpp:
222
        (WebCore::HTMLTitleElement::insertedInto):
223
        (WebCore::HTMLTitleElement::removedFrom):
224
        * html/HTMLTitleElement.h:
225
        (HTMLTitleElement):
226
        * html/HTMLTrackElement.cpp:
227
        (WebCore::HTMLTrackElement::insertedInto):
228
        * html/HTMLTrackElement.h:
229
        (HTMLTrackElement):
230
        * mathml/MathMLMathElement.cpp:
231
        (WebCore::MathMLMathElement::insertedInto):
232
        * mathml/MathMLMathElement.h:
233
        (MathMLMathElement):
234
        * svg/SVGElement.cpp:
235
        (WebCore::SVGElement::removedFrom):
236
        * svg/SVGElement.h:
237
        (SVGElement):
238
        * svg/SVGFEImageElement.cpp:
239
        (WebCore::SVGFEImageElement::insertedInto):
240
        (WebCore::SVGFEImageElement::removedFrom):
241
        * svg/SVGFEImageElement.h:
242
        (SVGFEImageElement):
243
        * svg/SVGFontFaceElement.cpp:
244
        (WebCore::SVGFontFaceElement::insertedInto):
245
        (WebCore::SVGFontFaceElement::removedFrom):
246
        * svg/SVGFontFaceElement.h:
247
        (SVGFontFaceElement):
248
        * svg/SVGFontFaceUriElement.cpp:
249
        (WebCore::SVGFontFaceUriElement::insertedInto):
250
        * svg/SVGFontFaceUriElement.h:
251
        (SVGFontFaceUriElement):
252
        * svg/SVGGlyphElement.cpp:
253
        (WebCore::SVGGlyphElement::insertedInto):
254
        (WebCore::SVGGlyphElement::removedFrom):
255
        * svg/SVGGlyphElement.h:
256
        (SVGGlyphElement):
257
        * svg/SVGHKernElement.cpp:
258
        (WebCore::SVGHKernElement::insertedInto):
259
        (WebCore::SVGHKernElement::removedFrom):
260
        * svg/SVGHKernElement.h:
261
        (SVGHKernElement):
262
        * svg/SVGImageElement.cpp:
263
        (WebCore::SVGImageElement::insertedInto):
264
        * svg/SVGImageElement.h:
265
        (SVGImageElement):
266
        * svg/SVGSVGElement.cpp:
267
        (WebCore::SVGSVGElement::insertedInto):
268
        (WebCore::SVGSVGElement::removedFrom):
269
        * svg/SVGSVGElement.h:
270
        (SVGSVGElement):
271
        * svg/SVGScriptElement.cpp:
272
        (WebCore::SVGScriptElement::insertedInto):
273
        * svg/SVGScriptElement.h:
274
        (SVGScriptElement):
275
        * svg/SVGStyleElement.cpp:
276
        (WebCore::SVGStyleElement::insertedInto):
277
        (WebCore::SVGStyleElement::removedFrom):
278
        * svg/SVGStyleElement.h:
279
        (SVGStyleElement):
280
        * svg/SVGStyledElement.cpp:
281
        (WebCore::SVGStyledElement::insertedInto):
282
        (WebCore::SVGStyledElement::removedFrom):
283
        (WebCore::SVGStyledElement::updateRelativeLengthsInformation):
284
        * svg/SVGStyledElement.h:
285
        (SVGStyledElement):
286
        * svg/SVGTRefElement.cpp:
287
        (WebCore::SVGTRefElement::buildPendingResource):
288
        (WebCore::SVGTRefElement::insertedInto):
289
        (WebCore::SVGTRefElement::removedFrom):
290
        * svg/SVGTRefElement.h:
291
        (SVGTRefElement):
292
        * svg/SVGTextPathElement.cpp:
293
        (WebCore::SVGTextPathElement::insertedInto):
294
        * svg/SVGTextPathElement.h:
295
        * svg/SVGTitleElement.cpp:
296
        (WebCore::SVGTitleElement::insertedInto):
297
        (WebCore::SVGTitleElement::removedFrom):
298
        * svg/SVGTitleElement.h:
299
        (SVGTitleElement):
300
        * svg/SVGUseElement.cpp:
301
        (WebCore::SVGUseElement::insertedInto):
302
        (WebCore::SVGUseElement::removedFrom):
303
        * svg/SVGUseElement.h:
304
        (SVGUseElement):
305
        * svg/SVGVKernElement.cpp:
306
        (WebCore::SVGVKernElement::insertedInto):
307
        (WebCore::SVGVKernElement::removedFrom):
308
        * svg/SVGVKernElement.h:
309
        (SVGVKernElement):
310
        * svg/animation/SVGSMILElement.cpp:
311
        (WebCore::SVGSMILElement::insertedInto):
312
        (WebCore::SVGSMILElement::removedFrom):
313
        * svg/animation/SVGSMILElement.h:
314
        (SVGSMILElement):
315
1
2012-04-14  Emil A Eklund  <eae@chromium.org>
316
2012-04-14  Emil A Eklund  <eae@chromium.org>
2
317
3
        Fix pixelSnapping for CalendarPicker, MediaControl and ScrollbarPart
318
        Fix pixelSnapping for CalendarPicker, MediaControl and ScrollbarPart
- a/Source/WebCore/CMakeLists.txt +1 lines
Lines 539-544 SET(WebCore_SOURCES a/Source/WebCore/CMakeLists.txt_sec1
539
    dom/ComposedShadowTreeWalker.cpp
539
    dom/ComposedShadowTreeWalker.cpp
540
    dom/CompositionEvent.cpp
540
    dom/CompositionEvent.cpp
541
    dom/ContainerNode.cpp
541
    dom/ContainerNode.cpp
542
    dom/ContainerNodeAlgorithms.cpp
542
    dom/ContextDestructionObserver.cpp
543
    dom/ContextDestructionObserver.cpp
543
    dom/CustomEvent.cpp
544
    dom/CustomEvent.cpp
544
    dom/DatasetDOMStringMap.cpp
545
    dom/DatasetDOMStringMap.cpp
- a/Source/WebCore/GNUmakefile.list.am +1 lines
Lines 1759-1764 webcore_sources += \ a/Source/WebCore/GNUmakefile.list.am_sec1
1759
	Source/WebCore/dom/CompositionEvent.cpp \
1759
	Source/WebCore/dom/CompositionEvent.cpp \
1760
	Source/WebCore/dom/CompositionEvent.h \
1760
	Source/WebCore/dom/CompositionEvent.h \
1761
	Source/WebCore/dom/ContainerNodeAlgorithms.h \
1761
	Source/WebCore/dom/ContainerNodeAlgorithms.h \
1762
	Source/WebCore/dom/ContainerNodeAlgorithms.cpp \
1762
	Source/WebCore/dom/ContainerNode.cpp \
1763
	Source/WebCore/dom/ContainerNode.cpp \
1763
	Source/WebCore/dom/ContainerNode.h \
1764
	Source/WebCore/dom/ContainerNode.h \
1764
	Source/WebCore/dom/ContextDestructionObserver.cpp \
1765
	Source/WebCore/dom/ContextDestructionObserver.cpp \
- a/Source/WebCore/Target.pri +2 lines
Lines 518-523 SOURCES += \ a/Source/WebCore/Target.pri_sec1
518
    dom/ComposedShadowTreeWalker.cpp \
518
    dom/ComposedShadowTreeWalker.cpp \
519
    dom/CompositionEvent.cpp \
519
    dom/CompositionEvent.cpp \
520
    dom/ContainerNode.cpp \
520
    dom/ContainerNode.cpp \
521
    dom/ContainerNodeAlgorithms.cpp \
521
    dom/ContextDestructionObserver.cpp \
522
    dom/ContextDestructionObserver.cpp \
522
    dom/CustomEvent.cpp \
523
    dom/CustomEvent.cpp \
523
    dom/DecodedDataDocumentParser.cpp \
524
    dom/DecodedDataDocumentParser.cpp \
Lines 1666-1671 HEADERS += \ a/Source/WebCore/Target.pri_sec2
1666
    dom/Comment.h \
1667
    dom/Comment.h \
1667
    dom/ComposedShadowTreeWalker.h \
1668
    dom/ComposedShadowTreeWalker.h \
1668
    dom/ContainerNode.h \
1669
    dom/ContainerNode.h \
1670
    dom/ContainerNodeAlgorithms.h \
1669
    dom/CustomEvent.h \
1671
    dom/CustomEvent.h \
1670
    dom/default/PlatformMessagePortChannel.h \
1672
    dom/default/PlatformMessagePortChannel.h \
1671
    dom/DeviceMotionClient.h \
1673
    dom/DeviceMotionClient.h \
- a/Source/WebCore/WebCore.gypi +1 lines
Lines 5149-5154 a/Source/WebCore/WebCore.gypi_sec1
5149
            'dom/CompositionEvent.h',
5149
            'dom/CompositionEvent.h',
5150
            'dom/ContainerNode.cpp',
5150
            'dom/ContainerNode.cpp',
5151
            'dom/ContainerNodeAlgorithms.h',
5151
            'dom/ContainerNodeAlgorithms.h',
5152
            'dom/ContainerNodeAlgorithms.cpp',
5152
            'dom/ContextDestructionObserver.cpp',
5153
            'dom/ContextDestructionObserver.cpp',
5153
            'dom/CrossThreadTask.h',
5154
            'dom/CrossThreadTask.h',
5154
            'dom/CustomEvent.cpp',
5155
            'dom/CustomEvent.cpp',
- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +4 lines
Lines 3748-3753 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec1
3748
		A78FE13C12366B1000ACE8D0 /* SpellChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = A78FE13A12366B1000ACE8D0 /* SpellChecker.h */; settings = {ATTRIBUTES = (Private, ); }; };
3748
		A78FE13C12366B1000ACE8D0 /* SpellChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = A78FE13A12366B1000ACE8D0 /* SpellChecker.h */; settings = {ATTRIBUTES = (Private, ); }; };
3749
		A795463E0B5C4C80007B438F /* DragDataMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A795463D0B5C4C80007B438F /* DragDataMac.mm */; };
3749
		A795463E0B5C4C80007B438F /* DragDataMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A795463D0B5C4C80007B438F /* DragDataMac.mm */; };
3750
		A79546430B5C4CB4007B438F /* DragData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A79546420B5C4CB4007B438F /* DragData.cpp */; };
3750
		A79546430B5C4CB4007B438F /* DragData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A79546420B5C4CB4007B438F /* DragData.cpp */; };
3751
		A7A78CD51532BA62006C21E4 /* ContainerNodeAlgorithms.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7A78CD41532BA62006C21E4 /* ContainerNodeAlgorithms.cpp */; };
3751
		A7AD2F870EC89D07008AB002 /* LinkHash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7AD2F850EC89D07008AB002 /* LinkHash.cpp */; };
3752
		A7AD2F870EC89D07008AB002 /* LinkHash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7AD2F850EC89D07008AB002 /* LinkHash.cpp */; };
3752
		A7AD2F880EC89D07008AB002 /* LinkHash.h in Headers */ = {isa = PBXBuildFile; fileRef = A7AD2F860EC89D07008AB002 /* LinkHash.h */; settings = {ATTRIBUTES = (Private, ); }; };
3753
		A7AD2F880EC89D07008AB002 /* LinkHash.h in Headers */ = {isa = PBXBuildFile; fileRef = A7AD2F860EC89D07008AB002 /* LinkHash.h */; settings = {ATTRIBUTES = (Private, ); }; };
3753
		A7B070D2130A409C00A3763C /* FrameActionScheduler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7B070D0130A409C00A3763C /* FrameActionScheduler.cpp */; };
3754
		A7B070D2130A409C00A3763C /* FrameActionScheduler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7B070D0130A409C00A3763C /* FrameActionScheduler.cpp */; };
Lines 10772-10777 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec2
10772
		A78FE13A12366B1000ACE8D0 /* SpellChecker.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = SpellChecker.h; sourceTree = "<group>"; };
10773
		A78FE13A12366B1000ACE8D0 /* SpellChecker.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = SpellChecker.h; sourceTree = "<group>"; };
10773
		A795463D0B5C4C80007B438F /* DragDataMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DragDataMac.mm; sourceTree = "<group>"; };
10774
		A795463D0B5C4C80007B438F /* DragDataMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DragDataMac.mm; sourceTree = "<group>"; };
10774
		A79546420B5C4CB4007B438F /* DragData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DragData.cpp; sourceTree = "<group>"; };
10775
		A79546420B5C4CB4007B438F /* DragData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DragData.cpp; sourceTree = "<group>"; };
10776
		A7A78CD41532BA62006C21E4 /* ContainerNodeAlgorithms.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContainerNodeAlgorithms.cpp; sourceTree = "<group>"; };
10775
		A7AD2F850EC89D07008AB002 /* LinkHash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LinkHash.cpp; sourceTree = "<group>"; };
10777
		A7AD2F850EC89D07008AB002 /* LinkHash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LinkHash.cpp; sourceTree = "<group>"; };
10776
		A7AD2F860EC89D07008AB002 /* LinkHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LinkHash.h; sourceTree = "<group>"; };
10778
		A7AD2F860EC89D07008AB002 /* LinkHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LinkHash.h; sourceTree = "<group>"; };
10777
		A7B070D0130A409C00A3763C /* FrameActionScheduler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameActionScheduler.cpp; sourceTree = "<group>"; };
10779
		A7B070D0130A409C00A3763C /* FrameActionScheduler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameActionScheduler.cpp; sourceTree = "<group>"; };
Lines 20958-20963 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec3
20958
				79F2F5A01091939A000D87CB /* CompositionEvent.idl */,
20960
				79F2F5A01091939A000D87CB /* CompositionEvent.idl */,
20959
				A81872140977D3C0005826D9 /* ContainerNode.cpp */,
20961
				A81872140977D3C0005826D9 /* ContainerNode.cpp */,
20960
				A81872110977D3C0005826D9 /* ContainerNode.h */,
20962
				A81872110977D3C0005826D9 /* ContainerNode.h */,
20963
				A7A78CD41532BA62006C21E4 /* ContainerNodeAlgorithms.cpp */,
20961
				E1A1470711102B1500EEC0F3 /* ContainerNodeAlgorithms.h */,
20964
				E1A1470711102B1500EEC0F3 /* ContainerNodeAlgorithms.h */,
20962
				97627B8B14FB3CEE002CDCA1 /* ContextDestructionObserver.cpp */,
20965
				97627B8B14FB3CEE002CDCA1 /* ContextDestructionObserver.cpp */,
20963
				97627B8C14FB3CEE002CDCA1 /* ContextDestructionObserver.h */,
20966
				97627B8C14FB3CEE002CDCA1 /* ContextDestructionObserver.h */,
Lines 25285-25290 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec4
25285
				BC0B36A40CD3C67C00AC7EB5 /* Console.cpp in Sources */,
25288
				BC0B36A40CD3C67C00AC7EB5 /* Console.cpp in Sources */,
25286
				41F0618F0F5F069800A07EAC /* ConsoleMessage.cpp in Sources */,
25289
				41F0618F0F5F069800A07EAC /* ConsoleMessage.cpp in Sources */,
25287
				A818721F0977D3C0005826D9 /* ContainerNode.cpp in Sources */,
25290
				A818721F0977D3C0005826D9 /* ContainerNode.cpp in Sources */,
25291
				A7A78CD51532BA62006C21E4 /* ContainerNodeAlgorithms.cpp in Sources */,
25288
				BC5EB9800E82072500B25965 /* ContentData.cpp in Sources */,
25292
				BC5EB9800E82072500B25965 /* ContentData.cpp in Sources */,
25289
				59102FBB14327D3B003C9D04 /* ContentSearchUtils.cpp in Sources */,
25293
				59102FBB14327D3B003C9D04 /* ContentSearchUtils.cpp in Sources */,
25290
				97C471DB12F925BD0086354B /* ContentSecurityPolicy.cpp in Sources */,
25294
				97C471DB12F925BD0086354B /* ContentSecurityPolicy.cpp in Sources */,
- a/Source/WebCore/dom/ContainerNode.cpp -104 / +8 lines
Lines 47-53 using namespace std; a/Source/WebCore/dom/ContainerNode.cpp_sec1
47
47
48
namespace WebCore {
48
namespace WebCore {
49
49
50
static void notifyChildInserted(Node*);
51
static void dispatchChildInsertionEvents(Node*);
50
static void dispatchChildInsertionEvents(Node*);
52
static void dispatchChildRemovalEvents(Node*);
51
static void dispatchChildRemovalEvents(Node*);
53
static void updateTreeAfterInsertion(ContainerNode*, Node*, bool shouldLazyAttach);
52
static void updateTreeAfterInsertion(ContainerNode*, Node*, bool shouldLazyAttach);
Lines 230-236 void ContainerNode::parserInsertBefore(PassRefPtr<Node> newChild, Node* nextChil a/Source/WebCore/dom/ContainerNode.cpp_sec2
230
        insertBeforeCommon(next.get(), child);
229
        insertBeforeCommon(next.get(), child);
231
230
232
        childrenChanged(true, nextChildPreviousSibling.get(), nextChild, 1);
231
        childrenChanged(true, nextChildPreviousSibling.get(), nextChild, 1);
233
        notifyChildInserted(child);
232
        ChildNodeInsertionNotifier(this).notify(child);
234
    }
233
    }
235
}
234
}
236
235
Lines 406-416 bool ContainerNode::removeChild(Node* oldChild, ExceptionCode& ec) a/Source/WebCore/dom/ContainerNode.cpp_sec3
406
405
407
    childrenChanged(false, prev, next, -1);
406
    childrenChanged(false, prev, next, -1);
408
407
409
    if (child->inDocument())
408
    ChildNodeRemovalNotifier(this).notify(child.get());
410
        child->removedFromDocument();
411
    else if (child->isContainerNode())
412
        toContainerNode(child.get())->removedFromTree(true);
413
414
    dispatchSubtreeModifiedEvent();
409
    dispatchSubtreeModifiedEvent();
415
410
416
    return child;
411
    return child;
Lines 456-465 void ContainerNode::parserRemoveChild(Node* oldChild) a/Source/WebCore/dom/ContainerNode.cpp_sec4
456
    removeBetween(prev, next, oldChild);
451
    removeBetween(prev, next, oldChild);
457
452
458
    childrenChanged(true, prev, next, -1);
453
    childrenChanged(true, prev, next, -1);
459
    if (oldChild->inDocument())
454
    ChildNodeRemovalNotifier(this).notify(oldChild);
460
        oldChild->removedFromDocument();
461
    else if (oldChild->isContainerNode())
462
        toContainerNode(oldChild)->removedFromTree(true);
463
}
455
}
464
456
465
// this differs from other remove functions because it forcibly removes all the children,
457
// this differs from other remove functions because it forcibly removes all the children,
Lines 520-532 void ContainerNode::removeChildren() a/Source/WebCore/dom/ContainerNode.cpp_sec5
520
512
521
    childrenChanged(false, 0, 0, -static_cast<int>(removedChildrenCount));
513
    childrenChanged(false, 0, 0, -static_cast<int>(removedChildrenCount));
522
514
523
    for (i = 0; i < removedChildrenCount; ++i) {
515
    for (i = 0; i < removedChildrenCount; ++i)
524
        Node* removedChild = removedChildren[i].get();
516
        ChildNodeRemovalNotifier(this).notify(removedChildren[i].get());
525
        if (removedChild->inDocument())
526
            removedChild->removedFromDocument();
527
        else if (removedChild->isContainerNode())
528
            toContainerNode(removedChild)->removedFromTree(true);
529
    }
530
517
531
    allowEventDispatch();
518
    allowEventDispatch();
532
    dispatchSubtreeModifiedEvent();
519
    dispatchSubtreeModifiedEvent();
Lines 603-611 void ContainerNode::parserAddChild(PassRefPtr<Node> newChild) a/Source/WebCore/dom/ContainerNode.cpp_sec6
603
    
590
    
604
    allowEventDispatch();
591
    allowEventDispatch();
605
592
606
    // FIXME: Why doesn't this use notifyChildInserted(newChild) instead?
593
    // FIXME: Why doesn't this use notify(newChild.get()) instead?
607
    if (inDocument())
594
    if (inDocument())
608
        newChild->insertedIntoDocument();
595
        ChildNodeInsertionNotifier(this).notifyInsertedIntoDocument(newChild.get());
609
    childrenChanged(true, last, 0, 1);
596
    childrenChanged(true, last, 0, 1);
610
}
597
}
611
598
Lines 696-767 void ContainerNode::detach() a/Source/WebCore/dom/ContainerNode.cpp_sec7
696
    Node::detach();
683
    Node::detach();
697
}
684
}
698
685
699
void ContainerNode::insertedIntoDocument()
700
{
701
    RefPtr<Node> protect(this);
702
703
    Node::insertedIntoDocument();
704
    insertedIntoTree(false);
705
706
    NodeVector children;
707
    getChildNodes(this, children);
708
    for (size_t i = 0; i < children.size(); ++i) {
709
        // If we have been removed from the document during this loop, then
710
        // we don't want to tell the rest of our children that they've been
711
        // inserted into the document because they haven't.
712
        if (!inDocument())
713
            break;
714
        if (children[i]->parentNode() != this)
715
            continue;
716
        children[i]->insertedIntoDocument();
717
    }
718
}
719
720
void ContainerNode::removedFromDocument()
721
{
722
    Node::removedFromDocument();
723
    if (document()->cssTarget() == this) 
724
        document()->setCSSTarget(0); 
725
    removedFromTree(false);
726
727
    NodeVector children;
728
    getChildNodes(this, children);
729
    for (size_t i = 0; i < children.size(); ++i) {
730
        // If we have been added to the document during this loop, then we
731
        // don't want to tell the rest of our children that they've been
732
        // removed from the document because they haven't.
733
        if (inDocument())
734
            break;
735
        if (children[i]->parentNode() != this)
736
            continue;
737
        children[i]->removedFromDocument();
738
    }
739
}
740
741
void ContainerNode::insertedIntoTree(bool deep)
742
{
743
    if (!deep)
744
        return;
745
    forbidEventDispatch();
746
    for (Node* child = m_firstChild; child; child = child->nextSibling()) {
747
        if (child->isContainerNode())
748
            toContainerNode(child)->insertedIntoTree(true);
749
    }
750
    allowEventDispatch();
751
}
752
753
void ContainerNode::removedFromTree(bool deep)
754
{
755
    if (!deep)
756
        return;
757
    forbidEventDispatch();
758
    for (Node* child = m_firstChild; child; child = child->nextSibling()) {
759
        if (child->isContainerNode())
760
            toContainerNode(child)->removedFromTree(true);
761
    }
762
    allowEventDispatch();
763
}
764
765
void ContainerNode::childrenChanged(bool changedByParser, Node*, Node*, int childCountDelta)
686
void ContainerNode::childrenChanged(bool changedByParser, Node*, Node*, int childCountDelta)
766
{
687
{
767
    document()->incDOMTreeVersion();
688
    document()->incDOMTreeVersion();
Lines 1007-1029 Node *ContainerNode::childNode(unsigned index) const a/Source/WebCore/dom/ContainerNode.cpp_sec8
1007
    return n;
928
    return n;
1008
}
929
}
1009
930
1010
static void notifyChildInserted(Node* child)
1011
{
1012
    ASSERT(!eventDispatchForbidden());
1013
1014
#if ENABLE(INSPECTOR)
1015
    InspectorInstrumentation::didInsertDOMNode(child->document(), child);
1016
#endif
1017
1018
    RefPtr<Node> c = child;
1019
    RefPtr<Document> document = child->document();
1020
1021
    Node* parentOrHostNode = c->parentOrHostNode();
1022
    if (parentOrHostNode && parentOrHostNode->inDocument())
1023
        c->insertedIntoDocument();
1024
    else if (c->isContainerNode())
1025
        toContainerNode(c.get())->insertedIntoTree(true);
1026
}
1027
931
1028
static void dispatchChildInsertionEvents(Node* child)
932
static void dispatchChildInsertionEvents(Node* child)
1029
{
933
{
Lines 1092-1098 static void updateTreeAfterInsertion(ContainerNode* parent, Node* child, bool sh a/Source/WebCore/dom/ContainerNode.cpp_sec9
1092
996
1093
    parent->childrenChanged(false, child->previousSibling(), child->nextSibling(), 1);
997
    parent->childrenChanged(false, child->previousSibling(), child->nextSibling(), 1);
1094
998
1095
    notifyChildInserted(child);
999
    ChildNodeInsertionNotifier(parent).notify(child);
1096
1000
1097
    // FIXME: Attachment should be the first operation in this function, but some code
1001
    // FIXME: Attachment should be the first operation in this function, but some code
1098
    // (for example, HTMLFormControlElement's autofocus support) requires this ordering.
1002
    // (for example, HTMLFormControlElement's autofocus support) requires this ordering.
- a/Source/WebCore/dom/ContainerNode.h -8 / +9 lines
Lines 77-95 public: a/Source/WebCore/dom/ContainerNode.h_sec1
77
    virtual void setFocus(bool = true) OVERRIDE;
77
    virtual void setFocus(bool = true) OVERRIDE;
78
    virtual void setActive(bool active = true, bool pause = false) OVERRIDE;
78
    virtual void setActive(bool active = true, bool pause = false) OVERRIDE;
79
    virtual void setHovered(bool = true) OVERRIDE;
79
    virtual void setHovered(bool = true) OVERRIDE;
80
    virtual void insertedIntoDocument() OVERRIDE;
81
    virtual void removedFromDocument() OVERRIDE;
82
    virtual void scheduleSetNeedsStyleRecalc(StyleChangeType = FullStyleChange) OVERRIDE;
80
    virtual void scheduleSetNeedsStyleRecalc(StyleChangeType = FullStyleChange) OVERRIDE;
83
81
84
    // -----------------------------------------------------------------------------
82
    // -----------------------------------------------------------------------------
85
    // Notification of document structure changes (see Node.h for more notification methods)
83
    // Notification of document structure changes (see Node.h for more notification methods)
86
84
87
    // These functions are called whenever you are connected or disconnected from a tree. That tree may be the main
88
    // document tree, or it could be another disconnected tree. Override these functions to do any work that depends
89
    // on connectedness to some ancestor (e.g., an ancestor <form>).
90
    virtual void insertedIntoTree(bool deep);
91
    virtual void removedFromTree(bool deep);
92
93
    // Notifies the node that it's list of children have changed (either by adding or removing child nodes), or a child
85
    // Notifies the node that it's list of children have changed (either by adding or removing child nodes), or a child
94
    // node that is of the type CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE has changed its value.
86
    // node that is of the type CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE has changed its value.
95
    virtual void childrenChanged(bool createdByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
87
    virtual void childrenChanged(bool createdByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
Lines 227-232 inline Node* Node::lastChild() const a/Source/WebCore/dom/ContainerNode.h_sec2
227
    return toContainerNode(this)->lastChild();
219
    return toContainerNode(this)->lastChild();
228
}
220
}
229
221
222
inline Node* Node::highestAncestor() const
223
{
224
    Node* node = const_cast<Node*>(this);
225
    Node* highest = node;
226
    for (; node; node = node->parentNode())
227
        highest = node;
228
    return highest;
229
}
230
230
typedef Vector<RefPtr<Node>, 11> NodeVector;
231
typedef Vector<RefPtr<Node>, 11> NodeVector;
231
232
232
inline void getChildNodes(Node* node, NodeVector& nodes)
233
inline void getChildNodes(Node* node, NodeVector& nodes)
- a/Source/WebCore/dom/ContainerNodeAlgorithms.cpp +114 lines
Line 0 a/Source/WebCore/dom/ContainerNodeAlgorithms.cpp_sec1
1
/*
2
 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3
 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
4
 *           (C) 2001 Dirk Mueller (mueller@kde.org)
5
 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6
 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7
 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
8
 * Copyright (C) 2012 Google Inc. All rights reserved.
9
 *
10
 * This library is free software; you can redistribute it and/or
11
 * modify it under the terms of the GNU Library General Public
12
 * License as published by the Free Software Foundation; either
13
 * version 2 of the License, or (at your option) any later version.
14
 *
15
 * This library is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
 * Library General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU Library General Public License
21
 * along with this library; see the file COPYING.LIB.  If not, write to
22
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23
 * Boston, MA 02110-1301, USA.
24
 */
25
26
#include "config.h"
27
#include "ContainerNodeAlgorithms.h"
28
29
#include "Element.h"
30
#include "ShadowTree.h"
31
32
namespace WebCore {
33
34
void ChildNodeInsertionNotifier::notifyDescendantInsertedIntoDocument(ContainerNode* node)
35
{
36
    NodeVector children;
37
    getChildNodes(node, children);
38
    for (size_t i = 0; i < children.size(); ++i) {
39
        // If we have been removed from the document during this loop, then
40
        // we don't want to tell the rest of our children that they've been
41
        // inserted into the document because they haven't.
42
        if (node->inDocument() && children[i]->parentNode() == node)
43
            notifyNodeInsertedIntoDocument(children[i].get());
44
    }
45
        
46
    if (!node->isElementNode())
47
        return;
48
49
    if (ShadowTree* tree = toElement(node)->shadowTree()) {
50
        ShadowRootVector roots(tree);
51
        for (size_t i = 0; i < roots.size(); ++i)
52
            notifyNodeInsertedIntoDocument(roots[i].get());
53
    }
54
}
55
56
void ChildNodeInsertionNotifier::notifyDescendantInsertedIntoTree(ContainerNode* node)
57
{
58
    for (Node* child = node->firstChild(); child; child = child->nextSibling()) {
59
        if (child->isContainerNode())
60
            notifyNodeInsertedIntoTree(toContainerNode(child));
61
    }
62
63
    if (!node->isElementNode())
64
        return;
65
66
    if (ShadowTree* tree = toElement(node)->shadowTree()) {
67
        for (ShadowRoot* root = tree->youngestShadowRoot(); root; root = root->olderShadowRoot())
68
            notifyNodeInsertedIntoTree(root);
69
    }
70
}
71
72
void ChildNodeRemovalNotifier::notifyDescendantRemovedFromDocument(ContainerNode* node)
73
{
74
    NodeVector children;
75
    getChildNodes(node, children);
76
    for (size_t i = 0; i < children.size(); ++i) {
77
        // If we have been added to the document during this loop, then we
78
        // don't want to tell the rest of our children that they've been
79
        // removed from the document because they haven't.
80
        if (!node->inDocument() && children[i]->parentNode() == node)
81
            notifyNodeRemovedFromDocument(children[i].get());
82
    }
83
84
    if (!node->isElementNode())
85
        return;
86
87
    if (node->document()->cssTarget() == node)
88
        node->document()->setCSSTarget(0);
89
90
    if (ShadowTree* tree = toElement(node)->shadowTree()) {
91
        ShadowRootVector roots(tree);
92
        for (size_t i = 0; i < roots.size(); ++i)
93
            notifyNodeRemovedFromDocument(roots[i].get());
94
    }
95
}
96
97
void ChildNodeRemovalNotifier::notifyDescendantRemovedFromTree(ContainerNode* node)
98
{
99
    for (Node* child = node->firstChild(); child; child = child->nextSibling()) {
100
        if (child->isContainerNode())
101
            notifyNodeRemovedFromTree(toContainerNode(child));
102
    }
103
104
    if (!node->isElementNode())
105
        return;
106
107
    if (ShadowTree* tree = toElement(node)->shadowTree()) {
108
        ShadowRootVector roots(tree);
109
        for (size_t i = 0; i < roots.size(); ++i)
110
            notifyNodeRemovedFromTree(roots[i].get());
111
    }
112
}
113
114
}
- a/Source/WebCore/dom/ContainerNodeAlgorithms.h -5 / +111 lines
Lines 22-34 a/Source/WebCore/dom/ContainerNodeAlgorithms.h_sec1
22
#ifndef ContainerNodeAlgorithms_h
22
#ifndef ContainerNodeAlgorithms_h
23
#define ContainerNodeAlgorithms_h
23
#define ContainerNodeAlgorithms_h
24
24
25
#include <Document.h>
25
#include "Document.h"
26
#include "InspectorInstrumentation.h"
26
#include <wtf/Assertions.h>
27
#include <wtf/Assertions.h>
27
28
28
namespace WebCore {
29
namespace WebCore {
29
30
30
class Node;
31
class Node;
31
32
33
class ChildNodeInsertionNotifier {
34
public:
35
    explicit ChildNodeInsertionNotifier(Node* insertionPoint)
36
        : m_insertionPoint(insertionPoint)
37
    { }
38
39
    void notifyInsertedIntoDocument(Node*);
40
    void notify(Node*);
41
42
private:
43
    void notifyDescendantInsertedIntoDocument(ContainerNode*);
44
    void notifyDescendantInsertedIntoTree(ContainerNode*);
45
    void notifyNodeInsertedIntoDocument(Node*);
46
    void notifyNodeInsertedIntoTree(ContainerNode*);
47
48
    Node* m_insertionPoint;
49
};
50
51
class ChildNodeRemovalNotifier {
52
public:
53
    explicit ChildNodeRemovalNotifier(Node* insertionPoint)
54
        : m_insertionPoint(insertionPoint)
55
    { }
56
57
    void notify(Node*);
58
59
private:
60
    void notifyDescendantRemovedFromDocument(ContainerNode*);
61
    void notifyDescendantRemovedFromTree(ContainerNode*);
62
    void notifyNodeRemovedFromDocument(Node*);
63
    void notifyNodeRemovedFromTree(ContainerNode*);
64
65
    Node* m_insertionPoint;
66
};
67
32
namespace Private {
68
namespace Private {
33
69
34
    template<class GenericNode, class GenericNodeContainer>
70
    template<class GenericNode, class GenericNodeContainer>
Lines 39-45 namespace Private { a/Source/WebCore/dom/ContainerNodeAlgorithms.h_sec2
39
// Helper functions for TreeShared-derived classes, which have a 'Node' style interface
75
// Helper functions for TreeShared-derived classes, which have a 'Node' style interface
40
// This applies to 'ContainerNode' and 'SVGElementInstance'
76
// This applies to 'ContainerNode' and 'SVGElementInstance'
41
template<class GenericNode, class GenericNodeContainer>
77
template<class GenericNode, class GenericNodeContainer>
42
void removeAllChildrenInContainer(GenericNodeContainer* container)
78
inline void removeAllChildrenInContainer(GenericNodeContainer* container)
43
{
79
{
44
    // List of nodes to be deleted.
80
    // List of nodes to be deleted.
45
    GenericNode* head = 0;
81
    GenericNode* head = 0;
Lines 67-73 void removeAllChildrenInContainer(GenericNodeContainer* container) a/Source/WebCore/dom/ContainerNodeAlgorithms.h_sec3
67
}
103
}
68
104
69
template<class GenericNode, class GenericNodeContainer>
105
template<class GenericNode, class GenericNodeContainer>
70
void appendChildToContainer(GenericNode* child, GenericNodeContainer* container)
106
inline void appendChildToContainer(GenericNode* child, GenericNodeContainer* container)
71
{
107
{
72
    child->setParent(container);
108
    child->setParent(container);
73
109
Lines 100-106 namespace Private { a/Source/WebCore/dom/ContainerNodeAlgorithms.h_sec4
100
            if (Document* containerDocument = container->ownerDocument())
136
            if (Document* containerDocument = container->ownerDocument())
101
                containerDocument->adoptIfNeeded(node);
137
                containerDocument->adoptIfNeeded(node);
102
            if (node->inDocument())
138
            if (node->inDocument())
103
                node->removedFromDocument();
139
                ChildNodeRemovalNotifier(container).notify(node);
104
        }
140
        }
105
    };
141
    };
106
142
Lines 148-154 namespace Private { a/Source/WebCore/dom/ContainerNodeAlgorithms.h_sec5
148
        container->setFirstChild(0);
184
        container->setFirstChild(0);
149
        container->setLastChild(0);
185
        container->setLastChild(0);
150
    }
186
    }
151
};
187
188
} // namespace Private
189
190
inline void ChildNodeInsertionNotifier::notifyNodeInsertedIntoDocument(Node* node)
191
{
192
    ASSERT(m_insertionPoint->inDocument());
193
    RefPtr<Node> protect(node);
194
    Node::InsertionNotificationRequest request = node->insertedInto(m_insertionPoint);
195
    if (node->isContainerNode())
196
        notifyDescendantInsertedIntoDocument(toContainerNode(node));
197
    if (request == Node::InsertionShouldCallDidNotifyDescendantInseretions)
198
        node->didNotifyDescendantInseretions(m_insertionPoint);
199
}
200
201
inline void ChildNodeInsertionNotifier::notifyNodeInsertedIntoTree(ContainerNode* node)
202
{
203
    ASSERT(!m_insertionPoint->inDocument());
204
    forbidEventDispatch();
205
    Node::InsertionNotificationRequest request = node->insertedInto(m_insertionPoint);
206
    notifyDescendantInsertedIntoTree(node);
207
    if (request == Node::InsertionShouldCallDidNotifyDescendantInseretions)
208
        node->didNotifyDescendantInseretions(m_insertionPoint);
209
    allowEventDispatch();
210
}
211
212
inline void ChildNodeInsertionNotifier::notifyInsertedIntoDocument(Node* node)
213
{
214
    notifyNodeInsertedIntoDocument(node);
215
}
216
217
inline void ChildNodeInsertionNotifier::notify(Node* node)
218
{
219
    ASSERT(!eventDispatchForbidden());
220
221
#if ENABLE(INSPECTOR)
222
    InspectorInstrumentation::didInsertDOMNode(node->document(), node);
223
#endif
224
225
    RefPtr<Document> protectDocument(node->document());
226
    RefPtr<Node> protectNode(node);
227
    if (m_insertionPoint->inDocument())
228
        notifyNodeInsertedIntoDocument(node);
229
    else if (node->isContainerNode())
230
        notifyNodeInsertedIntoTree(toContainerNode(node));
231
}
232
233
234
inline void ChildNodeRemovalNotifier::notifyNodeRemovedFromDocument(Node* node)
235
{
236
    ASSERT(m_insertionPoint->inDocument());
237
    node->removedFrom(m_insertionPoint);
238
    if (node->isContainerNode())
239
        notifyDescendantRemovedFromDocument(toContainerNode(node));
240
}
241
242
inline void ChildNodeRemovalNotifier::notifyNodeRemovedFromTree(ContainerNode* node)
243
{
244
    ASSERT(!m_insertionPoint->inDocument());
245
    forbidEventDispatch();
246
    node->removedFrom(m_insertionPoint);
247
    notifyDescendantRemovedFromTree(node);
248
    allowEventDispatch();
249
}
250
251
inline void ChildNodeRemovalNotifier::notify(Node* node)
252
{
253
    if (node->inDocument())
254
        notifyNodeRemovedFromDocument(node);
255
    else if (node->isContainerNode())
256
        notifyNodeRemovedFromTree(toContainerNode(node));
257
}
152
258
153
} // namespace WebCore
259
} // namespace WebCore
154
260
- a/Source/WebCore/dom/DOMAllInOne.cpp +1 lines
Lines 43-48 a/Source/WebCore/dom/DOMAllInOne.cpp_sec1
43
#include "Comment.cpp"
43
#include "Comment.cpp"
44
#include "CompositionEvent.cpp"
44
#include "CompositionEvent.cpp"
45
#include "ContainerNode.cpp"
45
#include "ContainerNode.cpp"
46
#include "ContainerNodeAlgorithms.cpp"
46
#include "ContextDestructionObserver.cpp"
47
#include "ContextDestructionObserver.cpp"
47
#include "CustomEvent.cpp"
48
#include "CustomEvent.cpp"
48
#include "DOMCoreException.cpp"
49
#include "DOMCoreException.cpp"
- a/Source/WebCore/dom/DocumentType.cpp -5 / +10 lines
Lines 56-63 PassRefPtr<Node> DocumentType::cloneNode(bool /*deep*/) a/Source/WebCore/dom/DocumentType.cpp_sec1
56
    return create(document(), m_name, m_publicId, m_systemId);
56
    return create(document(), m_name, m_publicId, m_systemId);
57
}
57
}
58
58
59
void DocumentType::insertedIntoDocument()
59
Node::InsertionNotificationRequest DocumentType::insertedInto(Node* insertionPoint)
60
{
60
{
61
    Node::insertedInto(insertionPoint);
62
    if (!insertionPoint->inDocument())
63
        return InsertionDone;
64
61
    // Our document node can be null if we were created by a DOMImplementation.  We use the parent() instead.
65
    // Our document node can be null if we were created by a DOMImplementation.  We use the parent() instead.
62
    ASSERT(parentNode() && parentNode()->isDocumentNode());
66
    ASSERT(parentNode() && parentNode()->isDocumentNode());
63
    if (parentNode() && parentNode()->isDocumentNode()) {
67
    if (parentNode() && parentNode()->isDocumentNode()) {
Lines 65-78 void DocumentType::insertedIntoDocument() a/Source/WebCore/dom/DocumentType.cpp_sec2
65
        if (!doc->doctype())
69
        if (!doc->doctype())
66
            doc->setDocType(this);
70
            doc->setDocType(this);
67
    }
71
    }
68
    Node::insertedIntoDocument();
72
73
    return InsertionDone;
69
}
74
}
70
75
71
void DocumentType::removedFromDocument()
76
void DocumentType::removedFrom(Node* insertionPoint)
72
{
77
{
73
    if (document() && document()->doctype() == this)
78
    if (insertionPoint->inDocument() && document() && document()->doctype() == this)
74
        document()->setDocType(0);
79
        document()->setDocType(0);
75
    Node::removedFromDocument();
80
    Node::removedFrom(insertionPoint);
76
}
81
}
77
82
78
}
83
}
- a/Source/WebCore/dom/DocumentType.h -2 / +2 lines
Lines 54-61 private: a/Source/WebCore/dom/DocumentType.h_sec1
54
    virtual NodeType nodeType() const;
54
    virtual NodeType nodeType() const;
55
    virtual PassRefPtr<Node> cloneNode(bool deep);
55
    virtual PassRefPtr<Node> cloneNode(bool deep);
56
56
57
    virtual void insertedIntoDocument();
57
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
58
    virtual void removedFromDocument();
58
    virtual void removedFrom(Node*) OVERRIDE;
59
59
60
    OwnPtr<NamedNodeMap> m_entities;
60
    OwnPtr<NamedNodeMap> m_entities;
61
    OwnPtr<NamedNodeMap> m_notations;
61
    OwnPtr<NamedNodeMap> m_notations;
- a/Source/WebCore/dom/Element.cpp -41 / +26 lines
Lines 881-893 void Element::willRemove() a/Source/WebCore/dom/Element.cpp_sec1
881
    ContainerNode::willRemove();
881
    ContainerNode::willRemove();
882
}
882
}
883
883
884
void Element::insertedIntoDocument()
884
Node::InsertionNotificationRequest Element::insertedInto(Node* insertionPoint)
885
{
885
{
886
    // need to do superclass processing first so inDocument() is true
886
    // need to do superclass processing first so inDocument() is true
887
    // by the time we reach updateId
887
    // by the time we reach updateId
888
    ContainerNode::insertedIntoDocument();
888
    ContainerNode::insertedInto(insertionPoint);
889
    if (ShadowTree* tree = shadowTree())
889
890
        tree->insertedIntoDocument();
890
#if ENABLE(FULLSCREEN_API)
891
    if (containsFullScreenElement() && parentElement() && !parentElement()->containsFullScreenElement())
892
        setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(true);
893
#endif
894
895
    if (!insertionPoint->inDocument())
896
        return InsertionDone;
891
897
892
    if (m_attributeData) {
898
    if (m_attributeData) {
893
        if (hasID()) {
899
        if (hasID()) {
Lines 901-951 void Element::insertedIntoDocument() a/Source/WebCore/dom/Element.cpp_sec2
901
                updateName(nullAtom, nameItem->value());
907
                updateName(nullAtom, nameItem->value());
902
        }
908
        }
903
    }
909
    }
910
911
    return InsertionDone;
904
}
912
}
905
913
906
void Element::removedFromDocument()
914
void Element::removedFrom(Node* insertionPoint)
907
{
915
{
908
    setSavedLayerScrollOffset(IntSize());
916
    setSavedLayerScrollOffset(IntSize());
909
917
910
    if (m_attributeData) {
918
    if (insertionPoint->inDocument()) {
911
        if (hasID()) {
919
        if (m_attributeData) {
912
            Attribute* idItem = getAttributeItem(document()->idAttributeName());
920
            if (hasID()) {
913
            if (idItem && !idItem->isNull())
921
                Attribute* idItem = getAttributeItem(document()->idAttributeName());
914
                updateId(idItem->value(), nullAtom);
922
                if (idItem && !idItem->isNull())
915
        }
923
                    updateId(idItem->value(), nullAtom);
916
        if (hasName()) {
924
            }
917
            Attribute* nameItem = getAttributeItem(HTMLNames::nameAttr);
925
            if (hasName()) {
918
            if (nameItem && !nameItem->isNull())
926
                Attribute* nameItem = getAttributeItem(HTMLNames::nameAttr);
919
                updateName(nameItem->value(), nullAtom);
927
                if (nameItem && !nameItem->isNull())
928
                    updateName(nameItem->value(), nullAtom);
929
            }
920
        }
930
        }
921
    }
931
    }
922
932
923
    ContainerNode::removedFromDocument();
933
    ContainerNode::removedFrom(insertionPoint);
924
    if (ShadowTree* tree = shadowTree())
925
        tree->removedFromDocument();
926
}
927
928
void Element::insertedIntoTree(bool deep)
929
{
930
    ContainerNode::insertedIntoTree(deep);
931
    if (!deep)
932
        return;
933
    if (ShadowTree* tree = shadowTree())
934
        tree->insertedIntoTree(true);
935
936
#if ENABLE(FULLSCREEN_API)
937
    if (containsFullScreenElement() && parentElement() && !parentElement()->containsFullScreenElement())
938
        setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(true);
939
#endif
940
}
941
942
void Element::removedFromTree(bool deep)
943
{
944
    ContainerNode::removedFromTree(deep);
945
    if (!deep)
946
        return;
947
    if (ShadowTree* tree = shadowTree())
948
        tree->removedFromTree(true);
949
}
934
}
950
935
951
void Element::attach()
936
void Element::attach()
- a/Source/WebCore/dom/Element.h -4 / +2 lines
Lines 413-422 protected: a/Source/WebCore/dom/Element.h_sec1
413
    }
413
    }
414
414
415
    virtual void willRemove();
415
    virtual void willRemove();
416
    virtual void insertedIntoDocument();
416
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
417
    virtual void removedFromDocument();
417
    virtual void removedFrom(Node*) OVERRIDE;
418
    virtual void insertedIntoTree(bool);
419
    virtual void removedFromTree(bool);
420
    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
418
    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
421
    virtual bool willRecalcStyle(StyleChange) { return true; }
419
    virtual bool willRecalcStyle(StyleChange) { return true; }
422
    virtual void didRecalcStyle(StyleChange) { }
420
    virtual void didRecalcStyle(StyleChange) { }
- a/Source/WebCore/dom/Node.cpp -4 / +9 lines
Lines 2387-2400 ScriptExecutionContext* Node::scriptExecutionContext() const a/Source/WebCore/dom/Node.cpp_sec1
2387
    return document();
2387
    return document();
2388
}
2388
}
2389
2389
2390
void Node::insertedIntoDocument()
2390
Node::InsertionNotificationRequest Node::insertedInto(Node* insertionPoint)
2391
{
2391
{
2392
    setFlag(InDocumentFlag);
2392
    ASSERT(insertionPoint->inDocument() || isContainerNode());
2393
    if (insertionPoint->inDocument())
2394
        setFlag(InDocumentFlag);
2395
    return InsertionDone;
2393
}
2396
}
2394
2397
2395
void Node::removedFromDocument()
2398
void Node::removedFrom(Node* insertionPoint)
2396
{
2399
{
2397
    clearFlag(InDocumentFlag);
2400
    ASSERT(insertionPoint->inDocument() || isContainerNode());
2401
    if (insertionPoint->inDocument())
2402
        clearFlag(InDocumentFlag);
2398
}
2403
}
2399
2404
2400
void Node::didMoveToNewDocument(Document* oldDocument)
2405
void Node::didMoveToNewDocument(Document* oldDocument)
- a/Source/WebCore/dom/Node.h -10 / +24 lines
Lines 226-231 public: a/Source/WebCore/dom/Node.h_sec1
226
    // Node's parent, shadow tree host.
226
    // Node's parent, shadow tree host.
227
    ContainerNode* parentOrHostNode() const;
227
    ContainerNode* parentOrHostNode() const;
228
    Element* parentOrHostElement() const;
228
    Element* parentOrHostElement() const;
229
    Node* highestAncestor() const;
230
229
    // Use when it's guaranteed to that shadowHost is 0.
231
    // Use when it's guaranteed to that shadowHost is 0.
230
    ContainerNode* parentNodeGuaranteedHostFree() const;
232
    ContainerNode* parentNodeGuaranteedHostFree() const;
231
    // Returns the parent node, but 0 if the parent node is a ShadowRoot.
233
    // Returns the parent node, but 0 if the parent node is a ShadowRoot.
Lines 505-526 public: a/Source/WebCore/dom/Node.h_sec2
505
507
506
    // -----------------------------------------------------------------------------
508
    // -----------------------------------------------------------------------------
507
    // Notification of document structure changes (see ContainerNode.h for more notification methods)
509
    // Notification of document structure changes (see ContainerNode.h for more notification methods)
508
509
    // Notifies the node that it has been inserted into the document. This is called during document parsing, and also
510
    // when a node is added through the DOM methods insertBefore(), appendChild() or replaceChild(). Note that this only
511
    // happens when the node becomes part of the document tree, i.e. only when the document is actually an ancestor of
512
    // the node. The call happens _after_ the node has been added to the tree.
513
    //
510
    //
511
    // At first, WebKit notifies the node that it has been inserted into the document. This is called during document parsing, and also
512
    // when a node is added through the DOM methods insertBefore(), appendChild() or replaceChild(). The call happens _after_ the node has been added to the tree.
514
    // This is similar to the DOMNodeInsertedIntoDocument DOM event, but does not require the overhead of event
513
    // This is similar to the DOMNodeInsertedIntoDocument DOM event, but does not require the overhead of event
515
    // dispatching.
514
    // dispatching.
516
    virtual void insertedIntoDocument();
515
    //
516
    // Webkit notifies this callback regardless if the subtree of the node is a document tree or a floating subtree.
517
    // Implementation can determine the type of subtree by seeing insertionPoint->inDocument().
518
    // For a performance reason, notifications are delivered only to ContainerNode subclasses if the insertionPoint is out of document.
519
    //
520
    // There are another callback named didNotifyDescendantInseretions(), which is called after all the descendant is notified.
521
    // Only a few subclasses actually need this. To utilize this, the node should return InsertionShouldCallDidNotifyDescendantInseretions
522
    // from insrtedInto().
523
    //
524
    enum InsertionNotificationRequest {
525
        InsertionDone,
526
        InsertionShouldCallDidNotifyDescendantInseretions
527
    };
517
528
518
    // Notifies the node that it is no longer part of the document tree, i.e. when the document is no longer an ancestor
529
    virtual InsertionNotificationRequest insertedInto(Node* insertionPoint);
519
    // node.
530
    virtual void didNotifyDescendantInseretions(Node*) { }
531
532
    // Notifies the node that it is no longer part of the tree.
520
    //
533
    //
521
    // This is similar to the DOMNodeRemovedFromDocument DOM event, but does not require the overhead of event
534
    // This is a dual of insertedInto(), and is similar to the DOMNodeRemovedFromDocument DOM event, but does not require the overhead of event
522
    // dispatching, and is called _after_ the node is removed from the tree.
535
    // dispatching, and is called _after_ the node is removed from the tree.
523
    virtual void removedFromDocument();
536
    //
537
    virtual void removedFrom(Node* insertionPoint);
524
538
525
#ifndef NDEBUG
539
#ifndef NDEBUG
526
    virtual void formatForDebugger(char* buffer, unsigned length) const;
540
    virtual void formatForDebugger(char* buffer, unsigned length) const;
- a/Source/WebCore/dom/ProcessingInstruction.cpp -5 / +10 lines
Lines 282-298 void ProcessingInstruction::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) a/Source/WebCore/dom/ProcessingInstruction.cpp_sec1
282
    addSubresourceURL(urls, sheet()->baseURL());
282
    addSubresourceURL(urls, sheet()->baseURL());
283
}
283
}
284
284
285
void ProcessingInstruction::insertedIntoDocument()
285
Node::InsertionNotificationRequest ProcessingInstruction::insertedInto(Node* insertionPoint)
286
{
286
{
287
    Node::insertedIntoDocument();
287
    Node::insertedInto(insertionPoint);
288
    if (!insertionPoint->inDocument())
289
        return InsertionDone;
288
    document()->addStyleSheetCandidateNode(this, m_createdByParser);
290
    document()->addStyleSheetCandidateNode(this, m_createdByParser);
289
    checkStyleSheet();
291
    checkStyleSheet();
292
    return InsertionDone;
290
}
293
}
291
294
292
void ProcessingInstruction::removedFromDocument()
295
void ProcessingInstruction::removedFrom(Node* insertionPoint)
293
{
296
{
294
    Node::removedFromDocument();
297
    Node::removedFrom(insertionPoint);
295
298
    if (!insertionPoint->inDocument())
299
        return;
300
    
296
    document()->removeStyleSheetCandidateNode(this);
301
    document()->removeStyleSheetCandidateNode(this);
297
302
298
    if (m_sheet) {
303
    if (m_sheet) {
- a/Source/WebCore/dom/ProcessingInstruction.h -2 / +2 lines
Lines 64-71 private: a/Source/WebCore/dom/ProcessingInstruction.h_sec1
64
    virtual bool offsetInCharacters() const;
64
    virtual bool offsetInCharacters() const;
65
    virtual int maxCharacterOffset() const;
65
    virtual int maxCharacterOffset() const;
66
66
67
    virtual void insertedIntoDocument();
67
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
68
    virtual void removedFromDocument();
68
    virtual void removedFrom(Node*) OVERRIDE;
69
69
70
    void checkStyleSheet();
70
    void checkStyleSheet();
71
    virtual void setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet*);
71
    virtual void setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet*);
- a/Source/WebCore/dom/ScriptElement.cpp -2 / +2 lines
Lines 77-85 ScriptElement::~ScriptElement() a/Source/WebCore/dom/ScriptElement.cpp_sec1
77
    stopLoadRequest();
77
    stopLoadRequest();
78
}
78
}
79
79
80
void ScriptElement::insertedIntoDocument()
80
void ScriptElement::insertedInto(Node* insertionPoint)
81
{
81
{
82
    if (!m_parserInserted)
82
    if (insertionPoint->inDocument() && !m_parserInserted)
83
        prepareScript(); // FIXME: Provide a real starting line number here.
83
        prepareScript(); // FIXME: Provide a real starting line number here.
84
}
84
}
85
85
- a/Source/WebCore/dom/ScriptElement.h -1 / +2 lines
Lines 29-34 namespace WebCore { a/Source/WebCore/dom/ScriptElement.h_sec1
29
29
30
class CachedScript;
30
class CachedScript;
31
class Element;
31
class Element;
32
class Node;
32
class ScriptElement;
33
class ScriptElement;
33
class ScriptSourceCode;
34
class ScriptSourceCode;
34
35
Lines 66-72 protected: a/Source/WebCore/dom/ScriptElement.h_sec2
66
    bool forceAsync() const { return m_forceAsync; }
67
    bool forceAsync() const { return m_forceAsync; }
67
68
68
    // Helper functions used by our parent classes.
69
    // Helper functions used by our parent classes.
69
    void insertedIntoDocument();
70
    void insertedInto(Node*);
70
    void childrenChanged();
71
    void childrenChanged();
71
    void handleSourceAttribute(const String& sourceUrl);
72
    void handleSourceAttribute(const String& sourceUrl);
72
    void handleAsyncAttribute();
73
    void handleAsyncAttribute();
- a/Source/WebCore/dom/ShadowTree.cpp -43 / +3 lines
Lines 28-33 a/Source/WebCore/dom/ShadowTree.cpp_sec1
28
#include "ShadowTree.h"
28
#include "ShadowTree.h"
29
29
30
#include "CSSStyleSelector.h"
30
#include "CSSStyleSelector.h"
31
#include "ContainerNodeAlgorithms.h"
31
#include "Document.h"
32
#include "Document.h"
32
#include "Element.h"
33
#include "Element.h"
33
#include "HTMLShadowElement.h"
34
#include "HTMLShadowElement.h"
Lines 38-52 a/Source/WebCore/dom/ShadowTree.cpp_sec2
38
39
39
namespace WebCore {
40
namespace WebCore {
40
41
41
class ShadowRootVector : public Vector<RefPtr<ShadowRoot> > {
42
public:
43
    explicit ShadowRootVector(ShadowTree* tree)
44
    {
45
        for (ShadowRoot* root = tree->youngestShadowRoot(); root; root = root->olderShadowRoot())
46
            append(root);
47
    }
48
};
49
50
ShadowTree::ShadowTree()
42
ShadowTree::ShadowTree()
51
    : m_needsRecalculateContent(false)
43
    : m_needsRecalculateContent(false)
52
{
44
{
Lines 85-93 void ShadowTree::addShadowRoot(Element* shadowHost, PassRefPtr<ShadowRoot> shado a/Source/WebCore/dom/ShadowTree.cpp_sec3
85
        return;
77
        return;
86
78
87
    shadowRoot->setShadowHost(shadowHost);
79
    shadowRoot->setShadowHost(shadowHost);
80
    ChildNodeInsertionNotifier(shadowHost).notify(shadowRoot.get());
88
81
89
    if (shadowHost->inDocument())
90
        shadowRoot->insertedIntoDocument();
91
    if (shadowHost->attached()) {
82
    if (shadowHost->attached()) {
92
        shadowRoot->lazyAttach();
83
        shadowRoot->lazyAttach();
93
        detach();
84
        detach();
Lines 117-160 void ShadowTree::removeAllShadowRoots() a/Source/WebCore/dom/ShadowTree.cpp_sec4
117
        oldRoot->setPrev(0);
108
        oldRoot->setPrev(0);
118
        oldRoot->setNext(0);
109
        oldRoot->setNext(0);
119
        shadowHost->document()->adoptIfNeeded(oldRoot.get());
110
        shadowHost->document()->adoptIfNeeded(oldRoot.get());
120
        if (oldRoot->inDocument())
111
        ChildNodeRemovalNotifier(shadowHost).notify(oldRoot.get());
121
            oldRoot->removedFromDocument();
122
        else
123
            oldRoot->removedFromTree(true);
124
    }
112
    }
125
113
126
    if (shadowHost->attached())
114
    if (shadowHost->attached())
127
        shadowHost->attachChildrenLazily();
115
        shadowHost->attachChildrenLazily();
128
}
116
}
129
117
130
void ShadowTree::insertedIntoDocument()
131
{
132
    ShadowRootVector roots(this);
133
    for (size_t i = 0; i < roots.size(); ++i)
134
        roots[i]->insertedIntoDocument();
135
}
136
137
void ShadowTree::removedFromDocument()
138
{
139
    ShadowRootVector roots(this);
140
    for (size_t i = 0; i < roots.size(); ++i)
141
        roots[i]->removedFromDocument();
142
}
143
144
void ShadowTree::insertedIntoTree(bool deep)
145
{
146
    ShadowRootVector roots(this);
147
    for (size_t i = 0; i < roots.size(); ++i)
148
        roots[i]->insertedIntoTree(deep);
149
}
150
151
void ShadowTree::removedFromTree(bool deep)
152
{
153
    ShadowRootVector roots(this);
154
    for (size_t i = 0; i < roots.size(); ++i)
155
        roots[i]->removedFromTree(deep);
156
}
157
158
void ShadowTree::willRemove()
118
void ShadowTree::willRemove()
159
{
119
{
160
    ShadowRootVector roots(this);
120
    ShadowRootVector roots(this);
- a/Source/WebCore/dom/ShadowTree.h -4 / +10 lines
Lines 34-39 a/Source/WebCore/dom/ShadowTree.h_sec1
34
#include <wtf/Noncopyable.h>
34
#include <wtf/Noncopyable.h>
35
#include <wtf/OwnPtr.h>
35
#include <wtf/OwnPtr.h>
36
#include <wtf/PassRefPtr.h>
36
#include <wtf/PassRefPtr.h>
37
#include <wtf/Vector.h>
37
38
38
namespace WebCore {
39
namespace WebCore {
39
40
Lines 57-66 public: a/Source/WebCore/dom/ShadowTree.h_sec2
57
    void addShadowRoot(Element* shadowHost, PassRefPtr<ShadowRoot>, ExceptionCode&);
58
    void addShadowRoot(Element* shadowHost, PassRefPtr<ShadowRoot>, ExceptionCode&);
58
    void removeAllShadowRoots();
59
    void removeAllShadowRoots();
59
60
60
    void insertedIntoDocument();
61
    void removedFromDocument();
62
    void insertedIntoTree(bool deep);
63
    void removedFromTree(bool deep);
64
    void willRemove();
61
    void willRemove();
65
62
66
    void setParentTreeScope(TreeScope*);
63
    void setParentTreeScope(TreeScope*);
Lines 130-135 inline Element* ShadowTree::host() const a/Source/WebCore/dom/ShadowTree.h_sec3
130
    return youngestShadowRoot()->host();
127
    return youngestShadowRoot()->host();
131
}
128
}
132
129
130
class ShadowRootVector : public Vector<RefPtr<ShadowRoot> > {
131
public:
132
    explicit ShadowRootVector(ShadowTree* tree)
133
    {
134
        for (ShadowRoot* root = tree->youngestShadowRoot(); root; root = root->olderShadowRoot())
135
            append(root);
136
    }
137
};
138
133
} // namespace
139
} // namespace
134
140
135
#endif
141
#endif
- a/Source/WebCore/html/FormAssociatedElement.cpp -27 / +12 lines
Lines 60-77 void FormAssociatedElement::didMoveToNewDocument(Document* oldDocument) a/Source/WebCore/html/FormAssociatedElement.cpp_sec1
60
        oldDocument->unregisterFormElementWithFormAttribute(this);
60
        oldDocument->unregisterFormElementWithFormAttribute(this);
61
}
61
}
62
62
63
void FormAssociatedElement::insertedIntoDocument()
63
void FormAssociatedElement::insertedInto(Node* insertionPoint)
64
{
64
{
65
    resetFormOwner();
66
    if (!insertionPoint->inDocument())
67
        return;
68
65
    HTMLElement* element = toHTMLElement(this);
69
    HTMLElement* element = toHTMLElement(this);
66
    if (element->fastHasAttribute(formAttr))
70
    if (element->fastHasAttribute(formAttr))
67
        element->document()->registerFormElementWithFormAttribute(this);
71
        element->document()->registerFormElementWithFormAttribute(this);
68
}
72
}
69
73
70
void FormAssociatedElement::removedFromDocument()
74
void FormAssociatedElement::removedFrom(Node* insertionPoint)
71
{
75
{
72
    HTMLElement* element = toHTMLElement(this);
76
    HTMLElement* element = toHTMLElement(this);
73
    if (element->fastHasAttribute(formAttr))
77
    if (insertionPoint->inDocument() && element->fastHasAttribute(formAttr))
74
        element->document()->unregisterFormElementWithFormAttribute(this);
78
        element->document()->unregisterFormElementWithFormAttribute(this);
79
    // If the form and element are both in the same tree, preserve the connection to the form.
80
    // Otherwise, null out our form and remove ourselves from the form's list of elements.
81
    if (m_form && element->highestAncestor() != m_form->highestAncestor())
82
        setForm(0);
75
}
83
}
76
84
77
HTMLFormElement* FormAssociatedElement::findAssociatedForm(const HTMLElement* element, HTMLFormElement* currentAssociatedForm)
85
HTMLFormElement* FormAssociatedElement::findAssociatedForm(const HTMLElement* element, HTMLFormElement* currentAssociatedForm)
Lines 95-127 HTMLFormElement* FormAssociatedElement::findAssociatedForm(const HTMLElement* el a/Source/WebCore/html/FormAssociatedElement.cpp_sec2
95
    return currentAssociatedForm;
103
    return currentAssociatedForm;
96
}
104
}
97
105
98
void FormAssociatedElement::insertedIntoTree()
99
{
100
    resetFormOwner();
101
}
102
103
static inline Node* findRoot(Node* n)
104
{
105
    Node* root = n;
106
    for (; n; n = n->parentNode())
107
        root = n;
108
    return root;
109
}
110
111
void FormAssociatedElement::removedFromTree()
112
{
113
    HTMLElement* element = toHTMLElement(this);
114
115
    // If the form and element are both in the same tree, preserve the connection to the form.
116
    // Otherwise, null out our form and remove ourselves from the form's list of elements.
117
    if (m_form && findRoot(element) != findRoot(m_form))
118
        setForm(0);
119
}
120
121
void FormAssociatedElement::formRemovedFromTree(const Node* formRoot)
106
void FormAssociatedElement::formRemovedFromTree(const Node* formRoot)
122
{
107
{
123
    ASSERT(m_form);
108
    ASSERT(m_form);
124
    if (findRoot(toHTMLElement(this)) != formRoot)
109
    if (toHTMLElement(this)->highestAncestor() != formRoot)
125
        setForm(0);
110
        setForm(0);
126
}
111
}
127
112
- a/Source/WebCore/html/FormAssociatedElement.h -4 / +2 lines
Lines 63-72 public: a/Source/WebCore/html/FormAssociatedElement.h_sec1
63
protected:
63
protected:
64
    FormAssociatedElement();
64
    FormAssociatedElement();
65
65
66
    void insertedIntoTree();
66
    void insertedInto(Node*);
67
    void removedFromTree();
67
    void removedFrom(Node*);
68
    void insertedIntoDocument();
69
    void removedFromDocument();
70
    void didMoveToNewDocument(Document* oldDocument);
68
    void didMoveToNewDocument(Document* oldDocument);
71
69
72
    void setForm(HTMLFormElement*);
70
    void setForm(HTMLFormElement*);
- a/Source/WebCore/html/HTMLBaseElement.cpp -6 / +9 lines
Lines 50-65 void HTMLBaseElement::parseAttribute(Attribute* attribute) a/Source/WebCore/html/HTMLBaseElement.cpp_sec1
50
        HTMLElement::parseAttribute(attribute);
50
        HTMLElement::parseAttribute(attribute);
51
}
51
}
52
52
53
void HTMLBaseElement::insertedIntoDocument()
53
Node::InsertionNotificationRequest HTMLBaseElement::insertedInto(Node* insertionPoint)
54
{
54
{
55
    HTMLElement::insertedIntoDocument();
55
    HTMLElement::insertedInto(insertionPoint);
56
    document()->processBaseElement();
56
    if (insertionPoint->inDocument())
57
        document()->processBaseElement();
58
    return InsertionDone;
57
}
59
}
58
60
59
void HTMLBaseElement::removedFromDocument()
61
void HTMLBaseElement::removedFrom(Node* insertionPoint)
60
{
62
{
61
    HTMLElement::removedFromDocument();
63
    HTMLElement::removedFrom(insertionPoint);
62
    document()->processBaseElement();
64
    if (insertionPoint->inDocument())
65
        document()->processBaseElement();
63
}
66
}
64
67
65
bool HTMLBaseElement::isURLAttribute(Attribute* attribute) const
68
bool HTMLBaseElement::isURLAttribute(Attribute* attribute) const
- a/Source/WebCore/html/HTMLBaseElement.h -2 / +2 lines
Lines 37-44 private: a/Source/WebCore/html/HTMLBaseElement.h_sec1
37
    virtual String target() const;
37
    virtual String target() const;
38
    virtual bool isURLAttribute(Attribute*) const;
38
    virtual bool isURLAttribute(Attribute*) const;
39
    virtual void parseAttribute(Attribute*) OVERRIDE;
39
    virtual void parseAttribute(Attribute*) OVERRIDE;
40
    virtual void insertedIntoDocument();
40
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
41
    virtual void removedFromDocument();
41
    virtual void removedFrom(Node*) OVERRIDE;
42
};
42
};
43
43
44
} // namespace
44
} // namespace
- a/Source/WebCore/html/HTMLBodyElement.cpp -2 / +9 lines
Lines 152-161 void HTMLBodyElement::parseAttribute(Attribute* attr) a/Source/WebCore/html/HTMLBodyElement.cpp_sec1
152
        HTMLElement::parseAttribute(attr);
152
        HTMLElement::parseAttribute(attr);
153
}
153
}
154
154
155
void HTMLBodyElement::insertedIntoDocument()
155
Node::InsertionNotificationRequest HTMLBodyElement::insertedInto(Node* insertionPoint)
156
{
156
{
157
    HTMLElement::insertedIntoDocument();
157
    HTMLElement::insertedInto(insertionPoint);
158
    if (insertionPoint->inDocument())
159
        return InsertionShouldCallDidNotifyDescendantInseretions;
160
    return InsertionDone;
161
}
158
162
163
void HTMLBodyElement::didNotifyDescendantInseretions(Node* insertionPoint)
164
{
165
    ASSERT_UNUSED(insertionPoint, insertionPoint->inDocument());
159
    ASSERT(document());
166
    ASSERT(document());
160
167
161
    // FIXME: Perhaps this code should be in attach() instead of here.
168
    // FIXME: Perhaps this code should be in attach() instead of here.
- a/Source/WebCore/html/HTMLBodyElement.h -1 / +2 lines
Lines 74-80 private: a/Source/WebCore/html/HTMLBodyElement.h_sec1
74
    virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
74
    virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
75
    virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
75
    virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
76
76
77
    virtual void insertedIntoDocument();
77
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
78
    virtual void didNotifyDescendantInseretions(Node*) OVERRIDE;
78
    
79
    
79
    virtual bool isURLAttribute(Attribute*) const;
80
    virtual bool isURLAttribute(Attribute*) const;
80
    
81
    
- a/Source/WebCore/html/HTMLFormControlElement.cpp -18 / +7 lines
Lines 221-249 void HTMLFormControlElement::didMoveToNewDocument(Document* oldDocument) a/Source/WebCore/html/HTMLFormControlElement.cpp_sec1
221
    HTMLElement::didMoveToNewDocument(oldDocument);
221
    HTMLElement::didMoveToNewDocument(oldDocument);
222
}
222
}
223
223
224
void HTMLFormControlElement::insertedIntoTree(bool deep)
224
Node::InsertionNotificationRequest HTMLFormControlElement::insertedInto(Node* insertionPoint)
225
{
225
{
226
    FormAssociatedElement::insertedIntoTree();
226
    HTMLElement::insertedInto(insertionPoint);
227
    HTMLElement::insertedIntoTree(deep);
227
    FormAssociatedElement::insertedInto(insertionPoint);
228
    return InsertionDone;
228
}
229
}
229
230
230
void HTMLFormControlElement::removedFromTree(bool deep)
231
void HTMLFormControlElement::removedFrom(Node* insertionPoint)
231
{
232
{
232
    m_fieldSetAncestorValid = false;
233
    m_fieldSetAncestorValid = false;
233
    FormAssociatedElement::removedFromTree();
234
    HTMLElement::removedFrom(insertionPoint);
234
    HTMLElement::removedFromTree(deep);
235
    FormAssociatedElement::removedFrom(insertionPoint);
235
}
236
237
void HTMLFormControlElement::insertedIntoDocument()
238
{
239
    HTMLElement::insertedIntoDocument();
240
    FormAssociatedElement::insertedIntoDocument();
241
}
242
243
void HTMLFormControlElement::removedFromDocument()
244
{
245
    HTMLElement::removedFromDocument();
246
    FormAssociatedElement::removedFromDocument();
247
}
236
}
248
237
249
const AtomicString& HTMLFormControlElement::formControlName() const
238
const AtomicString& HTMLFormControlElement::formControlName() const
- a/Source/WebCore/html/HTMLFormControlElement.h -4 / +2 lines
Lines 120-129 protected: a/Source/WebCore/html/HTMLFormControlElement.h_sec1
120
    virtual void requiredAttributeChanged();
120
    virtual void requiredAttributeChanged();
121
    virtual void disabledAttributeChanged();
121
    virtual void disabledAttributeChanged();
122
    virtual void attach();
122
    virtual void attach();
123
    virtual void insertedIntoTree(bool deep);
123
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
124
    virtual void removedFromTree(bool deep);
124
    virtual void removedFrom(Node*) OVERRIDE;
125
    virtual void insertedIntoDocument();
126
    virtual void removedFromDocument();
127
    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
125
    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
128
126
129
    virtual bool supportsFocus() const;
127
    virtual bool supportsFocus() const;
- a/Source/WebCore/html/HTMLFormElement.cpp -10 / +12 lines
Lines 130-147 bool HTMLFormElement::rendererIsNeeded(const NodeRenderingContext& context) a/Source/WebCore/html/HTMLFormElement.cpp_sec1
130
    return formIsTablePart;
130
    return formIsTablePart;
131
}
131
}
132
132
133
void HTMLFormElement::insertedIntoDocument()
133
Node::InsertionNotificationRequest HTMLFormElement::insertedInto(Node* insertionPoint)
134
{
134
{
135
    HTMLElement::insertedIntoDocument();
135
    HTMLElement::insertedInto(insertionPoint);
136
136
    if (insertionPoint->inDocument())
137
    if (hasID())
137
        return InsertionShouldCallDidNotifyDescendantInseretions;
138
        document()->resetFormElementsOwner();
138
    return InsertionDone;
139
}
139
}
140
140
141
void HTMLFormElement::removedFromDocument()
141
void HTMLFormElement::didNotifyDescendantInseretions(Node* insertionPoint)
142
{
142
{
143
    HTMLElement::removedFromDocument();
143
    ASSERT(insertionPoint->inDocument());
144
144
    HTMLElement::didNotifyDescendantInseretions(insertionPoint);
145
    if (hasID())
145
    if (hasID())
146
        document()->resetFormElementsOwner();
146
        document()->resetFormElementsOwner();
147
}
147
}
Lines 154-166 static inline Node* findRoot(Node* n) a/Source/WebCore/html/HTMLFormElement.cpp_sec2
154
    return root;
154
    return root;
155
}
155
}
156
156
157
void HTMLFormElement::removedFromTree(bool deep)
157
void HTMLFormElement::removedFrom(Node* insertionPoint)
158
{
158
{
159
    Node* root = findRoot(this);
159
    Node* root = findRoot(this);
160
    Vector<FormAssociatedElement*> associatedElements(m_associatedElements);
160
    Vector<FormAssociatedElement*> associatedElements(m_associatedElements);
161
    for (unsigned i = 0; i < associatedElements.size(); ++i)
161
    for (unsigned i = 0; i < associatedElements.size(); ++i)
162
        associatedElements[i]->formRemovedFromTree(root);
162
        associatedElements[i]->formRemovedFromTree(root);
163
    HTMLElement::removedFromTree(deep);
163
    HTMLElement::removedFrom(insertionPoint);
164
    if (insertionPoint->inDocument() && hasID())
165
        document()->resetFormElementsOwner();
164
}
166
}
165
167
166
void HTMLFormElement::handleLocalEvents(Event* event)
168
void HTMLFormElement::handleLocalEvents(Event* event)
- a/Source/WebCore/html/HTMLFormElement.h -3 / +3 lines
Lines 115-123 private: a/Source/WebCore/html/HTMLFormElement.h_sec1
115
    HTMLFormElement(const QualifiedName&, Document*);
115
    HTMLFormElement(const QualifiedName&, Document*);
116
116
117
    virtual bool rendererIsNeeded(const NodeRenderingContext&);
117
    virtual bool rendererIsNeeded(const NodeRenderingContext&);
118
    virtual void insertedIntoDocument();
118
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
119
    virtual void removedFromDocument();
119
    virtual void didNotifyDescendantInseretions(Node*) OVERRIDE;
120
    virtual void removedFromTree(bool deep) OVERRIDE;
120
    virtual void removedFrom(Node*) OVERRIDE;
121
121
122
    virtual void handleLocalEvents(Event*);
122
    virtual void handleLocalEvents(Event*);
123
123
- a/Source/WebCore/html/HTMLFrameElementBase.cpp -3 / +11 lines
Lines 153-161 void HTMLFrameElementBase::setNameAndOpenURL() a/Source/WebCore/html/HTMLFrameElementBase.cpp_sec1
153
    openURL();
153
    openURL();
154
}
154
}
155
155
156
void HTMLFrameElementBase::insertedIntoDocument()
156
Node::InsertionNotificationRequest HTMLFrameElementBase::insertedInto(Node* insertionPoint)
157
{
157
{
158
    HTMLFrameOwnerElement::insertedIntoDocument();
158
    HTMLFrameOwnerElement::insertedInto(insertionPoint);
159
    if (insertionPoint->inDocument())
160
        return InsertionShouldCallDidNotifyDescendantInseretions;
161
    return InsertionDone;
162
}
163
164
void HTMLFrameElementBase::didNotifyDescendantInseretions(Node* insertionPoint)
165
{
166
    ASSERT_UNUSED(insertionPoint, insertionPoint->inDocument());
159
167
160
    // DocumentFragments don't kick of any loads.
168
    // DocumentFragments don't kick of any loads.
161
    if (!document()->frame())
169
    if (!document()->frame())
Lines 165-171 void HTMLFrameElementBase::insertedIntoDocument() a/Source/WebCore/html/HTMLFrameElementBase.cpp_sec2
165
    // during attribute parsing *before* the normal parser machinery would
173
    // during attribute parsing *before* the normal parser machinery would
166
    // attach the element. To support this, we lazyAttach here, but only
174
    // attach the element. To support this, we lazyAttach here, but only
167
    // if we don't already have a renderer (if we're inserted
175
    // if we don't already have a renderer (if we're inserted
168
    // as part of a DocumentFragment, insertedIntoDocument from an earlier element
176
    // as part of a DocumentFragment, insertedInto from an earlier element
169
    // could have forced a style resolve and already attached us).
177
    // could have forced a style resolve and already attached us).
170
    if (!renderer())
178
    if (!renderer())
171
        lazyAttach(DoNotSetAttached);
179
        lazyAttach(DoNotSetAttached);
- a/Source/WebCore/html/HTMLFrameElementBase.h -1 / +2 lines
Lines 54-60 protected: a/Source/WebCore/html/HTMLFrameElementBase.h_sec1
54
    bool isURLAllowed() const;
54
    bool isURLAllowed() const;
55
55
56
    virtual void parseAttribute(Attribute*) OVERRIDE;
56
    virtual void parseAttribute(Attribute*) OVERRIDE;
57
    virtual void insertedIntoDocument();
57
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
58
    virtual void didNotifyDescendantInseretions(Node*) OVERRIDE;
58
    virtual void attach();
59
    virtual void attach();
59
60
60
private:
61
private:
- a/Source/WebCore/html/HTMLFrameSetElement.cpp -8 / +14 lines
Lines 210-227 bool HTMLFrameSetElement::willRecalcStyle(StyleChange) a/Source/WebCore/html/HTMLFrameSetElement.cpp_sec1
210
    return true;
210
    return true;
211
}
211
}
212
212
213
void HTMLFrameSetElement::insertedIntoDocument()
213
Node::InsertionNotificationRequest HTMLFrameSetElement::insertedInto(Node* insertionPoint)
214
{
214
{
215
    HTMLElement::insertedIntoDocument();
215
    HTMLElement::insertedInto(insertionPoint);
216
    if (Frame* frame = document()->frame())
216
    if (insertionPoint->inDocument()) {
217
        frame->loader()->client()->dispatchDidBecomeFrameset(document()->isFrameSet());
217
        if (Frame* frame = document()->frame())
218
            frame->loader()->client()->dispatchDidBecomeFrameset(document()->isFrameSet());
219
    }
220
221
    return InsertionDone;
218
}
222
}
219
223
220
void HTMLFrameSetElement::removedFromDocument()
224
void HTMLFrameSetElement::removedFrom(Node* insertionPoint)
221
{
225
{
222
    HTMLElement::removedFromDocument();
226
    HTMLElement::removedFrom(insertionPoint);
223
    if (Frame* frame = document()->frame())
227
    if (insertionPoint->inDocument()) {
224
        frame->loader()->client()->dispatchDidBecomeFrameset(document()->isFrameSet());
228
        if (Frame* frame = document()->frame())
229
            frame->loader()->client()->dispatchDidBecomeFrameset(document()->isFrameSet());
230
    }
225
}
231
}
226
232
227
} // namespace WebCore
233
} // namespace WebCore
- a/Source/WebCore/html/HTMLFrameSetElement.h -2 / +2 lines
Lines 79-86 private: a/Source/WebCore/html/HTMLFrameSetElement.h_sec1
79
79
80
    virtual bool willRecalcStyle(StyleChange);
80
    virtual bool willRecalcStyle(StyleChange);
81
81
82
    virtual void insertedIntoDocument();
82
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
83
    virtual void removedFromDocument();
83
    virtual void removedFrom(Node*) OVERRIDE;
84
84
85
    OwnArrayPtr<Length> m_rowLengths;
85
    OwnArrayPtr<Length> m_rowLengths;
86
    OwnArrayPtr<Length> m_colLengths;
86
    OwnArrayPtr<Length> m_colLengths;
- a/Source/WebCore/html/HTMLIFrameElement.cpp -8 / +7 lines
Lines 100-119 RenderObject* HTMLIFrameElement::createRenderer(RenderArena* arena, RenderStyle* a/Source/WebCore/html/HTMLIFrameElement.cpp_sec1
100
    return new (arena) RenderIFrame(this);
100
    return new (arena) RenderIFrame(this);
101
}
101
}
102
102
103
void HTMLIFrameElement::insertedIntoDocument()
103
Node::InsertionNotificationRequest HTMLIFrameElement::insertedInto(Node* insertionPoint)
104
{
104
{
105
    if (document()->isHTMLDocument())
105
    InsertionNotificationRequest result = HTMLFrameElementBase::insertedInto(insertionPoint);
106
    if (insertionPoint->inDocument() && document()->isHTMLDocument())
106
        static_cast<HTMLDocument*>(document())->addExtraNamedItem(m_name);
107
        static_cast<HTMLDocument*>(document())->addExtraNamedItem(m_name);
107
108
    return result;
108
    HTMLFrameElementBase::insertedIntoDocument();
109
}
109
}
110
110
111
void HTMLIFrameElement::removedFromDocument()
111
void HTMLIFrameElement::removedFrom(Node* insertionPoint)
112
{
112
{
113
    if (document()->isHTMLDocument())
113
    HTMLFrameElementBase::removedFrom(insertionPoint);
114
    if (insertionPoint->inDocument() && document()->isHTMLDocument())
114
        static_cast<HTMLDocument*>(document())->removeExtraNamedItem(m_name);
115
        static_cast<HTMLDocument*>(document())->removeExtraNamedItem(m_name);
115
116
    HTMLFrameElementBase::removedFromDocument();
117
}
116
}
118
117
119
#if ENABLE(MICRODATA)
118
#if ENABLE(MICRODATA)
- a/Source/WebCore/html/HTMLIFrameElement.h -2 / +2 lines
Lines 39-46 private: a/Source/WebCore/html/HTMLIFrameElement.h_sec1
39
    virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
39
    virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
40
    virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
40
    virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
41
41
42
    virtual void insertedIntoDocument();
42
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
43
    virtual void removedFromDocument();
43
    virtual void removedFrom(Node*) OVERRIDE;
44
    
44
    
45
    virtual bool rendererIsNeeded(const NodeRenderingContext&);
45
    virtual bool rendererIsNeeded(const NodeRenderingContext&);
46
    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
46
    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
- a/Source/WebCore/html/HTMLImageElement.cpp -14 / +9 lines
Lines 168-184 void HTMLImageElement::attach() a/Source/WebCore/html/HTMLImageElement.cpp_sec1
168
    }
168
    }
169
}
169
}
170
170
171
void HTMLImageElement::insertedIntoDocument()
171
Node::InsertionNotificationRequest HTMLImageElement::insertedInto(Node* insertionPoint)
172
{
173
    // If we have been inserted from a renderer-less document,
174
    // our loader may have not fetched the image, so do it now.
175
    if (!m_imageLoader.image())
176
        m_imageLoader.updateFromElement();
177
178
    HTMLElement::insertedIntoDocument();
179
}
180
181
void HTMLImageElement::insertedIntoTree(bool deep)
182
{
172
{
183
    if (!m_form) {
173
    if (!m_form) {
184
        // m_form can be non-null if it was set in constructor.
174
        // m_form can be non-null if it was set in constructor.
Lines 191-205 void HTMLImageElement::insertedIntoTree(bool deep) a/Source/WebCore/html/HTMLImageElement.cpp_sec2
191
        }
181
        }
192
    }
182
    }
193
183
194
    HTMLElement::insertedIntoTree(deep);
184
    // If we have been inserted from a renderer-less document,
185
    // our loader may have not fetched the image, so do it now.
186
    if (insertionPoint->inDocument() && !m_imageLoader.image())
187
        m_imageLoader.updateFromElement();
188
189
    return HTMLElement::insertedInto(insertionPoint);
195
}
190
}
196
191
197
void HTMLImageElement::removedFromTree(bool deep)
192
void HTMLImageElement::removedFrom(Node* insertionPoint)
198
{
193
{
199
    if (m_form)
194
    if (m_form)
200
        m_form->removeImgElement(this);
195
        m_form->removeImgElement(this);
201
    m_form = 0;
196
    m_form = 0;
202
    HTMLElement::removedFromTree(deep);
197
    HTMLElement::removedFrom(insertionPoint);
203
}
198
}
204
199
205
int HTMLImageElement::width(bool ignorePendingStylesheets)
200
int HTMLImageElement::width(bool ignorePendingStylesheets)
- a/Source/WebCore/html/HTMLImageElement.h -4 / +2 lines
Lines 99-108 private: a/Source/WebCore/html/HTMLImageElement.h_sec1
99
99
100
    virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
100
    virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
101
101
102
    virtual void insertedIntoDocument();
102
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
103
    virtual void insertedIntoTree(bool deep);
103
    virtual void removedFrom(Node*) OVERRIDE;
104
    virtual void removedFromTree(bool deep);
105
106
    virtual bool shouldRegisterAsNamedItem() const OVERRIDE { return true; }
104
    virtual bool shouldRegisterAsNamedItem() const OVERRIDE { return true; }
107
    virtual bool shouldRegisterAsExtraNamedItem() const OVERRIDE { return true; }
105
    virtual bool shouldRegisterAsExtraNamedItem() const OVERRIDE { return true; }
108
106
- a/Source/WebCore/html/HTMLInputElement.cpp -6 / +9 lines
Lines 1454-1471 void HTMLInputElement::didChangeForm() a/Source/WebCore/html/HTMLInputElement.cpp_sec1
1454
    addToRadioButtonGroup();
1454
    addToRadioButtonGroup();
1455
}
1455
}
1456
1456
1457
void HTMLInputElement::insertedIntoDocument()
1457
Node::InsertionNotificationRequest HTMLInputElement::insertedInto(Node* insertionPoint)
1458
{
1458
{
1459
    HTMLTextFormControlElement::insertedIntoDocument();
1459
    HTMLTextFormControlElement::insertedInto(insertionPoint);
1460
    if (!insertionPoint->inDocument())
1461
        return InsertionDone;
1460
    ASSERT(inDocument());
1462
    ASSERT(inDocument());
1461
    addToRadioButtonGroup();
1463
    addToRadioButtonGroup();
1464
    return InsertionDone;
1462
}
1465
}
1463
1466
1464
void HTMLInputElement::removedFromDocument()
1467
void HTMLInputElement::removedFrom(Node* insertionPoint)
1465
{
1468
{
1466
    ASSERT(inDocument());
1469
    if (insertionPoint->inDocument())
1467
    removeFromRadioButtonGroup();
1470
        removeFromRadioButtonGroup();
1468
    HTMLTextFormControlElement::removedFromDocument();
1471
    HTMLTextFormControlElement::removedFrom(insertionPoint);
1469
}
1472
}
1470
1473
1471
void HTMLInputElement::didMoveToNewDocument(Document* oldDocument)
1474
void HTMLInputElement::didMoveToNewDocument(Document* oldDocument)
- a/Source/WebCore/html/HTMLInputElement.h -2 / +2 lines
Lines 247-254 private: a/Source/WebCore/html/HTMLInputElement.h_sec1
247
247
248
    virtual void willChangeForm() OVERRIDE;
248
    virtual void willChangeForm() OVERRIDE;
249
    virtual void didChangeForm() OVERRIDE;
249
    virtual void didChangeForm() OVERRIDE;
250
    virtual void insertedIntoDocument() OVERRIDE;
250
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
251
    virtual void removedFromDocument() OVERRIDE;
251
    virtual void removedFrom(Node*) OVERRIDE;
252
    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
252
    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
253
253
254
    virtual bool isKeyboardFocusable(KeyboardEvent*) const;
254
    virtual bool isKeyboardFocusable(KeyboardEvent*) const;
- a/Source/WebCore/html/HTMLLinkElement.cpp -5 / +10 lines
Lines 243-264 void HTMLLinkElement::clearSheet() a/Source/WebCore/html/HTMLLinkElement.cpp_sec1
243
    m_sheet = 0;
243
    m_sheet = 0;
244
}
244
}
245
245
246
void HTMLLinkElement::insertedIntoDocument()
246
Node::InsertionNotificationRequest HTMLLinkElement::insertedInto(Node* insertionPoint)
247
{
247
{
248
    HTMLElement::insertedIntoDocument();
248
    HTMLElement::insertedInto(insertionPoint);
249
    if (!insertionPoint->inDocument())
250
        return InsertionDone;
249
251
250
    m_isInShadowTree = isInShadowTree();
252
    m_isInShadowTree = isInShadowTree();
251
    if (m_isInShadowTree)
253
    if (m_isInShadowTree)
252
        return;
254
        return InsertionDone;
253
255
254
    document()->addStyleSheetCandidateNode(this, m_createdByParser);
256
    document()->addStyleSheetCandidateNode(this, m_createdByParser);
255
257
256
    process();
258
    process();
259
    return InsertionDone;
257
}
260
}
258
261
259
void HTMLLinkElement::removedFromDocument()
262
void HTMLLinkElement::removedFrom(Node* insertionPoint)
260
{
263
{
261
    HTMLElement::removedFromDocument();
264
    HTMLElement::removedFrom(insertionPoint);
265
    if (!insertionPoint->inDocument())
266
        return;
262
267
263
    if (m_isInShadowTree) {
268
    if (m_isInShadowTree) {
264
        ASSERT(!m_sheet);
269
        ASSERT(!m_sheet);
- a/Source/WebCore/html/HTMLLinkElement.h -2 / +2 lines
Lines 75-82 private: a/Source/WebCore/html/HTMLLinkElement.h_sec1
75
    static void processCallback(Node*);
75
    static void processCallback(Node*);
76
    void clearSheet();
76
    void clearSheet();
77
77
78
    virtual void insertedIntoDocument();
78
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
79
    virtual void removedFromDocument();
79
    virtual void removedFrom(Node*) OVERRIDE;
80
80
81
    // from CachedResourceClient
81
    // from CachedResourceClient
82
    virtual void setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet* sheet);
82
    virtual void setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet* sheet);
- a/Source/WebCore/html/HTMLMapElement.cpp -6 / +8 lines
Lines 131-146 HTMLCollection* HTMLMapElement::areas() a/Source/WebCore/html/HTMLMapElement.cpp_sec1
131
    return ensureCachedHTMLCollection(MapAreas);
131
    return ensureCachedHTMLCollection(MapAreas);
132
}
132
}
133
133
134
void HTMLMapElement::insertedIntoDocument()
134
Node::InsertionNotificationRequest HTMLMapElement::insertedInto(Node* insertionPoint)
135
{
135
{
136
    treeScope()->addImageMap(this);
136
    if (insertionPoint->inDocument())
137
    HTMLElement::insertedIntoDocument();
137
        treeScope()->addImageMap(this);
138
    return HTMLElement::insertedInto(insertionPoint);
138
}
139
}
139
140
140
void HTMLMapElement::removedFromDocument()
141
void HTMLMapElement::removedFrom(Node* insertionPoint)
141
{
142
{
142
    treeScope()->removeImageMap(this);
143
    if (insertionPoint->inDocument())
143
    HTMLElement::removedFromDocument();
144
        treeScope()->removeImageMap(this);
145
    HTMLElement::removedFrom(insertionPoint);
144
}
146
}
145
147
146
}
148
}
- a/Source/WebCore/html/HTMLMapElement.h -2 / +2 lines
Lines 48-55 private: a/Source/WebCore/html/HTMLMapElement.h_sec1
48
48
49
    virtual void parseAttribute(Attribute*) OVERRIDE;
49
    virtual void parseAttribute(Attribute*) OVERRIDE;
50
50
51
    virtual void insertedIntoDocument();
51
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
52
    virtual void removedFromDocument();
52
    virtual void removedFrom(Node*) OVERRIDE;
53
53
54
    AtomicString m_name;
54
    AtomicString m_name;
55
};
55
};
- a/Source/WebCore/html/HTMLMediaElement.cpp -11 / +15 lines
Lines 491-512 bool HTMLMediaElement::childShouldCreateRenderer(const NodeRenderingContext& chi a/Source/WebCore/html/HTMLMediaElement.cpp_sec1
491
    return childContext.isOnUpperEncapsulationBoundary() && HTMLElement::childShouldCreateRenderer(childContext);
491
    return childContext.isOnUpperEncapsulationBoundary() && HTMLElement::childShouldCreateRenderer(childContext);
492
}
492
}
493
493
494
void HTMLMediaElement::insertedIntoDocument()
494
Node::InsertionNotificationRequest HTMLMediaElement::insertedInto(Node* insertionPoint)
495
{
495
{
496
    LOG(Media, "HTMLMediaElement::insertedIntoDocument");
496
    LOG(Media, "HTMLMediaElement::insertedInto");
497
    HTMLElement::insertedIntoDocument();
497
    HTMLElement::insertedInto(insertionPoint);
498
    if (!getAttribute(srcAttr).isEmpty() && m_networkState == NETWORK_EMPTY)
498
    if (insertionPoint->inDocument() && !getAttribute(srcAttr).isEmpty() && m_networkState == NETWORK_EMPTY)
499
        scheduleLoad(MediaResource);
499
        scheduleLoad(MediaResource);
500
    return InsertionDone;
500
}
501
}
501
502
502
void HTMLMediaElement::removedFromDocument()
503
void HTMLMediaElement::removedFrom(Node* insertionPoint)
503
{
504
{
504
    LOG(Media, "HTMLMediaElement::removedFromDocument");
505
    if (insertionPoint->inDocument()) {
505
    if (m_networkState > NETWORK_EMPTY)
506
        LOG(Media, "HTMLMediaElement::removedFromDocument");
506
        pause();
507
        if (m_networkState > NETWORK_EMPTY)
507
    if (m_isFullscreen)
508
            pause();
508
        exitFullscreen();
509
        if (m_isFullscreen)
509
    HTMLElement::removedFromDocument();
510
            exitFullscreen();
511
    }
512
513
    HTMLElement::removedFrom(insertionPoint);
510
}
514
}
511
515
512
void HTMLMediaElement::attach()
516
void HTMLMediaElement::attach()
- a/Source/WebCore/html/HTMLMediaElement.h -2 / +2 lines
Lines 360-367 private: a/Source/WebCore/html/HTMLMediaElement.h_sec1
360
    virtual bool rendererIsNeeded(const NodeRenderingContext&);
360
    virtual bool rendererIsNeeded(const NodeRenderingContext&);
361
    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
361
    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
362
    virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const OVERRIDE;
362
    virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const OVERRIDE;
363
    virtual void insertedIntoDocument();
363
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
364
    virtual void removedFromDocument();
364
    virtual void removedFrom(Node*) OVERRIDE;
365
    virtual void didRecalcStyle(StyleChange);
365
    virtual void didRecalcStyle(StyleChange);
366
    
366
    
367
    virtual void defaultEventHandler(Event*);
367
    virtual void defaultEventHandler(Event*);
- a/Source/WebCore/html/HTMLMetaElement.cpp -3 / +5 lines
Lines 54-63 void HTMLMetaElement::parseAttribute(Attribute* attr) a/Source/WebCore/html/HTMLMetaElement.cpp_sec1
54
        HTMLElement::parseAttribute(attr);
54
        HTMLElement::parseAttribute(attr);
55
}
55
}
56
56
57
void HTMLMetaElement::insertedIntoDocument()
57
Node::InsertionNotificationRequest HTMLMetaElement::insertedInto(Node* insertionPoint)
58
{
58
{
59
    HTMLElement::insertedIntoDocument();
59
    HTMLElement::insertedInto(insertionPoint);
60
    process();
60
    if (insertionPoint->inDocument())
61
        process();
62
    return InsertionDone;
61
}
63
}
62
64
63
void HTMLMetaElement::process()
65
void HTMLMetaElement::process()
- a/Source/WebCore/html/HTMLMetaElement.h -1 / +1 lines
Lines 39-45 private: a/Source/WebCore/html/HTMLMetaElement.h_sec1
39
    HTMLMetaElement(const QualifiedName&, Document*);
39
    HTMLMetaElement(const QualifiedName&, Document*);
40
40
41
    virtual void parseAttribute(Attribute*) OVERRIDE;
41
    virtual void parseAttribute(Attribute*) OVERRIDE;
42
    virtual void insertedIntoDocument();
42
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
43
43
44
    void process();
44
    void process();
45
45
- a/Source/WebCore/html/HTMLObjectElement.cpp -18 / +7 lines
Lines 328-343 bool HTMLObjectElement::rendererIsNeeded(const NodeRenderingContext& context) a/Source/WebCore/html/HTMLObjectElement.cpp_sec1
328
    return HTMLPlugInImageElement::rendererIsNeeded(context);
328
    return HTMLPlugInImageElement::rendererIsNeeded(context);
329
}
329
}
330
330
331
void HTMLObjectElement::insertedIntoDocument()
331
Node::InsertionNotificationRequest HTMLObjectElement::insertedInto(Node* insertionPoint)
332
{
332
{
333
    HTMLPlugInImageElement::insertedIntoDocument();
333
    HTMLPlugInImageElement::insertedInto(insertionPoint);
334
    FormAssociatedElement::insertedIntoDocument();
334
    FormAssociatedElement::insertedInto(insertionPoint);
335
    return InsertionDone;
335
}
336
}
336
337
337
void HTMLObjectElement::removedFromDocument()
338
void HTMLObjectElement::removedFrom(Node* insertionPoint)
338
{
339
{
339
    HTMLPlugInImageElement::removedFromDocument();
340
    HTMLPlugInImageElement::removedFrom(insertionPoint);
340
    FormAssociatedElement::removedFromDocument();
341
    FormAssociatedElement::removedFrom(insertionPoint);
341
}
342
}
342
343
343
void HTMLObjectElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
344
void HTMLObjectElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
Lines 485-502 void HTMLObjectElement::didMoveToNewDocument(Document* oldDocument) a/Source/WebCore/html/HTMLObjectElement.cpp_sec2
485
    HTMLPlugInImageElement::didMoveToNewDocument(oldDocument);
486
    HTMLPlugInImageElement::didMoveToNewDocument(oldDocument);
486
}
487
}
487
488
488
void HTMLObjectElement::insertedIntoTree(bool deep)
489
{
490
    FormAssociatedElement::insertedIntoTree();
491
    HTMLPlugInImageElement::insertedIntoTree(deep);
492
}
493
494
void HTMLObjectElement::removedFromTree(bool deep)
495
{
496
    FormAssociatedElement::removedFromTree();
497
    HTMLPlugInImageElement::removedFromTree(deep);
498
}
499
500
bool HTMLObjectElement::appendFormData(FormDataList& encoding, bool)
489
bool HTMLObjectElement::appendFormData(FormDataList& encoding, bool)
501
{
490
{
502
    if (name().isEmpty())
491
    if (name().isEmpty())
- a/Source/WebCore/html/HTMLObjectElement.h -4 / +2 lines
Lines 70-81 private: a/Source/WebCore/html/HTMLObjectElement.h_sec1
70
    virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
70
    virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
71
    virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
71
    virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
72
72
73
    virtual void insertedIntoTree(bool deep);
73
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
74
    virtual void removedFromTree(bool deep);
74
    virtual void removedFrom(Node*) OVERRIDE;
75
75
76
    virtual bool rendererIsNeeded(const NodeRenderingContext&);
76
    virtual bool rendererIsNeeded(const NodeRenderingContext&);
77
    virtual void insertedIntoDocument();
78
    virtual void removedFromDocument();
79
    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
77
    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
80
78
81
    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
79
    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
- a/Source/WebCore/html/HTMLOptionElement.cpp -2 / +2 lines
Lines 306-312 bool HTMLOptionElement::disabled() const a/Source/WebCore/html/HTMLOptionElement.cpp_sec1
306
    return ownElementDisabled() || (parentNode() && parentNode()->isHTMLElement() && static_cast<HTMLElement*>(parentNode())->disabled());
306
    return ownElementDisabled() || (parentNode() && parentNode()->isHTMLElement() && static_cast<HTMLElement*>(parentNode())->disabled());
307
}
307
}
308
308
309
void HTMLOptionElement::insertedIntoTree(bool deep)
309
Node::InsertionNotificationRequest HTMLOptionElement::insertedInto(Node* insertionPoint)
310
{
310
{
311
    if (HTMLSelectElement* select = ownerSelectElement()) {
311
    if (HTMLSelectElement* select = ownerSelectElement()) {
312
        select->setRecalcListItems();
312
        select->setRecalcListItems();
Lines 319-325 void HTMLOptionElement::insertedIntoTree(bool deep) a/Source/WebCore/html/HTMLOptionElement.cpp_sec2
319
        select->scrollToSelection();
319
        select->scrollToSelection();
320
    }
320
    }
321
321
322
    HTMLElement::insertedIntoTree(deep);
322
    return HTMLElement::insertedInto(insertionPoint);
323
}
323
}
324
324
325
String HTMLOptionElement::collectOptionInnerText() const
325
String HTMLOptionElement::collectOptionInnerText() const
- a/Source/WebCore/html/HTMLOptionElement.h -1 / +1 lines
Lines 75-81 private: a/Source/WebCore/html/HTMLOptionElement.h_sec1
75
75
76
    virtual void parseAttribute(Attribute*) OVERRIDE;
76
    virtual void parseAttribute(Attribute*) OVERRIDE;
77
77
78
    virtual void insertedIntoTree(bool);
78
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
79
    virtual void accessKeyAction(bool);
79
    virtual void accessKeyAction(bool);
80
80
81
    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
81
    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
- a/Source/WebCore/html/HTMLQuoteElement.cpp -2 / +2 lines
Lines 41-52 PassRefPtr<HTMLQuoteElement> HTMLQuoteElement::create(const QualifiedName& tagNa a/Source/WebCore/html/HTMLQuoteElement.cpp_sec1
41
    return adoptRef(new HTMLQuoteElement(tagName, document));
41
    return adoptRef(new HTMLQuoteElement(tagName, document));
42
}
42
}
43
43
44
void HTMLQuoteElement::insertedIntoDocument()
44
Node::InsertionNotificationRequest HTMLQuoteElement::insertedInto(Node* insertionPoint)
45
{
45
{
46
    if (hasTagName(qTag))
46
    if (hasTagName(qTag))
47
        document()->setUsesBeforeAfterRules(true);
47
        document()->setUsesBeforeAfterRules(true);
48
48
49
    HTMLElement::insertedIntoDocument();
49
    return HTMLElement::insertedInto(insertionPoint);
50
}
50
}
51
51
52
bool HTMLQuoteElement::isURLAttribute(Attribute* attribute) const
52
bool HTMLQuoteElement::isURLAttribute(Attribute* attribute) const
- a/Source/WebCore/html/HTMLQuoteElement.h -1 / +1 lines
Lines 36-42 public: a/Source/WebCore/html/HTMLQuoteElement.h_sec1
36
private:
36
private:
37
    HTMLQuoteElement(const QualifiedName&, Document*);
37
    HTMLQuoteElement(const QualifiedName&, Document*);
38
    
38
    
39
    virtual void insertedIntoDocument();
39
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
40
    virtual bool isURLAttribute(Attribute*) const;
40
    virtual bool isURLAttribute(Attribute*) const;
41
};
41
};
42
42
- a/Source/WebCore/html/HTMLScriptElement.cpp -3 / +4 lines
Lines 74-83 void HTMLScriptElement::parseAttribute(Attribute* attr) a/Source/WebCore/html/HTMLScriptElement.cpp_sec1
74
        HTMLElement::parseAttribute(attr);
74
        HTMLElement::parseAttribute(attr);
75
}
75
}
76
76
77
void HTMLScriptElement::insertedIntoDocument()
77
Node::InsertionNotificationRequest HTMLScriptElement::insertedInto(Node* insertionPoint)
78
{
78
{
79
    HTMLElement::insertedIntoDocument();
79
    HTMLElement::insertedInto(insertionPoint);
80
    ScriptElement::insertedIntoDocument();
80
    ScriptElement::insertedInto(insertionPoint);
81
    return InsertionDone;
81
}
82
}
82
83
83
void HTMLScriptElement::setText(const String &value)
84
void HTMLScriptElement::setText(const String &value)
- a/Source/WebCore/html/HTMLScriptElement.h -1 / +1 lines
Lines 45-51 private: a/Source/WebCore/html/HTMLScriptElement.h_sec1
45
    HTMLScriptElement(const QualifiedName&, Document*, bool wasInsertedByParser, bool alreadyStarted);
45
    HTMLScriptElement(const QualifiedName&, Document*, bool wasInsertedByParser, bool alreadyStarted);
46
46
47
    virtual void parseAttribute(Attribute*) OVERRIDE;
47
    virtual void parseAttribute(Attribute*) OVERRIDE;
48
    virtual void insertedIntoDocument();
48
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
49
    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
49
    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
50
50
51
    virtual bool isURLAttribute(Attribute*) const;
51
    virtual bool isURLAttribute(Attribute*) const;
- a/Source/WebCore/html/HTMLSelectElement.cpp -2 / +3 lines
Lines 1472-1484 void HTMLSelectElement::typeAheadFind(KeyboardEvent* event) a/Source/WebCore/html/HTMLSelectElement.cpp_sec1
1472
    }
1472
    }
1473
}
1473
}
1474
1474
1475
void HTMLSelectElement::insertedIntoTree(bool deep)
1475
Node::InsertionNotificationRequest HTMLSelectElement::insertedInto(Node* insertionPoint)
1476
{
1476
{
1477
    // When the element is created during document parsing, it won't have any
1477
    // When the element is created during document parsing, it won't have any
1478
    // items yet - but for innerHTML and related methods, this method is called
1478
    // items yet - but for innerHTML and related methods, this method is called
1479
    // after the whole subtree is constructed.
1479
    // after the whole subtree is constructed.
1480
    recalcListItems();
1480
    recalcListItems();
1481
    HTMLFormControlElementWithState::insertedIntoTree(deep);
1481
    HTMLFormControlElementWithState::insertedInto(insertionPoint);
1482
    return InsertionDone;
1482
}
1483
}
1483
1484
1484
void HTMLSelectElement::accessKeySetSelectedIndex(int index)
1485
void HTMLSelectElement::accessKeySetSelectedIndex(int index)
- a/Source/WebCore/html/HTMLSelectElement.h -1 / +1 lines
Lines 142-148 private: a/Source/WebCore/html/HTMLSelectElement.h_sec1
142
    void typeAheadFind(KeyboardEvent*);
142
    void typeAheadFind(KeyboardEvent*);
143
    void saveLastSelection();
143
    void saveLastSelection();
144
144
145
    virtual void insertedIntoTree(bool);
145
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
146
146
147
    virtual bool isOptionalFormControl() const { return !isRequiredFormControl(); }
147
    virtual bool isOptionalFormControl() const { return !isRequiredFormControl(); }
148
    virtual bool isRequiredFormControl() const;
148
    virtual bool isRequiredFormControl() const;
- a/Source/WebCore/html/HTMLSourceElement.cpp -2 / +3 lines
Lines 54-65 PassRefPtr<HTMLSourceElement> HTMLSourceElement::create(const QualifiedName& tag a/Source/WebCore/html/HTMLSourceElement.cpp_sec1
54
    return adoptRef(new HTMLSourceElement(tagName, document));
54
    return adoptRef(new HTMLSourceElement(tagName, document));
55
}
55
}
56
56
57
void HTMLSourceElement::insertedIntoTree(bool deep)
57
Node::InsertionNotificationRequest HTMLSourceElement::insertedInto(Node* insertionPoint)
58
{
58
{
59
    HTMLElement::insertedIntoTree(deep);
59
    HTMLElement::insertedInto(insertionPoint);
60
    Element* parent = parentElement();
60
    Element* parent = parentElement();
61
    if (parent && parent->isMediaElement())
61
    if (parent && parent->isMediaElement())
62
        static_cast<HTMLMediaElement*>(parentNode())->sourceWasAdded(this);
62
        static_cast<HTMLMediaElement*>(parentNode())->sourceWasAdded(this);
63
    return InsertionDone;
63
}
64
}
64
65
65
void HTMLSourceElement::willRemove()
66
void HTMLSourceElement::willRemove()
- a/Source/WebCore/html/HTMLSourceElement.h -1 / +1 lines
Lines 49-55 public: a/Source/WebCore/html/HTMLSourceElement.h_sec1
49
private:
49
private:
50
    HTMLSourceElement(const QualifiedName&, Document*);
50
    HTMLSourceElement(const QualifiedName&, Document*);
51
    
51
    
52
    virtual void insertedIntoTree(bool);
52
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
53
    virtual void willRemove();
53
    virtual void willRemove();
54
    virtual bool isURLAttribute(Attribute*) const;
54
    virtual bool isURLAttribute(Attribute*) const;
55
55
- a/Source/WebCore/html/HTMLStyleElement.cpp -10 / +15 lines
Lines 151-176 void HTMLStyleElement::unregisterWithScopingNode() a/Source/WebCore/html/HTMLStyleElement.cpp_sec1
151
}
151
}
152
#endif
152
#endif
153
153
154
void HTMLStyleElement::insertedIntoDocument()
154
Node::InsertionNotificationRequest HTMLStyleElement::insertedInto(Node* insertionPoint)
155
{
155
{
156
    HTMLElement::insertedIntoDocument();
156
    HTMLElement::insertedInto(insertionPoint);
157
    StyleElement::insertedIntoDocument(document(), this);
157
    if (insertionPoint->inDocument())
158
        StyleElement::insertedIntoDocument(document(), this);
158
#if ENABLE(STYLE_SCOPED)
159
#if ENABLE(STYLE_SCOPED)
159
    if (scoped() && !m_isRegisteredWithScopingNode)
160
    if (scoped() && !m_isRegisteredWithScopingNode)
160
        registerWithScopingNode();
161
        registerWithScopingNode();
161
#endif
162
#endif
163
    return InsertionDone;
162
}
164
}
163
165
164
void HTMLStyleElement::removedFromDocument()
166
void HTMLStyleElement::removedFrom(Node* insertionPoint)
165
{
167
{
168
    HTMLElement::removedFrom(insertionPoint);
169
170
    if (insertionPoint->inDocument()) {
166
#if ENABLE(STYLE_SCOPED)
171
#if ENABLE(STYLE_SCOPED)
167
    // In come cases on teardown willRemove is not called - test here for unregistering again
172
        // In come cases on teardown willRemove is not called - test here for unregistering again
168
    // FIXME: Do we need to bother?
173
        // FIXME: Do we need to bother?
169
    if (m_isRegisteredWithScopingNode)
174
        if (m_isRegisteredWithScopingNode)
170
        unregisterWithScopingNode();
175
            unregisterWithScopingNode();
171
#endif
176
#endif
172
    HTMLElement::removedFromDocument();
177
        StyleElement::removedFromDocument(document(), this);
173
    StyleElement::removedFromDocument(document(), this);
178
    }
174
}
179
}
175
180
176
181
- a/Source/WebCore/html/HTMLStyleElement.h -2 / +2 lines
Lines 60-67 private: a/Source/WebCore/html/HTMLStyleElement.h_sec1
60
60
61
    // overload from HTMLElement
61
    // overload from HTMLElement
62
    virtual void parseAttribute(Attribute*) OVERRIDE;
62
    virtual void parseAttribute(Attribute*) OVERRIDE;
63
    virtual void insertedIntoDocument();
63
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
64
    virtual void removedFromDocument();
64
    virtual void removedFrom(Node*) OVERRIDE;
65
#if ENABLE(STYLE_SCOPED)
65
#if ENABLE(STYLE_SCOPED)
66
    virtual void willRemove();
66
    virtual void willRemove();
67
#endif
67
#endif
- a/Source/WebCore/html/HTMLTextFormControlElement.cpp -2 / +5 lines
Lines 70-80 bool HTMLTextFormControlElement::childShouldCreateRenderer(const NodeRenderingCo a/Source/WebCore/html/HTMLTextFormControlElement.cpp_sec1
70
    return childContext.isOnEncapsulationBoundary() && HTMLFormControlElementWithState::childShouldCreateRenderer(childContext);
70
    return childContext.isOnEncapsulationBoundary() && HTMLFormControlElementWithState::childShouldCreateRenderer(childContext);
71
}
71
}
72
72
73
void HTMLTextFormControlElement::insertedIntoDocument()
73
Node::InsertionNotificationRequest HTMLTextFormControlElement::insertedInto(Node* insertionPoint)
74
{
74
{
75
    HTMLFormControlElement::insertedIntoDocument();
75
    HTMLFormControlElement::insertedInto(insertionPoint);
76
    if (!insertionPoint->inDocument())
77
        return InsertionDone;
76
    String initialValue = value();
78
    String initialValue = value();
77
    setTextAsOfLastFormControlChangeEvent(initialValue.isNull() ? emptyString() : initialValue);
79
    setTextAsOfLastFormControlChangeEvent(initialValue.isNull() ? emptyString() : initialValue);
80
    return InsertionDone;
78
}
81
}
79
82
80
void HTMLTextFormControlElement::dispatchFocusEvent(PassRefPtr<Node> oldFocusedNode)
83
void HTMLTextFormControlElement::dispatchFocusEvent(PassRefPtr<Node> oldFocusedNode)
- a/Source/WebCore/html/HTMLTextFormControlElement.h -1 / +2 lines
Lines 45-51 public: a/Source/WebCore/html/HTMLTextFormControlElement.h_sec1
45
45
46
    void forwardEvent(Event*);
46
    void forwardEvent(Event*);
47
47
48
    virtual void insertedIntoDocument();
48
49
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
49
50
50
    // The derived class should return true if placeholder processing is needed.
51
    // The derived class should return true if placeholder processing is needed.
51
    virtual bool supportsPlaceholder() const = 0;
52
    virtual bool supportsPlaceholder() const = 0;
- a/Source/WebCore/html/HTMLTitleElement.cpp -6 / +9 lines
Lines 44-59 PassRefPtr<HTMLTitleElement> HTMLTitleElement::create(const QualifiedName& tagNa a/Source/WebCore/html/HTMLTitleElement.cpp_sec1
44
    return adoptRef(new HTMLTitleElement(tagName, document));
44
    return adoptRef(new HTMLTitleElement(tagName, document));
45
}
45
}
46
46
47
void HTMLTitleElement::insertedIntoDocument()
47
Node::InsertionNotificationRequest HTMLTitleElement::insertedInto(Node* insertionPoint)
48
{
48
{
49
    HTMLElement::insertedIntoDocument();
49
    HTMLElement::insertedInto(insertionPoint);
50
    document()->setTitleElement(m_title, this);
50
    if (insertionPoint->inDocument())
51
        document()->setTitleElement(m_title, this);
52
    return InsertionDone;
51
}
53
}
52
54
53
void HTMLTitleElement::removedFromDocument()
55
void HTMLTitleElement::removedFrom(Node* insertionPoint)
54
{
56
{
55
    HTMLElement::removedFromDocument();
57
    HTMLElement::removedFrom(insertionPoint);
56
    document()->removeTitle(this);
58
    if (insertionPoint->inDocument())
59
        document()->removeTitle(this);
57
}
60
}
58
61
59
void HTMLTitleElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
62
void HTMLTitleElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
- a/Source/WebCore/html/HTMLTitleElement.h -2 / +2 lines
Lines 39-46 public: a/Source/WebCore/html/HTMLTitleElement.h_sec1
39
private:
39
private:
40
    HTMLTitleElement(const QualifiedName&, Document*);
40
    HTMLTitleElement(const QualifiedName&, Document*);
41
41
42
    virtual void insertedIntoDocument();
42
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
43
    virtual void removedFromDocument();
43
    virtual void removedFrom(Node*) OVERRIDE;
44
    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
44
    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
45
45
46
    StringWithDirection m_title;
46
    StringWithDirection m_title;
- a/Source/WebCore/html/HTMLTrackElement.cpp -2 / +3 lines
Lines 72-83 PassRefPtr<HTMLTrackElement> HTMLTrackElement::create(const QualifiedName& tagNa a/Source/WebCore/html/HTMLTrackElement.cpp_sec1
72
    return adoptRef(new HTMLTrackElement(tagName, document));
72
    return adoptRef(new HTMLTrackElement(tagName, document));
73
}
73
}
74
74
75
void HTMLTrackElement::insertedIntoTree(bool deep)
75
Node::InsertionNotificationRequest HTMLTrackElement::insertedInto(Node* insertionPoint)
76
{
76
{
77
    HTMLElement::insertedIntoTree(deep);
77
    HTMLElement::insertedInto(insertionPoint);
78
78
79
    if (HTMLMediaElement* parent = mediaElement())
79
    if (HTMLMediaElement* parent = mediaElement())
80
        parent->didAddTrack(this);
80
        parent->didAddTrack(this);
81
    return InsertionDone;
81
}
82
}
82
83
83
void HTMLTrackElement::willRemove()
84
void HTMLTrackElement::willRemove()
- a/Source/WebCore/html/HTMLTrackElement.h -1 / +1 lines
Lines 77-83 private: a/Source/WebCore/html/HTMLTrackElement.h_sec1
77
77
78
    virtual void parseAttribute(Attribute*) OVERRIDE;
78
    virtual void parseAttribute(Attribute*) OVERRIDE;
79
79
80
    virtual void insertedIntoTree(bool) OVERRIDE;
80
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
81
    virtual void willRemove() OVERRIDE;
81
    virtual void willRemove() OVERRIDE;
82
    virtual bool isURLAttribute(Attribute*) const;
82
    virtual bool isURLAttribute(Attribute*) const;
83
83
- a/Source/WebCore/mathml/MathMLMathElement.cpp -5 / +4 lines
Lines 29-35 a/Source/WebCore/mathml/MathMLMathElement.cpp_sec1
29
#if ENABLE(MATHML)
29
#if ENABLE(MATHML)
30
30
31
#include "MathMLMathElement.h"
31
#include "MathMLMathElement.h"
32
33
#include "RenderMathMLMath.h"
32
#include "RenderMathMLMath.h"
34
33
35
namespace WebCore {
34
namespace WebCore {
Lines 44-55 PassRefPtr<MathMLMathElement> MathMLMathElement::create(const QualifiedName& tag a/Source/WebCore/mathml/MathMLMathElement.cpp_sec2
44
    return adoptRef(new MathMLMathElement(tagName, document));
43
    return adoptRef(new MathMLMathElement(tagName, document));
45
}
44
}
46
45
47
void MathMLMathElement::insertedIntoDocument()
46
Node::InsertionNotificationRequest MathMLMathElement::insertedInto(Node* insertionPoint)
48
{
47
{
49
    // There are sibling rules in the MathML default style.
48
    // There are sibling rules in the MathML default style.
50
    document()->setUsesSiblingRules(true);
49
    if (insertionPoint->inDocument())
51
    
50
        document()->setUsesSiblingRules(true);
52
    MathMLInlineContainerElement::insertedIntoDocument();
51
    return MathMLInlineContainerElement::insertedInto(insertionPoint);
53
}
52
}
54
53
55
RenderObject* MathMLMathElement::createRenderer(RenderArena* arena, RenderStyle*)
54
RenderObject* MathMLMathElement::createRenderer(RenderArena* arena, RenderStyle*)
- a/Source/WebCore/mathml/MathMLMathElement.h -1 / +1 lines
Lines 39-45 public: a/Source/WebCore/mathml/MathMLMathElement.h_sec1
39
private:
39
private:
40
    MathMLMathElement(const QualifiedName& tagName, Document*);
40
    MathMLMathElement(const QualifiedName& tagName, Document*);
41
41
42
    virtual void insertedIntoDocument();
42
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
43
    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
43
    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
44
};
44
};
45
    
45
    
- a/Source/WebCore/svg/SVGElement.cpp -4 / +7 lines
Lines 169-179 void SVGElement::setXmlbase(const String& value, ExceptionCode&) a/Source/WebCore/svg/SVGElement.cpp_sec1
169
    setAttribute(XMLNames::baseAttr, value);
169
    setAttribute(XMLNames::baseAttr, value);
170
}
170
}
171
171
172
void SVGElement::removedFromDocument()
172
void SVGElement::removedFrom(Node* rootParent)
173
{
173
{
174
    document()->accessSVGExtensions()->removeAllAnimationElementsFromTarget(this);
174
    if (rootParent->inDocument()) {
175
    document()->accessSVGExtensions()->removeAllElementReferencesForTarget(this);
175
        document()->accessSVGExtensions()->removeAllAnimationElementsFromTarget(this);
176
    StyledElement::removedFromDocument();
176
        document()->accessSVGExtensions()->removeAllElementReferencesForTarget(this);
177
    }
178
179
    StyledElement::removedFrom(rootParent);
177
}
180
}
178
181
179
SVGSVGElement* SVGElement::ownerSVGElement() const
182
SVGSVGElement* SVGElement::ownerSVGElement() const
- a/Source/WebCore/svg/SVGElement.h -1 / +1 lines
Lines 121-127 protected: a/Source/WebCore/svg/SVGElement.h_sec1
121
    virtual void attributeChanged(Attribute*) OVERRIDE;
121
    virtual void attributeChanged(Attribute*) OVERRIDE;
122
    virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const;
122
    virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const;
123
    
123
    
124
    virtual void removedFromDocument();
124
    virtual void removedFrom(Node*) OVERRIDE;
125
125
126
    SVGElementRareData* rareSVGData() const;
126
    SVGElementRareData* rareSVGData() const;
127
    SVGElementRareData* ensureRareSVGData();
127
    SVGElementRareData* ensureRareSVGData();
- a/Source/WebCore/svg/SVGFEImageElement.cpp -5 / +7 lines
Lines 175-190 void SVGFEImageElement::svgAttributeChanged(const QualifiedName& attrName) a/Source/WebCore/svg/SVGFEImageElement.cpp_sec1
175
    ASSERT_NOT_REACHED();
175
    ASSERT_NOT_REACHED();
176
}
176
}
177
177
178
void SVGFEImageElement::insertedIntoDocument()
178
Node::InsertionNotificationRequest SVGFEImageElement::insertedInto(Node* rootParent)
179
{
179
{
180
    SVGFilterPrimitiveStandardAttributes::insertedIntoDocument();
180
    SVGFilterPrimitiveStandardAttributes::insertedInto(rootParent);
181
    buildPendingResource();
181
    buildPendingResource();
182
    return InsertionDone;
182
}
183
}
183
184
184
void SVGFEImageElement::removedFromDocument()
185
void SVGFEImageElement::removedFrom(Node* rootParent)
185
{
186
{
186
    SVGFilterPrimitiveStandardAttributes::removedFromDocument();
187
    SVGFilterPrimitiveStandardAttributes::removedFrom(rootParent);
187
    clearResourceReferences();
188
    if (rootParent->inDocument())
189
        clearResourceReferences();
188
}
190
}
189
191
190
void SVGFEImageElement::notifyFinished(CachedResource*)
192
void SVGFEImageElement::notifyFinished(CachedResource*)
- a/Source/WebCore/svg/SVGFEImageElement.h -2 / +2 lines
Lines 60-67 private: a/Source/WebCore/svg/SVGFEImageElement.h_sec1
60
    void requestImageResource();
60
    void requestImageResource();
61
61
62
    virtual void buildPendingResource();
62
    virtual void buildPendingResource();
63
    virtual void insertedIntoDocument();
63
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
64
    virtual void removedFromDocument();
64
    virtual void removedFrom(Node*) OVERRIDE;
65
65
66
    BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEImageElement)
66
    BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEImageElement)
67
        DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio)
67
        DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio)
- a/Source/WebCore/svg/SVGFontFaceElement.cpp -8 / +12 lines
Lines 315-337 void SVGFontFaceElement::rebuildFontFace() a/Source/WebCore/svg/SVGFontFaceElement.cpp_sec1
315
    document()->styleSelectorChanged(DeferRecalcStyle);
315
    document()->styleSelectorChanged(DeferRecalcStyle);
316
}
316
}
317
317
318
void SVGFontFaceElement::insertedIntoDocument()
318
Node::InsertionNotificationRequest SVGFontFaceElement::insertedInto(Node* rootParent)
319
{
319
{
320
    SVGElement::insertedIntoDocument();
320
    SVGElement::insertedInto(rootParent);
321
321
    if (!rootParent->inDocument())
322
        return InsertionDone;
322
    document()->accessSVGExtensions()->registerSVGFontFaceElement(this);
323
    document()->accessSVGExtensions()->registerSVGFontFaceElement(this);
323
324
324
    rebuildFontFace();
325
    rebuildFontFace();
326
    return InsertionDone;
325
}
327
}
326
328
327
void SVGFontFaceElement::removedFromDocument()
329
void SVGFontFaceElement::removedFrom(Node* rootParent)
328
{
330
{
329
    SVGElement::removedFromDocument();
331
    SVGElement::removedFrom(rootParent);
330
332
331
    document()->accessSVGExtensions()->unregisterSVGFontFaceElement(this);
333
    if (rootParent->inDocument()) {
332
    m_fontFaceRule->properties()->parseDeclaration(emptyString(), 0);
334
        document()->accessSVGExtensions()->unregisterSVGFontFaceElement(this);
335
        m_fontFaceRule->properties()->parseDeclaration(emptyString(), 0);
333
336
334
    document()->styleSelectorChanged(DeferRecalcStyle);
337
        document()->styleSelectorChanged(DeferRecalcStyle);
338
    }
335
}
339
}
336
340
337
void SVGFontFaceElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
341
void SVGFontFaceElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
- a/Source/WebCore/svg/SVGFontFaceElement.h -2 / +2 lines
Lines 57-64 private: a/Source/WebCore/svg/SVGFontFaceElement.h_sec1
57
    virtual void parseAttribute(Attribute*) OVERRIDE;
57
    virtual void parseAttribute(Attribute*) OVERRIDE;
58
58
59
    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
59
    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
60
    virtual void insertedIntoDocument();
60
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
61
    virtual void removedFromDocument();
61
    virtual void removedFrom(Node*) OVERRIDE;
62
62
63
    RefPtr<StyleRuleFontFace> m_fontFaceRule;
63
    RefPtr<StyleRuleFontFace> m_fontFaceRule;
64
    RefPtr<SVGFontElement> m_fontElement;
64
    RefPtr<SVGFontElement> m_fontElement;
- a/Source/WebCore/svg/SVGFontFaceUriElement.cpp -2 / +2 lines
Lines 82-91 void SVGFontFaceUriElement::childrenChanged(bool changedByParser, Node* beforeCh a/Source/WebCore/svg/SVGFontFaceUriElement.cpp_sec1
82
        static_cast<SVGFontFaceElement*>(grandparent)->rebuildFontFace();
82
        static_cast<SVGFontFaceElement*>(grandparent)->rebuildFontFace();
83
}
83
}
84
84
85
void SVGFontFaceUriElement::insertedIntoDocument()
85
Node::InsertionNotificationRequest SVGFontFaceUriElement::insertedInto(Node* rootParent)
86
{
86
{
87
    loadFont();
87
    loadFont();
88
    SVGElement::insertedIntoDocument();
88
    return SVGElement::insertedInto(rootParent);
89
}
89
}
90
90
91
void SVGFontFaceUriElement::loadFont()
91
void SVGFontFaceUriElement::loadFont()
- a/Source/WebCore/svg/SVGFontFaceUriElement.h -1 / +1 lines
Lines 42-48 private: a/Source/WebCore/svg/SVGFontFaceUriElement.h_sec1
42
    
42
    
43
    virtual void parseAttribute(Attribute*) OVERRIDE;
43
    virtual void parseAttribute(Attribute*) OVERRIDE;
44
    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
44
    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
45
    virtual void insertedIntoDocument();
45
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
46
46
47
    void loadFont();
47
    void loadFont();
48
48
- a/Source/WebCore/svg/SVGGlyphElement.cpp -5 / +6 lines
Lines 61-76 void SVGGlyphElement::parseAttribute(Attribute* attr) a/Source/WebCore/svg/SVGGlyphElement.cpp_sec1
61
        SVGStyledElement::parseAttribute(attr);
61
        SVGStyledElement::parseAttribute(attr);
62
}
62
}
63
63
64
void SVGGlyphElement::insertedIntoDocument()
64
Node::InsertionNotificationRequest SVGGlyphElement::insertedInto(Node* rootParent)
65
{
65
{
66
    invalidateGlyphCache();
66
    invalidateGlyphCache();
67
    SVGStyledElement::insertedIntoDocument();
67
    return SVGStyledElement::insertedInto(rootParent);
68
}
68
}
69
69
70
void SVGGlyphElement::removedFromDocument()
70
void SVGGlyphElement::removedFrom(Node* rootParent)
71
{
71
{
72
    invalidateGlyphCache();
72
    if (rootParent->inDocument())
73
    SVGStyledElement::removedFromDocument();
73
        invalidateGlyphCache();
74
    SVGStyledElement::removedFrom(rootParent);
74
}
75
}
75
76
76
static inline SVGGlyph::ArabicForm parseArabicForm(const AtomicString& value)
77
static inline SVGGlyph::ArabicForm parseArabicForm(const AtomicString& value)
- a/Source/WebCore/svg/SVGGlyphElement.h -2 / +2 lines
Lines 49-56 private: a/Source/WebCore/svg/SVGGlyphElement.h_sec1
49
    // FIXME: svgAttributeChanged missing.
49
    // FIXME: svgAttributeChanged missing.
50
    virtual void parseAttribute(Attribute*) OVERRIDE;
50
    virtual void parseAttribute(Attribute*) OVERRIDE;
51
51
52
    virtual void insertedIntoDocument();
52
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
53
    virtual void removedFromDocument();
53
    virtual void removedFrom(Node*) OVERRIDE;
54
54
55
    virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; }
55
    virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; }
56
56
- a/Source/WebCore/svg/SVGHKernElement.cpp -4 / +6 lines
Lines 41-64 PassRefPtr<SVGHKernElement> SVGHKernElement::create(const QualifiedName& tagName a/Source/WebCore/svg/SVGHKernElement.cpp_sec1
41
    return adoptRef(new SVGHKernElement(tagName, document));
41
    return adoptRef(new SVGHKernElement(tagName, document));
42
}
42
}
43
43
44
void SVGHKernElement::insertedIntoDocument()
44
Node::InsertionNotificationRequest SVGHKernElement::insertedInto(Node* rootParent)
45
{
45
{
46
    ContainerNode* fontNode = parentNode();
46
    ContainerNode* fontNode = parentNode();
47
    if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) {
47
    if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) {
48
        if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode))
48
        if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode))
49
            element->invalidateGlyphCache();
49
            element->invalidateGlyphCache();
50
    }
50
    }
51
    SVGElement::insertedIntoDocument();
51
52
    return SVGElement::insertedInto(rootParent);
52
}
53
}
53
54
54
void SVGHKernElement::removedFromDocument()
55
void SVGHKernElement::removedFrom(Node* rootParent)
55
{
56
{
56
    ContainerNode* fontNode = parentNode();
57
    ContainerNode* fontNode = parentNode();
57
    if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) {
58
    if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) {
58
        if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode))
59
        if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode))
59
            element->invalidateGlyphCache();
60
            element->invalidateGlyphCache();
60
    }
61
    }
61
    SVGElement::removedFromDocument();
62
63
    SVGElement::removedFrom(rootParent);
62
}
64
}
63
65
64
void SVGHKernElement::buildHorizontalKerningPair(KerningPairVector& kerningPairs)
66
void SVGHKernElement::buildHorizontalKerningPair(KerningPairVector& kerningPairs)
- a/Source/WebCore/svg/SVGHKernElement.h -2 / +2 lines
Lines 36-43 public: a/Source/WebCore/svg/SVGHKernElement.h_sec1
36
private:
36
private:
37
    SVGHKernElement(const QualifiedName&, Document*);
37
    SVGHKernElement(const QualifiedName&, Document*);
38
38
39
    virtual void insertedIntoDocument();
39
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
40
    virtual void removedFromDocument();
40
    virtual void removedFrom(Node*) OVERRIDE;
41
41
42
    virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; }
42
    virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; }
43
};
43
};
- a/Source/WebCore/svg/SVGImageElement.cpp -3 / +5 lines
Lines 211-223 void SVGImageElement::attach() a/Source/WebCore/svg/SVGImageElement.cpp_sec1
211
    }
211
    }
212
}
212
}
213
213
214
void SVGImageElement::insertedIntoDocument()
214
Node::InsertionNotificationRequest SVGImageElement::insertedInto(Node* rootParent)
215
{
215
{
216
    SVGStyledTransformableElement::insertedIntoDocument();
216
    SVGStyledTransformableElement::insertedInto(rootParent);
217
217
    if (!rootParent->inDocument())
218
        return InsertionDone;
218
    // Update image loader, as soon as we're living in the tree.
219
    // Update image loader, as soon as we're living in the tree.
219
    // We can only resolve base URIs properly, after that!
220
    // We can only resolve base URIs properly, after that!
220
    m_imageLoader.updateFromElement();
221
    m_imageLoader.updateFromElement();
222
    return InsertionDone;
221
}
223
}
222
224
223
const QualifiedName& SVGImageElement::imageSourceAttributeName() const
225
const QualifiedName& SVGImageElement::imageSourceAttributeName() const
- a/Source/WebCore/svg/SVGImageElement.h -1 / +1 lines
Lines 55-61 private: a/Source/WebCore/svg/SVGImageElement.h_sec1
55
    virtual void svgAttributeChanged(const QualifiedName&);
55
    virtual void svgAttributeChanged(const QualifiedName&);
56
56
57
    virtual void attach();
57
    virtual void attach();
58
    virtual void insertedIntoDocument();
58
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
59
59
60
    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
60
    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
61
 
61
 
- a/Source/WebCore/svg/SVGSVGElement.cpp -6 / +8 lines
Lines 474-489 RenderObject* SVGSVGElement::createRenderer(RenderArena* arena, RenderStyle*) a/Source/WebCore/svg/SVGSVGElement.cpp_sec1
474
    return new (arena) RenderSVGViewportContainer(this);
474
    return new (arena) RenderSVGViewportContainer(this);
475
}
475
}
476
476
477
void SVGSVGElement::insertedIntoDocument()
477
Node::InsertionNotificationRequest SVGSVGElement::insertedInto(Node* rootParent)
478
{
478
{
479
    document()->accessSVGExtensions()->addTimeContainer(this);
479
    if (rootParent->inDocument())
480
    SVGStyledLocatableElement::insertedIntoDocument();
480
        document()->accessSVGExtensions()->addTimeContainer(this);
481
    return SVGStyledLocatableElement::insertedInto(rootParent);
481
}
482
}
482
483
483
void SVGSVGElement::removedFromDocument()
484
void SVGSVGElement::removedFrom(Node* rootParent)
484
{
485
{
485
    document()->accessSVGExtensions()->removeTimeContainer(this);
486
    if (rootParent->inDocument())
486
    SVGStyledLocatableElement::removedFromDocument();
487
        document()->accessSVGExtensions()->removeTimeContainer(this);
488
    SVGStyledLocatableElement::removedFrom(rootParent);
487
}
489
}
488
490
489
void SVGSVGElement::pauseAnimations()
491
void SVGSVGElement::pauseAnimations()
- a/Source/WebCore/svg/SVGSVGElement.h -2 / +2 lines
Lines 145-152 private: a/Source/WebCore/svg/SVGSVGElement.h_sec1
145
    virtual bool rendererIsNeeded(const NodeRenderingContext& context) { return StyledElement::rendererIsNeeded(context); }
145
    virtual bool rendererIsNeeded(const NodeRenderingContext& context) { return StyledElement::rendererIsNeeded(context); }
146
    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
146
    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
147
147
148
    virtual void insertedIntoDocument();
148
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
149
    virtual void removedFromDocument();
149
    virtual void removedFrom(Node*) OVERRIDE;
150
150
151
    virtual void svgAttributeChanged(const QualifiedName&);
151
    virtual void svgAttributeChanged(const QualifiedName&);
152
152
- a/Source/WebCore/svg/SVGScriptElement.cpp -4 / +6 lines
Lines 117-127 void SVGScriptElement::svgAttributeChanged(const QualifiedName& attrName) a/Source/WebCore/svg/SVGScriptElement.cpp_sec1
117
    ASSERT_NOT_REACHED();
117
    ASSERT_NOT_REACHED();
118
}
118
}
119
119
120
void SVGScriptElement::insertedIntoDocument()
120
Node::InsertionNotificationRequest SVGScriptElement::insertedInto(Node* rootParent)
121
{
121
{
122
    SVGElement::insertedIntoDocument();
122
    SVGElement::insertedInto(rootParent);
123
    ScriptElement::insertedIntoDocument();
123
    ScriptElement::insertedInto(rootParent);
124
    SVGExternalResourcesRequired::insertedIntoDocument(this);
124
    if (rootParent->inDocument())
125
        SVGExternalResourcesRequired::insertedIntoDocument(this);
126
    return InsertionDone;
125
}
127
}
126
128
127
void SVGScriptElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
129
void SVGScriptElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
- a/Source/WebCore/svg/SVGScriptElement.h -1 / +1 lines
Lines 46-52 private: a/Source/WebCore/svg/SVGScriptElement.h_sec1
46
46
47
    bool isSupportedAttribute(const QualifiedName&);
47
    bool isSupportedAttribute(const QualifiedName&);
48
    virtual void parseAttribute(Attribute*) OVERRIDE;
48
    virtual void parseAttribute(Attribute*) OVERRIDE;
49
    virtual void insertedIntoDocument();
49
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
50
    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
50
    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
51
51
52
    virtual void svgAttributeChanged(const QualifiedName&);
52
    virtual void svgAttributeChanged(const QualifiedName&);
- a/Source/WebCore/svg/SVGStyleElement.cpp -6 / +9 lines
Lines 134-149 void SVGStyleElement::finishParsingChildren() a/Source/WebCore/svg/SVGStyleElement.cpp_sec1
134
    SVGElement::finishParsingChildren();
134
    SVGElement::finishParsingChildren();
135
}
135
}
136
136
137
void SVGStyleElement::insertedIntoDocument()
137
Node::InsertionNotificationRequest SVGStyleElement::insertedInto(Node* rootParent)
138
{
138
{
139
    SVGElement::insertedIntoDocument();
139
    SVGElement::insertedInto(rootParent);
140
    StyleElement::insertedIntoDocument(document(), this);
140
    if (rootParent->inDocument())
141
        StyleElement::insertedIntoDocument(document(), this);
142
    return InsertionDone;
141
}
143
}
142
144
143
void SVGStyleElement::removedFromDocument()
145
void SVGStyleElement::removedFrom(Node* rootParent)
144
{
146
{
145
    SVGElement::removedFromDocument();
147
    SVGElement::removedFrom(rootParent);
146
    StyleElement::removedFromDocument(document(), this);
148
    if (rootParent->inDocument())
149
        StyleElement::removedFromDocument(document(), this);
147
}
150
}
148
151
149
void SVGStyleElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
152
void SVGStyleElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
- a/Source/WebCore/svg/SVGStyleElement.h -2 / +2 lines
Lines 54-61 private: a/Source/WebCore/svg/SVGStyleElement.h_sec1
54
54
55
    bool isSupportedAttribute(const QualifiedName&);
55
    bool isSupportedAttribute(const QualifiedName&);
56
    virtual void parseAttribute(Attribute*) OVERRIDE;
56
    virtual void parseAttribute(Attribute*) OVERRIDE;
57
    virtual void insertedIntoDocument();
57
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
58
    virtual void removedFromDocument();
58
    virtual void removedFrom(Node*) OVERRIDE;
59
    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
59
    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
60
60
61
    virtual void finishParsingChildren();
61
    virtual void finishParsingChildren();
- a/Source/WebCore/svg/SVGStyledElement.cpp -8 / +9 lines
Lines 357-367 void SVGStyledElement::attach() a/Source/WebCore/svg/SVGStyledElement.cpp_sec1
357
        object->updateFromElement();
357
        object->updateFromElement();
358
}
358
}
359
359
360
void SVGStyledElement::insertedIntoDocument()
360
Node::InsertionNotificationRequest SVGStyledElement::insertedInto(Node* rootParent)
361
{
361
{
362
    SVGElement::insertedIntoDocument();
362
    SVGElement::insertedInto(rootParent);
363
    updateRelativeLengthsInformation();
363
    updateRelativeLengthsInformation();
364
    buildPendingResourcesIfNeeded();
364
    buildPendingResourcesIfNeeded();
365
    return InsertionDone;
365
}
366
}
366
367
367
void SVGStyledElement::buildPendingResourcesIfNeeded()
368
void SVGStyledElement::buildPendingResourcesIfNeeded()
Lines 388-401 void SVGStyledElement::buildPendingResourcesIfNeeded() a/Source/WebCore/svg/SVGStyledElement.cpp_sec2
388
    }
389
    }
389
}
390
}
390
391
391
void SVGStyledElement::removedFromDocument()
392
void SVGStyledElement::removedFrom(Node* rootParent)
392
{
393
{
393
    updateRelativeLengthsInformation(false, this);
394
    if (rootParent->inDocument())
394
    SVGElement::removedFromDocument();
395
        updateRelativeLengthsInformation(false, this);
396
    SVGElement::removedFrom(rootParent);
395
    SVGElementInstance::invalidateAllInstancesOfElement(this);
397
    SVGElementInstance::invalidateAllInstancesOfElement(this);
396
397
    Document* document = this->document();
398
    Document* document = this->document();
398
    if (!needsPendingResourceHandling() || !document)
399
    if (!rootParent->inDocument() || !needsPendingResourceHandling() || !document)
399
        return;
400
        return;
400
401
401
    document->accessSVGExtensions()->removeElementFromPendingResources(this);
402
    document->accessSVGExtensions()->removeElementFromPendingResources(this);
Lines 463-469 AffineTransform SVGStyledElement::localCoordinateSpaceTransform(SVGLocatable::CT a/Source/WebCore/svg/SVGStyledElement.cpp_sec3
463
464
464
void SVGStyledElement::updateRelativeLengthsInformation(bool hasRelativeLengths, SVGStyledElement* element)
465
void SVGStyledElement::updateRelativeLengthsInformation(bool hasRelativeLengths, SVGStyledElement* element)
465
{
466
{
466
    // If we're not yet in a document, this function will be called again from insertedIntoDocument(). Do nothing now.
467
    // If we're not yet in a document, this function will be called again from insertedInto(). Do nothing now.
467
    if (!inDocument())
468
    if (!inDocument())
468
        return;
469
        return;
469
470
- a/Source/WebCore/svg/SVGStyledElement.h -2 / +2 lines
Lines 72-79 protected: a/Source/WebCore/svg/SVGStyledElement.h_sec1
72
    virtual void svgAttributeChanged(const QualifiedName&);
72
    virtual void svgAttributeChanged(const QualifiedName&);
73
73
74
    virtual void attach();
74
    virtual void attach();
75
    virtual void insertedIntoDocument();
75
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
76
    virtual void removedFromDocument();
76
    virtual void removedFrom(Node*) OVERRIDE;
77
    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
77
    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
78
78
79
    static CSSPropertyID cssPropertyIdForSVGAttributeName(const QualifiedName&);
79
    static CSSPropertyID cssPropertyIdForSVGAttributeName(const QualifiedName&);
- a/Source/WebCore/svg/SVGTRefElement.cpp -7 / +10 lines
Lines 263-269 void SVGTRefElement::buildPendingResource() a/Source/WebCore/svg/SVGTRefElement.cpp_sec1
263
    // Remove any existing event listener.
263
    // Remove any existing event listener.
264
    clearEventListener();
264
    clearEventListener();
265
265
266
    // If we're not yet in a document, this function will be called again from insertedIntoDocument().
266
    // If we're not yet in a document, this function will be called again from insertedInto().
267
    if (!inDocument())
267
    if (!inDocument())
268
        return;
268
        return;
269
269
Lines 286-301 void SVGTRefElement::buildPendingResource() a/Source/WebCore/svg/SVGTRefElement.cpp_sec2
286
    target->addEventListener(eventNames().DOMNodeRemovedFromDocumentEvent, m_eventListener.get(), false);
286
    target->addEventListener(eventNames().DOMNodeRemovedFromDocumentEvent, m_eventListener.get(), false);
287
}
287
}
288
288
289
void SVGTRefElement::insertedIntoDocument()
289
Node::InsertionNotificationRequest SVGTRefElement::insertedInto(Node* rootParent)
290
{
290
{
291
    SVGStyledElement::insertedIntoDocument();
291
    SVGStyledElement::insertedInto(rootParent);
292
    buildPendingResource();
292
    if (rootParent->inDocument())
293
        buildPendingResource();
294
    return InsertionDone;
293
}
295
}
294
296
295
void SVGTRefElement::removedFromDocument()
297
void SVGTRefElement::removedFrom(Node* rootParent)
296
{
298
{
297
    SVGStyledElement::removedFromDocument();
299
    SVGStyledElement::removedFrom(rootParent);
298
    clearEventListener();
300
    if (rootParent->inDocument())
301
        clearEventListener();
299
}
302
}
300
303
301
void SVGTRefElement::clearEventListener()
304
void SVGTRefElement::clearEventListener()
- a/Source/WebCore/svg/SVGTRefElement.h -2 / +2 lines
Lines 50-57 private: a/Source/WebCore/svg/SVGTRefElement.h_sec1
50
    virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const;
50
    virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const;
51
    virtual bool rendererIsNeeded(const NodeRenderingContext&);
51
    virtual bool rendererIsNeeded(const NodeRenderingContext&);
52
52
53
    virtual void insertedIntoDocument();
53
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
54
    virtual void removedFromDocument();
54
    virtual void removedFrom(Node*) OVERRIDE;
55
55
56
    void clearEventListener();
56
    void clearEventListener();
57
57
- a/Source/WebCore/svg/SVGTextPathElement.cpp -4 / +7 lines
Lines 139-159 bool SVGTextPathElement::rendererIsNeeded(const NodeRenderingContext& context) a/Source/WebCore/svg/SVGTextPathElement.cpp_sec1
139
    return false;
139
    return false;
140
}
140
}
141
141
142
void SVGTextPathElement::insertedIntoDocument()
142
Node::InsertionNotificationRequest SVGTextPathElement::insertedInto(Node* rootParent)
143
{
143
{
144
    SVGStyledElement::insertedIntoDocument();
144
    SVGStyledElement::insertedInto(rootParent);
145
    if (!rootParent->inDocument())
146
        return InsertionDone;
145
147
146
    String id;
148
    String id;
147
    Element* targetElement = SVGURIReference::targetElementFromIRIString(href(), document(), &id);
149
    Element* targetElement = SVGURIReference::targetElementFromIRIString(href(), document(), &id);
148
    if (!targetElement) {
150
    if (!targetElement) {
149
        if (hasPendingResources() || id.isEmpty())
151
        if (hasPendingResources() || id.isEmpty())
150
            return;
152
            return InsertionDone;
151
153
152
        ASSERT(!hasPendingResources());
154
        ASSERT(!hasPendingResources());
153
        document()->accessSVGExtensions()->addPendingResource(id, this);
155
        document()->accessSVGExtensions()->addPendingResource(id, this);
154
        ASSERT(hasPendingResources());
156
        ASSERT(hasPendingResources());
155
        return;
156
    }
157
    }
158
159
    return InsertionDone;
157
}
160
}
158
161
159
bool SVGTextPathElement::selfHasRelativeLengths() const
162
bool SVGTextPathElement::selfHasRelativeLengths() const
- a/Source/WebCore/svg/SVGTextPathElement.h -1 / +1 lines
Lines 115-121 public: a/Source/WebCore/svg/SVGTextPathElement.h_sec1
115
private:
115
private:
116
    SVGTextPathElement(const QualifiedName&, Document*);
116
    SVGTextPathElement(const QualifiedName&, Document*);
117
117
118
    virtual void insertedIntoDocument();
118
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
119
119
120
    bool isSupportedAttribute(const QualifiedName&);
120
    bool isSupportedAttribute(const QualifiedName&);
121
    virtual void parseAttribute(Attribute*) OVERRIDE;
121
    virtual void parseAttribute(Attribute*) OVERRIDE;
- a/Source/WebCore/svg/SVGTitleElement.cpp -6 / +10 lines
Lines 21-29 a/Source/WebCore/svg/SVGTitleElement.cpp_sec1
21
#include "config.h"
21
#include "config.h"
22
#if ENABLE(SVG)
22
#if ENABLE(SVG)
23
#include "SVGTitleElement.h"
23
#include "SVGTitleElement.h"
24
#include "SVGNames.h"
25
24
26
#include "Document.h"
25
#include "Document.h"
26
#include "SVGNames.h"
27
27
28
namespace WebCore {
28
namespace WebCore {
29
29
Lines 38-55 PassRefPtr<SVGTitleElement> SVGTitleElement::create(const QualifiedName& tagName a/Source/WebCore/svg/SVGTitleElement.cpp_sec2
38
    return adoptRef(new SVGTitleElement(tagName, document));
38
    return adoptRef(new SVGTitleElement(tagName, document));
39
}
39
}
40
40
41
void SVGTitleElement::insertedIntoDocument()
41
Node::InsertionNotificationRequest SVGTitleElement::insertedInto(Node* rootParent)
42
{
42
{
43
    SVGStyledElement::insertedIntoDocument();
43
    SVGStyledElement::insertedInto(rootParent);
44
    if (!rootParent->inDocument())
45
        return InsertionDone;
44
    if (firstChild())
46
    if (firstChild())
45
        // FIXME: does SVG have a title text direction?
47
        // FIXME: does SVG have a title text direction?
46
        document()->setTitleElement(StringWithDirection(textContent(), LTR), this);
48
        document()->setTitleElement(StringWithDirection(textContent(), LTR), this);
49
    return InsertionDone;
47
}
50
}
48
51
49
void SVGTitleElement::removedFromDocument()
52
void SVGTitleElement::removedFrom(Node* rootParent)
50
{
53
{
51
    SVGElement::removedFromDocument();
54
    SVGElement::removedFrom(rootParent);
52
    document()->removeTitle(this);
55
    if (rootParent->inDocument())
56
        document()->removeTitle(this);
53
}
57
}
54
58
55
void SVGTitleElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
59
void SVGTitleElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
- a/Source/WebCore/svg/SVGTitleElement.h -2 / +2 lines
Lines 35-42 public: a/Source/WebCore/svg/SVGTitleElement.h_sec1
35
private:
35
private:
36
    SVGTitleElement(const QualifiedName&, Document*);
36
    SVGTitleElement(const QualifiedName&, Document*);
37
37
38
    virtual void insertedIntoDocument();
38
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
39
    virtual void removedFromDocument();
39
    virtual void removedFrom(Node*) OVERRIDE;
40
    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
40
    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
41
41
42
    virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; }
42
    virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; }
- a/Source/WebCore/svg/SVGUseElement.cpp -5 / +9 lines
Lines 175-195 static inline bool isWellFormedDocument(Document* document) a/Source/WebCore/svg/SVGUseElement.cpp_sec1
175
    return true;
175
    return true;
176
}
176
}
177
177
178
void SVGUseElement::insertedIntoDocument()
178
Node::InsertionNotificationRequest SVGUseElement::insertedInto(Node* rootParent)
179
{
179
{
180
    // This functions exists to assure assumptions made in the code regarding SVGElementInstance creation/destruction are satisfied.
180
    // This functions exists to assure assumptions made in the code regarding SVGElementInstance creation/destruction are satisfied.
181
    SVGStyledTransformableElement::insertedIntoDocument();
181
    SVGStyledTransformableElement::insertedInto(rootParent);
182
    if (!rootParent->inDocument())
183
        return InsertionDone;
182
    ASSERT(!m_targetElementInstance || !isWellFormedDocument(document()));
184
    ASSERT(!m_targetElementInstance || !isWellFormedDocument(document()));
183
    ASSERT(!hasPendingResources() || !isWellFormedDocument(document()));
185
    ASSERT(!hasPendingResources() || !isWellFormedDocument(document()));
184
    if (!m_wasInsertedByParser)
186
    if (!m_wasInsertedByParser)
185
        buildPendingResource();
187
        buildPendingResource();
186
    SVGExternalResourcesRequired::insertedIntoDocument(this);
188
    SVGExternalResourcesRequired::insertedIntoDocument(this);
189
    return InsertionDone;
187
}
190
}
188
191
189
void SVGUseElement::removedFromDocument()
192
void SVGUseElement::removedFrom(Node* rootParent)
190
{
193
{
191
    SVGStyledTransformableElement::removedFromDocument();
194
    SVGStyledTransformableElement::removedFrom(rootParent);
192
    clearResourceReferences();
195
    if (rootParent->inDocument())
196
        clearResourceReferences();
193
}
197
}
194
198
195
Document* SVGUseElement::referencedDocument() const
199
Document* SVGUseElement::referencedDocument() const
- a/Source/WebCore/svg/SVGUseElement.h -2 / +2 lines
Lines 59-66 private: a/Source/WebCore/svg/SVGUseElement.h_sec1
59
    virtual bool isValid() const { return SVGTests::isValid(); }
59
    virtual bool isValid() const { return SVGTests::isValid(); }
60
    virtual bool supportsFocus() const { return true; }
60
    virtual bool supportsFocus() const { return true; }
61
61
62
    virtual void insertedIntoDocument();
62
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
63
    virtual void removedFromDocument();
63
    virtual void removedFrom(Node*) OVERRIDE;
64
    virtual void buildPendingResource();
64
    virtual void buildPendingResource();
65
65
66
    bool isSupportedAttribute(const QualifiedName&);
66
    bool isSupportedAttribute(const QualifiedName&);
- a/Source/WebCore/svg/SVGVKernElement.cpp -8 / +11 lines
Lines 39-62 PassRefPtr<SVGVKernElement> SVGVKernElement::create(const QualifiedName& tagName a/Source/WebCore/svg/SVGVKernElement.cpp_sec1
39
    return adoptRef(new SVGVKernElement(tagName, document));
39
    return adoptRef(new SVGVKernElement(tagName, document));
40
}
40
}
41
41
42
void SVGVKernElement::insertedIntoDocument()
42
Node::InsertionNotificationRequest SVGVKernElement::insertedInto(Node* rootParent)
43
{
43
{
44
    ContainerNode* fontNode = parentNode();
44
    if (rootParent->inDocument()) {
45
    if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) {
45
        ContainerNode* fontNode = parentNode();
46
        if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode))
46
        if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) {
47
            element->invalidateGlyphCache();
47
            if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode))
48
                element->invalidateGlyphCache();
49
        }
48
    }
50
    }
49
    SVGElement::insertedIntoDocument();
51
52
    return SVGElement::insertedInto(rootParent);
50
}
53
}
51
54
52
void SVGVKernElement::removedFromDocument()
55
void SVGVKernElement::removedFrom(Node* rootParent)
53
{
56
{
54
    ContainerNode* fontNode = parentNode();
57
    ContainerNode* fontNode = parentNode();
55
    if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) {
58
    if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) {
56
        if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode))
59
        if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode))
57
            element->invalidateGlyphCache();
60
            element->invalidateGlyphCache();
58
    }
61
    }
59
    SVGElement::removedFromDocument();
62
    SVGElement::removedFrom(rootParent);
60
}
63
}
61
64
62
void SVGVKernElement::buildVerticalKerningPair(KerningPairVector& kerningPairs)
65
void SVGVKernElement::buildVerticalKerningPair(KerningPairVector& kerningPairs)
- a/Source/WebCore/svg/SVGVKernElement.h -2 / +2 lines
Lines 39-46 public: a/Source/WebCore/svg/SVGVKernElement.h_sec1
39
private:
39
private:
40
    SVGVKernElement(const QualifiedName&, Document*);
40
    SVGVKernElement(const QualifiedName&, Document*);
41
41
42
    virtual void insertedIntoDocument();
42
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
43
    virtual void removedFromDocument();
43
    virtual void removedFrom(Node*) OVERRIDE;
44
44
45
    virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; }
45
    virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; }
46
};
46
};
- a/Source/WebCore/svg/animation/SVGSMILElement.cpp -19 / +26 lines
Lines 189-197 void SVGSMILElement::reset() a/Source/WebCore/svg/animation/SVGSMILElement.cpp_sec1
189
    resolveFirstInterval();
189
    resolveFirstInterval();
190
}
190
}
191
191
192
void SVGSMILElement::insertedIntoDocument()
192
Node::InsertionNotificationRequest SVGSMILElement::insertedInto(Node* rootParent)
193
{
193
{
194
    SVGElement::insertedIntoDocument();
194
    SVGElement::insertedInto(rootParent);
195
    if (!rootParent->inDocument())
196
        return InsertionDone;
195
197
196
    // Verify we are not in <use> instance tree.
198
    // Verify we are not in <use> instance tree.
197
    ASSERT(!isInShadowTree());
199
    ASSERT(!isInShadowTree());
Lines 199-205 void SVGSMILElement::insertedIntoDocument() a/Source/WebCore/svg/animation/SVGSMILElement.cpp_sec2
199
    m_attributeName = constructQualifiedName(this, fastGetAttribute(SVGNames::attributeNameAttr));
201
    m_attributeName = constructQualifiedName(this, fastGetAttribute(SVGNames::attributeNameAttr));
200
    SVGSVGElement* owner = ownerSVGElement();
202
    SVGSVGElement* owner = ownerSVGElement();
201
    if (!owner)
203
    if (!owner)
202
        return;
204
        return InsertionDone;
203
    m_timeContainer = owner->timeContainer();
205
    m_timeContainer = owner->timeContainer();
204
    ASSERT(m_timeContainer);
206
    ASSERT(m_timeContainer);
205
    m_timeContainer->setDocumentOrderIndexesDirty();
207
    m_timeContainer->setDocumentOrderIndexesDirty();
Lines 212-239 void SVGSMILElement::insertedIntoDocument() a/Source/WebCore/svg/animation/SVGSMILElement.cpp_sec3
212
        resolveFirstInterval();
214
        resolveFirstInterval();
213
        reschedule();
215
        reschedule();
214
    }
216
    }
217
218
    return InsertionDone;
215
}
219
}
216
220
217
void SVGSMILElement::removedFromDocument()
221
void SVGSMILElement::removedFrom(Node* rootParent)
218
{
222
{
219
    if (m_timeContainer) {
223
    if (rootParent->inDocument()) {
220
        m_timeContainer->unschedule(this);
224
        if (m_timeContainer) {
221
        m_timeContainer = 0;
225
            m_timeContainer->unschedule(this);
222
    }
226
            m_timeContainer = 0;
223
    // Calling disconnectConditions() may kill us if there are syncbase conditions.
227
        }
224
    // OK, but we don't want to die inside the call.
228
        // Calling disconnectConditions() may kill us if there are syncbase conditions.
225
    RefPtr<SVGSMILElement> keepAlive(this);
229
        // OK, but we don't want to die inside the call.
226
    disconnectConditions();
230
        RefPtr<SVGSMILElement> keepAlive(this);
231
        disconnectConditions();
227
232
228
    // Clear target now, because disconnectConditions calls targetElement() which will recreate the target if we removed it sooner. 
233
        // Clear target now, because disconnectConditions calls targetElement() which will recreate the target if we removed it sooner. 
229
    if (m_targetElement) {
234
        if (m_targetElement) {
230
        document()->accessSVGExtensions()->removeAnimationElementFromTarget(this, m_targetElement);
235
            document()->accessSVGExtensions()->removeAnimationElementFromTarget(this, m_targetElement);
231
        targetElementWillChange(m_targetElement, 0);
236
            targetElementWillChange(m_targetElement, 0);
232
        m_targetElement = 0;
237
            m_targetElement = 0;
238
        }
239
240
        m_attributeName = anyQName();
233
    }
241
    }
234
242
235
    m_attributeName = anyQName();
243
    SVGElement::removedFrom(rootParent);
236
    SVGElement::removedFromDocument();
237
}
244
}
238
   
245
   
239
SMILTime SVGSMILElement::parseOffsetValue(const String& data)
246
SMILTime SVGSMILElement::parseOffsetValue(const String& data)
- a/Source/WebCore/svg/animation/SVGSMILElement.h -2 / +2 lines
Lines 47-54 public: a/Source/WebCore/svg/animation/SVGSMILElement.h_sec1
47
    bool isSupportedAttribute(const QualifiedName&);
47
    bool isSupportedAttribute(const QualifiedName&);
48
    virtual void parseAttribute(Attribute*) OVERRIDE;
48
    virtual void parseAttribute(Attribute*) OVERRIDE;
49
    virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE;
49
    virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE;
50
    virtual void insertedIntoDocument();
50
    virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
51
    virtual void removedFromDocument();
51
    virtual void removedFrom(Node*) OVERRIDE;
52
    
52
    
53
    virtual bool hasValidAttributeType() = 0;
53
    virtual bool hasValidAttributeType() = 0;
54
    virtual void animationAttributeChanged() = 0;
54
    virtual void animationAttributeChanged() = 0;

Return to Bug 82701