mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:38:11 +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:
parent
494df52961
commit
f42f300ba3
7 changed files with 137 additions and 10 deletions
|
@ -162,6 +162,22 @@ float StyleProperties::line_height() const
|
|||
return (float)font().glyph_height() * 1.4f;
|
||||
}
|
||||
|
||||
CSS::Position StyleProperties::position() const
|
||||
{
|
||||
if (property(CSS::PropertyID::Position).has_value()) {
|
||||
String position_string = string_or_fallback(CSS::PropertyID::Position, "static");
|
||||
if (position_string == "relative")
|
||||
return CSS::Position::Relative;
|
||||
if (position_string == "absolute")
|
||||
return CSS::Position::Absolute;
|
||||
if (position_string == "sticky")
|
||||
return CSS::Position::Sticky;
|
||||
if (position_string == "fixed")
|
||||
return CSS::Position::Fixed;
|
||||
}
|
||||
return CSS::Position::Static;
|
||||
}
|
||||
|
||||
bool StyleProperties::operator==(const StyleProperties& other) const
|
||||
{
|
||||
if (m_property_values.size() != other.m_property_values.size())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue