LibWeb: Implement HTMLFrameElement as a NavigableContainer

NavigableContainer is our home grown concept which already contains the
AOs needed for frame and iframe elements. This patch simply aligns our
HTMLFrameElement implementation with this class.

A couple of notes:

1. The <script> in the <head> element is intentional. The <frameset>
   element effectively takes the place of the <body> element, and we
   cannot add a <script> to a <frameset> element.

2. We don't render <frameset> or <frame> at all. Rendering is defined
   in the following spec:
   https://html.spec.whatwg.org/multipage/rendering.html#frames-and-framesets

3. If you load the test page in your browser, you won't see anything,
   regardless of (2). Our test infra adds a <pre> element to the "body"
   element (which is the <frameset> element here). Such children will
   never be rendered. In the future, we could come up with something
   better for our test infra to do, but this isn't important anyways
   for this test - we can still grab the <pre> element's innerText.
This commit is contained in:
Timothy Flynn 2024-11-03 21:02:07 -05:00 committed by Tim Ledbetter
parent 7d3ad89603
commit 16def85153
Notes: github-actions[bot] 2024-11-04 09:55:47 +00:00
6 changed files with 103 additions and 6 deletions

View file

@ -6,13 +6,13 @@
#pragma once
#include <LibWeb/HTML/HTMLElement.h>
#include <LibWeb/HTML/NavigableContainer.h>
namespace Web::HTML {
// NOTE: This element is marked as obsolete, but is still listed as required by the specification.
class HTMLFrameElement final : public HTMLElement {
WEB_PLATFORM_OBJECT(HTMLFrameElement, HTMLElement);
class HTMLFrameElement final : public NavigableContainer {
WEB_PLATFORM_OBJECT(HTMLFrameElement, NavigableContainer);
JS_DECLARE_ALLOCATOR(HTMLFrameElement);
public:
@ -24,7 +24,12 @@ private:
virtual void initialize(JS::Realm&) override;
// ^DOM::Element
virtual void inserted() override;
virtual void removed_from(Node*) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual i32 default_tab_index_value() const override;
void process_the_frame_attributes(bool initial_insertion = false);
};
}