mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Support individual translate
CSS property
This commit is contained in:
parent
6836d4edb1
commit
66a821e731
Notes:
github-actions[bot]
2024-11-22 19:07:48 +00:00
Author: https://github.com/awesomekling
Commit: 66a821e731
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2506
Reviewed-by: https://github.com/shannonbooth
22 changed files with 267 additions and 80 deletions
49
Libraries/LibWeb/CSS/StyleValues/TranslationStyleValue.h
Normal file
49
Libraries/LibWeb/CSS/StyleValues/TranslationStyleValue.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Andreas Kling <andreas@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/CSS/CSSStyleValue.h>
|
||||
#include <LibWeb/CSS/PercentageOr.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
class TranslationStyleValue : public StyleValueWithDefaultOperators<TranslationStyleValue> {
|
||||
public:
|
||||
static ValueComparingNonnullRefPtr<TranslationStyleValue> create(LengthPercentage x, LengthPercentage y)
|
||||
{
|
||||
return adopt_ref(*new (nothrow) TranslationStyleValue(move(x), move(y)));
|
||||
}
|
||||
|
||||
virtual ~TranslationStyleValue() override = default;
|
||||
|
||||
LengthPercentage const& x() const { return m_properties.x; }
|
||||
LengthPercentage const& y() const { return m_properties.y; }
|
||||
|
||||
virtual String to_string() const override;
|
||||
|
||||
bool properties_equal(TranslationStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||
|
||||
private:
|
||||
explicit TranslationStyleValue(
|
||||
LengthPercentage x,
|
||||
LengthPercentage y)
|
||||
: StyleValueWithDefaultOperators(Type::Translation)
|
||||
, m_properties {
|
||||
.x = move(x),
|
||||
.y = move(y),
|
||||
}
|
||||
{
|
||||
}
|
||||
|
||||
struct Properties {
|
||||
LengthPercentage x;
|
||||
LengthPercentage y;
|
||||
bool operator==(Properties const&) const = default;
|
||||
} m_properties;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue