1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:38:10 +00:00

LibWeb: Use rect value in CSS clip property

When a rect value is passed to the clip property via CSS, keep it in
ComputedValues so that at a later stage can make use of it.
This commit is contained in:
Tom 2022-07-31 18:47:09 +02:00 committed by Andreas Kling
parent b4dd477644
commit 8163ee1500
9 changed files with 84 additions and 0 deletions

View file

@ -8,6 +8,7 @@
#include <AK/TypeCasts.h>
#include <LibCore/DirIterator.h>
#include <LibGfx/Font/FontDatabase.h>
#include <LibWeb/CSS/Clip.h>
#include <LibWeb/CSS/StyleProperties.h>
#include <LibWeb/FontCache.h>
#include <LibWeb/Layout/BlockContainer.h>
@ -235,6 +236,14 @@ Optional<CSS::ImageRendering> StyleProperties::image_rendering() const
return value_id_to_image_rendering(value->to_identifier());
}
CSS::Clip StyleProperties::clip() const
{
auto value = property(CSS::PropertyID::Clip);
if (!value->has_rect())
return CSS::Clip::make_auto();
return CSS::Clip(value->as_rect().rect());
}
Optional<CSS::JustifyContent> StyleProperties::justify_content() const
{
auto value = property(CSS::PropertyID::JustifyContent);