1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 00:35:06 +00:00

LibWeb: Remove hand-rolled is_foo() helpers in Layout::Node classes

This commit is contained in:
Andreas Kling 2021-01-01 18:55:47 +01:00
parent 3bb0cb2202
commit 07dd73c351
31 changed files with 39 additions and 82 deletions

View file

@ -28,6 +28,7 @@
#include <LibWeb/DOM/Document.h>
#include <LibWeb/HTML/HTMLAnchorElement.h>
#include <LibWeb/HTML/HTMLElement.h>
#include <LibWeb/Layout/BreakNode.h>
#include <LibWeb/Layout/TextNode.h>
namespace Web::HTML {
@ -119,9 +120,9 @@ String HTMLElement::inner_text()
Function<void(const Layout::Node&)> recurse = [&](auto& node) {
for (auto* child = node.first_child(); child; child = child->next_sibling()) {
if (child->is_text())
if (is<Layout::TextNode>(child))
builder.append(downcast<Layout::TextNode>(*child).text_for_rendering());
if (child->is_break())
if (is<Layout::BreakNode>(child))
builder.append('\n');
recurse(*child);
}