2021-03-22 17:41:47 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								/*
  
						 
					
						
							
								
									
										
										
										
											2021-04-28 22:46:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								 *  Copyright  ( c )  2020 - 2021 ,  the  SerenityOS  developers . 
							 
						 
					
						
							
								
									
										
										
											
												LibWeb: Parse `<urange>` as CSS::UnicodeRange
Like, An+B, this is an old construct that does not fit well with modern
CSS syntax, so things get a bit hairy! We have to determine which
tokens match the grammar for `<urange>`, then turn those back into a
string, and then parse the string differently from normal. Thankfully
the spec describes in detail how to do that. :^)
This is not 100% correct, since we are not using the original source
text (referred to in the spec as the "representation") of the tokens,
but just converting them to strings in a manual, ad-hoc way.
Re-engineering the Tokenizer to keep that original text was too much of
a tangent for today. In any case, we do parse `U+4???`, `U+0-100`,
`U+1234`, and similar, so good enough for now!
											 
										 
										
											2022-04-07 17:41:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								 *  Copyright  ( c )  2021 - 2022 ,  Sam  Atkins  < atkinssj @ serenityos . org > 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-22 17:41:47 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								 * 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-22 01:24:48 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								 *  SPDX - License - Identifier :  BSD - 2 - Clause 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-22 17:41:47 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# pragma once 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-27 11:04:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <AK/Error.h> 
  
						 
					
						
							
								
									
										
										
										
											2021-03-22 17:41:47 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# include  <AK/NonnullOwnPtrVector.h> 
  
						 
					
						
							
								
									
										
										
										
											2021-07-12 17:30:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <AK/NonnullRefPtrVector.h> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# include  <AK/RefPtr.h> 
  
						 
					
						
							
								
									
										
										
										
											2021-03-22 17:41:47 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# include  <AK/Vector.h> 
  
						 
					
						
							
								
									
										
										
										
											2021-10-08 15:54:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/CSS/CSSStyleDeclaration.h> 
  
						 
					
						
							
								
									
										
										
										
											2022-03-31 21:18:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/CSS/FontFace.h> 
  
						 
					
						
							
								
									
										
										
										
											2021-11-22 17:27:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/CSS/GeneralEnclosed.h> 
  
						 
					
						
							
								
									
										
										
										
											2021-09-29 12:56:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/CSS/MediaQuery.h> 
  
						 
					
						
							
								
									
										
										
										
											2022-04-12 14:08:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/CSS/Parser/Block.h> 
  
						 
					
						
							
								
									
										
										
										
											2022-03-31 11:43:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/CSS/Parser/ComponentValue.h> 
  
						 
					
						
							
								
									
										
										
										
											2022-03-31 14:36:12 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/CSS/Parser/Declaration.h> 
  
						 
					
						
							
								
									
										
										
										
											2021-03-22 17:41:47 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/CSS/Parser/DeclarationOrAtRule.h> 
  
						 
					
						
							
								
									
										
										
										
											2022-04-12 13:35:55 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/CSS/Parser/Function.h> 
  
						 
					
						
							
								
									
										
										
										
											2022-04-12 19:05:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/CSS/Parser/Rule.h> 
  
						 
					
						
							
								
									
										
										
										
											2021-03-22 17:41:47 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/CSS/Parser/Tokenizer.h> 
  
						 
					
						
							
								
									
										
										
										
											2022-03-06 13:48:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/CSS/Ratio.h> 
  
						 
					
						
							
								
									
										
										
										
											2021-03-22 17:41:47 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/CSS/Selector.h> 
  
						 
					
						
							
								
									
										
										
										
											2021-07-18 17:12:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/CSS/StyleValue.h> 
  
						 
					
						
							
								
									
										
										
										
											2021-10-08 15:54:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/CSS/Supports.h> 
  
						 
					
						
							
								
									
										
										
											
												LibWeb: Parse `<urange>` as CSS::UnicodeRange
Like, An+B, this is an old construct that does not fit well with modern
CSS syntax, so things get a bit hairy! We have to determine which
tokens match the grammar for `<urange>`, then turn those back into a
string, and then parse the string differently from normal. Thankfully
the spec describes in detail how to do that. :^)
This is not 100% correct, since we are not using the original source
text (referred to in the spec as the "representation") of the tokens,
but just converting them to strings in a manual, ad-hoc way.
Re-engineering the Tokenizer to keep that original text was too much of
a tangent for today. In any case, we do parse `U+4???`, `U+0-100`,
`U+1234`, and similar, so good enough for now!
											 
										 
										
											2022-04-07 17:41:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/CSS/UnicodeRange.h> 
  
						 
					
						
							
								
									
										
										
										
											2022-04-12 11:32:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/Forward.h> 
  
						 
					
						
							
								
									
										
										
										
											2021-03-22 17:41:47 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-12 12:00:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								namespace  Web : : CSS : : Parser  {  
						 
					
						
							
								
									
										
										
										
											2021-03-22 17:41:47 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-02 20:25:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								class  ParsingContext  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								public :  
						 
					
						
							
								
									
										
										
										
											2021-09-15 23:24:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    ParsingContext ( )  =  default ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-22 20:59:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    explicit  ParsingContext ( DOM : : Document  const & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-25 16:17:21 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    explicit  ParsingContext ( DOM : : Document  const & ,  AK : : URL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-22 13:00:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    explicit  ParsingContext ( DOM : : ParentNode & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-02 20:25:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    bool  in_quirks_mode ( )  const ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-22 20:59:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    DOM : : Document  const *  document ( )  const  {  return  m_document ;  } 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-13 00:33:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    AK : : URL  complete_url ( String  const & )  const ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-02 20:25:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-11 20:39:44 +01: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 20:25:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								private :  
						 
					
						
							
								
									
										
										
										
											2021-10-22 20:59:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    DOM : : Document  const *  m_document  {  nullptr  } ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-11 20:39:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    PropertyID  m_current_property_id  {  PropertyID : : Invalid  } ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-25 16:17:21 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    AK : : URL  m_url ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-02 20:25:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								} ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-03 14:00:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								template < typename  T >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								class  TokenStream  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								public :  
						 
					
						
							
								
									
										
										
										
											2022-04-27 12:46:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    class  StateTransaction  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    public : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        explicit  StateTransaction ( TokenStream < T > &  token_stream ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            :  m_token_stream ( token_stream ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            ,  m_saved_iterator_offset ( token_stream . m_iterator_offset ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        ~ StateTransaction ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            if  ( ! m_commit ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                m_token_stream . m_iterator_offset  =  m_saved_iterator_offset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        StateTransaction  create_child ( )  {  return  StateTransaction ( * this ) ;  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        void  commit ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            m_commit  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            if  ( m_parent ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                m_parent - > commit ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    private : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        explicit  StateTransaction ( StateTransaction &  parent ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            :  m_parent ( & parent ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            ,  m_token_stream ( parent . m_token_stream ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            ,  m_saved_iterator_offset ( parent . m_token_stream . m_iterator_offset ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        StateTransaction *  m_parent  {  nullptr  } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        TokenStream < T > &  m_token_stream ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        int  m_saved_iterator_offset  {  0  } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        bool  m_commit  {  false  } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-03 14:00:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    explicit  TokenStream ( Vector < T >  const & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-14 13:21:51 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    ~ TokenStream ( )  =  default ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-03 14:00:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-10 17:05:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    TokenStream ( TokenStream < T >  const & )  =  delete ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-03 14:00:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    bool  has_next_token ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    T  const &  next_token ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-28 16:27:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    T  const &  peek_token ( int  offset  =  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-03 14:00:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    T  const &  current_token ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    void  reconsume_current_input_token ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-27 12:46:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    StateTransaction  begin_transaction ( )  {  return  StateTransaction ( * this ) ;  } 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-30 17:17:21 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-03 14:00:41 +01: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 17:41:47 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								class  Parser  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								public :  
						 
					
						
							
								
									
										
										
										
											2021-11-11 00:55:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Parser ( ParsingContext  const & ,  StringView  input ,  String  const &  encoding  =  " utf-8 " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-14 13:21:51 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    ~ Parser ( )  =  default ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-22 17:41:47 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 14:13:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    NonnullRefPtr < CSSStyleSheet >  parse_as_css_stylesheet ( Optional < AK : : URL >  location ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 16:01:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < ElementInlineCSSStyleDeclaration >  parse_as_style_attribute ( DOM : : Element & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-30 11:48:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < CSSRule >  parse_as_css_rule ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-30 12:05:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < StyleProperty >  parse_as_supports_condition ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-28 16:37:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-17 15:14:01 +00: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 12:34:25 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    // Contrary to the name, these parse a comma-separated list of selectors, according to the spec.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-17 15:14:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < SelectorList >  parse_as_selector ( SelectorParsingMode  =  SelectorParsingMode : : Standard ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < SelectorList >  parse_as_relative_selector ( SelectorParsingMode  =  SelectorParsingMode : : Standard ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 17:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-29 12:56:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    NonnullRefPtrVector < MediaQuery >  parse_as_media_query_list ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < MediaQuery >  parse_as_media_query ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-08 15:54:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < Supports >  parse_as_supports ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 17:48:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_as_css_value ( PropertyID ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 11:43:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    static  RefPtr < StyleValue >  parse_css_value ( Badge < StyleComputer > ,  ParsingContext  const & ,  PropertyID ,  Vector < ComponentValue >  const & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-03 12:32:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 17:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								private :  
						 
					
						
							
								
									
										
										
										
											2022-04-27 11:04:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    enum  class  ParseError  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-12 17:47:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        IncludesIgnoredVendorPrefix , 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-12 17:42:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        SyntaxError , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-27 11:04:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template < typename  T > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    using  ParseErrorOr  =  ErrorOr < T ,  ParseError > ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-12 17:42:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 14:13:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    // "Parse a stylesheet" is intended to be the normal parser entry point, for parsing stylesheets.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    struct  ParsedStyleSheet  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        Optional < AK : : URL >  location ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-12 19:05:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        NonnullRefPtrVector < Rule >  rules ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 14:13:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    } ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 17:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template < typename  T > 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 14:13:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    ParsedStyleSheet  parse_a_stylesheet ( TokenStream < T > & ,  Optional < AK : : URL >  location ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-30 11:36:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    // "Parse a list of rules" is intended 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-30 17:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template < typename  T > 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-12 19:05:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    NonnullRefPtrVector < Rule >  parse_a_list_of_rules ( TokenStream < T > & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-30 11:48:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // "Parse a rule" is intended for use by the CSSStyleSheet#insertRule method, and similar functions which might exist, which parse text into a single rule.
 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 17:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template < typename  T > 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-12 19:05:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < Rule >  parse_a_rule ( TokenStream < T > & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-30 11:48:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-30 12:05:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    // "Parse a declaration" is used in @supports conditions. [CSS3-CONDITIONAL]
 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 17:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template < typename  T > 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 14:36:12 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < Declaration >  parse_a_declaration ( TokenStream < T > & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-30 12:23:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-30 16:44:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template < typename  T > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    Vector < DeclarationOrAtRule >  parse_a_style_blocks_contents ( TokenStream < T > & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-30 12:23:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    // "Parse a list of declarations" is for the contents of a style attribute, which parses text into the contents of a single style rule.
 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 17:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template < typename  T > 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-28 16:37:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Vector < DeclarationOrAtRule >  parse_a_list_of_declarations ( TokenStream < T > & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-30 12:32:42 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // "Parse a component value" is for things that need to consume a single value, like the parsing rules for attr().
 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 17:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template < typename  T > 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 11:43:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < ComponentValue >  parse_a_component_value ( TokenStream < T > & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-30 12:39:36 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								    // "Parse a list of component values" is for the contents of presentational attributes, which parse text into a single declaration’  
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 17:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template < typename  T > 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 11:43:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Vector < ComponentValue >  parse_a_list_of_component_values ( TokenStream < T > & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-30 12:39:36 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 17:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template < typename  T > 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 11:43:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Vector < Vector < ComponentValue > >  parse_a_comma_separated_list_of_component_values ( TokenStream < T > & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-17 19:29:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    enum  class  SelectorType  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        Standalone , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        Relative 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-03 15:40:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template < typename  T > 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-27 11:04:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    ParseErrorOr < SelectorList >  parse_a_selector_list ( TokenStream < T > & ,  SelectorType ,  SelectorParsingMode  =  SelectorParsingMode : : Standard ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-17 19:29:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-29 12:56:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template < typename  T > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    NonnullRefPtrVector < MediaQuery >  parse_a_media_query_list ( TokenStream < T > & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-08 15:54:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template < typename  T > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < Supports >  parse_a_supports ( TokenStream < T > & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-22 17:41:47 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-27 12:03:42 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < Selector : : SimpleSelector : : ANPlusBPattern >  parse_a_n_plus_b_pattern ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-22 17:41:47 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 13:46:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    enum  class  TopLevel  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        No , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        Yes 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-03 15:40:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template < typename  T > 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-12 19:05:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    [ [ nodiscard ] ]  NonnullRefPtrVector < Rule >  consume_a_list_of_rules ( TokenStream < T > & ,  TopLevel ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-03 15:40:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template < typename  T > 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-12 19:05:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    [ [ nodiscard ] ]  NonnullRefPtr < Rule >  consume_an_at_rule ( TokenStream < T > & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-03 15:40:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template < typename  T > 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-12 19:05:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < Rule >  consume_a_qualified_rule ( TokenStream < T > & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-03 15:40:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template < typename  T > 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-30 16:44:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    [ [ nodiscard ] ]  Vector < DeclarationOrAtRule >  consume_a_style_blocks_contents ( TokenStream < T > & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    template < typename  T > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-03 15:40:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    [ [ nodiscard ] ]  Vector < DeclarationOrAtRule >  consume_a_list_of_declarations ( TokenStream < T > & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    template < typename  T > 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 14:36:12 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < Declaration >  consume_a_declaration ( TokenStream < T > & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-03 15:40:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template < typename  T > 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 11:43:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    [ [ nodiscard ] ]  ComponentValue  consume_a_component_value ( TokenStream < T > & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-03 15:40:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template < typename  T > 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-12 14:08:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    NonnullRefPtr < Block >  consume_a_simple_block ( TokenStream < T > & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-03 15:40:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template < typename  T > 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-12 13:35:55 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    NonnullRefPtr < Function >  consume_a_function ( TokenStream < T > & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-22 17:41:47 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 11:43:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < GeneralEnclosed >  parse_general_enclosed ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-08 15:54:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 11:43:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < CSSRule >  parse_font_face_rule ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 21:18:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Vector < FontFace : : Source >  parse_font_face_src ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-28 20:32:28 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-12 19:05:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < CSSRule >  convert_to_rule ( NonnullRefPtr < Rule > ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-30 16:50:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < PropertyOwningCSSStyleDeclaration >  convert_to_style_declaration ( Vector < DeclarationOrAtRule >  declarations ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 14:36:12 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < StyleProperty >  convert_to_style_property ( Declaration  const & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-09 16:34:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-14 17:09:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    class  Dimension  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    public : 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-22 12:48:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        Dimension ( Angle & &  value ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            :  m_value ( move ( value ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        Dimension ( Frequency & &  value ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            :  m_value ( move ( value ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-14 17:09:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        Dimension ( Length & &  value ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            :  m_value ( move ( value ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        Dimension ( Percentage & &  value ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            :  m_value ( move ( value ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-22 12:48:59 +00: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 17:09:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        bool  is_length ( )  const ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        Length  length ( )  const ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-22 12:48:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        bool  is_length_percentage ( )  const ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        LengthPercentage  length_percentage ( )  const ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-14 17:09:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        bool  is_percentage ( )  const ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        Percentage  percentage ( )  const ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-22 12:48:59 +00: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 17:09:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    private : 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-22 12:48:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        Variant < Angle ,  Frequency ,  Length ,  Percentage ,  Resolution ,  Time >  m_value ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-14 17:09:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    } ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 11:43:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < Dimension >  parse_dimension ( ComponentValue  const & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-09 19:08:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < Color >  parse_rgb_or_hsl_color ( StringView  function_name ,  Vector < ComponentValue >  const & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 11:43:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < Color >  parse_color ( ComponentValue  const & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < Length >  parse_length ( ComponentValue  const & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < Ratio >  parse_ratio ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
									
										
										
											
												LibWeb: Parse `<urange>` as CSS::UnicodeRange
Like, An+B, this is an old construct that does not fit well with modern
CSS syntax, so things get a bit hairy! We have to determine which
tokens match the grammar for `<urange>`, then turn those back into a
string, and then parse the string differently from normal. Thankfully
the spec describes in detail how to do that. :^)
This is not 100% correct, since we are not using the original source
text (referred to in the spec as the "representation") of the tokens,
but just converting them to strings in a manual, ad-hoc way.
Re-engineering the Tokenizer to keep that original text was too much of
a tangent for today. In any case, we do parse `U+4???`, `U+0-100`,
`U+1234`, and similar, so good enough for now!
											 
										 
										
											2022-04-07 17:41:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < UnicodeRange >  parse_unicode_range ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-27 19:56:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < UnicodeRange >  parse_unicode_range ( StringView ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-29 08:38:50 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    enum  class  AllowedDataUrlType  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        None , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        Image , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 11:43:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < AK : : URL >  parse_url_function ( ComponentValue  const & ,  AllowedDataUrlType  =  AllowedDataUrlType : : None ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-12 00:15:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_linear_gradient_function ( ComponentValue  const & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-27 11:04:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    ParseErrorOr < NonnullRefPtr < StyleValue > >  parse_css_value ( PropertyID ,  TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 11:43:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_css_value ( ComponentValue  const & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_builtin_value ( ComponentValue  const & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_dynamic_value ( ComponentValue  const & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_calculated_value ( Vector < ComponentValue >  const & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_dimension_value ( ComponentValue  const & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_numeric_value ( ComponentValue  const & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_identifier_value ( ComponentValue  const & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_color_value ( ComponentValue  const & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-31 18:46:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_rect_value ( ComponentValue  const & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 11:43:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_string_value ( ComponentValue  const & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_image_value ( ComponentValue  const & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-08 17:19:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template < typename  ParseFunction > 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 11:43:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_comma_separated_value_list ( Vector < ComponentValue >  const & ,  ParseFunction ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_simple_comma_separated_value_list ( Vector < ComponentValue >  const & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_background_value ( Vector < ComponentValue >  const & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_single_background_position_value ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_single_background_repeat_value ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_single_background_size_value ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_border_value ( Vector < ComponentValue >  const & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_border_radius_value ( Vector < ComponentValue >  const & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_border_radius_shorthand_value ( Vector < ComponentValue >  const & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_content_value ( Vector < ComponentValue >  const & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_flex_value ( Vector < ComponentValue >  const & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_flex_flow_value ( Vector < ComponentValue >  const & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_font_value ( Vector < ComponentValue >  const & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_font_family_value ( Vector < ComponentValue >  const & ,  size_t  start_index  =  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_list_style_value ( Vector < ComponentValue >  const & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_overflow_value ( Vector < ComponentValue >  const & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-23 16:59:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    enum  class  AllowInsetKeyword  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        No , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        Yes , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 11:43:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_shadow_value ( Vector < ComponentValue >  const & ,  AllowInsetKeyword ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_single_shadow_value ( TokenStream < ComponentValue > & ,  AllowInsetKeyword ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_text_decoration_value ( Vector < ComponentValue >  const & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 16:22:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_text_decoration_line_value ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 11:43:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_transform_value ( Vector < ComponentValue >  const & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_transform_origin_value ( Vector < ComponentValue >  const & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-23 19:49:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    RefPtr < StyleValue >  parse_grid_track_sizes ( Vector < ComponentValue >  const & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-14 16:20:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-28 16:30:59 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    // calc() parsing, according to https://www.w3.org/TR/css-values-3/#calc-syntax
 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 11:43:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    OwnPtr < CalculatedStyleValue : : CalcSum >  parse_calc_sum ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    OwnPtr < CalculatedStyleValue : : CalcProduct >  parse_calc_product ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < CalculatedStyleValue : : CalcValue >  parse_calc_value ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    OwnPtr < CalculatedStyleValue : : CalcNumberSum >  parse_calc_number_sum ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    OwnPtr < CalculatedStyleValue : : CalcNumberProduct >  parse_calc_number_product ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < CalculatedStyleValue : : CalcNumberValue >  parse_calc_number_value ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    OwnPtr < CalculatedStyleValue : : CalcProductPartWithOperator >  parse_calc_product_part_with_operator ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    OwnPtr < CalculatedStyleValue : : CalcSumPartWithOperator >  parse_calc_sum_part_with_operator ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    OwnPtr < CalculatedStyleValue : : CalcNumberProductPartWithOperator >  parse_calc_number_product_part_with_operator ( TokenStream < ComponentValue > &  tokens ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    OwnPtr < CalculatedStyleValue : : CalcNumberSumPartWithOperator >  parse_calc_number_sum_part_with_operator ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    OwnPtr < CalculatedStyleValue : : CalcSum >  parse_calc_expression ( Vector < ComponentValue >  const & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-27 11:04:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    ParseErrorOr < NonnullRefPtr < Selector > >  parse_complex_selector ( TokenStream < ComponentValue > & ,  SelectorType ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    ParseErrorOr < Optional < Selector : : CompoundSelector > >  parse_compound_selector ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 11:43:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < Selector : : Combinator >  parse_selector_combinator ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-27 11:04:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    ParseErrorOr < Selector : : SimpleSelector >  parse_attribute_simple_selector ( ComponentValue  const & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    ParseErrorOr < Selector : : SimpleSelector >  parse_pseudo_simple_selector ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    ParseErrorOr < Optional < Selector : : SimpleSelector > >  parse_simple_selector ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 11:43:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    NonnullRefPtr < MediaQuery >  parse_media_query ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    OwnPtr < MediaCondition >  parse_media_condition ( TokenStream < ComponentValue > & ,  MediaCondition : : AllowOr  allow_or ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < MediaFeature >  parse_media_feature ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < MediaQuery : : MediaType >  parse_media_type ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    OwnPtr < MediaCondition >  parse_media_in_parens ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < MediaFeatureValue >  parse_media_feature_value ( MediaFeatureID ,  TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    OwnPtr < Supports : : Condition >  parse_supports_condition ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < Supports : : InParens >  parse_supports_in_parens ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < Supports : : Feature >  parse_supports_feature ( TokenStream < ComponentValue > & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-08 15:54:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-11 00:55:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    static  bool  has_ignored_vendor_prefix ( StringView ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-28 20:32:28 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    static  bool  is_builtin ( StringView ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-12 16:49:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 16:01:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    struct  PropertiesAndCustomProperties  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        Vector < StyleProperty >  properties ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        HashMap < String ,  StyleProperty >  custom_properties ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    PropertiesAndCustomProperties  extract_properties ( Vector < DeclarationOrAtRule >  const & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-02 20:25:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    ParsingContext  m_context ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-22 17:41:47 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    Tokenizer  m_tokenizer ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    Vector < Token >  m_tokens ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-03 14:00:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    TokenStream < Token >  m_token_stream ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-22 17:41:47 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								} ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-07-30 17:48:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								namespace  Web  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-12 12:00:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								RefPtr < CSS : : CSSStyleSheet >  parse_css_stylesheet ( CSS : : Parser : : ParsingContext  const & ,  StringView ,  Optional < AK : : URL >  location  =  { } ) ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								RefPtr < CSS : : ElementInlineCSSStyleDeclaration >  parse_css_style_attribute ( CSS : : Parser : : ParsingContext  const & ,  StringView ,  DOM : : Element & ) ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								RefPtr < CSS : : StyleValue >  parse_css_value ( CSS : : Parser : : ParsingContext  const & ,  StringView ,  CSS : : PropertyID  property_id  =  CSS : : PropertyID : : Invalid ) ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Optional < CSS : : SelectorList >  parse_selector ( CSS : : Parser : : ParsingContext  const & ,  StringView ) ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								RefPtr < CSS : : CSSRule >  parse_css_rule ( CSS : : Parser : : ParsingContext  const & ,  StringView ) ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								RefPtr < CSS : : MediaQuery >  parse_media_query ( CSS : : Parser : : ParsingContext  const & ,  StringView ) ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								NonnullRefPtrVector < CSS : : MediaQuery >  parse_media_query_list ( CSS : : Parser : : ParsingContext  const & ,  StringView ) ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								RefPtr < CSS : : Supports >  parse_css_supports ( CSS : : Parser : : ParsingContext  const & ,  StringView ) ;  
						 
					
						
							
								
									
										
										
										
											2021-07-30 17:48:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}