mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:37:34 +00:00
LibWeb: Add class to represent "list of available images" from HTML spec
This commit is contained in:
parent
596eabe9e6
commit
9281bf7a01
6 changed files with 158 additions and 0 deletions
|
@ -58,6 +58,7 @@
|
|||
#include <LibWeb/HTML/HTMLLinkElement.h>
|
||||
#include <LibWeb/HTML/HTMLScriptElement.h>
|
||||
#include <LibWeb/HTML/HTMLTitleElement.h>
|
||||
#include <LibWeb/HTML/ListOfAvailableImages.h>
|
||||
#include <LibWeb/HTML/Location.h>
|
||||
#include <LibWeb/HTML/MessageEvent.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
|
@ -330,6 +331,8 @@ JS::ThrowCompletionOr<void> Document::initialize(JS::Realm& realm)
|
|||
|
||||
m_selection = MUST_OR_THROW_OOM(heap().allocate<Selection::Selection>(realm, realm, *this));
|
||||
|
||||
m_list_of_available_images = TRY_OR_THROW_OOM(realm.vm(), try_make<HTML::ListOfAvailableImages>());
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -2567,4 +2570,14 @@ void Document::make_active()
|
|||
HTML::relevant_settings_object(window).execution_ready = true;
|
||||
}
|
||||
|
||||
HTML::ListOfAvailableImages& Document::list_of_available_images()
|
||||
{
|
||||
return *m_list_of_available_images;
|
||||
}
|
||||
|
||||
HTML::ListOfAvailableImages const& Document::list_of_available_images() const
|
||||
{
|
||||
return *m_list_of_available_images;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -474,6 +474,9 @@ public:
|
|||
|
||||
void set_salvageable(bool value) { m_salvageable = value; };
|
||||
|
||||
HTML::ListOfAvailableImages& list_of_available_images();
|
||||
HTML::ListOfAvailableImages const& list_of_available_images() const;
|
||||
|
||||
protected:
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
@ -639,6 +642,9 @@ private:
|
|||
|
||||
// NOTE: This is a cache to make finding the first <base href> element O(1).
|
||||
JS::GCPtr<HTML::HTMLBaseElement const> m_first_base_element_with_href_in_tree_order;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/images.html#list-of-available-images
|
||||
OwnPtr<HTML::ListOfAvailableImages> m_list_of_available_images;
|
||||
};
|
||||
|
||||
template<>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue