summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-02-15 18:45:10 +0000
committerAndreas Kling <kling@serenityos.org>2022-02-15 23:24:34 +0100
commit3f7086f91a8510d2aedc45d9f3b5525bba673b3e (patch)
treed8a65eff0932ed87af85fc0c88787dd636eb52c5 /Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h
parent9130ecfd5e318eb88f02c688ec5a7fc9a76455ff (diff)
downloadserenity-3f7086f91a8510d2aedc45d9f3b5525bba673b3e.zip
LibWeb: Add an optional pointer to an HTMLParser to the HTMLTokenizer
This is needed to access the 'adjusted current node' in the 'Markup declaration open state'. We don't want to create a full parser for something like syntax highlighting, so it's optional (null) by default.
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h')
-rw-r--r--Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h
index 23c14cba6e..dd1dc76c85 100644
--- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h
+++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -110,6 +111,8 @@ public:
Optional<HTMLToken> next_token();
+ void set_parser(Badge<HTMLParser>, HTMLParser& parser) { m_parser = &parser; }
+
void switch_to(Badge<HTMLParser>, State new_state);
void switch_to(State new_state)
{
@@ -151,6 +154,8 @@ private:
void restore_to(Utf8CodePointIterator const& new_iterator);
HTMLToken::Position nth_last_position(size_t n = 0);
+ HTMLParser* m_parser { nullptr };
+
State m_state { State::Data };
State m_return_state { State::Data };