diff options
Diffstat (limited to 'WebCore/dom/DocumentParser.h')
-rw-r--r-- | WebCore/dom/DocumentParser.h | 62 |
1 files changed, 18 insertions, 44 deletions
diff --git a/WebCore/dom/DocumentParser.h b/WebCore/dom/DocumentParser.h index 881136c..7e47a87 100644 --- a/WebCore/dom/DocumentParser.h +++ b/WebCore/dom/DocumentParser.h @@ -24,29 +24,34 @@ #ifndef DocumentParser_h #define DocumentParser_h -#include <wtf/Assertions.h> +#include <wtf/Noncopyable.h> namespace WebCore { class Document; +class DocumentWriter; class LegacyHTMLTreeBuilder; -class LegacyHTMLDocumentParser; class SegmentedString; -class XSSAuditor; +class ScriptableDocumentParser; class DocumentParser : public Noncopyable { public: virtual ~DocumentParser() { } - // Script output must be prepended, while new data - // received during executing a script must be appended, hence the - // extra bool to be able to distinguish between both cases. - // document.write() always uses false, while the loader uses true. - virtual void write(const SegmentedString&, bool isFromNetwork) = 0; + virtual ScriptableDocumentParser* asScriptableDocumentParser() { return 0; } + + // insert is used by document.write + virtual void insert(const SegmentedString&) = 0; + + // appendBytes is used by DocumentWriter (the loader) + virtual void appendBytes(DocumentWriter*, const char* bytes, int length, bool flush) = 0; + + // FIXME: append() should be private, but DocumentWriter::replaceDocument + // uses it for now. + virtual void append(const SegmentedString&) = 0; + virtual void finish() = 0; virtual bool finishWasCalled() = 0; - virtual bool isWaitingForScripts() const = 0; - virtual bool isExecutingScript() const { return false; } virtual void stopParsing() { m_parserStopped = true; } // FIXME: processingData() is only used by DocumentLoader::isLoadingInAPISense @@ -54,53 +59,22 @@ public: // actually implements it. virtual bool processingData() const { return false; } - virtual bool wantsRawData() const { return false; } - virtual bool writeRawData(const char* /*data*/, int /*length*/) - { - ASSERT_NOT_REACHED(); - return false; - } - - virtual bool wellFormed() const { return true; } - - virtual int lineNumber() const { return -1; } - virtual int columnNumber() const { return -1; } - - virtual void executeScriptsWaitingForStylesheets() {} - + // FIXME: Exposed for HTMLFormControlElement::removedFromTree. HTML DOM + // code should not need to reach into implementation details of the parser. virtual LegacyHTMLTreeBuilder* htmlTreeBuilder() const { return 0; } - virtual LegacyHTMLDocumentParser* asHTMLDocumentParser() { return 0; } - - // FIXME: view source mode is only used by the HTML and Text - // DocumentParsers and may not belong on the base-class. - bool inViewSourceMode() const { return m_inViewSourceMode; } - void setInViewSourceMode(bool mode) { m_inViewSourceMode = mode; } Document* document() const { return m_document; } - XSSAuditor* xssAuditor() const { return m_XSSAuditor; } - void setXSSAuditor(XSSAuditor* auditor) { m_XSSAuditor = auditor; } - protected: - DocumentParser(Document* document, bool viewSourceMode = false) - : m_parserStopped(false) - , m_inViewSourceMode(viewSourceMode) - , m_document(document) - , m_XSSAuditor(0) - { - ASSERT(document); - } + DocumentParser(Document*); // The parser has buffers, so parsing may continue even after // it stops receiving data. We use m_parserStopped to stop the parser // even when it has buffered data. bool m_parserStopped; - bool m_inViewSourceMode; // Every DocumentParser needs a pointer back to the document. Document* m_document; - // The XSSAuditor associated with this document parser. - XSSAuditor* m_XSSAuditor; }; } // namespace WebCore |