diff options
author | Andreas Kling <kling@serenityos.org> | 2022-10-06 14:56:48 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-10-06 15:29:38 +0200 |
commit | a0e6882d99eaeeb223b04cef222b8f0425ab2f71 (patch) | |
tree | d9df7a21edf8b897f191caa0f41e1245559e1701 /Userland | |
parent | 8a3ca6416d3efeff890b9bdf4ed9782bd17f7f6c (diff) | |
download | serenity-a0e6882d99eaeeb223b04cef222b8f0425ab2f71.zip |
LibWeb: Remove Layout::Node::set_inline()
Now that this flag is no longer used, we can stop setting it.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/Element.cpp | 7 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/BreakNode.cpp | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/InlineNode.cpp | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/Node.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/Node.h | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/ReplacedBox.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/TextNode.cpp | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp | 2 |
12 files changed, 7 insertions, 34 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index 90462df78e..3d3f90b91b 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -304,11 +304,8 @@ RefPtr<Layout::Node> Element::create_layout_node_for_display_type(DOM::Document& } if (display.is_inline_outside()) { - if (display.is_flow_root_inside()) { - auto block = adopt_ref(*new Layout::BlockContainer(document, element, move(style))); - block->set_inline(true); - return block; - } + if (display.is_flow_root_inside()) + return adopt_ref(*new Layout::BlockContainer(document, element, move(style))); if (display.is_flow_inside()) return adopt_ref(*new Layout::InlineNode(document, element, move(style))); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp index 945c8d925a..1c14c29ee0 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp @@ -87,11 +87,7 @@ void HTMLImageElement::parse_attribute(FlyString const& name, String const& valu RefPtr<Layout::Node> HTMLImageElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style) { - auto display = style->display(); - auto layout_node = adopt_ref(*new Layout::ImageBox(document(), *this, move(style), m_image_loader)); - if (display.is_block_outside()) - layout_node->set_inline(false); - return layout_node; + return adopt_ref(*new Layout::ImageBox(document(), *this, move(style), m_image_loader)); } Gfx::Bitmap const* HTMLImageElement::bitmap() const diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp index 5e444cdc3d..3a613bb1af 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -65,9 +65,7 @@ RefPtr<Layout::Node> HTMLInputElement::create_layout_node(NonnullRefPtr<CSS::Sty if (type_state() == TypeAttributeState::RadioButton) return adopt_ref(*new Layout::RadioButton(document(), *this, move(style))); - auto layout_node = adopt_ref(*new Layout::BlockContainer(document(), this, move(style))); - layout_node->set_inline(true); - return layout_node; + return adopt_ref(*new Layout::BlockContainer(document(), this, move(style))); } void HTMLInputElement::set_checked(bool checked, ChangeSource change_source) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp index 7f23ab89c3..db4a4a86ff 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp @@ -20,9 +20,7 @@ HTMLLabelElement::~HTMLLabelElement() = default; RefPtr<Layout::Node> HTMLLabelElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style) { - auto layout_node = adopt_ref(*new Layout::Label(document(), this, move(style))); - layout_node->set_inline(true); - return layout_node; + return adopt_ref(*new Layout::Label(document(), this, move(style))); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp index 27a4dd681e..bcfe0a8a8b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp @@ -25,14 +25,10 @@ HTMLProgressElement::~HTMLProgressElement() = default; RefPtr<Layout::Node> HTMLProgressElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style) { - RefPtr<Layout::Node> layout_node; if (style->appearance().value_or(CSS::Appearance::Auto) == CSS::Appearance::None) { - layout_node = adopt_ref(*new Layout::BlockContainer(document(), this, move(style))); - layout_node->set_inline(true); - } else { - layout_node = adopt_ref(*new Layout::Progress(document(), *this, move(style))); + return adopt_ref(*new Layout::BlockContainer(document(), this, move(style))); } - return layout_node; + return adopt_ref(*new Layout::Progress(document(), *this, move(style))); } bool HTMLProgressElement::using_system_appearance() const diff --git a/Userland/Libraries/LibWeb/Layout/BreakNode.cpp b/Userland/Libraries/LibWeb/Layout/BreakNode.cpp index f5661ecf84..cb4c9cd9e5 100644 --- a/Userland/Libraries/LibWeb/Layout/BreakNode.cpp +++ b/Userland/Libraries/LibWeb/Layout/BreakNode.cpp @@ -13,7 +13,6 @@ namespace Web::Layout { BreakNode::BreakNode(DOM::Document& document, HTML::HTMLBRElement& element, NonnullRefPtr<CSS::StyleProperties> style) : Layout::NodeWithStyleAndBoxModelMetrics(document, &element, move(style)) { - set_inline(true); } BreakNode::~BreakNode() = default; diff --git a/Userland/Libraries/LibWeb/Layout/InlineNode.cpp b/Userland/Libraries/LibWeb/Layout/InlineNode.cpp index 2b87c97233..f288aeed7e 100644 --- a/Userland/Libraries/LibWeb/Layout/InlineNode.cpp +++ b/Userland/Libraries/LibWeb/Layout/InlineNode.cpp @@ -17,7 +17,6 @@ namespace Web::Layout { InlineNode::InlineNode(DOM::Document& document, DOM::Element* element, NonnullRefPtr<CSS::StyleProperties> style) : Layout::NodeWithStyleAndBoxModelMetrics(document, element, move(style)) { - set_inline(true); } InlineNode::~InlineNode() = default; diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp index 2fb2fe07ec..7d89ca0feb 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.cpp +++ b/Userland/Libraries/LibWeb/Layout/Node.cpp @@ -579,8 +579,6 @@ String Node::debug_description() const return builder.to_string(); } -void Node::set_inline(bool) { } - bool Node::is_inline() const { if (!has_style()) { diff --git a/Userland/Libraries/LibWeb/Layout/Node.h b/Userland/Libraries/LibWeb/Layout/Node.h index 8c72e81aec..da476acf81 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.h +++ b/Userland/Libraries/LibWeb/Layout/Node.h @@ -68,9 +68,6 @@ public: virtual bool can_have_children() const { return true; } - // FIXME: Remove this. - void set_inline(bool); - bool is_inline() const; bool is_inline_block() const; diff --git a/Userland/Libraries/LibWeb/Layout/ReplacedBox.cpp b/Userland/Libraries/LibWeb/Layout/ReplacedBox.cpp index cafd3aa7f5..67bd4b2a73 100644 --- a/Userland/Libraries/LibWeb/Layout/ReplacedBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/ReplacedBox.cpp @@ -14,8 +14,6 @@ namespace Web::Layout { ReplacedBox::ReplacedBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style) : Box(document, &element, move(style)) { - // FIXME: Allow non-inline replaced elements. - set_inline(true); } ReplacedBox::~ReplacedBox() = default; diff --git a/Userland/Libraries/LibWeb/Layout/TextNode.cpp b/Userland/Libraries/LibWeb/Layout/TextNode.cpp index f6bda2a5c2..9d4c28ff27 100644 --- a/Userland/Libraries/LibWeb/Layout/TextNode.cpp +++ b/Userland/Libraries/LibWeb/Layout/TextNode.cpp @@ -18,7 +18,6 @@ namespace Web::Layout { TextNode::TextNode(DOM::Document& document, DOM::Text& text) : Node(document, &text) { - set_inline(true); } TextNode::~TextNode() = default; diff --git a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp index eadcbea281..f87568fa71 100644 --- a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp +++ b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp @@ -254,8 +254,6 @@ void TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::Context& int child_index = layout_node->parent()->index_of_child<ListItemBox>(*layout_node).value(); auto marker_style = style_computer.compute_style(element, CSS::Selector::PseudoElement::Marker); auto list_item_marker = adopt_ref(*new ListItemMarkerBox(document, layout_node->computed_values().list_style_type(), child_index + 1, *marker_style)); - if (layout_node->first_child()) - list_item_marker->set_inline(layout_node->first_child()->is_inline()); static_cast<ListItemBox&>(*layout_node).set_marker(list_item_marker); element.set_pseudo_element_node({}, CSS::Selector::PseudoElement::Marker, list_item_marker); layout_node->append_child(move(list_item_marker)); |