mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:48:11 +00:00
LibWeb: Remove hand-rolled is_foo() helpers in Layout::Node classes
This commit is contained in:
parent
3bb0cb2202
commit
07dd73c351
31 changed files with 39 additions and 82 deletions
|
@ -35,6 +35,7 @@
|
|||
#include <LibWeb/Layout/InitialContainingBlockBox.h>
|
||||
#include <LibWeb/Layout/Node.h>
|
||||
#include <LibWeb/Layout/ReplacedBox.h>
|
||||
#include <LibWeb/Layout/TextNode.h>
|
||||
#include <LibWeb/Page/Frame.h>
|
||||
#include <typeinfo>
|
||||
|
||||
|
@ -56,7 +57,7 @@ Node::~Node()
|
|||
|
||||
bool Node::can_contain_boxes_with_position_absolute() const
|
||||
{
|
||||
return style().position() != CSS::Position::Static || is_initial_containing_block();
|
||||
return style().position() != CSS::Position::Static || is<InitialContainingBlockBox>(*this);
|
||||
}
|
||||
|
||||
const BlockBox* Node::containing_block() const
|
||||
|
@ -68,7 +69,7 @@ const BlockBox* Node::containing_block() const
|
|||
return downcast<BlockBox>(ancestor);
|
||||
};
|
||||
|
||||
if (is_text())
|
||||
if (is<TextNode>(*this))
|
||||
return nearest_block_ancestor();
|
||||
|
||||
auto position = style().position();
|
||||
|
@ -165,7 +166,7 @@ float Node::font_size() const
|
|||
|
||||
Gfx::FloatPoint Node::box_type_agnostic_position() const
|
||||
{
|
||||
if (is_box())
|
||||
if (is<Box>(*this))
|
||||
return downcast<Box>(*this).absolute_position();
|
||||
ASSERT(is_inline());
|
||||
Gfx::FloatPoint position;
|
||||
|
@ -303,4 +304,9 @@ String Node::class_name() const
|
|||
return demangle(typeid(*this).name());
|
||||
}
|
||||
|
||||
bool Node::is_inline_block() const
|
||||
{
|
||||
return is_inline() && is<BlockBox>(*this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue