LibWeb: Split GridTrackPlacementStyleValue out of StyleValue.{h,cpp}

This commit is contained in:
Sam Atkins 2023-03-24 14:53:08 +00:00 committed by Linus Groh
parent 402845fe00
commit 486ef3df7f
Notes: sideshowbarker 2024-07-17 05:18:58 +09:00
11 changed files with 69 additions and 29 deletions

View File

@ -79,6 +79,7 @@ set(SOURCES
CSS/StyleValues/FontStyleValue.cpp
CSS/StyleValues/GridAreaShorthandStyleValue.cpp
CSS/StyleValues/GridTemplateAreaStyleValue.cpp
CSS/StyleValues/GridTrackPlacementStyleValue.cpp
CSS/StyleValues/GridTrackPlacementShorthandStyleValue.cpp
CSS/Supports.cpp
CSS/SyntaxHighlighter/SyntaxHighlighter.cpp

View File

@ -46,6 +46,7 @@
#include <LibWeb/CSS/StyleValues/GridAreaShorthandStyleValue.h>
#include <LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.h>
#include <LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.h>
#include <LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/Dump.h>
#include <LibWeb/Infra/Strings.h>

View File

@ -20,6 +20,7 @@
#include <LibWeb/CSS/StyleValues/ColorStyleValue.h>
#include <LibWeb/CSS/StyleValues/GridAreaShorthandStyleValue.h>
#include <LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.h>
#include <LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Element.h>
#include <LibWeb/Layout/Viewport.h>

View File

@ -36,6 +36,7 @@
#include <LibWeb/CSS/StyleValues/FontStyleValue.h>
#include <LibWeb/CSS/StyleValues/GridAreaShorthandStyleValue.h>
#include <LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.h>
#include <LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Element.h>
#include <LibWeb/FontCache.h>

View File

@ -12,6 +12,7 @@
#include <LibWeb/CSS/StyleValues/AngleStyleValue.h>
#include <LibWeb/CSS/StyleValues/ContentStyleValue.h>
#include <LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.h>
#include <LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h>
#include <LibWeb/FontCache.h>
#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/Node.h>

View File

@ -28,6 +28,7 @@
#include <LibWeb/CSS/StyleValues/GridAreaShorthandStyleValue.h>
#include <LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.h>
#include <LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.h>
#include <LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/Loader/LoadRequest.h>
@ -1030,11 +1031,6 @@ CalculatedStyleValue::CalculationResult CalculatedStyleValue::CalcNumberSumPartW
return value->resolve(layout_node, percentage_basis);
}
ErrorOr<String> GridTrackPlacementStyleValue::to_string() const
{
return m_grid_track_placement.to_string();
}
ErrorOr<String> GridTrackSizeStyleValue::to_string() const
{
return m_grid_track_size_list.to_string();
@ -1924,10 +1920,6 @@ ErrorOr<String> StyleValueList::to_string() const
return builder.to_string();
}
ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue> GridTrackPlacementStyleValue::create(CSS::GridTrackPlacement grid_track_placement)
{
return adopt_ref(*new GridTrackPlacementStyleValue(grid_track_placement));
}
ValueComparingNonnullRefPtr<GridTrackSizeStyleValue> GridTrackSizeStyleValue::create(CSS::GridTrackSizeList grid_track_size_list)
{

View File

@ -661,26 +661,6 @@ private:
NonnullOwnPtr<CalcSum> m_expression;
};
class GridTrackPlacementStyleValue final : public StyleValueWithDefaultOperators<GridTrackPlacementStyleValue> {
public:
static ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue> create(CSS::GridTrackPlacement grid_track_placement);
virtual ~GridTrackPlacementStyleValue() override = default;
CSS::GridTrackPlacement const& grid_track_placement() const { return m_grid_track_placement; }
virtual ErrorOr<String> to_string() const override;
bool properties_equal(GridTrackPlacementStyleValue const& other) const { return m_grid_track_placement == other.m_grid_track_placement; };
private:
explicit GridTrackPlacementStyleValue(CSS::GridTrackPlacement grid_track_placement)
: StyleValueWithDefaultOperators(Type::GridTrackPlacement)
, m_grid_track_placement(grid_track_placement)
{
}
CSS::GridTrackPlacement m_grid_track_placement;
};
class GridTrackSizeStyleValue final : public StyleValueWithDefaultOperators<GridTrackSizeStyleValue> {
public:
static ValueComparingNonnullRefPtr<GridTrackSizeStyleValue> create(CSS::GridTrackSizeList grid_track_size_list);

View File

@ -8,6 +8,7 @@
*/
#include "GridAreaShorthandStyleValue.h"
#include <LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h>
namespace Web::CSS {

View File

@ -8,6 +8,7 @@
*/
#include "GridTrackPlacementShorthandStyleValue.h"
#include <LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h>
namespace Web::CSS {

View File

@ -0,0 +1,24 @@
/*
* 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 "GridTrackPlacementStyleValue.h"
namespace Web::CSS {
ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue> GridTrackPlacementStyleValue::create(CSS::GridTrackPlacement grid_track_placement)
{
return adopt_ref(*new GridTrackPlacementStyleValue(grid_track_placement));
}
ErrorOr<String> GridTrackPlacementStyleValue::to_string() const
{
return m_grid_track_placement.to_string();
}
}

View File

@ -0,0 +1,37 @@
/*
* 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/GridTrackPlacement.h>
#include <LibWeb/CSS/StyleValue.h>
namespace Web::CSS {
class GridTrackPlacementStyleValue final : public StyleValueWithDefaultOperators<GridTrackPlacementStyleValue> {
public:
static ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue> create(GridTrackPlacement grid_track_placement);
virtual ~GridTrackPlacementStyleValue() override = default;
GridTrackPlacement const& grid_track_placement() const { return m_grid_track_placement; }
virtual ErrorOr<String> to_string() const override;
bool properties_equal(GridTrackPlacementStyleValue const& other) const { return m_grid_track_placement == other.m_grid_track_placement; };
private:
explicit GridTrackPlacementStyleValue(GridTrackPlacement grid_track_placement)
: StyleValueWithDefaultOperators(Type::GridTrackPlacement)
, m_grid_track_placement(grid_track_placement)
{
}
GridTrackPlacement m_grid_track_placement;
};
}