mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-02 16:25:34 +03:00
LibWeb: Split GridTrackSizeStyleValue out of StyleValue.{h,cpp}
This commit is contained in:
parent
486ef3df7f
commit
d39788556a
Notes:
sideshowbarker
2024-07-16 22:23:18 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/d39788556a Pull-request: https://github.com/SerenityOS/serenity/pull/18040
@ -81,6 +81,7 @@ set(SOURCES
|
||||
CSS/StyleValues/GridTemplateAreaStyleValue.cpp
|
||||
CSS/StyleValues/GridTrackPlacementStyleValue.cpp
|
||||
CSS/StyleValues/GridTrackPlacementShorthandStyleValue.cpp
|
||||
CSS/StyleValues/GridTrackSizeStyleValue.cpp
|
||||
CSS/Supports.cpp
|
||||
CSS/SyntaxHighlighter/SyntaxHighlighter.cpp
|
||||
CSS/Time.cpp
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include <LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/GridTrackSizeStyleValue.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/Dump.h>
|
||||
#include <LibWeb/Infra/Strings.h>
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <LibWeb/CSS/StyleValues/GridAreaShorthandStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/GridTrackSizeStyleValue.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Element.h>
|
||||
#include <LibWeb/Layout/Viewport.h>
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <LibWeb/CSS/StyleValues/ContentStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/GridTrackSizeStyleValue.h>
|
||||
#include <LibWeb/FontCache.h>
|
||||
#include <LibWeb/Layout/BlockContainer.h>
|
||||
#include <LibWeb/Layout/Node.h>
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/GridTrackSizeStyleValue.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
#include <LibWeb/Loader/LoadRequest.h>
|
||||
@ -1031,11 +1032,6 @@ CalculatedStyleValue::CalculationResult CalculatedStyleValue::CalcNumberSumPartW
|
||||
return value->resolve(layout_node, percentage_basis);
|
||||
}
|
||||
|
||||
ErrorOr<String> GridTrackSizeStyleValue::to_string() const
|
||||
{
|
||||
return m_grid_track_size_list.to_string();
|
||||
}
|
||||
|
||||
ErrorOr<String> IdentifierStyleValue::to_string() const
|
||||
{
|
||||
return String::from_utf8(CSS::string_from_value_id(m_id));
|
||||
@ -1921,16 +1917,6 @@ ErrorOr<String> StyleValueList::to_string() const
|
||||
}
|
||||
|
||||
|
||||
ValueComparingNonnullRefPtr<GridTrackSizeStyleValue> GridTrackSizeStyleValue::create(CSS::GridTrackSizeList grid_track_size_list)
|
||||
{
|
||||
return adopt_ref(*new GridTrackSizeStyleValue(grid_track_size_list));
|
||||
}
|
||||
|
||||
ValueComparingNonnullRefPtr<GridTrackSizeStyleValue> GridTrackSizeStyleValue::make_auto()
|
||||
{
|
||||
return adopt_ref(*new GridTrackSizeStyleValue(CSS::GridTrackSizeList()));
|
||||
}
|
||||
|
||||
ValueComparingNonnullRefPtr<RectStyleValue> RectStyleValue::create(EdgeRect rect)
|
||||
{
|
||||
return adopt_ref(*new RectStyleValue(rect));
|
||||
|
@ -661,29 +661,6 @@ private:
|
||||
NonnullOwnPtr<CalcSum> m_expression;
|
||||
};
|
||||
|
||||
class GridTrackSizeStyleValue final : public StyleValueWithDefaultOperators<GridTrackSizeStyleValue> {
|
||||
public:
|
||||
static ValueComparingNonnullRefPtr<GridTrackSizeStyleValue> create(CSS::GridTrackSizeList grid_track_size_list);
|
||||
virtual ~GridTrackSizeStyleValue() override = default;
|
||||
|
||||
static ValueComparingNonnullRefPtr<GridTrackSizeStyleValue> make_auto();
|
||||
|
||||
CSS::GridTrackSizeList grid_track_size_list() const { return m_grid_track_size_list; }
|
||||
|
||||
virtual ErrorOr<String> to_string() const override;
|
||||
|
||||
bool properties_equal(GridTrackSizeStyleValue const& other) const { return m_grid_track_size_list == other.m_grid_track_size_list; }
|
||||
|
||||
private:
|
||||
explicit GridTrackSizeStyleValue(CSS::GridTrackSizeList grid_track_size_list)
|
||||
: StyleValueWithDefaultOperators(Type::GridTrackSizeList)
|
||||
, m_grid_track_size_list(grid_track_size_list)
|
||||
{
|
||||
}
|
||||
|
||||
CSS::GridTrackSizeList m_grid_track_size_list;
|
||||
};
|
||||
|
||||
class IdentifierStyleValue final : public StyleValueWithDefaultOperators<IdentifierStyleValue> {
|
||||
public:
|
||||
static ValueComparingNonnullRefPtr<IdentifierStyleValue> create(CSS::ValueID id)
|
||||
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
|
||||
* Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org>
|
||||
* Copyright (c) 2022-2023, MacDue <macdue@dueutil.tech>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "GridTrackSizeStyleValue.h"
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
ErrorOr<String> GridTrackSizeStyleValue::to_string() const
|
||||
{
|
||||
return m_grid_track_size_list.to_string();
|
||||
}
|
||||
|
||||
ValueComparingNonnullRefPtr<GridTrackSizeStyleValue> GridTrackSizeStyleValue::create(CSS::GridTrackSizeList grid_track_size_list)
|
||||
{
|
||||
return adopt_ref(*new GridTrackSizeStyleValue(grid_track_size_list));
|
||||
}
|
||||
|
||||
ValueComparingNonnullRefPtr<GridTrackSizeStyleValue> GridTrackSizeStyleValue::make_auto()
|
||||
{
|
||||
return adopt_ref(*new GridTrackSizeStyleValue(CSS::GridTrackSizeList()));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
|
||||
* Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org>
|
||||
* Copyright (c) 2022-2023, MacDue <macdue@dueutil.tech>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/CSS/GridTrackSize.h>
|
||||
#include <LibWeb/CSS/StyleValue.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
class GridTrackSizeStyleValue final : public StyleValueWithDefaultOperators<GridTrackSizeStyleValue> {
|
||||
public:
|
||||
static ValueComparingNonnullRefPtr<GridTrackSizeStyleValue> create(CSS::GridTrackSizeList grid_track_size_list);
|
||||
virtual ~GridTrackSizeStyleValue() override = default;
|
||||
|
||||
static ValueComparingNonnullRefPtr<GridTrackSizeStyleValue> make_auto();
|
||||
|
||||
CSS::GridTrackSizeList grid_track_size_list() const { return m_grid_track_size_list; }
|
||||
|
||||
virtual ErrorOr<String> to_string() const override;
|
||||
|
||||
bool properties_equal(GridTrackSizeStyleValue const& other) const { return m_grid_track_size_list == other.m_grid_track_size_list; }
|
||||
|
||||
private:
|
||||
explicit GridTrackSizeStyleValue(CSS::GridTrackSizeList grid_track_size_list)
|
||||
: StyleValueWithDefaultOperators(Type::GridTrackSizeList)
|
||||
, m_grid_track_size_list(grid_track_size_list)
|
||||
{
|
||||
}
|
||||
|
||||
CSS::GridTrackSizeList m_grid_track_size_list;
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user