summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-07-06 20:17:12 +0200
committerAndreas Kling <kling@serenityos.org>2022-07-06 20:31:27 +0200
commit94509c984412d24014a342cdb4336a400794dc9a (patch)
treef47998e90812d521a24d91d61d453e41eeaa89ac
parent8abbbdf6fa0eeeaded8edd69f0acae56b36d78ff (diff)
downloadserenity-94509c984412d24014a342cdb4336a400794dc9a.zip
LibWeb: Use correct margin & padding values in anonymous wrapper boxes
Anonymous wrappers get their non-inherited properties from the initial state of a new CSS::ComputedValues object. Before this patch, all the values in their margin and padding LengthBox would be "auto".
-rw-r--r--Userland/Libraries/LibWeb/CSS/ComputedValues.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/ComputedValues.h b/Userland/Libraries/LibWeb/CSS/ComputedValues.h
index 3c06ed53ae..0b1a410830 100644
--- a/Userland/Libraries/LibWeb/CSS/ComputedValues.h
+++ b/Userland/Libraries/LibWeb/CSS/ComputedValues.h
@@ -47,6 +47,9 @@ public:
static float opacity() { return 1.0f; }
static CSS::Length border_radius() { return Length::make_px(0); }
static Variant<CSS::VerticalAlign, CSS::LengthPercentage> vertical_align() { return CSS::VerticalAlign::Baseline; }
+ static CSS::LengthBox inset() { return { CSS::Length::make_auto(), CSS::Length::make_auto(), CSS::Length::make_auto(), CSS::Length::make_auto() }; }
+ static CSS::LengthBox margin() { return { CSS::Length::make_px(0), CSS::Length::make_px(0), CSS::Length::make_px(0), CSS::Length::make_px(0) }; }
+ static CSS::LengthBox padding() { return { CSS::Length::make_px(0), CSS::Length::make_px(0), CSS::Length::make_px(0), CSS::Length::make_px(0) }; }
};
struct BackgroundLayerData {
@@ -235,9 +238,9 @@ protected:
Optional<CSS::LengthPercentage> height;
Optional<CSS::LengthPercentage> min_height;
Optional<CSS::LengthPercentage> max_height;
- CSS::LengthBox inset;
- CSS::LengthBox margin;
- CSS::LengthBox padding;
+ CSS::LengthBox inset { InitialValues::inset() };
+ CSS::LengthBox margin { InitialValues::margin() };
+ CSS::LengthBox padding { InitialValues::padding() };
BorderData border_left;
BorderData border_top;
BorderData border_right;