mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:37:36 +00:00
LibWeb: Add basic support for dynamic markup insertion
This implements basic support for dynamic markup insertion, adding * Document::open() * Document::write(Vector<String> const&) * Document::writeln(Vector<String> const&) * Document::close() The HTMLParser is modified to make it possible to create a script-created parser which initially only contains a HTMLTokenizer without any data. Aditionally the HTMLParser::run method gains an overload which does not modify the Document and does not run HTMLParser::the_end() so that we can reenter the parser at a later time. Furthermore all FIXMEs that consern the insertion point are implemented wich is defined in the HTMLTokenizer. Additionally the following member-variables of the HTMLParser are now exposed by getter funcions: * m_tokenizer * m_aborted * m_script_nesting_level The HTMLTokenizer is modified so that it contains an insertion point which keeps track of where the next input from the Document::write functions will be inserted. The insertion point is implemented as the charakter offset into m_decoded_input and a boolean describing if the insertion point is defined. Functions to update, check and {re}store the insertion point are also added. The function HTMLTokenizer::insert_eof is added to tell a script-created parser that document::close was called and HTMLParser::the_end() should be called. Lastly an explicit default constructor is added to HTMLTokenizer to create a empty HTMLTokenizer into which data can be inserted.
This commit is contained in:
parent
d29d9462e9
commit
db789813c9
7 changed files with 282 additions and 19 deletions
|
@ -244,8 +244,11 @@ public:
|
|||
|
||||
Window& window() { return *m_window; }
|
||||
|
||||
void write(Vector<String> const& strings);
|
||||
void writeln(Vector<String> const& strings);
|
||||
ExceptionOr<void> write(Vector<String> const& strings);
|
||||
ExceptionOr<void> writeln(Vector<String> const& strings);
|
||||
|
||||
ExceptionOr<Document*> open(String const& = "", String const& = "");
|
||||
ExceptionOr<void> close();
|
||||
|
||||
Window* default_view() { return m_window; }
|
||||
|
||||
|
@ -355,6 +358,9 @@ private:
|
|||
RefPtr<Core::Timer> m_style_update_timer;
|
||||
RefPtr<Core::Timer> m_layout_update_timer;
|
||||
|
||||
OwnPtr<HTML::HTMLParser> m_parser;
|
||||
bool m_active_parser_was_aborted { false };
|
||||
|
||||
String m_source;
|
||||
|
||||
OwnPtr<JS::Interpreter> m_interpreter;
|
||||
|
@ -385,6 +391,12 @@ private:
|
|||
|
||||
u32 m_ignore_destructive_writes_counter { 0 };
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#unload-counter
|
||||
u32 m_unload_counter { 0 };
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#throw-on-dynamic-markup-insertion-counter
|
||||
u32 m_throw_on_dynamic_markup_insertion_counter { 0 };
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/semantics.html#script-blocking-style-sheet-counter
|
||||
u32 m_script_blocking_style_sheet_counter { 0 };
|
||||
|
||||
|
@ -403,5 +415,4 @@ private:
|
|||
|
||||
bool m_needs_layout { false };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue