/src/mozilla-central/dom/svg/SVGTitleElement.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #include "mozilla/dom/SVGTitleElement.h" |
8 | | #include "mozilla/dom/SVGTitleElementBinding.h" |
9 | | |
10 | | NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Title) |
11 | | |
12 | | namespace mozilla { |
13 | | namespace dom { |
14 | | |
15 | | JSObject* |
16 | | SVGTitleElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) |
17 | 0 | { |
18 | 0 | return SVGTitleElement_Binding::Wrap(aCx, this, aGivenProto); |
19 | 0 | } |
20 | | |
21 | | //---------------------------------------------------------------------- |
22 | | // nsISupports methods |
23 | | |
24 | | NS_IMPL_ISUPPORTS_INHERITED(SVGTitleElement, SVGTitleElementBase, |
25 | | nsIMutationObserver) |
26 | | |
27 | | //---------------------------------------------------------------------- |
28 | | // Implementation |
29 | | |
30 | | SVGTitleElement::SVGTitleElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) |
31 | | : SVGTitleElementBase(std::move(aNodeInfo)) |
32 | 0 | { |
33 | 0 | AddMutationObserver(this); |
34 | 0 | } |
35 | | |
36 | | SVGTitleElement::~SVGTitleElement() |
37 | 0 | { |
38 | 0 | } |
39 | | |
40 | | void |
41 | | SVGTitleElement::CharacterDataChanged(nsIContent* aContent, |
42 | | const CharacterDataChangeInfo&) |
43 | 0 | { |
44 | 0 | SendTitleChangeEvent(false); |
45 | 0 | } |
46 | | |
47 | | void |
48 | | SVGTitleElement::ContentAppended(nsIContent* aFirstNewContent) |
49 | 0 | { |
50 | 0 | SendTitleChangeEvent(false); |
51 | 0 | } |
52 | | |
53 | | void |
54 | | SVGTitleElement::ContentInserted(nsIContent* aChild) |
55 | 0 | { |
56 | 0 | SendTitleChangeEvent(false); |
57 | 0 | } |
58 | | |
59 | | void |
60 | | SVGTitleElement::ContentRemoved(nsIContent* aChild, |
61 | | nsIContent* aPreviousSibling) |
62 | 0 | { |
63 | 0 | SendTitleChangeEvent(false); |
64 | 0 | } |
65 | | |
66 | | nsresult |
67 | | SVGTitleElement::BindToTree(nsIDocument *aDocument, |
68 | | nsIContent *aParent, |
69 | | nsIContent *aBindingParent) |
70 | 0 | { |
71 | 0 | // Let this fall through. |
72 | 0 | nsresult rv = SVGTitleElementBase::BindToTree(aDocument, aParent, |
73 | 0 | aBindingParent); |
74 | 0 | NS_ENSURE_SUCCESS(rv, rv); |
75 | 0 |
|
76 | 0 | SendTitleChangeEvent(true); |
77 | 0 |
|
78 | 0 | return NS_OK; |
79 | 0 | } |
80 | | |
81 | | void |
82 | | SVGTitleElement::UnbindFromTree(bool aDeep, bool aNullParent) |
83 | 0 | { |
84 | 0 | SendTitleChangeEvent(false); |
85 | 0 |
|
86 | 0 | // Let this fall through. |
87 | 0 | SVGTitleElementBase::UnbindFromTree(aDeep, aNullParent); |
88 | 0 | } |
89 | | |
90 | | void |
91 | | SVGTitleElement::DoneAddingChildren(bool aHaveNotified) |
92 | 0 | { |
93 | 0 | if (!aHaveNotified) { |
94 | 0 | SendTitleChangeEvent(false); |
95 | 0 | } |
96 | 0 | } |
97 | | |
98 | | void |
99 | | SVGTitleElement::SendTitleChangeEvent(bool aBound) |
100 | 0 | { |
101 | 0 | nsIDocument* doc = GetUncomposedDoc(); |
102 | 0 | if (doc) { |
103 | 0 | doc->NotifyPossibleTitleChange(aBound); |
104 | 0 | } |
105 | 0 | } |
106 | | |
107 | | //---------------------------------------------------------------------- |
108 | | // nsINode methods |
109 | | |
110 | | NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGTitleElement) |
111 | | |
112 | | } // namespace dom |
113 | | } // namespace mozilla |
114 | | |