mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 21:52:45 +00:00 
			
		
		
		
	LibWeb: Split GridTrackPlacementStyleValue out of StyleValue.{h,cpp}
This commit is contained in:
		
							parent
							
								
									402845fe00
								
							
						
					
					
						commit
						486ef3df7f
					
				
					 11 changed files with 69 additions and 29 deletions
				
			
		|  | @ -79,6 +79,7 @@ set(SOURCES | ||||||
|     CSS/StyleValues/FontStyleValue.cpp |     CSS/StyleValues/FontStyleValue.cpp | ||||||
|     CSS/StyleValues/GridAreaShorthandStyleValue.cpp |     CSS/StyleValues/GridAreaShorthandStyleValue.cpp | ||||||
|     CSS/StyleValues/GridTemplateAreaStyleValue.cpp |     CSS/StyleValues/GridTemplateAreaStyleValue.cpp | ||||||
|  |     CSS/StyleValues/GridTrackPlacementStyleValue.cpp | ||||||
|     CSS/StyleValues/GridTrackPlacementShorthandStyleValue.cpp |     CSS/StyleValues/GridTrackPlacementShorthandStyleValue.cpp | ||||||
|     CSS/Supports.cpp |     CSS/Supports.cpp | ||||||
|     CSS/SyntaxHighlighter/SyntaxHighlighter.cpp |     CSS/SyntaxHighlighter/SyntaxHighlighter.cpp | ||||||
|  |  | ||||||
|  | @ -46,6 +46,7 @@ | ||||||
| #include <LibWeb/CSS/StyleValues/GridAreaShorthandStyleValue.h> | #include <LibWeb/CSS/StyleValues/GridAreaShorthandStyleValue.h> | ||||||
| #include <LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.h> | #include <LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.h> | ||||||
| #include <LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.h> | #include <LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.h> | ||||||
|  | #include <LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h> | ||||||
| #include <LibWeb/DOM/Document.h> | #include <LibWeb/DOM/Document.h> | ||||||
| #include <LibWeb/Dump.h> | #include <LibWeb/Dump.h> | ||||||
| #include <LibWeb/Infra/Strings.h> | #include <LibWeb/Infra/Strings.h> | ||||||
|  |  | ||||||
|  | @ -20,6 +20,7 @@ | ||||||
| #include <LibWeb/CSS/StyleValues/ColorStyleValue.h> | #include <LibWeb/CSS/StyleValues/ColorStyleValue.h> | ||||||
| #include <LibWeb/CSS/StyleValues/GridAreaShorthandStyleValue.h> | #include <LibWeb/CSS/StyleValues/GridAreaShorthandStyleValue.h> | ||||||
| #include <LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.h> | #include <LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.h> | ||||||
|  | #include <LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h> | ||||||
| #include <LibWeb/DOM/Document.h> | #include <LibWeb/DOM/Document.h> | ||||||
| #include <LibWeb/DOM/Element.h> | #include <LibWeb/DOM/Element.h> | ||||||
| #include <LibWeb/Layout/Viewport.h> | #include <LibWeb/Layout/Viewport.h> | ||||||
|  |  | ||||||
|  | @ -36,6 +36,7 @@ | ||||||
| #include <LibWeb/CSS/StyleValues/FontStyleValue.h> | #include <LibWeb/CSS/StyleValues/FontStyleValue.h> | ||||||
| #include <LibWeb/CSS/StyleValues/GridAreaShorthandStyleValue.h> | #include <LibWeb/CSS/StyleValues/GridAreaShorthandStyleValue.h> | ||||||
| #include <LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.h> | #include <LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.h> | ||||||
|  | #include <LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h> | ||||||
| #include <LibWeb/DOM/Document.h> | #include <LibWeb/DOM/Document.h> | ||||||
| #include <LibWeb/DOM/Element.h> | #include <LibWeb/DOM/Element.h> | ||||||
| #include <LibWeb/FontCache.h> | #include <LibWeb/FontCache.h> | ||||||
|  |  | ||||||
|  | @ -12,6 +12,7 @@ | ||||||
| #include <LibWeb/CSS/StyleValues/AngleStyleValue.h> | #include <LibWeb/CSS/StyleValues/AngleStyleValue.h> | ||||||
| #include <LibWeb/CSS/StyleValues/ContentStyleValue.h> | #include <LibWeb/CSS/StyleValues/ContentStyleValue.h> | ||||||
| #include <LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.h> | #include <LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.h> | ||||||
|  | #include <LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h> | ||||||
| #include <LibWeb/FontCache.h> | #include <LibWeb/FontCache.h> | ||||||
| #include <LibWeb/Layout/BlockContainer.h> | #include <LibWeb/Layout/BlockContainer.h> | ||||||
| #include <LibWeb/Layout/Node.h> | #include <LibWeb/Layout/Node.h> | ||||||
|  |  | ||||||
|  | @ -28,6 +28,7 @@ | ||||||
| #include <LibWeb/CSS/StyleValues/GridAreaShorthandStyleValue.h> | #include <LibWeb/CSS/StyleValues/GridAreaShorthandStyleValue.h> | ||||||
| #include <LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.h> | #include <LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.h> | ||||||
| #include <LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.h> | #include <LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.h> | ||||||
|  | #include <LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h> | ||||||
| #include <LibWeb/DOM/Document.h> | #include <LibWeb/DOM/Document.h> | ||||||
| #include <LibWeb/HTML/BrowsingContext.h> | #include <LibWeb/HTML/BrowsingContext.h> | ||||||
| #include <LibWeb/Loader/LoadRequest.h> | #include <LibWeb/Loader/LoadRequest.h> | ||||||
|  | @ -1030,11 +1031,6 @@ CalculatedStyleValue::CalculationResult CalculatedStyleValue::CalcNumberSumPartW | ||||||
|     return value->resolve(layout_node, percentage_basis); |     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 | ErrorOr<String> GridTrackSizeStyleValue::to_string() const | ||||||
| { | { | ||||||
|     return m_grid_track_size_list.to_string(); |     return m_grid_track_size_list.to_string(); | ||||||
|  | @ -1924,10 +1920,6 @@ ErrorOr<String> StyleValueList::to_string() const | ||||||
|     return builder.to_string(); |     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) | ValueComparingNonnullRefPtr<GridTrackSizeStyleValue> GridTrackSizeStyleValue::create(CSS::GridTrackSizeList grid_track_size_list) | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -661,26 +661,6 @@ private: | ||||||
|     NonnullOwnPtr<CalcSum> m_expression; |     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> { | class GridTrackSizeStyleValue final : public StyleValueWithDefaultOperators<GridTrackSizeStyleValue> { | ||||||
| public: | public: | ||||||
|     static ValueComparingNonnullRefPtr<GridTrackSizeStyleValue> create(CSS::GridTrackSizeList grid_track_size_list); |     static ValueComparingNonnullRefPtr<GridTrackSizeStyleValue> create(CSS::GridTrackSizeList grid_track_size_list); | ||||||
|  |  | ||||||
|  | @ -8,6 +8,7 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include "GridAreaShorthandStyleValue.h" | #include "GridAreaShorthandStyleValue.h" | ||||||
|  | #include <LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h> | ||||||
| 
 | 
 | ||||||
| namespace Web::CSS { | namespace Web::CSS { | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -8,6 +8,7 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include "GridTrackPlacementShorthandStyleValue.h" | #include "GridTrackPlacementShorthandStyleValue.h" | ||||||
|  | #include <LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h> | ||||||
| 
 | 
 | ||||||
| namespace Web::CSS { | namespace Web::CSS { | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -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(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  | @ -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; | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | } | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Sam Atkins
						Sam Atkins