Selaa lähdekoodia

LibWeb: Make NavigableContainerViewport always have a NavigableContainer

Let's not limit this to only corresponding to an HTMLIFrameElement.
Andreas Kling 8 kuukautta sitten
vanhempi
commit
11d966f3ba

+ 1 - 1
Libraries/LibWeb/Layout/NavigableContainerViewport.cpp

@@ -13,7 +13,7 @@ namespace Web::Layout {
 
 GC_DEFINE_ALLOCATOR(NavigableContainerViewport);
 
-NavigableContainerViewport::NavigableContainerViewport(DOM::Document& document, DOM::Element& element, CSS::StyleProperties style)
+NavigableContainerViewport::NavigableContainerViewport(DOM::Document& document, HTML::NavigableContainer& element, CSS::StyleProperties style)
     : ReplacedBox(document, element, move(style))
 {
 }

+ 4 - 4
Libraries/LibWeb/Layout/NavigableContainerViewport.h

@@ -6,7 +6,7 @@
 
 #pragma once
 
-#include <LibWeb/HTML/HTMLIFrameElement.h>
+#include <LibWeb/HTML/NavigableContainer.h>
 #include <LibWeb/Layout/ReplacedBox.h>
 
 namespace Web::Layout {
@@ -16,13 +16,13 @@ class NavigableContainerViewport final : public ReplacedBox {
     GC_DECLARE_ALLOCATOR(NavigableContainerViewport);
 
 public:
-    NavigableContainerViewport(DOM::Document&, DOM::Element&, CSS::StyleProperties);
+    NavigableContainerViewport(DOM::Document&, HTML::NavigableContainer&, CSS::StyleProperties);
     virtual ~NavigableContainerViewport() override;
 
     virtual void prepare_for_replaced_layout() override;
 
-    const HTML::HTMLIFrameElement& dom_node() const { return verify_cast<HTML::HTMLIFrameElement>(ReplacedBox::dom_node()); }
-    HTML::HTMLIFrameElement& dom_node() { return verify_cast<HTML::HTMLIFrameElement>(ReplacedBox::dom_node()); }
+    [[nodiscard]] HTML::NavigableContainer const& dom_node() const { return verify_cast<HTML::NavigableContainer>(ReplacedBox::dom_node()); }
+    [[nodiscard]] HTML::NavigableContainer& dom_node() { return verify_cast<HTML::NavigableContainer>(ReplacedBox::dom_node()); }
 
     virtual GC::Ptr<Painting::Paintable> create_paintable() const override;