summaryrefslogtreecommitdiffstats
path: root/WebCore/dom/ScriptElement.h
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/dom/ScriptElement.h')
-rw-r--r--WebCore/dom/ScriptElement.h81
1 files changed, 34 insertions, 47 deletions
diff --git a/WebCore/dom/ScriptElement.h b/WebCore/dom/ScriptElement.h
index c663e43..b6beb6e 100644
--- a/WebCore/dom/ScriptElement.h
+++ b/WebCore/dom/ScriptElement.h
@@ -28,79 +28,66 @@ namespace WebCore {
class CachedScript;
class Element;
-class ScriptElementData;
+class ScriptElement;
class ScriptSourceCode;
-class ScriptElement {
+class ScriptElement : private CachedResourceClient {
public:
- ScriptElement() { }
- virtual ~ScriptElement() { }
+ ScriptElement(Element*, bool createdByParser, bool isEvaluated);
+ virtual ~ScriptElement();
+
+ Element* element() const { return m_element; }
- virtual String scriptContent() const = 0;
+ // A charset for loading the script (may be overridden by HTTP headers or a BOM).
+ String scriptCharset() const;
- virtual String sourceAttributeValue() const = 0;
- virtual String charsetAttributeValue() const = 0;
- virtual String typeAttributeValue() const = 0;
- virtual String languageAttributeValue() const = 0;
- virtual String forAttributeValue() const = 0;
- virtual String eventAttributeValue() const = 0;
- virtual bool asyncAttributeValue() const = 0;
- virtual bool deferAttributeValue() const = 0;
+ String scriptContent() const;
+ bool shouldExecuteAsJavaScript() const;
+ void executeScript(const ScriptSourceCode&);
+ void execute(CachedScript*);
+ // XML parser calls these
+ virtual String sourceAttributeValue() const = 0;
virtual void dispatchLoadEvent() = 0;
virtual void dispatchErrorEvent() = 0;
- // A charset for loading the script (may be overridden by HTTP headers or a BOM).
- virtual String scriptCharset() const = 0;
-
- virtual bool shouldExecuteAsJavaScript() const = 0;
-
protected:
- // Helper functions used by our parent classes.
- static void insertedIntoDocument(ScriptElementData&, const String& sourceUrl);
- static void removedFromDocument(ScriptElementData&);
- static void childrenChanged(ScriptElementData&);
- static void finishParsingChildren(ScriptElementData&, const String& sourceUrl);
- static void handleSourceAttribute(ScriptElementData&, const String& sourceUrl);
-};
+ bool haveFiredLoadEvent() const { return m_firedLoad; }
+ void setHaveFiredLoadEvent(bool firedLoad) { m_firedLoad = firedLoad; }
+ bool createdByParser() const { return m_createdByParser; }
+ bool isEvaluated() const { return m_isEvaluated; }
-// HTML/SVGScriptElement hold this struct as member variable
-// and pass it to the static helper functions in ScriptElement
-class ScriptElementData : private CachedResourceClient {
-public:
- ScriptElementData(ScriptElement*, Element*);
- virtual ~ScriptElementData();
+ // Helper functions used by our parent classes.
+ void insertedIntoDocument(const String& sourceUrl);
+ void removedFromDocument();
+ void childrenChanged();
+ void finishParsingChildren(const String& sourceUrl);
+ void handleSourceAttribute(const String& sourceUrl);
+private:
bool ignoresLoadRequest() const;
- bool shouldExecuteAsJavaScript() const;
-
- String scriptContent() const;
- String scriptCharset() const;
bool isAsynchronous() const;
bool isDeferred() const;
- Element* element() const { return m_element; }
- bool createdByParser() const { return m_createdByParser; }
- void setCreatedByParser(bool value) { m_createdByParser = value; }
- bool haveFiredLoadEvent() const { return m_firedLoad; }
- void setHaveFiredLoadEvent(bool firedLoad) { m_firedLoad = firedLoad; }
-
void requestScript(const String& sourceUrl);
void evaluateScript(const ScriptSourceCode&);
void stopLoadRequest();
- void execute(CachedScript*);
-
-private:
virtual void notifyFinished(CachedResource*);
-private:
- ScriptElement* m_scriptElement;
+ virtual String charsetAttributeValue() const = 0;
+ virtual String typeAttributeValue() const = 0;
+ virtual String languageAttributeValue() const = 0;
+ virtual String forAttributeValue() const = 0;
+ virtual String eventAttributeValue() const = 0;
+ virtual bool asyncAttributeValue() const = 0;
+ virtual bool deferAttributeValue() const = 0;
+
Element* m_element;
CachedResourceHandle<CachedScript> m_cachedScript;
bool m_createdByParser; // HTML5: "parser-inserted"
bool m_requested;
- bool m_evaluated; // HTML5: "already started"
+ bool m_isEvaluated; // HTML5: "already started"
bool m_firedLoad;
};