From 5f9d80d8bcda00f5958dd41df49e5f2a51bddfab Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 11 May 2020 23:04:59 +0200 Subject: [PATCH] LibWeb: Add basic support for CSS percentages Many properties can now have percentage values that get resolved in layout. The reference value (what is this a percentage *of*?) differs per property, so I've added a helper where you provide a reference value as an added parameter to the existing length_or_fallback(). --- Base/home/anon/www/percent-css.html | 41 +++++++++++++++++ Base/home/anon/www/welcome.html | 1 + Libraries/LibWeb/CSS/StyleProperties.cpp | 10 ++++ Libraries/LibWeb/CSS/StyleProperties.h | 1 + Libraries/LibWeb/CSS/StyleValue.h | 27 +++++++++++ Libraries/LibWeb/Layout/LayoutBlock.cpp | 58 ++++++++++++------------ Libraries/LibWeb/Parser/CSSParser.cpp | 10 +++- 7 files changed, 117 insertions(+), 31 deletions(-) create mode 100644 Base/home/anon/www/percent-css.html diff --git a/Base/home/anon/www/percent-css.html b/Base/home/anon/www/percent-css.html new file mode 100644 index 0000000000..85a1b93178 --- /dev/null +++ b/Base/home/anon/www/percent-css.html @@ -0,0 +1,41 @@ + + + + + + +
+
25%
+
50%
+
75%
+
100%
+
+
+
+
25%
+
+ + diff --git a/Base/home/anon/www/welcome.html b/Base/home/anon/www/welcome.html index 2fffcb8f6c..9ee1bac2c9 100644 --- a/Base/home/anon/www/welcome.html +++ b/Base/home/anon/www/welcome.html @@ -28,6 +28,7 @@ span#ua {

Your user agent is:

Some small test pages: