diff --git a/Libraries/LibWeb/CSS/Length.cpp b/Libraries/LibWeb/CSS/Length.cpp index c3da61b5f74..2bff0a24905 100644 --- a/Libraries/LibWeb/CSS/Length.cpp +++ b/Libraries/LibWeb/CSS/Length.cpp @@ -43,9 +43,14 @@ Length Length::make_auto() return Length(0, Type::Auto); } +Length Length::make_px(double value) +{ + return Length(value, Type::Px); +} + Length Length::make_px(CSSPixels value) { - return Length(value.to_double(), Type::Px); + return make_px(value.to_double()); } Length Length::percentage_of(Percentage const& percentage) const diff --git a/Libraries/LibWeb/CSS/Length.h b/Libraries/LibWeb/CSS/Length.h index 4c2a364f6a7..ab93b8658a5 100644 --- a/Libraries/LibWeb/CSS/Length.h +++ b/Libraries/LibWeb/CSS/Length.h @@ -87,6 +87,7 @@ public: ~Length(); static Length make_auto(); + static Length make_px(double value); static Length make_px(CSSPixels value); Length percentage_of(Percentage const&) const;