From a21403650916f414e70d2fb3a6a5e5fdc79799ed Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Fri, 12 Nov 2021 13:00:03 +0000 Subject: [PATCH] LibWeb: Remove background-repeat/image fields and getters These aren't needed now that we render using background_layers instead. The one casualty is the resolved style for background-repeat, but that was incorrect anyway. --- .../Libraries/LibWeb/CSS/ComputedValues.h | 4 -- .../CSS/ResolvedCSSStyleDeclaration.cpp | 4 -- Userland/Libraries/LibWeb/DOM/Document.cpp | 42 ------------------- Userland/Libraries/LibWeb/DOM/Document.h | 3 -- Userland/Libraries/LibWeb/Layout/Node.cpp | 4 -- 5 files changed, 57 deletions(-) diff --git a/Userland/Libraries/LibWeb/CSS/ComputedValues.h b/Userland/Libraries/LibWeb/CSS/ComputedValues.h index b72172b2e1..39991b0306 100644 --- a/Userland/Libraries/LibWeb/CSS/ComputedValues.h +++ b/Userland/Libraries/LibWeb/CSS/ComputedValues.h @@ -25,7 +25,6 @@ public: static CSS::Display display() { return CSS::Display { CSS::Display::Outside::Inline, CSS::Display::Inside::Flow }; } static Color color() { return Color::Black; } static Color background_color() { return Color::Transparent; } - static CSS::Repeat background_repeat() { return CSS::Repeat::Repeat; } static CSS::ListStyleType list_style_type() { return CSS::ListStyleType::Disc; } static CSS::FlexDirection flex_direction() { return CSS::FlexDirection::Row; } static CSS::FlexWrap flex_wrap() { return CSS::FlexWrap::Nowrap; } @@ -126,7 +125,6 @@ public: Color color() const { return m_inherited.color; } Color background_color() const { return m_noninherited.background_color; } Vector const& background_layers() const { return m_noninherited.background_layers; } - BackgroundRepeatData background_repeat() const { return m_noninherited.background_repeat; } CSS::ListStyleType list_style_type() const { return m_inherited.list_style_type; } @@ -184,7 +182,6 @@ protected: Length border_top_right_radius; Color background_color { InitialValues::background_color() }; Vector background_layers; - BackgroundRepeatData background_repeat { InitialValues::background_repeat(), InitialValues::background_repeat() }; CSS::FlexDirection flex_direction { InitialValues::flex_direction() }; CSS::FlexWrap flex_wrap { InitialValues::flex_wrap() }; CSS::FlexBasisData flex_basis {}; @@ -210,7 +207,6 @@ public: void set_cursor(CSS::Cursor cursor) { m_inherited.cursor = cursor; } void set_pointer_events(CSS::PointerEvents value) { m_inherited.pointer_events = value; } void set_background_color(const Color& color) { m_noninherited.background_color = color; } - void set_background_repeat(BackgroundRepeatData repeat) { m_noninherited.background_repeat = repeat; } void set_background_layers(Vector&& layers) { m_noninherited.background_layers = move(layers); } void set_float(CSS::Float value) { m_noninherited.float_ = value; } void set_clear(CSS::Clear value) { m_noninherited.clear = value; } diff --git a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp index c66bc0ccb8..bdf93d0503 100644 --- a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp +++ b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp @@ -645,10 +645,6 @@ RefPtr ResolvedCSSStyleDeclaration::style_value_for_property(Layout: return ColorStyleValue::create(layout_node.computed_values().color()); case PropertyID::BackgroundColor: return ColorStyleValue::create(layout_node.computed_values().background_color()); - case CSS::PropertyID::BackgroundRepeat: - return BackgroundRepeatStyleValue::create( - layout_node.computed_values().background_repeat().repeat_x, - layout_node.computed_values().background_repeat().repeat_y); case CSS::PropertyID::Background: { auto maybe_background_color = property(CSS::PropertyID::BackgroundColor); auto maybe_background_image = property(CSS::PropertyID::BackgroundImage); diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 911555367d..9351418658 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -366,48 +366,6 @@ Vector const* Document::background_layers() const return &body_layout_node->background_layers(); } -RefPtr Document::background_image() const -{ - auto* body_element = body(); - if (!body_element) - return {}; - - auto* body_layout_node = body_element->layout_node(); - if (!body_layout_node) - return {}; - - auto background_image = body_layout_node->background_image(); - if (!background_image) - return {}; - return background_image->bitmap(); -} - -CSS::Repeat Document::background_repeat_x() const -{ - auto* body_element = body(); - if (!body_element) - return CSS::Repeat::Repeat; - - auto* body_layout_node = body_element->layout_node(); - if (!body_layout_node) - return CSS::Repeat::Repeat; - - return body_layout_node->computed_values().background_repeat().repeat_x; -} - -CSS::Repeat Document::background_repeat_y() const -{ - auto* body_element = body(); - if (!body_element) - return CSS::Repeat::Repeat; - - auto* body_layout_node = body_element->layout_node(); - if (!body_layout_node) - return CSS::Repeat::Repeat; - - return body_layout_node->computed_values().background_repeat().repeat_y; -} - // https://html.spec.whatwg.org/multipage/urls-and-fetching.html#parse-a-url AK::URL Document::parse_url(String const& url) const { diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h index cf3c809cea..f87f3e6fdb 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.h +++ b/Userland/Libraries/LibWeb/DOM/Document.h @@ -131,9 +131,6 @@ public: Color background_color(const Gfx::Palette&) const; Vector const* background_layers() const; - RefPtr background_image() const; - CSS::Repeat background_repeat_x() const; - CSS::Repeat background_repeat_y() const; Color link_color() const; void set_link_color(Color); diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp index 82973509cf..f55fea4f36 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.cpp +++ b/Userland/Libraries/LibWeb/Layout/Node.cpp @@ -300,10 +300,6 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& specified_style) if (border_top_right_radius.has_value()) computed_values.set_border_top_right_radius(border_top_right_radius.value()->to_length()); - auto background_repeat = specified_style.background_repeat(); - if (background_repeat.has_value()) - computed_values.set_background_repeat(background_repeat.value()); - computed_values.set_display(specified_style.display()); auto flex_direction = specified_style.flex_direction();