1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +00:00

LibWeb: CSS: Add "position: absolute" with top and left

This momentarily handles the CSS property "position: absolute;" in
combination with the properties "top" and "left", so that elements can
be placed anywhere on the page independently from their parents.

Statically positioned elements ignore absolute positioned elements when
calculating their position as they don't take up space.
This commit is contained in:
myphs 2020-03-23 17:29:15 +01:00 committed by Andreas Kling
parent 494df52961
commit f42f300ba3
7 changed files with 137 additions and 10 deletions

View file

@ -50,6 +50,14 @@ enum class ValueID {
Right,
Justify,
};
enum class Position {
Static,
Relative,
Absolute,
Fixed,
Sticky,
};
}
class StyleValue : public RefCounted<StyleValue> {
@ -65,6 +73,7 @@ public:
Color,
Identifier,
Image,
Position,
};
Type type() const { return m_type; }
@ -76,6 +85,7 @@ public:
bool is_image() const { return type() == Type::Image; }
bool is_string() const { return type() == Type::String; }
bool is_length() const { return type() == Type::Length; }
bool is_position() const { return type() == Type::Position; }
virtual String to_string() const = 0;
virtual Length to_length() const { return {}; }