2021-03-22 13:41:47 -03:00
/*
2021-04-28 17:46:44 -03:00
* Copyright ( c ) 2020 - 2021 , the SerenityOS developers .
2021-09-03 07:14:37 -03:00
* Copyright ( c ) 2021 , Sam Atkins < atkinssj @ serenityos . org >
2021-03-22 13:41:47 -03:00
*
2021-04-22 05:24:48 -03:00
* SPDX - License - Identifier : BSD - 2 - Clause
2021-03-22 13:41:47 -03:00
*/
# pragma once
# include <AK/NonnullOwnPtrVector.h>
2021-07-12 13:30:40 -03:00
# include <AK/NonnullRefPtrVector.h>
# include <AK/RefPtr.h>
2021-07-23 12:13:07 -03:00
# include <AK/Result.h>
2021-03-22 13:41:47 -03:00
# include <AK/Vector.h>
2021-10-08 11:54:16 -03:00
# include <LibWeb/CSS/CSSStyleDeclaration.h>
2021-11-22 14:27:09 -03:00
# include <LibWeb/CSS/GeneralEnclosed.h>
2021-09-29 08:56:37 -03:00
# include <LibWeb/CSS/MediaQuery.h>
2021-03-22 13:41:47 -03:00
# include <LibWeb/CSS/Parser/DeclarationOrAtRule.h>
# include <LibWeb/CSS/Parser/StyleBlockRule.h>
# include <LibWeb/CSS/Parser/StyleComponentValueRule.h>
# include <LibWeb/CSS/Parser/StyleDeclarationRule.h>
# include <LibWeb/CSS/Parser/StyleFunctionRule.h>
2021-07-03 09:36:33 -03:00
# include <LibWeb/CSS/Parser/StyleRule.h>
2021-03-22 13:41:47 -03:00
# include <LibWeb/CSS/Parser/Tokenizer.h>
2022-03-06 10:48:32 -03:00
# include <LibWeb/CSS/Ratio.h>
2021-03-22 13:41:47 -03:00
# include <LibWeb/CSS/Selector.h>
2021-07-18 13:12:23 -03:00
# include <LibWeb/CSS/StyleValue.h>
2021-10-08 11:54:16 -03:00
# include <LibWeb/CSS/Supports.h>
2021-03-22 13:41:47 -03:00
namespace Web : : CSS {
2021-07-09 12:34:29 -03:00
class CSSStyleSheet ;
class CSSRule ;
class CSSStyleRule ;
struct StyleProperty ;
2021-07-08 17:53:22 -03:00
enum class PropertyID ;
2021-07-09 12:34:29 -03:00
2021-07-02 16:25:13 -03:00
class ParsingContext {
public :
2021-09-16 03:24:47 -03:00
ParsingContext ( ) = default ;
2021-10-22 16:59:45 -03:00
explicit ParsingContext ( DOM : : Document const & ) ;
2022-03-14 17:09:55 -03:00
explicit ParsingContext ( DOM : : Document const & , Optional < AK : : URL > const ) ;
2021-07-22 09:00:29 -03:00
explicit ParsingContext ( DOM : : ParentNode & ) ;
2021-07-02 16:25:13 -03:00
bool in_quirks_mode ( ) const ;
2021-10-22 16:59:45 -03:00
DOM : : Document const * document ( ) const { return m_document ; }
2021-09-12 18:33:23 -03:00
AK : : URL complete_url ( String const & ) const ;
2021-07-02 16:25:13 -03:00
2021-09-11 16:39:44 -03:00
PropertyID current_property_id ( ) const { return m_current_property_id ; }
void set_current_property_id ( PropertyID property_id ) { m_current_property_id = property_id ; }
2021-07-02 16:25:13 -03:00
private :
2021-10-22 16:59:45 -03:00
DOM : : Document const * m_document { nullptr } ;
2021-09-11 16:39:44 -03:00
PropertyID m_current_property_id { PropertyID : : Invalid } ;
2022-03-14 17:09:55 -03:00
Optional < AK : : URL > m_url ;
2021-07-02 16:25:13 -03:00
} ;
2021-07-03 10:00:41 -03:00
template < typename T >
class TokenStream {
public :
explicit TokenStream ( Vector < T > const & ) ;
2022-03-14 16:21:51 -03:00
~ TokenStream ( ) = default ;
2021-07-03 10:00:41 -03:00
2021-11-10 14:05:03 -03:00
TokenStream ( TokenStream < T > const & ) = delete ;
2021-07-03 10:00:41 -03:00
bool has_next_token ( ) ;
T const & next_token ( ) ;
2021-07-28 12:27:45 -03:00
T const & peek_token ( int offset = 0 ) ;
2021-07-03 10:00:41 -03:00
T const & current_token ( ) ;
void reconsume_current_input_token ( ) ;
2021-09-30 13:17:21 -03:00
int position ( ) const { return m_iterator_offset ; }
void rewind_to_position ( int ) ;
2021-07-03 10:00:41 -03:00
void skip_whitespace ( ) ;
void dump_all_tokens ( ) ;
private :
Vector < T > const & m_tokens ;
int m_iterator_offset { - 1 } ;
T make_eof ( ) ;
T m_eof ;
} ;
2021-03-22 13:41:47 -03:00
class Parser {
public :
2021-11-10 20:55:02 -03:00
Parser ( ParsingContext const & , StringView input , String const & encoding = " utf-8 " ) ;
2022-03-14 16:21:51 -03:00
~ Parser ( ) = default ;
2021-03-22 13:41:47 -03:00
// The normal parser entry point, for parsing stylesheets.
2021-07-09 12:34:29 -03:00
NonnullRefPtr < CSSStyleSheet > parse_as_stylesheet ( ) ;
2021-03-22 13:41:47 -03:00
// For the content of at-rules such as @media. It differs from "Parse a stylesheet" in the handling of <CDO-token> and <CDC-token>.
2021-07-09 12:34:29 -03:00
NonnullRefPtrVector < CSSRule > parse_as_list_of_rules ( ) ;
2021-03-22 13:41:47 -03:00
// For use by the CSSStyleSheet#insertRule method, and similar functions which might exist, which parse text into a single rule.
2021-07-09 12:34:29 -03:00
RefPtr < CSSRule > parse_as_rule ( ) ;
2021-03-22 13:41:47 -03:00
// Used in @supports conditions. [CSS3-CONDITIONAL]
2021-07-09 12:34:29 -03:00
Optional < StyleProperty > parse_as_declaration ( ) ;
2021-03-22 13:41:47 -03:00
// For the contents of a style attribute, which parses text into the contents of a single style rule.
2022-03-28 12:37:54 -03:00
Vector < DeclarationOrAtRule > parse_as_list_of_declarations ( ) ;
2021-03-22 13:41:47 -03:00
// For things that need to consume a single value, like the parsing rules for attr().
Optional < StyleComponentValueRule > parse_as_component_value ( ) ;
// For the contents of presentational attributes, which parse text into a single declaration’ s value, or for parsing a stand-alone selector [SELECT] or list of Media Queries [MEDIAQ], as in Selectors API or the media HTML attribute.
Vector < StyleComponentValueRule > parse_as_list_of_component_values ( ) ;
2021-07-02 15:52:07 -03:00
Vector < Vector < StyleComponentValueRule > > parse_as_comma_separated_list_of_component_values ( ) ;
2021-07-08 09:44:01 -03:00
2022-03-28 12:37:54 -03:00
RefPtr < PropertyOwningCSSStyleDeclaration > parse_as_style_attribute ( ) ;
2022-03-17 12:14:01 -03:00
enum class SelectorParsingMode {
Standard ,
// `<forgiving-selector-list>` and `<forgiving-relative-selector-list>`
// are handled with this parameter, not as separate functions.
// https://drafts.csswg.org/selectors/#forgiving-selector
Forgiving
} ;
2021-07-03 08:34:25 -03:00
// Contrary to the name, these parse a comma-separated list of selectors, according to the spec.
2022-03-17 12:14:01 -03:00
Optional < SelectorList > parse_as_selector ( SelectorParsingMode = SelectorParsingMode : : Standard ) ;
Optional < SelectorList > parse_as_relative_selector ( SelectorParsingMode = SelectorParsingMode : : Standard ) ;
2021-07-30 13:06:48 -03:00
2021-09-29 08:56:37 -03:00
NonnullRefPtrVector < MediaQuery > parse_as_media_query_list ( ) ;
RefPtr < MediaQuery > parse_as_media_query ( ) ;
2021-10-08 11:54:16 -03:00
RefPtr < Supports > parse_as_supports ( ) ;
2021-07-30 13:48:23 -03:00
RefPtr < StyleValue > parse_as_css_value ( PropertyID ) ;
2021-12-03 09:32:12 -03:00
static RefPtr < StyleValue > parse_css_value ( Badge < StyleComputer > , ParsingContext const & , PropertyID , Vector < StyleComponentValueRule > const & ) ;
2021-07-30 13:06:48 -03:00
private :
2021-09-12 15:29:47 -03:00
enum class ParsingResult {
2021-09-12 13:42:11 -03:00
Done ,
2021-09-12 13:47:58 -03:00
IncludesIgnoredVendorPrefix ,
2021-09-12 13:42:11 -03:00
SyntaxError ,
} ;
2021-07-30 13:06:48 -03:00
template < typename T >
NonnullRefPtr < CSSStyleSheet > parse_a_stylesheet ( TokenStream < T > & ) ;
template < typename T >
NonnullRefPtrVector < CSSRule > parse_a_list_of_rules ( TokenStream < T > & ) ;
template < typename T >
RefPtr < CSSRule > parse_a_rule ( TokenStream < T > & ) ;
template < typename T >
Optional < StyleProperty > parse_a_declaration ( TokenStream < T > & ) ;
template < typename T >
2022-03-28 12:37:54 -03:00
Vector < DeclarationOrAtRule > parse_a_list_of_declarations ( TokenStream < T > & ) ;
2021-07-30 13:06:48 -03:00
template < typename T >
Optional < StyleComponentValueRule > parse_a_component_value ( TokenStream < T > & ) ;
template < typename T >
Vector < StyleComponentValueRule > parse_a_list_of_component_values ( TokenStream < T > & ) ;
template < typename T >
Vector < Vector < StyleComponentValueRule > > parse_a_comma_separated_list_of_component_values ( TokenStream < T > & ) ;
2022-03-17 16:29:40 -03:00
enum class SelectorType {
Standalone ,
Relative
} ;
2021-07-03 11:40:06 -03:00
template < typename T >
2022-03-17 16:29:40 -03:00
Result < SelectorList , ParsingResult > parse_a_selector_list ( TokenStream < T > & , SelectorType , SelectorParsingMode = SelectorParsingMode : : Standard ) ;
2021-09-29 08:56:37 -03:00
template < typename T >
NonnullRefPtrVector < MediaQuery > parse_a_media_query_list ( TokenStream < T > & ) ;
2021-10-08 11:54:16 -03:00
template < typename T >
RefPtr < Supports > parse_a_supports ( TokenStream < T > & ) ;
2021-03-22 13:41:47 -03:00
2022-03-17 16:13:51 -03:00
enum class AllowTrailingTokens {
No ,
Yes
} ;
Optional < Selector : : SimpleSelector : : ANPlusBPattern > parse_a_n_plus_b_pattern ( TokenStream < StyleComponentValueRule > & , AllowTrailingTokens = AllowTrailingTokens : : No ) ;
2021-03-22 13:41:47 -03:00
2021-07-03 11:40:06 -03:00
template < typename T >
[ [ nodiscard ] ] NonnullRefPtrVector < StyleRule > consume_a_list_of_rules ( TokenStream < T > & , bool top_level ) ;
template < typename T >
[ [ nodiscard ] ] NonnullRefPtr < StyleRule > consume_an_at_rule ( TokenStream < T > & ) ;
template < typename T >
[ [ nodiscard ] ] RefPtr < StyleRule > consume_a_qualified_rule ( TokenStream < T > & ) ;
template < typename T >
[ [ nodiscard ] ] Vector < DeclarationOrAtRule > consume_a_list_of_declarations ( TokenStream < T > & ) ;
template < typename T >
2021-07-08 17:53:22 -03:00
[ [ nodiscard ] ] Optional < StyleDeclarationRule > consume_a_declaration ( TokenStream < T > & ) ;
2021-07-03 11:40:06 -03:00
template < typename T >
2021-07-08 17:53:22 -03:00
[ [ nodiscard ] ] StyleComponentValueRule consume_a_component_value ( TokenStream < T > & ) ;
2021-07-03 11:40:06 -03:00
template < typename T >
2021-07-08 17:53:22 -03:00
[ [ nodiscard ] ] NonnullRefPtr < StyleBlockRule > consume_a_simple_block ( TokenStream < T > & ) ;
2021-07-03 11:40:06 -03:00
template < typename T >
2021-07-08 17:53:22 -03:00
[ [ nodiscard ] ] NonnullRefPtr < StyleFunctionRule > consume_a_function ( TokenStream < T > & ) ;
2021-03-22 13:41:47 -03:00
2021-11-22 14:27:09 -03:00
[ [ nodiscard ] ] Optional < GeneralEnclosed > parse_general_enclosed ( TokenStream < StyleComponentValueRule > & ) ;
2021-10-08 11:54:16 -03:00
2022-03-28 16:32:28 -03:00
RefPtr < CSSRule > parse_font_face_rule ( TokenStream < StyleComponentValueRule > & ) ;
2021-07-08 17:53:22 -03:00
[ [ nodiscard ] ] RefPtr < CSSRule > convert_to_rule ( NonnullRefPtr < StyleRule > ) ;
2022-03-28 12:37:54 -03:00
[ [ nodiscard ] ] RefPtr < PropertyOwningCSSStyleDeclaration > convert_to_style_declaration ( Vector < DeclarationOrAtRule > declarations ) ;
2021-11-24 13:11:04 -03:00
[ [ nodiscard ] ] Optional < StyleProperty > convert_to_style_property ( StyleDeclarationRule const & ) ;
2021-07-09 12:34:29 -03:00
2022-01-14 14:09:02 -03:00
class Dimension {
public :
2022-02-22 09:48:59 -03:00
Dimension ( Angle & & value )
: m_value ( move ( value ) )
{
}
Dimension ( Frequency & & value )
: m_value ( move ( value ) )
{
}
2022-01-14 14:09:02 -03:00
Dimension ( Length & & value )
: m_value ( move ( value ) )
{
}
Dimension ( Percentage & & value )
: m_value ( move ( value ) )
{
}
2022-02-22 09:48:59 -03:00
Dimension ( Resolution & & value )
: m_value ( move ( value ) )
{
}
Dimension ( Time & & value )
: m_value ( move ( value ) )
{
}
bool is_angle ( ) const ;
Angle angle ( ) const ;
bool is_angle_percentage ( ) const ;
AnglePercentage angle_percentage ( ) const ;
bool is_frequency ( ) const ;
Frequency frequency ( ) const ;
bool is_frequency_percentage ( ) const ;
FrequencyPercentage frequency_percentage ( ) const ;
2022-01-14 14:09:02 -03:00
bool is_length ( ) const ;
Length length ( ) const ;
2022-02-22 09:48:59 -03:00
bool is_length_percentage ( ) const ;
LengthPercentage length_percentage ( ) const ;
2022-01-14 14:09:02 -03:00
bool is_percentage ( ) const ;
Percentage percentage ( ) const ;
2022-02-22 09:48:59 -03:00
bool is_resolution ( ) const ;
Resolution resolution ( ) const ;
bool is_time ( ) const ;
Time time ( ) const ;
bool is_time_percentage ( ) const ;
TimePercentage time_percentage ( ) const ;
2022-01-14 14:09:02 -03:00
private :
2022-02-22 09:48:59 -03:00
Variant < Angle , Frequency , Length , Percentage , Resolution , Time > m_value ;
2022-01-14 14:09:02 -03:00
} ;
Optional < Dimension > parse_dimension ( StyleComponentValueRule const & ) ;
2021-11-05 14:41:04 -03:00
Optional < Color > parse_color ( StyleComponentValueRule const & ) ;
Optional < Length > parse_length ( StyleComponentValueRule const & ) ;
2022-03-06 10:48:32 -03:00
Optional < Ratio > parse_ratio ( TokenStream < StyleComponentValueRule > & ) ;
2021-10-29 09:38:50 -03:00
enum class AllowedDataUrlType {
None ,
Image ,
} ;
2021-11-05 14:41:04 -03:00
Optional < AK : : URL > parse_url_function ( StyleComponentValueRule const & , AllowedDataUrlType = AllowedDataUrlType : : None ) ;
2021-07-09 17:04:34 -03:00
2021-09-12 15:44:35 -03:00
Result < NonnullRefPtr < StyleValue > , ParsingResult > parse_css_value ( PropertyID , TokenStream < StyleComponentValueRule > & ) ;
2021-11-05 14:41:04 -03:00
RefPtr < StyleValue > parse_css_value ( StyleComponentValueRule const & ) ;
RefPtr < StyleValue > parse_builtin_value ( StyleComponentValueRule const & ) ;
RefPtr < StyleValue > parse_dynamic_value ( StyleComponentValueRule const & ) ;
2022-01-25 11:45:08 -03:00
RefPtr < StyleValue > parse_calculated_value ( Vector < StyleComponentValueRule > const & ) ;
2022-01-14 14:09:02 -03:00
RefPtr < StyleValue > parse_dimension_value ( StyleComponentValueRule const & ) ;
2021-11-05 14:41:04 -03:00
RefPtr < StyleValue > parse_numeric_value ( StyleComponentValueRule const & ) ;
RefPtr < StyleValue > parse_identifier_value ( StyleComponentValueRule const & ) ;
RefPtr < StyleValue > parse_color_value ( StyleComponentValueRule const & ) ;
RefPtr < StyleValue > parse_string_value ( StyleComponentValueRule const & ) ;
RefPtr < StyleValue > parse_image_value ( StyleComponentValueRule const & ) ;
2021-11-08 14:19:55 -03:00
template < typename ParseFunction >
RefPtr < StyleValue > parse_comma_separated_value_list ( Vector < StyleComponentValueRule > const & , ParseFunction ) ;
RefPtr < StyleValue > parse_simple_comma_separated_value_list ( Vector < StyleComponentValueRule > const & ) ;
2021-11-05 14:41:04 -03:00
RefPtr < StyleValue > parse_background_value ( Vector < StyleComponentValueRule > const & ) ;
RefPtr < StyleValue > parse_single_background_position_value ( TokenStream < StyleComponentValueRule > & ) ;
RefPtr < StyleValue > parse_single_background_repeat_value ( TokenStream < StyleComponentValueRule > & ) ;
RefPtr < StyleValue > parse_single_background_size_value ( TokenStream < StyleComponentValueRule > & ) ;
RefPtr < StyleValue > parse_border_value ( Vector < StyleComponentValueRule > const & ) ;
RefPtr < StyleValue > parse_border_radius_value ( Vector < StyleComponentValueRule > const & ) ;
RefPtr < StyleValue > parse_border_radius_shorthand_value ( Vector < StyleComponentValueRule > const & ) ;
2022-02-23 16:56:25 -03:00
RefPtr < StyleValue > parse_content_value ( Vector < StyleComponentValueRule > const & ) ;
2021-11-05 14:41:04 -03:00
RefPtr < StyleValue > parse_flex_value ( Vector < StyleComponentValueRule > const & ) ;
RefPtr < StyleValue > parse_flex_flow_value ( Vector < StyleComponentValueRule > const & ) ;
RefPtr < StyleValue > parse_font_value ( Vector < StyleComponentValueRule > const & ) ;
RefPtr < StyleValue > parse_font_family_value ( Vector < StyleComponentValueRule > const & , size_t start_index = 0 ) ;
RefPtr < StyleValue > parse_list_style_value ( Vector < StyleComponentValueRule > const & ) ;
RefPtr < StyleValue > parse_overflow_value ( Vector < StyleComponentValueRule > const & ) ;
2022-03-23 13:59:44 -03:00
enum class AllowInsetKeyword {
No ,
Yes ,
} ;
RefPtr < StyleValue > parse_shadow_value ( Vector < StyleComponentValueRule > const & , AllowInsetKeyword ) ;
RefPtr < StyleValue > parse_single_shadow_value ( TokenStream < StyleComponentValueRule > & , AllowInsetKeyword ) ;
2021-11-05 14:41:04 -03:00
RefPtr < StyleValue > parse_text_decoration_value ( Vector < StyleComponentValueRule > const & ) ;
RefPtr < StyleValue > parse_transform_value ( Vector < StyleComponentValueRule > const & ) ;
2022-03-21 15:11:06 -03:00
RefPtr < StyleValue > parse_transform_origin_value ( Vector < StyleComponentValueRule > const & ) ;
2021-07-14 12:20:06 -03:00
2021-07-28 12:30:59 -03:00
// calc() parsing, according to https://www.w3.org/TR/css-values-3/#calc-syntax
2021-11-05 14:41:04 -03:00
OwnPtr < CalculatedStyleValue : : CalcSum > parse_calc_sum ( TokenStream < StyleComponentValueRule > & ) ;
OwnPtr < CalculatedStyleValue : : CalcProduct > parse_calc_product ( TokenStream < StyleComponentValueRule > & ) ;
Optional < CalculatedStyleValue : : CalcValue > parse_calc_value ( TokenStream < StyleComponentValueRule > & ) ;
OwnPtr < CalculatedStyleValue : : CalcNumberSum > parse_calc_number_sum ( TokenStream < StyleComponentValueRule > & ) ;
OwnPtr < CalculatedStyleValue : : CalcNumberProduct > parse_calc_number_product ( TokenStream < StyleComponentValueRule > & ) ;
Optional < CalculatedStyleValue : : CalcNumberValue > parse_calc_number_value ( TokenStream < StyleComponentValueRule > & ) ;
OwnPtr < CalculatedStyleValue : : CalcProductPartWithOperator > parse_calc_product_part_with_operator ( TokenStream < StyleComponentValueRule > & ) ;
OwnPtr < CalculatedStyleValue : : CalcSumPartWithOperator > parse_calc_sum_part_with_operator ( TokenStream < StyleComponentValueRule > & ) ;
OwnPtr < CalculatedStyleValue : : CalcNumberProductPartWithOperator > parse_calc_number_product_part_with_operator ( TokenStream < StyleComponentValueRule > & tokens ) ;
OwnPtr < CalculatedStyleValue : : CalcNumberSumPartWithOperator > parse_calc_number_sum_part_with_operator ( TokenStream < StyleComponentValueRule > & ) ;
OwnPtr < CalculatedStyleValue : : CalcSum > parse_calc_expression ( Vector < StyleComponentValueRule > const & ) ;
2021-07-28 12:30:59 -03:00
2022-03-17 16:29:40 -03:00
Result < NonnullRefPtr < Selector > , ParsingResult > parse_complex_selector ( TokenStream < StyleComponentValueRule > & , SelectorType ) ;
2021-09-12 15:29:47 -03:00
Result < Selector : : CompoundSelector , ParsingResult > parse_compound_selector ( TokenStream < StyleComponentValueRule > & ) ;
2021-07-23 12:13:07 -03:00
Optional < Selector : : Combinator > parse_selector_combinator ( TokenStream < StyleComponentValueRule > & ) ;
2022-03-13 14:17:37 -03:00
Result < Selector : : SimpleSelector , ParsingResult > parse_attribute_simple_selector ( StyleComponentValueRule const & ) ;
Result < Selector : : SimpleSelector , ParsingResult > parse_pseudo_simple_selector ( TokenStream < StyleComponentValueRule > & ) ;
2021-09-12 15:29:47 -03:00
Result < Selector : : SimpleSelector , ParsingResult > parse_simple_selector ( TokenStream < StyleComponentValueRule > & ) ;
2021-07-23 12:13:07 -03:00
2021-09-29 16:54:06 -03:00
NonnullRefPtr < MediaQuery > parse_media_query ( TokenStream < StyleComponentValueRule > & ) ;
2022-01-01 08:44:44 -03:00
OwnPtr < MediaCondition > parse_media_condition ( TokenStream < StyleComponentValueRule > & , MediaCondition : : AllowOr allow_or ) ;
Optional < MediaFeature > parse_media_feature ( TokenStream < StyleComponentValueRule > & ) ;
Optional < MediaQuery : : MediaType > parse_media_type ( TokenStream < StyleComponentValueRule > & ) ;
OwnPtr < MediaCondition > parse_media_in_parens ( TokenStream < StyleComponentValueRule > & ) ;
2022-03-08 13:37:22 -03:00
Optional < MediaFeatureValue > parse_media_feature_value ( MediaFeatureID , TokenStream < StyleComponentValueRule > & ) ;
2021-09-29 08:56:37 -03:00
2021-10-08 11:54:16 -03:00
OwnPtr < Supports : : Condition > parse_supports_condition ( TokenStream < StyleComponentValueRule > & ) ;
Optional < Supports : : InParens > parse_supports_in_parens ( TokenStream < StyleComponentValueRule > & ) ;
Optional < Supports : : Feature > parse_supports_feature ( TokenStream < StyleComponentValueRule > & ) ;
2021-11-10 20:55:02 -03:00
static bool has_ignored_vendor_prefix ( StringView ) ;
2022-03-28 16:32:28 -03:00
static bool is_builtin ( StringView ) ;
2021-09-12 12:49:09 -03:00
2021-07-02 16:25:13 -03:00
ParsingContext m_context ;
2021-03-22 13:41:47 -03:00
Tokenizer m_tokenizer ;
Vector < Token > m_tokens ;
2021-07-03 10:00:41 -03:00
TokenStream < Token > m_token_stream ;
2021-03-22 13:41:47 -03:00
} ;
}
2021-07-30 13:48:23 -03:00
namespace Web {
2021-11-10 20:55:02 -03:00
RefPtr < CSS : : CSSStyleSheet > parse_css ( CSS : : ParsingContext const & , StringView ) ;
2022-03-28 11:57:20 -03:00
RefPtr < CSS : : PropertyOwningCSSStyleDeclaration > parse_css_style_attribute ( CSS : : ParsingContext const & , StringView ) ;
2021-11-10 20:55:02 -03:00
RefPtr < CSS : : StyleValue > parse_css_value ( CSS : : ParsingContext const & , StringView , CSS : : PropertyID property_id = CSS : : PropertyID : : Invalid ) ;
Optional < CSS : : SelectorList > parse_selector ( CSS : : ParsingContext const & , StringView ) ;
2021-09-29 16:12:39 -03:00
RefPtr < CSS : : CSSRule > parse_css_rule ( CSS : : ParsingContext const & , StringView ) ;
2021-11-10 20:55:02 -03:00
RefPtr < CSS : : MediaQuery > parse_media_query ( CSS : : ParsingContext const & , StringView ) ;
NonnullRefPtrVector < CSS : : MediaQuery > parse_media_query_list ( CSS : : ParsingContext const & , StringView ) ;
RefPtr < CSS : : Supports > parse_css_supports ( CSS : : ParsingContext const & , StringView ) ;
2021-07-30 13:48:23 -03:00
}