Line data Source code
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 : #ifndef mozilla_dom_ScriptElement_h
8 : #define mozilla_dom_ScriptElement_h
9 :
10 : #include "mozilla/Attributes.h"
11 : #include "nsIScriptLoaderObserver.h"
12 : #include "nsIScriptElement.h"
13 : #include "nsStubMutationObserver.h"
14 :
15 : namespace mozilla {
16 : namespace dom {
17 :
18 : /**
19 : * Baseclass useful for script elements (such as <xhtml:script> and
20 : * <svg:script>). Currently the class assumes that only the 'src'
21 : * attribute and the children of the class affect what script to execute.
22 : */
23 :
24 0 : class ScriptElement : public nsIScriptElement,
25 : public nsStubMutationObserver
26 : {
27 : public:
28 : // nsIScriptLoaderObserver
29 : NS_DECL_NSISCRIPTLOADEROBSERVER
30 :
31 : // nsIMutationObserver
32 : NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
33 : NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
34 : NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
35 : NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
36 :
37 5 : explicit ScriptElement(FromParser aFromParser)
38 5 : : nsIScriptElement(aFromParser)
39 : {
40 5 : }
41 :
42 : virtual nsresult FireErrorEvent() override;
43 :
44 : protected:
45 : // Internal methods
46 :
47 : /**
48 : * Check if this element contains any script, linked or inline
49 : */
50 : virtual bool HasScriptContent() = 0;
51 :
52 : virtual bool MaybeProcessScript() override;
53 : };
54 :
55 : } // dom namespace
56 : } // mozilla namespace
57 :
58 : #endif // mozilla_dom_ScriptElement_h
|