| 
									
										
										
										
											2022-08-24 12:21:15 +02:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2022, Martin Falisse <mfalisse@outlook.com> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
											  
											
												LibWeb: Add parent classes for managing GridTrackSizes
Add classes ExplicitTrackSizing and MetaGridTrackSize which will allow
for managing properties like auto-fill and minmax.
In the following CSS example there are 3 classes that will be used:
grid-template-column: repeat(auto-fill, minmax(50px, 1fr) 75px);
ExplicitTrackSizing - will contain the entire value. e.g.
repeat(auto-fill, minmax(50px, 1fr) 75px)
With a flag if it's a repeat, as well as references to the
MetaGridTrackSizes which is the next step down.
MetaGridTrackSize:
Contain the individual grid track sizes. Here there are two:
minmax(50px, 1fr) as well as 75px.
This way can keep track if it's a minmax function or not, and the
references to both GridTrackSizes in the case it is, or in just the one
if it is not.
GridTrackSize:
Is the most basic element, in this case there are three in total; two of
which are held by the first MetaGridTrackSize, and the third is held by
the second MetaGridTrackSize.
Examples: 50px, 1fr and 75px.
											
										 
											2022-10-09 19:34:27 +02:00
										 |  |  | #include <AK/Vector.h>
 | 
					
						
							| 
									
										
										
										
											2022-08-24 12:21:15 +02:00
										 |  |  | #include <LibWeb/CSS/Length.h>
 | 
					
						
							|  |  |  | #include <LibWeb/CSS/Percentage.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Web::CSS { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-30 13:27:57 +01:00
										 |  |  | class GridSize { | 
					
						
							| 
									
										
										
										
											2022-08-24 12:21:15 +02:00
										 |  |  | public: | 
					
						
							|  |  |  |     enum class Type { | 
					
						
							|  |  |  |         Length, | 
					
						
							|  |  |  |         Percentage, | 
					
						
							|  |  |  |         FlexibleLength, | 
					
						
							| 
									
										
										
										
											2023-01-16 17:33:30 +01:00
										 |  |  |         MaxContent, | 
					
						
							|  |  |  |         MinContent, | 
					
						
							| 
									
										
										
										
											2022-08-24 12:21:15 +02:00
										 |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-30 13:27:57 +01:00
										 |  |  |     GridSize(Length); | 
					
						
							|  |  |  |     GridSize(Percentage); | 
					
						
							|  |  |  |     GridSize(float); | 
					
						
							| 
									
										
										
										
											2023-01-16 17:33:30 +01:00
										 |  |  |     GridSize(Type); | 
					
						
							| 
									
										
										
										
											2022-10-30 13:27:57 +01:00
										 |  |  |     GridSize(); | 
					
						
							|  |  |  |     ~GridSize(); | 
					
						
							| 
									
										
										
										
											2022-08-24 12:21:15 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-30 13:27:57 +01:00
										 |  |  |     static GridSize make_auto(); | 
					
						
							| 
									
										
										
										
											2022-09-07 15:09:32 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-24 12:21:15 +02:00
										 |  |  |     Type type() const { return m_type; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     bool is_length() const { return m_type == Type::Length; } | 
					
						
							|  |  |  |     bool is_percentage() const { return m_type == Type::Percentage; } | 
					
						
							|  |  |  |     bool is_flexible_length() const { return m_type == Type::FlexibleLength; } | 
					
						
							| 
									
										
										
										
											2023-01-16 17:33:30 +01:00
										 |  |  |     bool is_max_content() const { return m_type == Type::MaxContent; } | 
					
						
							|  |  |  |     bool is_min_content() const { return m_type == Type::MinContent; } | 
					
						
							| 
									
										
										
										
											2022-08-24 12:21:15 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-13 17:42:39 +02:00
										 |  |  |     Length length() const; | 
					
						
							| 
									
										
										
										
											2022-08-24 12:21:15 +02:00
										 |  |  |     Percentage percentage() const { return m_percentage; } | 
					
						
							| 
									
										
										
										
											2022-09-07 14:55:19 +02:00
										 |  |  |     float flexible_length() const { return m_flexible_length; } | 
					
						
							| 
									
										
										
										
											2022-08-24 12:21:15 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-16 17:33:30 +01:00
										 |  |  |     // https://www.w3.org/TR/css-grid-2/#layout-algorithm
 | 
					
						
							|  |  |  |     // An intrinsic sizing function (min-content, max-content, auto, fit-content()).
 | 
					
						
							| 
									
										
										
										
											2022-09-07 15:12:38 +02:00
										 |  |  |     // FIXME: Add missing properties once implemented.
 | 
					
						
							|  |  |  |     bool is_intrinsic_track_sizing() const | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2023-01-16 17:33:30 +01:00
										 |  |  |         return (m_type == Type::Length && m_length.is_auto()) || m_type == Type::MaxContent || m_type == Type::MinContent; | 
					
						
							| 
									
										
										
										
											2022-09-07 15:12:38 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-15 13:21:43 +02:00
										 |  |  |     bool is_definite() const | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return (m_type == Type::Length && !m_length.is_auto()) || is_percentage(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-06 19:02:26 +01:00
										 |  |  |     ErrorOr<String> to_string() const; | 
					
						
							| 
									
										
										
										
											2022-10-30 13:27:57 +01:00
										 |  |  |     bool operator==(GridSize const& other) const | 
					
						
							| 
									
										
										
										
											2022-08-24 12:21:15 +02:00
										 |  |  |     { | 
					
						
							|  |  |  |         return m_type == other.type() | 
					
						
							|  |  |  |             && m_length == other.length() | 
					
						
							|  |  |  |             && m_percentage == other.percentage() | 
					
						
							|  |  |  |             && m_flexible_length == other.flexible_length(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  |     Type m_type; | 
					
						
							| 
									
										
										
										
											2022-09-13 17:42:39 +02:00
										 |  |  |     // Length includes a RefPtr<CalculatedStyleValue> member, but we can't include the header StyleValue.h as it includes
 | 
					
						
							|  |  |  |     // this file already. To break the cyclic dependency, we must initialize m_length in the constructor.
 | 
					
						
							|  |  |  |     Length m_length; | 
					
						
							| 
									
										
										
										
											2022-08-24 12:21:15 +02:00
										 |  |  |     Percentage m_percentage { Percentage(0) }; | 
					
						
							| 
									
										
										
										
											2022-09-07 14:55:19 +02:00
										 |  |  |     float m_flexible_length { 0 }; | 
					
						
							| 
									
										
										
										
											2022-08-24 12:21:15 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-30 13:27:57 +01:00
										 |  |  | class GridMinMax { | 
					
						
							| 
									
										
											  
											
												LibWeb: Add parent classes for managing GridTrackSizes
Add classes ExplicitTrackSizing and MetaGridTrackSize which will allow
for managing properties like auto-fill and minmax.
In the following CSS example there are 3 classes that will be used:
grid-template-column: repeat(auto-fill, minmax(50px, 1fr) 75px);
ExplicitTrackSizing - will contain the entire value. e.g.
repeat(auto-fill, minmax(50px, 1fr) 75px)
With a flag if it's a repeat, as well as references to the
MetaGridTrackSizes which is the next step down.
MetaGridTrackSize:
Contain the individual grid track sizes. Here there are two:
minmax(50px, 1fr) as well as 75px.
This way can keep track if it's a minmax function or not, and the
references to both GridTrackSizes in the case it is, or in just the one
if it is not.
GridTrackSize:
Is the most basic element, in this case there are three in total; two of
which are held by the first MetaGridTrackSize, and the third is held by
the second MetaGridTrackSize.
Examples: 50px, 1fr and 75px.
											
										 
											2022-10-09 19:34:27 +02:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2022-10-30 13:27:57 +01:00
										 |  |  |     GridMinMax(CSS::GridSize min_grid_size, CSS::GridSize max_grid_size); | 
					
						
							|  |  |  |     GridMinMax() = default; | 
					
						
							| 
									
										
										
										
											2022-10-15 13:04:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-30 13:27:57 +01:00
										 |  |  |     GridSize min_grid_size() const& { return m_min_grid_size; } | 
					
						
							|  |  |  |     GridSize max_grid_size() const& { return m_max_grid_size; } | 
					
						
							| 
									
										
											  
											
												LibWeb: Add parent classes for managing GridTrackSizes
Add classes ExplicitTrackSizing and MetaGridTrackSize which will allow
for managing properties like auto-fill and minmax.
In the following CSS example there are 3 classes that will be used:
grid-template-column: repeat(auto-fill, minmax(50px, 1fr) 75px);
ExplicitTrackSizing - will contain the entire value. e.g.
repeat(auto-fill, minmax(50px, 1fr) 75px)
With a flag if it's a repeat, as well as references to the
MetaGridTrackSizes which is the next step down.
MetaGridTrackSize:
Contain the individual grid track sizes. Here there are two:
minmax(50px, 1fr) as well as 75px.
This way can keep track if it's a minmax function or not, and the
references to both GridTrackSizes in the case it is, or in just the one
if it is not.
GridTrackSize:
Is the most basic element, in this case there are three in total; two of
which are held by the first MetaGridTrackSize, and the third is held by
the second MetaGridTrackSize.
Examples: 50px, 1fr and 75px.
											
										 
											2022-10-09 19:34:27 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-06 19:02:26 +01:00
										 |  |  |     ErrorOr<String> to_string() const; | 
					
						
							| 
									
										
										
										
											2022-10-30 13:27:57 +01:00
										 |  |  |     bool operator==(GridMinMax const& other) const | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return m_min_grid_size == other.min_grid_size() | 
					
						
							|  |  |  |             && m_max_grid_size == other.max_grid_size(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  |     GridSize m_min_grid_size; | 
					
						
							|  |  |  |     GridSize m_max_grid_size; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class GridTrackSizeList { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2023-01-16 17:29:15 +01:00
										 |  |  |     GridTrackSizeList(Vector<CSS::ExplicitGridTrack> track_list, Vector<Vector<String>> line_names); | 
					
						
							| 
									
										
										
										
											2022-10-30 13:27:57 +01:00
										 |  |  |     GridTrackSizeList(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     static GridTrackSizeList make_auto(); | 
					
						
							| 
									
										
											  
											
												LibWeb: Add parent classes for managing GridTrackSizes
Add classes ExplicitTrackSizing and MetaGridTrackSize which will allow
for managing properties like auto-fill and minmax.
In the following CSS example there are 3 classes that will be used:
grid-template-column: repeat(auto-fill, minmax(50px, 1fr) 75px);
ExplicitTrackSizing - will contain the entire value. e.g.
repeat(auto-fill, minmax(50px, 1fr) 75px)
With a flag if it's a repeat, as well as references to the
MetaGridTrackSizes which is the next step down.
MetaGridTrackSize:
Contain the individual grid track sizes. Here there are two:
minmax(50px, 1fr) as well as 75px.
This way can keep track if it's a minmax function or not, and the
references to both GridTrackSizes in the case it is, or in just the one
if it is not.
GridTrackSize:
Is the most basic element, in this case there are three in total; two of
which are held by the first MetaGridTrackSize, and the third is held by
the second MetaGridTrackSize.
Examples: 50px, 1fr and 75px.
											
										 
											2022-10-09 19:34:27 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-30 13:27:57 +01:00
										 |  |  |     Vector<CSS::ExplicitGridTrack> track_list() const { return m_track_list; } | 
					
						
							| 
									
										
										
										
											2023-01-16 17:29:15 +01:00
										 |  |  |     Vector<Vector<String>> line_names() const { return m_line_names; } | 
					
						
							| 
									
										
										
										
											2022-10-30 13:45:40 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-06 19:02:26 +01:00
										 |  |  |     ErrorOr<String> to_string() const; | 
					
						
							| 
									
										
										
										
											2022-10-30 13:27:57 +01:00
										 |  |  |     bool operator==(GridTrackSizeList const& other) const | 
					
						
							| 
									
										
											  
											
												LibWeb: Add parent classes for managing GridTrackSizes
Add classes ExplicitTrackSizing and MetaGridTrackSize which will allow
for managing properties like auto-fill and minmax.
In the following CSS example there are 3 classes that will be used:
grid-template-column: repeat(auto-fill, minmax(50px, 1fr) 75px);
ExplicitTrackSizing - will contain the entire value. e.g.
repeat(auto-fill, minmax(50px, 1fr) 75px)
With a flag if it's a repeat, as well as references to the
MetaGridTrackSizes which is the next step down.
MetaGridTrackSize:
Contain the individual grid track sizes. Here there are two:
minmax(50px, 1fr) as well as 75px.
This way can keep track if it's a minmax function or not, and the
references to both GridTrackSizes in the case it is, or in just the one
if it is not.
GridTrackSize:
Is the most basic element, in this case there are three in total; two of
which are held by the first MetaGridTrackSize, and the third is held by
the second MetaGridTrackSize.
Examples: 50px, 1fr and 75px.
											
										 
											2022-10-09 19:34:27 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2022-10-30 13:45:40 +01:00
										 |  |  |         return m_line_names == other.line_names() && m_track_list == other.track_list(); | 
					
						
							| 
									
										
											  
											
												LibWeb: Add parent classes for managing GridTrackSizes
Add classes ExplicitTrackSizing and MetaGridTrackSize which will allow
for managing properties like auto-fill and minmax.
In the following CSS example there are 3 classes that will be used:
grid-template-column: repeat(auto-fill, minmax(50px, 1fr) 75px);
ExplicitTrackSizing - will contain the entire value. e.g.
repeat(auto-fill, minmax(50px, 1fr) 75px)
With a flag if it's a repeat, as well as references to the
MetaGridTrackSizes which is the next step down.
MetaGridTrackSize:
Contain the individual grid track sizes. Here there are two:
minmax(50px, 1fr) as well as 75px.
This way can keep track if it's a minmax function or not, and the
references to both GridTrackSizes in the case it is, or in just the one
if it is not.
GridTrackSize:
Is the most basic element, in this case there are three in total; two of
which are held by the first MetaGridTrackSize, and the third is held by
the second MetaGridTrackSize.
Examples: 50px, 1fr and 75px.
											
										 
											2022-10-09 19:34:27 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2022-10-30 13:27:57 +01:00
										 |  |  |     Vector<CSS::ExplicitGridTrack> m_track_list; | 
					
						
							| 
									
										
										
										
											2023-01-16 17:29:15 +01:00
										 |  |  |     Vector<Vector<String>> m_line_names; | 
					
						
							| 
									
										
											  
											
												LibWeb: Add parent classes for managing GridTrackSizes
Add classes ExplicitTrackSizing and MetaGridTrackSize which will allow
for managing properties like auto-fill and minmax.
In the following CSS example there are 3 classes that will be used:
grid-template-column: repeat(auto-fill, minmax(50px, 1fr) 75px);
ExplicitTrackSizing - will contain the entire value. e.g.
repeat(auto-fill, minmax(50px, 1fr) 75px)
With a flag if it's a repeat, as well as references to the
MetaGridTrackSizes which is the next step down.
MetaGridTrackSize:
Contain the individual grid track sizes. Here there are two:
minmax(50px, 1fr) as well as 75px.
This way can keep track if it's a minmax function or not, and the
references to both GridTrackSizes in the case it is, or in just the one
if it is not.
GridTrackSize:
Is the most basic element, in this case there are three in total; two of
which are held by the first MetaGridTrackSize, and the third is held by
the second MetaGridTrackSize.
Examples: 50px, 1fr and 75px.
											
										 
											2022-10-09 19:34:27 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-30 13:27:57 +01:00
										 |  |  | class GridRepeat { | 
					
						
							| 
									
										
											  
											
												LibWeb: Add parent classes for managing GridTrackSizes
Add classes ExplicitTrackSizing and MetaGridTrackSize which will allow
for managing properties like auto-fill and minmax.
In the following CSS example there are 3 classes that will be used:
grid-template-column: repeat(auto-fill, minmax(50px, 1fr) 75px);
ExplicitTrackSizing - will contain the entire value. e.g.
repeat(auto-fill, minmax(50px, 1fr) 75px)
With a flag if it's a repeat, as well as references to the
MetaGridTrackSizes which is the next step down.
MetaGridTrackSize:
Contain the individual grid track sizes. Here there are two:
minmax(50px, 1fr) as well as 75px.
This way can keep track if it's a minmax function or not, and the
references to both GridTrackSizes in the case it is, or in just the one
if it is not.
GridTrackSize:
Is the most basic element, in this case there are three in total; two of
which are held by the first MetaGridTrackSize, and the third is held by
the second MetaGridTrackSize.
Examples: 50px, 1fr and 75px.
											
										 
											2022-10-09 19:34:27 +02:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2022-10-15 13:02:45 +02:00
										 |  |  |     enum class Type { | 
					
						
							|  |  |  |         AutoFit, | 
					
						
							|  |  |  |         AutoFill, | 
					
						
							| 
									
										
										
										
											2022-10-30 13:27:57 +01:00
										 |  |  |         Default, | 
					
						
							| 
									
										
										
										
											2022-10-15 13:02:45 +02:00
										 |  |  |     }; | 
					
						
							| 
									
										
										
										
											2022-10-30 13:27:57 +01:00
										 |  |  |     GridRepeat(GridTrackSizeList, int repeat_count); | 
					
						
							|  |  |  |     GridRepeat(GridTrackSizeList, Type); | 
					
						
							|  |  |  |     GridRepeat(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     bool is_auto_fill() const { return m_type == Type::AutoFill; } | 
					
						
							|  |  |  |     bool is_auto_fit() const { return m_type == Type::AutoFit; } | 
					
						
							|  |  |  |     bool is_default() const { return m_type == Type::Default; } | 
					
						
							|  |  |  |     int repeat_count() const | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         VERIFY(is_default()); | 
					
						
							|  |  |  |         return m_repeat_count; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     GridTrackSizeList grid_track_size_list() const& { return m_grid_track_size_list; } | 
					
						
							|  |  |  |     Type type() const& { return m_type; } | 
					
						
							| 
									
										
										
										
											2022-10-15 13:02:45 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-06 19:02:26 +01:00
										 |  |  |     ErrorOr<String> to_string() const; | 
					
						
							| 
									
										
										
										
											2022-10-30 13:27:57 +01:00
										 |  |  |     bool operator==(GridRepeat const& other) const | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if (m_type != other.type()) | 
					
						
							|  |  |  |             return false; | 
					
						
							|  |  |  |         if (m_type == Type::Default && m_repeat_count != other.repeat_count()) | 
					
						
							|  |  |  |             return false; | 
					
						
							|  |  |  |         return m_grid_track_size_list == other.grid_track_size_list(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-10-15 13:02:45 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-30 13:27:57 +01:00
										 |  |  | private: | 
					
						
							|  |  |  |     Type m_type; | 
					
						
							|  |  |  |     GridTrackSizeList m_grid_track_size_list; | 
					
						
							|  |  |  |     int m_repeat_count { 0 }; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class ExplicitGridTrack { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     enum class Type { | 
					
						
							|  |  |  |         MinMax, | 
					
						
							|  |  |  |         Repeat, | 
					
						
							|  |  |  |         Default, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     ExplicitGridTrack(CSS::GridRepeat); | 
					
						
							|  |  |  |     ExplicitGridTrack(CSS::GridMinMax); | 
					
						
							|  |  |  |     ExplicitGridTrack(CSS::GridSize); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     bool is_repeat() const { return m_type == Type::Repeat; } | 
					
						
							|  |  |  |     GridRepeat repeat() const | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         VERIFY(is_repeat()); | 
					
						
							|  |  |  |         return m_grid_repeat; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
											  
											
												LibWeb: Add parent classes for managing GridTrackSizes
Add classes ExplicitTrackSizing and MetaGridTrackSize which will allow
for managing properties like auto-fill and minmax.
In the following CSS example there are 3 classes that will be used:
grid-template-column: repeat(auto-fill, minmax(50px, 1fr) 75px);
ExplicitTrackSizing - will contain the entire value. e.g.
repeat(auto-fill, minmax(50px, 1fr) 75px)
With a flag if it's a repeat, as well as references to the
MetaGridTrackSizes which is the next step down.
MetaGridTrackSize:
Contain the individual grid track sizes. Here there are two:
minmax(50px, 1fr) as well as 75px.
This way can keep track if it's a minmax function or not, and the
references to both GridTrackSizes in the case it is, or in just the one
if it is not.
GridTrackSize:
Is the most basic element, in this case there are three in total; two of
which are held by the first MetaGridTrackSize, and the third is held by
the second MetaGridTrackSize.
Examples: 50px, 1fr and 75px.
											
										 
											2022-10-09 19:34:27 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-30 13:27:57 +01:00
										 |  |  |     bool is_minmax() const { return m_type == Type::MinMax; } | 
					
						
							|  |  |  |     GridMinMax minmax() const | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         VERIFY(is_minmax()); | 
					
						
							|  |  |  |         return m_grid_minmax; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     bool is_default() const { return m_type == Type::Default; } | 
					
						
							|  |  |  |     GridSize grid_size() const | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         VERIFY(is_default()); | 
					
						
							|  |  |  |         return m_grid_size; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
											  
											
												LibWeb: Add parent classes for managing GridTrackSizes
Add classes ExplicitTrackSizing and MetaGridTrackSize which will allow
for managing properties like auto-fill and minmax.
In the following CSS example there are 3 classes that will be used:
grid-template-column: repeat(auto-fill, minmax(50px, 1fr) 75px);
ExplicitTrackSizing - will contain the entire value. e.g.
repeat(auto-fill, minmax(50px, 1fr) 75px)
With a flag if it's a repeat, as well as references to the
MetaGridTrackSizes which is the next step down.
MetaGridTrackSize:
Contain the individual grid track sizes. Here there are two:
minmax(50px, 1fr) as well as 75px.
This way can keep track if it's a minmax function or not, and the
references to both GridTrackSizes in the case it is, or in just the one
if it is not.
GridTrackSize:
Is the most basic element, in this case there are three in total; two of
which are held by the first MetaGridTrackSize, and the third is held by
the second MetaGridTrackSize.
Examples: 50px, 1fr and 75px.
											
										 
											2022-10-09 19:34:27 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-30 13:27:57 +01:00
										 |  |  |     Type type() const { return m_type; } | 
					
						
							| 
									
										
											  
											
												LibWeb: Add parent classes for managing GridTrackSizes
Add classes ExplicitTrackSizing and MetaGridTrackSize which will allow
for managing properties like auto-fill and minmax.
In the following CSS example there are 3 classes that will be used:
grid-template-column: repeat(auto-fill, minmax(50px, 1fr) 75px);
ExplicitTrackSizing - will contain the entire value. e.g.
repeat(auto-fill, minmax(50px, 1fr) 75px)
With a flag if it's a repeat, as well as references to the
MetaGridTrackSizes which is the next step down.
MetaGridTrackSize:
Contain the individual grid track sizes. Here there are two:
minmax(50px, 1fr) as well as 75px.
This way can keep track if it's a minmax function or not, and the
references to both GridTrackSizes in the case it is, or in just the one
if it is not.
GridTrackSize:
Is the most basic element, in this case there are three in total; two of
which are held by the first MetaGridTrackSize, and the third is held by
the second MetaGridTrackSize.
Examples: 50px, 1fr and 75px.
											
										 
											2022-10-09 19:34:27 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-06 19:02:26 +01:00
										 |  |  |     ErrorOr<String> to_string() const; | 
					
						
							| 
									
										
										
										
											2022-10-30 13:27:57 +01:00
										 |  |  |     bool operator==(ExplicitGridTrack const& other) const | 
					
						
							| 
									
										
											  
											
												LibWeb: Add parent classes for managing GridTrackSizes
Add classes ExplicitTrackSizing and MetaGridTrackSize which will allow
for managing properties like auto-fill and minmax.
In the following CSS example there are 3 classes that will be used:
grid-template-column: repeat(auto-fill, minmax(50px, 1fr) 75px);
ExplicitTrackSizing - will contain the entire value. e.g.
repeat(auto-fill, minmax(50px, 1fr) 75px)
With a flag if it's a repeat, as well as references to the
MetaGridTrackSizes which is the next step down.
MetaGridTrackSize:
Contain the individual grid track sizes. Here there are two:
minmax(50px, 1fr) as well as 75px.
This way can keep track if it's a minmax function or not, and the
references to both GridTrackSizes in the case it is, or in just the one
if it is not.
GridTrackSize:
Is the most basic element, in this case there are three in total; two of
which are held by the first MetaGridTrackSize, and the third is held by
the second MetaGridTrackSize.
Examples: 50px, 1fr and 75px.
											
										 
											2022-10-09 19:34:27 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2022-10-30 13:27:57 +01:00
										 |  |  |         if (is_repeat() && other.is_repeat()) | 
					
						
							|  |  |  |             return m_grid_repeat == other.repeat(); | 
					
						
							|  |  |  |         if (is_minmax() && other.is_minmax()) | 
					
						
							|  |  |  |             return m_grid_minmax == other.minmax(); | 
					
						
							|  |  |  |         if (is_default() && other.is_default()) | 
					
						
							|  |  |  |             return m_grid_size == other.grid_size(); | 
					
						
							|  |  |  |         return false; | 
					
						
							| 
									
										
											  
											
												LibWeb: Add parent classes for managing GridTrackSizes
Add classes ExplicitTrackSizing and MetaGridTrackSize which will allow
for managing properties like auto-fill and minmax.
In the following CSS example there are 3 classes that will be used:
grid-template-column: repeat(auto-fill, minmax(50px, 1fr) 75px);
ExplicitTrackSizing - will contain the entire value. e.g.
repeat(auto-fill, minmax(50px, 1fr) 75px)
With a flag if it's a repeat, as well as references to the
MetaGridTrackSizes which is the next step down.
MetaGridTrackSize:
Contain the individual grid track sizes. Here there are two:
minmax(50px, 1fr) as well as 75px.
This way can keep track if it's a minmax function or not, and the
references to both GridTrackSizes in the case it is, or in just the one
if it is not.
GridTrackSize:
Is the most basic element, in this case there are three in total; two of
which are held by the first MetaGridTrackSize, and the third is held by
the second MetaGridTrackSize.
Examples: 50px, 1fr and 75px.
											
										 
											2022-10-09 19:34:27 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2022-10-30 13:27:57 +01:00
										 |  |  |     Type m_type; | 
					
						
							|  |  |  |     GridRepeat m_grid_repeat; | 
					
						
							|  |  |  |     GridMinMax m_grid_minmax; | 
					
						
							|  |  |  |     GridSize m_grid_size; | 
					
						
							| 
									
										
											  
											
												LibWeb: Add parent classes for managing GridTrackSizes
Add classes ExplicitTrackSizing and MetaGridTrackSize which will allow
for managing properties like auto-fill and minmax.
In the following CSS example there are 3 classes that will be used:
grid-template-column: repeat(auto-fill, minmax(50px, 1fr) 75px);
ExplicitTrackSizing - will contain the entire value. e.g.
repeat(auto-fill, minmax(50px, 1fr) 75px)
With a flag if it's a repeat, as well as references to the
MetaGridTrackSizes which is the next step down.
MetaGridTrackSize:
Contain the individual grid track sizes. Here there are two:
minmax(50px, 1fr) as well as 75px.
This way can keep track if it's a minmax function or not, and the
references to both GridTrackSizes in the case it is, or in just the one
if it is not.
GridTrackSize:
Is the most basic element, in this case there are three in total; two of
which are held by the first MetaGridTrackSize, and the third is held by
the second MetaGridTrackSize.
Examples: 50px, 1fr and 75px.
											
										 
											2022-10-09 19:34:27 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-24 12:21:15 +02:00
										 |  |  | } |