summaryrefslogtreecommitdiffstats
path: root/WebCore/html/HTML5Tokenizer.h
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/html/HTML5Tokenizer.h')
-rw-r--r--WebCore/html/HTML5Tokenizer.h40
1 files changed, 30 insertions, 10 deletions
diff --git a/WebCore/html/HTML5Tokenizer.h b/WebCore/html/HTML5Tokenizer.h
index 7d503aa..b96866d 100644
--- a/WebCore/html/HTML5Tokenizer.h
+++ b/WebCore/html/HTML5Tokenizer.h
@@ -27,39 +27,59 @@
#define HTML5Tokenizer_h
#include "CachedResourceClient.h"
+#include "HTML5ScriptRunnerHost.h"
+#include "HTML5Token.h"
#include "SegmentedString.h"
#include "Tokenizer.h"
#include <wtf/OwnPtr.h>
namespace WebCore {
-class HTMLDocument;
-class HTML5TreeBuilder;
class HTML5Lexer;
+class HTML5ScriptRunner;
+class HTML5TreeBuilder;
+class HTMLDocument;
+class ScriptSourceCode;
-// FIXME: This is the wrong layer to hook in the new HTML 5 Lexer,
-// however HTMLTokenizer is too large and too fragile of a class to hack into.
-// Eventually we should split all of the HTML lexer logic out from HTMLTokenizer
-// and then share non-lexer-specific tokenizer logic between HTML5 and the
-// legacy WebKit HTML lexer.
-
-// FIXME: This class is far from complete.
-class HTML5Tokenizer : public Tokenizer, public CachedResourceClient {
+// FIXME: The whole Tokenizer class system should be renamed "Parser"
+// or "ParserController" as the job of this class is to drive parsing process
+// but it does not itself Tokenize.
+class HTML5Tokenizer : public Tokenizer, HTML5ScriptRunnerHost, CachedResourceClient {
public:
HTML5Tokenizer(HTMLDocument*, bool reportErrors);
virtual ~HTML5Tokenizer();
+ // Tokenizer
virtual void begin();
virtual void write(const SegmentedString&, bool appendData);
virtual void end();
virtual void finish();
+ virtual int executingScript() const;
virtual bool isWaitingForScripts() const;
+ virtual void executeScriptsWaitingForStylesheets();
+
+ // HTML5ScriptRunnerHost
+ virtual void watchForLoad(CachedResource*);
+ virtual void stopWatchingForLoad(CachedResource*);
+ virtual void executeScript(const ScriptSourceCode&);
+
+ // CachedResourceClient
+ virtual void notifyFinished(CachedResource*);
private:
+ void pumpLexer();
+ void resumeParsingAfterScriptExecution();
+
SegmentedString m_source;
+ // We hold m_token here because it might be partially complete.
+ HTML5Token m_token;
+
+ HTMLDocument* m_document;
OwnPtr<HTML5Lexer> m_lexer;
+ OwnPtr<HTML5ScriptRunner> m_scriptRunner;
OwnPtr<HTML5TreeBuilder> m_treeBuilder;
+ bool m_wasWaitingOnScriptsDuringFinish;
};
}