Преглед на файлове

LibWeb: Remove Layout::Node::set_inline()

Now that this flag is no longer used, we can stop setting it.
Andreas Kling преди 2 години
родител
ревизия
a0e6882d99

+ 2 - 5
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)));
 

+ 1 - 5
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

+ 1 - 3
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)

+ 1 - 3
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)));
 }
 
 }

+ 2 - 6
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

+ 0 - 1
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;

+ 0 - 1
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;

+ 0 - 2
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()) {

+ 0 - 3
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;
 

+ 0 - 2
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;

+ 0 - 1
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;

+ 0 - 2
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));