summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Christiansen <tobi@tobyase.de>2021-05-14 22:31:03 +0200
committerAndreas Kling <kling@serenityos.org>2021-05-20 22:08:02 +0200
commit499934a84860dc9447ba65997cc9d83f53353be6 (patch)
tree020866d8f985f12c7863f3ded8f95b9d094f1e54
parent0c261a1c959907666aa21a92e52e14a261b1c763 (diff)
downloadserenity-499934a84860dc9447ba65997cc9d83f53353be6.zip
LibWeb: Make border-radius attibutes accessible
-rw-r--r--Userland/Libraries/LibWeb/CSS/ComputedValues.h13
-rw-r--r--Userland/Libraries/LibWeb/Layout/Node.cpp16
2 files changed, 29 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/ComputedValues.h b/Userland/Libraries/LibWeb/CSS/ComputedValues.h
index f419b19c21..10ef059362 100644
--- a/Userland/Libraries/LibWeb/CSS/ComputedValues.h
+++ b/Userland/Libraries/LibWeb/CSS/ComputedValues.h
@@ -67,6 +67,11 @@ public:
const BorderData& border_right() const { return m_noninherited.border_right; }
const BorderData& border_bottom() const { return m_noninherited.border_bottom; }
+ const CSS::Length& border_bottom_left_radius() const { return m_noninherited.border_bottom_left_radius; }
+ const CSS::Length& border_bottom_right_radius() const { return m_noninherited.border_bottom_right_radius; }
+ const CSS::Length& border_top_left_radius() const { return m_noninherited.border_top_left_radius; }
+ const CSS::Length& border_top_right_radius() const { return m_noninherited.border_top_right_radius; }
+
CSS::Overflow overflow_x() const { return m_noninherited.overflow_x; }
CSS::Overflow overflow_y() const { return m_noninherited.overflow_y; }
@@ -114,6 +119,10 @@ protected:
BorderData border_top;
BorderData border_right;
BorderData border_bottom;
+ Length border_bottom_left_radius;
+ Length border_bottom_right_radius;
+ Length border_top_left_radius;
+ Length border_top_right_radius;
Color background_color { InitialValues::background_color() };
CSS::Repeat background_repeat_x { InitialValues::background_repeat() };
CSS::Repeat background_repeat_y { InitialValues::background_repeat() };
@@ -154,6 +163,10 @@ public:
void set_overflow_y(CSS::Overflow value) { m_noninherited.overflow_y = value; }
void set_list_style_type(CSS::ListStyleType value) { m_inherited.list_style_type = value; }
void set_display(CSS::Display value) { m_noninherited.display = value; }
+ void set_border_bottom_left_radius(CSS::Length value) { m_noninherited.border_bottom_left_radius = value; }
+ void set_border_bottom_right_radius(CSS::Length value) { m_noninherited.border_bottom_right_radius = value; }
+ void set_border_top_left_radius(CSS::Length value) { m_noninherited.border_top_left_radius = value; }
+ void set_border_top_right_radius(CSS::Length value) { m_noninherited.border_top_right_radius = value; }
BorderData& border_left() { return m_noninherited.border_left; }
BorderData& border_top() { return m_noninherited.border_top; }
BorderData& border_right() { return m_noninherited.border_right; }
diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp
index 1c5e2a0dab..533c747ffd 100644
--- a/Userland/Libraries/LibWeb/Layout/Node.cpp
+++ b/Userland/Libraries/LibWeb/Layout/Node.cpp
@@ -226,6 +226,22 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& specified_style)
m_background_image = static_ptr_cast<CSS::ImageStyleValue>(bgimage.value());
}
+ auto border_bottom_left_radius = specified_style.property(CSS::PropertyID::BorderBottomLeftRadius);
+ if (border_bottom_left_radius.has_value())
+ computed_values.set_border_bottom_left_radius(border_bottom_left_radius.value()->to_length());
+
+ auto border_bottom_right_radius = specified_style.property(CSS::PropertyID::BorderBottomRightRadius);
+ if (border_bottom_right_radius.has_value())
+ computed_values.set_border_bottom_right_radius(border_bottom_right_radius.value()->to_length());
+
+ auto border_top_left_radius = specified_style.property(CSS::PropertyID::BorderTopLeftRadius);
+ if (border_top_left_radius.has_value())
+ computed_values.set_border_top_left_radius(border_top_left_radius.value()->to_length());
+
+ auto border_top_right_radius = specified_style.property(CSS::PropertyID::BorderTopRightRadius);
+ if (border_top_right_radius.has_value())
+ computed_values.set_border_top_right_radius(border_top_right_radius.value()->to_length());
+
auto background_repeat_x = specified_style.background_repeat_x();
if (background_repeat_x.has_value())
computed_values.set_background_repeat_x(background_repeat_x.value());