mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-29 11:00:29 +00:00
LibHTML: Store the HTML parser input along with the created Document
This will allow us to "view source" later on, long after parsing has finished and turned it into a DOM.
This commit is contained in:
parent
f2d1e591b6
commit
5036b888ac
Notes:
sideshowbarker
2024-07-19 11:05:47 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/5036b888ac9
2 changed files with 6 additions and 0 deletions
|
@ -89,6 +89,9 @@ public:
|
|||
const Element* get_element_by_id(const String&) const;
|
||||
Vector<const Element*> get_elements_by_name(const String&) const;
|
||||
|
||||
const String& source() const { return m_source; }
|
||||
void set_source(const String& source) { m_source = source; }
|
||||
|
||||
private:
|
||||
virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) const override;
|
||||
|
||||
|
@ -106,6 +109,8 @@ private:
|
|||
Color m_visited_link_color { Color::Magenta };
|
||||
|
||||
RefPtr<CTimer> m_style_update_timer;
|
||||
|
||||
String m_source;
|
||||
};
|
||||
|
||||
template<>
|
||||
|
|
|
@ -334,6 +334,7 @@ RefPtr<Document> parse_html_document(const StringView& html, const URL& url)
|
|||
{
|
||||
auto document = adopt(*new Document);
|
||||
document->set_url(url);
|
||||
document->set_source(html);
|
||||
|
||||
if (!parse_html_document(html, *document, *document))
|
||||
return nullptr;
|
||||
|
|
Loading…
Reference in a new issue