mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 12:05:15 +00:00
LibWeb: Add Layout::Node::is_root_element()
This returns true if the layout node corresponds to the <html> element.
This commit is contained in:
parent
cc14b5a6d7
commit
11256de366
Notes:
sideshowbarker
2024-07-19 01:03:02 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/11256de366e
2 changed files with 10 additions and 0 deletions
|
@ -28,6 +28,7 @@
|
|||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Element.h>
|
||||
#include <LibWeb/Dump.h>
|
||||
#include <LibWeb/HTML/HTMLHtmlElement.h>
|
||||
#include <LibWeb/Layout/BlockBox.h>
|
||||
#include <LibWeb/Layout/InitialContainingBlockBox.h>
|
||||
#include <LibWeb/Layout/Node.h>
|
||||
|
@ -265,4 +266,11 @@ void Node::handle_mousemove(Badge<EventHandler>, const Gfx::IntPoint&, unsigned,
|
|||
{
|
||||
}
|
||||
|
||||
bool Node::is_root_element() const
|
||||
{
|
||||
if (is_anonymous())
|
||||
return false;
|
||||
return is<HTML::HTMLHtmlElement>(*dom_node());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -91,6 +91,8 @@ public:
|
|||
const InitialContainingBlockBox& root() const;
|
||||
InitialContainingBlockBox& root();
|
||||
|
||||
bool is_root_element() const;
|
||||
|
||||
virtual const char* class_name() const = 0;
|
||||
virtual bool is_initial_containing_block() const { return false; }
|
||||
virtual bool is_text() const { return false; }
|
||||
|
|
Loading…
Add table
Reference in a new issue