1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
/*
* Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
* Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_SVG_SVG_SCRIPT_ELEMENT_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_SVG_SVG_SCRIPT_ELEMENT_H_
#include "third_party/blink/renderer/core/dom/create_element_flags.h"
#include "third_party/blink/renderer/core/script/script_element_base.h"
#include "third_party/blink/renderer/core/svg/svg_element.h"
#include "third_party/blink/renderer/core/svg/svg_uri_reference.h"
#include "third_party/blink/renderer/core/svg_names.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
namespace blink {
class ScriptLoader;
class SVGScriptElement final : public SVGElement,
public SVGURIReference,
public ScriptElementBase {
DEFINE_WRAPPERTYPEINFO();
USING_GARBAGE_COLLECTED_MIXIN(SVGScriptElement);
public:
static SVGScriptElement* Create(Document&, const CreateElementFlags);
ScriptLoader* Loader() const final { return loader_.Get(); }
#if DCHECK_IS_ON()
bool IsAnimatableAttribute(const QualifiedName&) const override;
#endif
bool IsScriptElement() const override { return true; }
void Trace(blink::Visitor*) override;
void TraceWrappers(ScriptWrappableVisitor*) const override;
private:
SVGScriptElement(Document&, const CreateElementFlags);
void ParseAttribute(const AttributeModificationParams&) override;
InsertionNotificationRequest InsertedInto(ContainerNode*) override;
void DidNotifySubtreeInsertionsToDocument() override;
void ChildrenChanged(const ChildrenChange&) override;
void DidMoveToNewDocument(Document& old_document) override;
void SvgAttributeChanged(const QualifiedName&) override;
bool IsURLAttribute(const Attribute&) const override;
bool IsStructurallyExternal() const override { return HasSourceAttribute(); }
void FinishParsingChildren() override;
bool HaveLoadedRequiredResources() override;
// ScriptElementBase overrides:
bool AsyncAttributeValue() const override { return false; }
String CharsetAttributeValue() const override { return String(); }
String CrossOriginAttributeValue() const override { return String(); }
bool DeferAttributeValue() const override { return false; }
String EventAttributeValue() const override { return String(); }
String ForAttributeValue() const override { return String(); }
String IntegrityAttributeValue() const override { return String(); }
String LanguageAttributeValue() const override { return String(); }
bool NomoduleAttributeValue() const override { return false; }
String SourceAttributeValue() const override;
String TypeAttributeValue() const override;
String TextFromChildren() override;
bool HasSourceAttribute() const override;
bool IsConnected() const override;
bool HasChildren() const override;
const AtomicString& GetNonceForElement() const override;
bool ElementHasDuplicateAttributes() const override {
return HasDuplicateAttribute();
}
bool AllowInlineScriptForCSP(const AtomicString& nonce,
const WTF::OrdinalNumber&,
const String& script_content,
ContentSecurityPolicy::InlineType) override;
Document& GetDocument() const override;
void DispatchLoadEvent() override;
void DispatchErrorEvent() override;
void SetScriptElementForBinding(
HTMLScriptElementOrSVGScriptElement&) override;
Element* CloneWithoutAttributesAndChildren(Document&) const override;
bool LayoutObjectIsNeeded(const ComputedStyle&) const override {
return false;
}
bool have_fired_load_ = false;
TraceWrapperMember<ScriptLoader> loader_;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_SVG_SVG_SCRIPT_ELEMENT_H_
|