2020-01-18 09:38:21 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/*
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
							 | 
						
					
						
							
								
									
										
										
										
											2021-09-03 11:14:37 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
							 | 
						
					
						
							
								
									
										
										
										
											2020-01-18 09:38:21 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							
								
									
										
										
										
											2021-04-22 01:24:48 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * SPDX-License-Identifier: BSD-2-Clause
							 | 
						
					
						
							
								
									
										
										
										
											2020-01-18 09:38:21 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-14 21:41:10 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <AK/ByteBuffer.h>
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <LibGfx/Palette.h>
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-07 10:32:51 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <LibWeb/CSS/StyleValue.h>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <LibWeb/DOM/Document.h>
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-02 13:51:30 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <LibWeb/Loader/LoadRequest.h>
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-01 20:42:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <LibWeb/Loader/ResourceLoader.h>
							 | 
						
					
						
							
								
									
										
										
										
											2021-05-30 12:36:53 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <LibWeb/Page/BrowsingContext.h>
							 | 
						
					
						
							
								
									
										
										
										
											2021-08-24 16:28:08 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <LibWeb/Page/Page.h>
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-22 21:48:21 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-26 20:01:35 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								namespace Web::CSS {
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-07 10:27:02 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-22 21:48:21 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								StyleValue::StyleValue(Type type)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    : m_type(type)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								StyleValue::~StyleValue()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-06 10:25:08 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-09-23 19:54:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								BackgroundStyleValue const& StyleValue::as_background() const
							 | 
						
					
						
							
								
									
										
										
										
											2021-09-22 12:42:54 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2021-09-23 19:54:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    VERIFY(is_background());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return static_cast<BackgroundStyleValue const&>(*this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								BackgroundRepeatStyleValue const& StyleValue::as_background_repeat() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    VERIFY(is_background_repeat());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return static_cast<BackgroundRepeatStyleValue const&>(*this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								BorderStyleValue const& StyleValue::as_border() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    VERIFY(is_border());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return static_cast<BorderStyleValue const&>(*this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								BorderRadiusStyleValue const& StyleValue::as_border_radius() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    VERIFY(is_border_radius());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return static_cast<BorderRadiusStyleValue const&>(*this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								BoxShadowStyleValue const& StyleValue::as_box_shadow() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    VERIFY(is_box_shadow());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return static_cast<BoxShadowStyleValue const&>(*this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								CalculatedStyleValue const& StyleValue::as_calculated() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    VERIFY(is_calculated());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return static_cast<CalculatedStyleValue const&>(*this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								ColorStyleValue const& StyleValue::as_color() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    VERIFY(is_color());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return static_cast<ColorStyleValue const&>(*this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								CustomStyleValue const& StyleValue::as_custom_property() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    VERIFY(is_custom_property());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return static_cast<CustomStyleValue const&>(*this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								FlexStyleValue const& StyleValue::as_flex() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    VERIFY(is_flex());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return static_cast<FlexStyleValue const&>(*this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								FlexFlowStyleValue const& StyleValue::as_flex_flow() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    VERIFY(is_flex_flow());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return static_cast<FlexFlowStyleValue const&>(*this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								FontStyleValue const& StyleValue::as_font() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    VERIFY(is_font());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return static_cast<FontStyleValue const&>(*this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2021-09-22 12:42:54 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-09-23 19:54:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								IdentifierStyleValue const& StyleValue::as_identifier() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    VERIFY(is_identifier());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return static_cast<IdentifierStyleValue const&>(*this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								ImageStyleValue const& StyleValue::as_image() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    VERIFY(is_image());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return static_cast<ImageStyleValue const&>(*this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								InheritStyleValue const& StyleValue::as_inherit() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    VERIFY(is_inherit());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return static_cast<InheritStyleValue const&>(*this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								InitialStyleValue const& StyleValue::as_initial() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    VERIFY(is_initial());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return static_cast<InitialStyleValue const&>(*this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								LengthStyleValue const& StyleValue::as_length() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    VERIFY(is_length());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return static_cast<LengthStyleValue const&>(*this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								ListStyleStyleValue const& StyleValue::as_list_style() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    VERIFY(is_list_style());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return static_cast<ListStyleStyleValue const&>(*this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								NumericStyleValue const& StyleValue::as_numeric() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    VERIFY(is_numeric());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return static_cast<NumericStyleValue const&>(*this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								OverflowStyleValue const& StyleValue::as_overflow() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    VERIFY(is_overflow());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return static_cast<OverflowStyleValue const&>(*this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								StringStyleValue const& StyleValue::as_string() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    VERIFY(is_string());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return static_cast<StringStyleValue const&>(*this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								TextDecorationStyleValue const& StyleValue::as_text_decoration() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    VERIFY(is_text_decoration());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return static_cast<TextDecorationStyleValue const&>(*this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								TransformationStyleValue const& StyleValue::as_transformation() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    VERIFY(is_transformation());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return static_cast<TransformationStyleValue const&>(*this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								UnsetStyleValue const& StyleValue::as_unset() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    VERIFY(is_unset());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return static_cast<UnsetStyleValue const&>(*this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								StyleValueList const& StyleValue::as_value_list() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    VERIFY(is_value_list());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return static_cast<StyleValueList const&>(*this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								String IdentifierStyleValue::to_string() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return CSS::string_from_value_id(m_id);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								bool IdentifierStyleValue::has_color() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    switch (m_id) {
							 | 
						
					
						
							
								
									
										
										
										
											2021-09-22 12:42:54 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case ValueID::Currentcolor:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebLink:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteActiveLink:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteActiveWindowBorder1:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteActiveWindowBorder2:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteActiveWindowTitle:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteBase:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteBaseText:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteButton:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteButtonText:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteDesktopBackground:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteFocusOutline:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteHighlightWindowBorder1:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteHighlightWindowBorder2:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteHighlightWindowTitle:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteHoverHighlight:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteInactiveSelection:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteInactiveSelectionText:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteInactiveWindowBorder1:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteInactiveWindowBorder2:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteInactiveWindowTitle:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteLink:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteMenuBase:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteMenuBaseText:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteMenuSelection:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteMenuSelectionText:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteMenuStripe:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteMovingWindowBorder1:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteMovingWindowBorder2:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteMovingWindowTitle:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteRubberBandBorder:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteRubberBandFill:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteRuler:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteRulerActiveText:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteRulerBorder:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteRulerInactiveText:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteSelection:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteSelectionText:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteSyntaxComment:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteSyntaxControlKeyword:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteSyntaxIdentifier:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteSyntaxKeyword:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteSyntaxNumber:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteSyntaxOperator:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteSyntaxPreprocessorStatement:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteSyntaxPreprocessorValue:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteSyntaxPunctuation:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteSyntaxString:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteSyntaxType:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteTextCursor:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteThreedHighlight:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteThreedShadow1:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteThreedShadow2:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteVisitedLink:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteWindow:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case ValueID::LibwebPaletteWindowText:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return true;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    default:
							 | 
						
					
						
							
								
									
										
										
										
											2021-09-23 19:54:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return false;
							 | 
						
					
						
							
								
									
										
										
										
											2021-09-22 12:42:54 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-06 10:25:08 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-09-16 19:20:20 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								Color IdentifierStyleValue::to_color(Layout::NodeWithStyle const& node) const
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-06 10:25:08 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2021-09-16 19:40:56 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if (id() == CSS::ValueID::Currentcolor) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if (!node.has_style())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            return Color::Black;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return node.computed_values().color();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-09-16 19:20:20 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    auto& document = node.document();
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if (id() == CSS::ValueID::LibwebLink)
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-06 10:25:08 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return document.link_color();
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-02-23 20:42:32 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    VERIFY(document.page());
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-12 18:23:05 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    auto palette = document.page()->palette();
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    switch (id()) {
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteDesktopBackground:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::DesktopBackground);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteActiveWindowBorder1:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::ActiveWindowBorder1);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteActiveWindowBorder2:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::ActiveWindowBorder2);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteActiveWindowTitle:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::ActiveWindowTitle);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteInactiveWindowBorder1:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::InactiveWindowBorder1);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteInactiveWindowBorder2:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::InactiveWindowBorder2);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteInactiveWindowTitle:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::InactiveWindowTitle);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteMovingWindowBorder1:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::MovingWindowBorder1);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteMovingWindowBorder2:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::MovingWindowBorder2);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteMovingWindowTitle:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::MovingWindowTitle);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteHighlightWindowBorder1:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::HighlightWindowBorder1);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteHighlightWindowBorder2:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::HighlightWindowBorder2);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteHighlightWindowTitle:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::HighlightWindowTitle);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteMenuStripe:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::MenuStripe);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteMenuBase:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::MenuBase);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteMenuBaseText:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::MenuBaseText);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteMenuSelection:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::MenuSelection);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteMenuSelectionText:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::MenuSelectionText);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteWindow:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::Window);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteWindowText:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::WindowText);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteButton:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::Button);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteButtonText:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::ButtonText);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteBase:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::Base);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteBaseText:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::BaseText);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteThreedHighlight:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::ThreedHighlight);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteThreedShadow1:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::ThreedShadow1);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteThreedShadow2:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::ThreedShadow2);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteHoverHighlight:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::HoverHighlight);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteSelection:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::Selection);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteSelectionText:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::SelectionText);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteInactiveSelection:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::InactiveSelection);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteInactiveSelectionText:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::InactiveSelectionText);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteRubberBandFill:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::RubberBandFill);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteRubberBandBorder:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::RubberBandBorder);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteLink:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::Link);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteActiveLink:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::ActiveLink);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteVisitedLink:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::VisitedLink);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteRuler:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::Ruler);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteRulerBorder:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::RulerBorder);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteRulerActiveText:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::RulerActiveText);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteRulerInactiveText:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::RulerInactiveText);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteTextCursor:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::TextCursor);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteFocusOutline:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::FocusOutline);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteSyntaxComment:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::SyntaxComment);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteSyntaxNumber:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::SyntaxNumber);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteSyntaxString:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::SyntaxString);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteSyntaxType:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::SyntaxType);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteSyntaxPunctuation:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::SyntaxPunctuation);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteSyntaxOperator:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::SyntaxOperator);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteSyntaxKeyword:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::SyntaxKeyword);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteSyntaxControlKeyword:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::SyntaxControlKeyword);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteSyntaxIdentifier:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::SyntaxIdentifier);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteSyntaxPreprocessorStatement:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::SyntaxPreprocessorStatement);
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-15 20:39:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case CSS::ValueID::LibwebPaletteSyntaxPreprocessorValue:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-25 14:54:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::SyntaxPreprocessorValue);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    default:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-06 10:25:08 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-19 11:49:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-09-30 02:18:30 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								ImageStyleValue::ImageStyleValue(const AK::URL& url, DOM::Document* document)
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-19 11:49:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    : StyleValue(Type::Image)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    , m_url(url)
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												AK: Make RefPtr, NonnullRefPtr, WeakPtr thread safe
This makes most operations thread safe, especially so that they
can safely be used in the Kernel. This includes obtaining a strong
reference from a weak reference, which now requires an explicit
call to WeakPtr::strong_ref(). Another major change is that
Weakable::make_weak_ref() may require the explicit target type.
Previously we used reinterpret_cast in WeakPtr, assuming that it
can be properly converted. But WeakPtr does not necessarily have
the knowledge to be able to do this. Instead, we now ask the class
itself to deliver a WeakPtr to the type that we want.
Also, WeakLink is no longer specific to a target type. The reason
for this is that we want to be able to safely convert e.g. WeakPtr<T>
to WeakPtr<U>, and before this we just reinterpret_cast the internal
WeakLink<T> to WeakLink<U>, which is a bold assumption that it would
actually produce the correct code. Instead, WeakLink now operates
on just a raw pointer and we only make those constructors/operators
available if we can verify that it can be safely cast.
In order to guarantee thread safety, we now use the least significant
bit in the pointer for locking purposes. This also means that only
properly aligned pointers can be used.
											
										 
										
											2020-09-29 16:26:13 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    , m_document(document)
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-19 11:49:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2021-09-30 02:18:30 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    // FIXME: This doesn't work right without a document.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    auto request = LoadRequest::create_for_url_on_page(url, document ? document->page() : nullptr);
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-05 23:32:23 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    set_resource(ResourceLoader::the().load_resource(Resource::Type::Image, request));
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-02 13:51:30 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								void ImageStyleValue::resource_did_load()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if (!m_document)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return;
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-23 13:33:03 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    m_bitmap = resource()->bitmap();
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-02 13:51:30 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    // FIXME: Do less than a full repaint if possible?
							 | 
						
					
						
							
								
									
										
										
										
											2021-09-30 02:18:30 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if (m_document && m_document->browsing_context())
							 | 
						
					
						
							
								
									
										
										
										
											2021-05-30 12:36:53 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        m_document->browsing_context()->set_needs_display({});
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-19 11:49:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2021-10-03 17:56:01 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// https://www.w3.org/TR/css-color-4/#serializing-sRGB-values
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								String ColorStyleValue::to_string() const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if (m_color.alpha() == 1)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return String::formatted("rgb({}, {}, {})", m_color.red(), m_color.green(), m_color.blue());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return String::formatted("rgba({}, {}, {}, {})", m_color.red(), m_color.green(), m_color.blue(), (float)(m_color.alpha()) / 255.0f);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-07 10:27:02 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 |