/src/mozilla-central/dom/xml/nsXMLElement.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 "nsXMLElement.h" |
8 | | #include "mozilla/dom/ElementBinding.h" |
9 | | #include "mozilla/dom/ElementInlines.h" |
10 | | #include "nsContentUtils.h" // nsAutoScriptBlocker |
11 | | |
12 | | using namespace mozilla; |
13 | | using namespace mozilla::dom; |
14 | | |
15 | | nsresult |
16 | | NS_NewXMLElement(Element** aInstancePtrResult, |
17 | | already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) |
18 | 0 | { |
19 | 0 | RefPtr<nsXMLElement> it = new nsXMLElement(std::move(aNodeInfo)); |
20 | 0 | it.forget(aInstancePtrResult); |
21 | 0 | return NS_OK; |
22 | 0 | } |
23 | | |
24 | | JSObject* |
25 | | nsXMLElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) |
26 | 0 | { |
27 | 0 | return Element_Binding::Wrap(aCx, this, aGivenProto); |
28 | 0 | } |
29 | | |
30 | | void |
31 | | nsXMLElement::UnbindFromTree(bool aDeep, bool aNullParent) |
32 | 0 | { |
33 | 0 | CSSPseudoElementType pseudoType = GetPseudoElementType(); |
34 | 0 | bool isBefore = pseudoType == CSSPseudoElementType::before; |
35 | 0 | nsAtom* property = isBefore |
36 | 0 | ? nsGkAtoms::beforePseudoProperty : nsGkAtoms::afterPseudoProperty; |
37 | 0 |
|
38 | 0 | switch (pseudoType) { |
39 | 0 | case CSSPseudoElementType::before: |
40 | 0 | case CSSPseudoElementType::after: { |
41 | 0 | MOZ_ASSERT(GetParent()); |
42 | 0 | MOZ_ASSERT(GetParent()->IsElement()); |
43 | 0 | GetParent()->DeleteProperty(property); |
44 | 0 | break; |
45 | 0 | } |
46 | 0 | default: |
47 | 0 | break; |
48 | 0 | } |
49 | 0 | Element::UnbindFromTree(aDeep, aNullParent); |
50 | 0 | } |
51 | | |
52 | | NS_IMPL_ELEMENT_CLONE(nsXMLElement) |