mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-20 00:12:20 +00:00
LibWeb: Split ResolutionStyleValue out of StyleValue.{h,cpp}
This commit is contained in:
parent
b1ccd30b02
commit
6cedf5e05b
|
@ -61,6 +61,7 @@
|
|||
#include <LibWeb/CSS/StyleValues/PercentageStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/PositionStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/RadialGradientStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/ResolutionStyleValue.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/Dump.h>
|
||||
#include <LibWeb/Infra/Strings.h>
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include <LibWeb/CSS/StyleValues/PercentageStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/PositionStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/RadialGradientStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/ResolutionStyleValue.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
#include <LibWeb/Loader/LoadRequest.h>
|
||||
|
|
|
@ -627,30 +627,6 @@ private:
|
|||
NonnullOwnPtr<CalcSum> m_expression;
|
||||
};
|
||||
|
||||
class ResolutionStyleValue : public StyleValueWithDefaultOperators<ResolutionStyleValue> {
|
||||
public:
|
||||
static ValueComparingNonnullRefPtr<ResolutionStyleValue> create(Resolution resolution)
|
||||
{
|
||||
return adopt_ref(*new ResolutionStyleValue(move(resolution)));
|
||||
}
|
||||
virtual ~ResolutionStyleValue() override { }
|
||||
|
||||
Resolution const& resolution() const { return m_resolution; }
|
||||
|
||||
virtual ErrorOr<String> to_string() const override { return m_resolution.to_string(); }
|
||||
|
||||
bool properties_equal(ResolutionStyleValue const& other) const { return m_resolution == other.m_resolution; }
|
||||
|
||||
private:
|
||||
explicit ResolutionStyleValue(Resolution resolution)
|
||||
: StyleValueWithDefaultOperators(Type::Resolution)
|
||||
, m_resolution(move(resolution))
|
||||
{
|
||||
}
|
||||
|
||||
Resolution m_resolution;
|
||||
};
|
||||
|
||||
class ShadowStyleValue final : public StyleValueWithDefaultOperators<ShadowStyleValue> {
|
||||
public:
|
||||
static ValueComparingNonnullRefPtr<ShadowStyleValue>
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) 2022-2023, Sam Atkins <atkinssj@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/CSS/Resolution.h>
|
||||
#include <LibWeb/CSS/StyleValue.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
class ResolutionStyleValue : public StyleValueWithDefaultOperators<ResolutionStyleValue> {
|
||||
public:
|
||||
static ValueComparingNonnullRefPtr<ResolutionStyleValue> create(Resolution resolution)
|
||||
{
|
||||
return adopt_ref(*new ResolutionStyleValue(move(resolution)));
|
||||
}
|
||||
virtual ~ResolutionStyleValue() override = default;
|
||||
|
||||
Resolution const& resolution() const { return m_resolution; }
|
||||
|
||||
virtual ErrorOr<String> to_string() const override { return m_resolution.to_string(); }
|
||||
|
||||
bool properties_equal(ResolutionStyleValue const& other) const { return m_resolution == other.m_resolution; }
|
||||
|
||||
private:
|
||||
explicit ResolutionStyleValue(Resolution resolution)
|
||||
: StyleValueWithDefaultOperators(Type::Resolution)
|
||||
, m_resolution(move(resolution))
|
||||
{
|
||||
}
|
||||
|
||||
Resolution m_resolution;
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in a new issue