2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								/*
  
						 
					
						
							
								
									
										
										
										
											2023-02-20 18:56:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								 *  Copyright  ( c )  2022 - 2023 ,  Andreas  Kling  < kling @ serenityos . org > 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 17:18:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								 *  Copyright  ( c )  2022 - 2023 ,  Sam  Atkins  < atkinssj @ serenityos . org > 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								 *  SPDX - License - Identifier :  BSD - 2 - Clause 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-19 11:02:56 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <AK/GenericShorthands.h> 
  
						 
					
						
							
								
									
										
										
										
											2022-05-01 22:36:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibUnicode/CharacterTypes.h> 
  
						 
					
						
							
								
									
										
										
										
											2023-08-23 17:18:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/CSS/SystemColor.h> 
  
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/DOM/Document.h> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/HTML/HTMLHtmlElement.h> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/Layout/BlockContainer.h> 
  
						 
					
						
							
								
									
										
										
										
											2023-02-25 11:04:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/Layout/Viewport.h> 
  
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/Painting/BackgroundPainting.h> 
  
						 
					
						
							
								
									
										
										
										
											2022-09-15 08:31:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/Painting/FilterPainting.h> 
  
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/Painting/PaintableBox.h> 
  
						 
					
						
							
								
									
										
										
										
											2022-03-11 00:03:28 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/Painting/StackingContext.h> 
  
						 
					
						
							
								
									
										
										
										
											2023-08-19 08:38:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/Painting/ViewportPaintable.h> 
  
						 
					
						
							
								
									
										
										
										
											2022-09-17 21:25:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <LibWeb/Platform/FontPlugin.h> 
  
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								namespace  Web : : Painting  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-11 12:51:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								JS : : NonnullGCPtr < PaintableWithLines >  PaintableWithLines : : create ( Layout : : BlockContainer  const &  block_container )  
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2023-01-11 12:51:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    return  block_container . heap ( ) . allocate_without_realm < PaintableWithLines > ( block_container ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								JS : : NonnullGCPtr < PaintableBox >  PaintableBox : : create ( Layout : : Box  const &  layout_box )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  layout_box . heap ( ) . allocate_without_realm < PaintableBox > ( layout_box ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								PaintableBox : : PaintableBox ( Layout : : Box  const &  layout_box )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    :  Paintable ( layout_box ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								PaintableBox : : ~ PaintableBox ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 13:08:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								bool  PaintableBox : : is_visible ( )  const  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  computed_values ( ) . visibility ( )  = =  CSS : : Visibility : : Visible  & &  computed_values ( ) . opacity ( )  ! =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-21 10:56:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								void  PaintableBox : : invalidate_stacking_context ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    m_stacking_context  =  nullptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								PaintableWithLines : : PaintableWithLines ( Layout : : BlockContainer  const &  layout_box )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    :  PaintableBox ( layout_box ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								PaintableWithLines : : ~ PaintableWithLines ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-06 20:51:46 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								CSSPixelPoint  PaintableBox : : scroll_offset ( )  const  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  const &  node  =  layout_node ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( node . is_generated_for_before_pseudo_element ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  node . pseudo_element_generator ( ) - > scroll_offset ( DOM : : Element : : ScrollOffsetFor : : PseudoBefore ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( node . is_generated_for_after_pseudo_element ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  node . pseudo_element_generator ( ) - > scroll_offset ( DOM : : Element : : ScrollOffsetFor : : PseudoAfter ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-06 21:20:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! ( dom_node ( )  & &  is < DOM : : Element > ( * dom_node ( ) ) ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-06 20:51:46 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        return  { } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  static_cast < DOM : : Element  const * > ( dom_node ( ) ) - > scroll_offset ( DOM : : Element : : ScrollOffsetFor : : Self ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-06 21:10:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								void  PaintableBox : : set_scroll_offset ( CSSPixelPoint  offset )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // FIXME: If there is horizontal and vertical scroll ignore only part of the new offset
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( offset . y ( )  <  0  | |  scroll_offset ( )  = =  offset ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto &  node  =  layout_node ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( node . is_generated_for_before_pseudo_element ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        node . pseudo_element_generator ( ) - > set_scroll_offset ( DOM : : Element : : ScrollOffsetFor : : PseudoBefore ,  offset ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    }  else  if  ( node . is_generated_for_after_pseudo_element ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        node . pseudo_element_generator ( ) - > set_scroll_offset ( DOM : : Element : : ScrollOffsetFor : : PseudoAfter ,  offset ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    }  else  if  ( is < DOM : : Element > ( * dom_node ( ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        static_cast < DOM : : Element * > ( dom_node ( ) ) - > set_scroll_offset ( DOM : : Element : : ScrollOffsetFor : : Self ,  offset ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    node . set_needs_display ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-06 20:29:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								void  PaintableBox : : scroll_by ( int  delta_x ,  int  delta_y )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  scrollable_overflow_rect  =  this - > scrollable_overflow_rect ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! scrollable_overflow_rect . has_value ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  max_x_offset  =  scrollable_overflow_rect - > width ( )  -  content_size ( ) . width ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  max_y_offset  =  scrollable_overflow_rect - > height ( )  -  content_size ( ) . height ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-06 20:51:46 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  current_offset  =  scroll_offset ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-06 20:29:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  new_offset_x  =  clamp ( current_offset . x ( )  +  delta_x ,  0 ,  max_x_offset ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  new_offset_y  =  clamp ( current_offset . y ( )  +  delta_y ,  0 ,  max_y_offset ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-06 21:10:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    set_scroll_offset ( {  new_offset_x ,  new_offset_y  } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-06 20:29:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:46:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								void  PaintableBox : : set_offset ( CSSPixelPoint  offset )  
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    m_offset  =  offset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:46:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								void  PaintableBox : : set_content_size ( CSSPixelSize  size )  
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    m_content_size  =  size ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												LibWeb: Fix iframes flickering on window resize
After finishing layout, iframe layout boxes (FrameBox) get notified
about their new size by LayoutState::commit(). This information is
forwarded to the nested browsing context, where it can be used for
layout of the nested document.
The problem here was that we notified the FrameBox twice. Once when
assigning the used offset to its paintable, and once when assigning its
size. Because the offset was assigned first, we ended up telling the
FrameBox "btw, your size is 0x0". This caused us to throw away all
the layout information we had for the nested document.
We'd then say "actually, your size is 300x200" (or something) but by
then it was already too late, and we had to do a full relayout.
This caused iframes to flicker as every time their containing document
was laid out, we'd nuke the iframe layout and redo it (on a zero timer).
The fix is pleasantly simple: we didn't need to inform the nested
document of its offset in the containing document's layout anyway. Only
its size is relevant. So we can simply remove the first call, which
removes the bogus 0x0 temporary size.
Note that iframes may still flicker if they change size in the
containing document. That's a separate issue that will require more
finesse to solve. However, this fixes a very noticeable common case.
											 
										 
										
											2023-05-15 12:06:40 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    layout_box ( ) . did_set_content_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-15 15:42:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								CSSPixelPoint  PaintableBox : : offset ( )  const  
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2023-08-15 15:11:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    return  m_offset ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:46:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								CSSPixelRect  PaintableBox : : compute_absolute_rect ( )  const  
						 
					
						
							
								
									
										
										
										
											2022-03-24 16:06:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2023-08-15 15:42:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    CSSPixelRect  rect  {  offset ( ) ,  content_size ( )  } ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-24 16:06:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    for  ( auto  const *  block  =  containing_block ( ) ;  block  & &  block - > paintable ( ) ;  block  =  block - > paintable ( ) - > containing_block ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-15 15:42:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        rect . translate_by ( block - > paintable_box ( ) - > offset ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-24 16:06:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    return  rect ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:46:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								CSSPixelRect  PaintableBox : : absolute_rect ( )  const  
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2022-03-24 16:06:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! m_absolute_rect . has_value ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        m_absolute_rect  =  compute_absolute_rect ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-12 00:35:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    return  * m_absolute_rect ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:46:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								CSSPixelRect  PaintableBox : : compute_absolute_paint_rect ( )  const  
						 
					
						
							
								
									
										
										
										
											2022-09-25 15:13:31 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // FIXME: This likely incomplete:
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  rect  =  absolute_border_box_rect ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-12 18:59:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( has_scrollable_overflow ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        auto  scrollable_overflow_rect  =  this - > scrollable_overflow_rect ( ) . value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        if  ( computed_values ( ) . overflow_x ( )  = =  CSS : : Overflow : : Visible ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            rect . unite_horizontally ( scrollable_overflow_rect ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        if  ( computed_values ( ) . overflow_y ( )  = =  CSS : : Overflow : : Visible ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            rect . unite_vertically ( scrollable_overflow_rect ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-25 15:13:31 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  resolved_box_shadow_data  =  resolve_box_shadow_data ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    for  ( auto  const &  shadow  :  resolved_box_shadow_data )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        if  ( shadow . placement  = =  ShadowPlacement : : Inner ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:46:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        auto  inflate  =  shadow . spread_distance  +  shadow . blur_radius ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        auto  shadow_rect  =  rect . inflated ( inflate ,  inflate ,  inflate ,  inflate ) . translated ( shadow . offset_x ,  shadow . offset_y ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-25 15:13:31 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        rect  =  rect . united ( shadow_rect ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  rect ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:46:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								CSSPixelRect  PaintableBox : : absolute_paint_rect ( )  const  
						 
					
						
							
								
									
										
										
										
											2022-09-25 15:13:31 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! m_absolute_paint_rect . has_value ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        m_absolute_paint_rect  =  compute_absolute_paint_rect ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  * m_absolute_paint_rect ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-04-20 16:02:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								StackingContext *  PaintableBox : : enclosing_stacking_context ( )  
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2023-08-28 10:48:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    for  ( auto *  ancestor  =  parent ( ) ;  ancestor ;  ancestor  =  ancestor - > parent ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        if  ( auto *  stacking_context  =  ancestor - > stacking_context_rooted_here ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            return  const_cast < StackingContext * > ( stacking_context ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-28 10:48:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    // We should always reach the viewport's stacking context.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    VERIFY_NOT_REACHED ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-31 17:08:45 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Optional < CSSPixelRect >  PaintableBox : : get_clip_rect ( )  const  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  clip  =  computed_values ( ) . clip ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( clip . is_rect ( )  & &  layout_box ( ) . is_absolutely_positioned ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        auto  border_box  =  absolute_border_box_rect ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-31 17:16:39 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        return  clip . to_rect ( ) . resolved ( layout_node ( ) ,  border_box ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-31 17:08:45 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  { } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								void  PaintableBox : : before_paint ( PaintContext &  context ,  [[maybe_unused]]  PaintPhase  phase )  const  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! is_visible ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  clip_rect  =  get_clip_rect ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( clip_rect . has_value ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-27 18:49:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        context . recording_painter ( ) . save ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        context . recording_painter ( ) . add_clip_rect ( clip_rect - > to_type < int > ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-31 17:08:45 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								void  PaintableBox : : after_paint ( PaintContext &  context ,  [[maybe_unused]]  PaintPhase  phase )  const  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! is_visible ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( get_clip_rect ( ) . has_value ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-27 18:49:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        context . recording_painter ( ) . restore ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-31 17:08:45 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								void  PaintableBox : : paint ( PaintContext &  context ,  PaintPhase  phase )  const  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! is_visible ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( phase  = =  PaintPhase : : Background )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-15 08:31:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        paint_backdrop_filter ( context ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        paint_background ( context ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        paint_box_shadow ( context ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( phase  = =  PaintPhase : : Border )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        paint_border ( context ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-02 17:24:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( phase  = =  PaintPhase : : Outline )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        auto  outline_width  =  computed_values ( ) . outline_width ( ) . to_px ( layout_node ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        auto  borders_data  =  borders_data_for_outline ( layout_node ( ) ,  computed_values ( ) . outline_color ( ) ,  computed_values ( ) . outline_style ( ) ,  outline_width ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        if  ( borders_data . has_value ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-02 20:09:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            auto  outline_offset  =  computed_values ( ) . outline_offset ( ) . to_px ( layout_node ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-02 17:24:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            auto  border_radius_data  =  normalized_border_radii_data ( ShrinkRadiiForBorders : : No ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-02 20:09:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            auto  borders_rect  =  absolute_border_box_rect ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            auto  outline_offset_x  =  outline_offset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            auto  outline_offset_y  =  outline_offset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            // "Both the height and the width of the outside of the shape drawn by the outline should not
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            // become smaller than twice the computed value of the outline-width property to make sure
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            // that an outline can be rendered even with large negative values."
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            // https://www.w3.org/TR/css-ui-4/#outline-offset
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            // So, if the horizontal outline offset is > half the borders_rect's width then we set it to that.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            // (And the same for y)
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            if  ( ( borders_rect . width ( )  /  2 )  +  outline_offset_x  <  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                outline_offset_x  =  - borders_rect . width ( )  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            if  ( ( borders_rect . height ( )  /  2 )  +  outline_offset_y  <  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                outline_offset_y  =  - borders_rect . height ( )  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            border_radius_data . inflate ( outline_width  +  outline_offset_y ,  outline_width  +  outline_offset_x ,  outline_width  +  outline_offset_y ,  outline_width  +  outline_offset_x ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            borders_rect . inflate ( outline_width  +  outline_offset_y ,  outline_width  +  outline_offset_x ,  outline_width  +  outline_offset_y ,  outline_width  +  outline_offset_x ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-11-27 18:49:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            context . recording_painter ( ) . paint_borders ( context . rounded_device_rect ( borders_rect ) ,  border_radius_data . as_corners ( context ) ,  borders_data - > to_device_pixels ( context ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-02 17:24:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-06-02 22:50:11 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( phase  = =  PaintPhase : : Overlay  & &  layout_box ( ) . document ( ) . inspected_layout_node ( )  = =  & layout_box ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:46:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        auto  content_rect  =  absolute_rect ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        auto  margin_box  =  box_model ( ) . margin_box ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-27 16:30:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        CSSPixelRect  margin_rect ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        margin_rect . set_x ( absolute_x ( )  -  margin_box . left ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        margin_rect . set_width ( content_width ( )  +  margin_box . left  +  margin_box . right ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        margin_rect . set_y ( absolute_y ( )  -  margin_box . top ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        margin_rect . set_height ( content_height ( )  +  margin_box . top  +  margin_box . bottom ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:46:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        auto  border_rect  =  absolute_border_box_rect ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        auto  padding_rect  =  absolute_padding_box_rect ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-27 16:30:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        auto  paint_inspector_rect  =  [ & ] ( CSSPixelRect  const &  rect ,  Color  color )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            auto  device_rect  =  context . enclosing_device_rect ( rect ) . to_type < int > ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-27 18:49:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            context . recording_painter ( ) . fill_rect ( device_rect ,  Color ( color ) . with_alpha ( 100 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            context . recording_painter ( ) . draw_rect ( device_rect ,  Color ( color ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        paint_inspector_rect ( margin_rect ,  Color : : Yellow ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        paint_inspector_rect ( padding_rect ,  Color : : Cyan ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        paint_inspector_rect ( border_rect ,  Color : : Green ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        paint_inspector_rect ( content_rect ,  Color : : Magenta ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-17 21:25:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        auto &  font  =  Platform : : FontPlugin : : the ( ) . default_font ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 22:17:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        StringBuilder  builder ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        if  ( layout_box ( ) . dom_node ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            builder . append ( layout_box ( ) . dom_node ( ) - > debug_description ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            builder . append ( layout_box ( ) . debug_description ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        builder . appendff ( "  {}x{} @ {},{} " ,  border_rect . width ( ) ,  border_rect . height ( ) ,  border_rect . x ( ) ,  border_rect . y ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-06 01:12:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        auto  size_text  =  builder . to_deprecated_string ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        auto  size_text_rect  =  border_rect ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        size_text_rect . set_y ( border_rect . y ( )  +  border_rect . height ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        size_text_rect . set_top ( size_text_rect . top ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-26 15:57:31 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        size_text_rect . set_width ( CSSPixels : : nearest_value_for ( font . width ( size_text ) )  +  4 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        size_text_rect . set_height ( CSSPixels : : nearest_value_for ( font . pixel_size ( ) )  +  4 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-27 16:30:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        auto  size_text_device_rect  =  context . enclosing_device_rect ( size_text_rect ) . to_type < int > ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-27 18:49:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        context . recording_painter ( ) . fill_rect ( size_text_device_rect ,  context . palette ( ) . color ( Gfx : : ColorRole : : Tooltip ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        context . recording_painter ( ) . draw_rect ( size_text_device_rect ,  context . palette ( ) . threed_shadow1 ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        context . recording_painter ( ) . draw_text ( size_text_device_rect ,  size_text ,  font ,  Gfx : : TextAlignment : : Center ,  context . palette ( ) . color ( Gfx : : ColorRole : : TooltipText ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-12 04:20:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								BordersData  PaintableBox : : remove_element_kind_from_borders_data ( PaintableBox : : BordersDataWithElementKind  borders_data )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        . top  =  borders_data . top . border_data , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        . right  =  borders_data . right . border_data , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        . bottom  =  borders_data . bottom . border_data , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        . left  =  borders_data . left . border_data , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								void  PaintableBox : : paint_border ( PaintContext &  context )  const  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2023-07-12 04:20:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  borders_data  =  m_override_borders_data . has_value ( )  ?  remove_element_kind_from_borders_data ( m_override_borders_data . value ( ) )  :  BordersData  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-02 23:05:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        . top  =  box_model ( ) . border . top  = =  0  ?  CSS : : BorderData ( )  :  computed_values ( ) . border_top ( ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        . right  =  box_model ( ) . border . right  = =  0  ?  CSS : : BorderData ( )  :  computed_values ( ) . border_right ( ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        . bottom  =  box_model ( ) . border . bottom  = =  0  ?  CSS : : BorderData ( )  :  computed_values ( ) . border_bottom ( ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        . left  =  box_model ( ) . border . left  = =  0  ?  CSS : : BorderData ( )  :  computed_values ( ) . border_left ( ) , 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-27 18:49:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    context . recording_painter ( ) . paint_borders ( context . rounded_device_rect ( absolute_border_box_rect ( ) ) ,  normalized_border_radii_data ( ) . as_corners ( context ) ,  borders_data . to_device_pixels ( context ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-15 08:31:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								void  PaintableBox : : paint_backdrop_filter ( PaintContext &  context )  const  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto &  backdrop_filter  =  computed_values ( ) . backdrop_filter ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! backdrop_filter . is_none ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-12 01:34:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        apply_backdrop_filter ( context ,  absolute_border_box_rect ( ) ,  normalized_border_radii_data ( ) ,  backdrop_filter ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-15 08:31:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								void  PaintableBox : : paint_background ( PaintContext &  context )  const  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // If the body's background properties were propagated to the root element, do no re-paint the body's background.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( layout_box ( ) . is_body ( )  & &  document ( ) . html_element ( ) - > should_use_body_background_properties ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-27 14:48:52 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    CSSPixelRect  background_rect ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    Color  background_color  =  computed_values ( ) . background_color ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto *  background_layers  =  & computed_values ( ) . background_layers ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( layout_box ( ) . is_root_element ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        // CSS 2.1 Appendix E.2: If the element is a root element, paint the background over the entire canvas.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-27 14:48:52 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        background_rect  =  context . css_viewport_rect ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        // Section 2.11.2: If the computed value of background-image on the root element is none and its background-color is transparent,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								        // user agents must instead propagate the computed values of the background properties from that element’  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        if  ( document ( ) . html_element ( ) - > should_use_body_background_properties ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            background_layers  =  document ( ) . background_layers ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-24 22:38:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            background_color  =  document ( ) . background_color ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    }  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:46:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        background_rect  =  absolute_padding_box_rect ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // HACK: If the Box has a border, use the bordered_rect to paint the background.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    //       This way if we have a border-radius there will be no gap between the filling and actual border.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-30 15:54:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( computed_values ( ) . border_top ( ) . width  ! =  0  | |  computed_values ( ) . border_right ( ) . width  ! =  0  | |  computed_values ( ) . border_bottom ( ) . width  ! =  0  | |  computed_values ( ) . border_left ( ) . width  ! =  0 ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:46:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        background_rect  =  absolute_border_box_rect ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-10 16:16:46 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Painting : : paint_background ( context ,  layout_box ( ) ,  background_rect ,  background_color ,  computed_values ( ) . image_rendering ( ) ,  background_layers ,  normalized_border_radii_data ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-25 15:13:31 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Vector < ShadowData >  PaintableBox : : resolve_box_shadow_data ( )  const  
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  box_shadow_data  =  computed_values ( ) . box_shadow ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( box_shadow_data . is_empty ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-25 15:13:31 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        return  { } ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-23 16:55:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Vector < ShadowData >  resolved_box_shadow_data ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    resolved_box_shadow_data . ensure_capacity ( box_shadow_data . size ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    for  ( auto  const &  layer  :  box_shadow_data )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        resolved_box_shadow_data . empend ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            layer . color , 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-27 16:22:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            layer . offset_x . to_px ( layout_box ( ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            layer . offset_y . to_px ( layout_box ( ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            layer . blur_radius . to_px ( layout_box ( ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            layer . spread_distance . to_px ( layout_box ( ) ) , 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-23 16:55:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            layer . placement  = =  CSS : : ShadowPlacement : : Outer  ?  ShadowPlacement : : Outer  :  ShadowPlacement : : Inner ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-25 15:13:31 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  resolved_box_shadow_data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								void  PaintableBox : : paint_box_shadow ( PaintContext &  context )  const  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  resolved_box_shadow_data  =  resolve_box_shadow_data ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( resolved_box_shadow_data . is_empty ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-05 02:42:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  borders_data  =  BordersData  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        . top  =  computed_values ( ) . border_top ( ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        . right  =  computed_values ( ) . border_right ( ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        . bottom  =  computed_values ( ) . border_bottom ( ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        . left  =  computed_values ( ) . border_left ( ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    Painting : : paint_box_shadow ( context ,  absolute_border_box_rect ( ) ,  absolute_padding_box_rect ( ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        borders_data ,  normalized_border_radii_data ( ) ,  resolved_box_shadow_data ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-26 20:43:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								BorderRadiiData  PaintableBox : : normalized_border_radii_data ( ShrinkRadiiForBorders  shrink )  const  
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2023-12-07 06:16:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  border_radii_data  =  this - > border_radii_data ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-26 20:43:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( shrink  = =  ShrinkRadiiForBorders : : Yes ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-07 06:16:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        border_radii_data . shrink ( computed_values ( ) . border_top ( ) . width ,  computed_values ( ) . border_right ( ) . width ,  computed_values ( ) . border_bottom ( ) . width ,  computed_values ( ) . border_left ( ) . width ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  border_radii_data ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-19 20:28:30 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Optional < CSSPixelRect >  PaintableBox : : calculate_overflow_clipped_rect ( )  const  
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2023-11-08 15:04:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( layout_node ( ) . is_viewport ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  { } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-24 01:07:00 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! m_clip_rect . has_value ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-24 01:17:00 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        // NOTE: stacking context should not be crossed while aggregating rectangle to
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        // clip `overflow: hidden` because intersecting rectangles with different
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        // transforms doesn't make sense
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        // TODO: figure out if there are cases when stacking context should be
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        // crossed to calculate correct clip rect
 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-20 16:00:42 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        if  ( ! stacking_context ( )  & &  containing_block ( )  & &  containing_block ( ) - > paintable_box ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            m_clip_rect  =  containing_block ( ) - > paintable_box ( ) - > calculate_overflow_clipped_rect ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-24 01:17:00 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-24 01:07:00 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        auto  overflow_x  =  computed_values ( ) . overflow_x ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        auto  overflow_y  =  computed_values ( ) . overflow_y ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-29 17:57:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        if  ( overflow_x  ! =  CSS : : Overflow : : Visible  & &  overflow_y  ! =  CSS : : Overflow : : Visible )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-24 01:07:00 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            if  ( m_clip_rect . has_value ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                m_clip_rect - > intersect ( absolute_padding_box_rect ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                m_clip_rect  =  absolute_padding_box_rect ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-12 00:07:43 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    return  m_clip_rect ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2022-07-19 11:02:56 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-08 15:02:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								void  PaintableBox : : before_children_paint ( PaintContext &  context ,  PaintPhase )  const  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  scroll_offset  =  - this - > scroll_offset ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-08 15:27:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    context . translate_scroll_offset_by ( scroll_offset ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-27 18:49:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    context . recording_painter ( ) . translate ( {  context . enclosing_device_pixels ( scroll_offset . x ( ) ) ,  context . enclosing_device_pixels ( scroll_offset . y ( ) )  } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-08 15:02:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								void  PaintableBox : : after_children_paint ( PaintContext &  context ,  PaintPhase )  const  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  scroll_offset  =  this - > scroll_offset ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-08 15:27:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    context . translate_scroll_offset_by ( scroll_offset ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-27 18:49:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    context . recording_painter ( ) . translate ( {  context . enclosing_device_pixels ( scroll_offset . x ( ) ) ,  context . enclosing_device_pixels ( scroll_offset . y ( ) )  } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-08 15:02:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-25 04:50:14 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								void  PaintableBox : : apply_clip_overflow_rect ( PaintContext &  context ,  PaintPhase  phase )  const  
						 
					
						
							
								
									
										
										
										
											2022-11-12 00:07:43 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! AK : : first_is_one_of ( phase ,  PaintPhase : : Background ,  PaintPhase : : Border ,  PaintPhase : : Foreground ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-13 20:45:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-24 01:07:00 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    // FIXME: Support more overflow variations.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-19 20:28:30 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  clip_rect  =  this - > calculate_overflow_clipped_rect ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-04 20:49:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  overflow_x  =  computed_values ( ) . overflow_x ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  overflow_y  =  computed_values ( ) . overflow_y ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-31 17:08:45 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  css_clip_property  =  get_clip_rect ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( css_clip_property . has_value ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        if  ( clip_rect . has_value ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            clip_rect - > intersect ( css_clip_property . value ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            clip_rect  =  css_clip_property . value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 13:58:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-21 22:03:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! clip_rect . has_value ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-04 20:49:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-21 22:03:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! m_clipping_overflow )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-27 18:49:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        context . recording_painter ( ) . save ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-08 15:27:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        auto  scroll_offset  =  context . scroll_offset ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-27 18:49:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        context . recording_painter ( ) . translate ( {  - context . enclosing_device_pixels ( scroll_offset . x ( ) ) ,  - context . enclosing_device_pixels ( scroll_offset . y ( ) )  } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        context . recording_painter ( ) . add_clip_rect ( context . enclosing_device_rect ( * clip_rect ) . to_type < int > ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        context . recording_painter ( ) . translate ( {  context . enclosing_device_pixels ( scroll_offset . x ( ) ) ,  context . enclosing_device_pixels ( scroll_offset . y ( ) )  } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-21 22:03:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        m_clipping_overflow  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-04 20:49:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-12 00:07:43 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-21 22:03:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! clip_rect - > is_empty ( )  & &  overflow_y  = =  CSS : : Overflow : : Hidden  & &  overflow_x  = =  CSS : : Overflow : : Hidden )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-26 20:43:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        auto  border_radii_data  =  normalized_border_radii_data ( ShrinkRadiiForBorders : : Yes ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-15 04:27:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        CornerRadii  corner_radii  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            . top_left  =  border_radii_data . top_left . as_corner ( context ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            . top_right  =  border_radii_data . top_right . as_corner ( context ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            . bottom_right  =  border_radii_data . bottom_right . as_corner ( context ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            . bottom_left  =  border_radii_data . bottom_left . as_corner ( context ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        } ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-04 20:49:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        if  ( border_radii_data . has_any_radius ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-05 22:30:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            VERIFY ( ! m_corner_clipper_id . has_value ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            m_corner_clipper_id  =  context . allocate_corner_clipper_id ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            context . recording_painter ( ) . sample_under_corners ( * m_corner_clipper_id ,  corner_radii ,  context . recording_painter ( ) . state ( ) . translation . map ( context . rounded_device_rect ( * clip_rect ) . to_type < int > ( ) ) ,  CornerClip : : Outside ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-04 20:49:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-25 04:50:14 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								void  PaintableBox : : clear_clip_overflow_rect ( PaintContext &  context ,  PaintPhase  phase )  const  
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2022-07-19 11:02:56 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! AK : : first_is_one_of ( phase ,  PaintPhase : : Background ,  PaintPhase : : Border ,  PaintPhase : : Foreground ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // FIXME: Support more overflow variations.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-04 20:49:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( m_clipping_overflow )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-27 18:49:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        context . recording_painter ( ) . restore ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-04 20:49:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        m_clipping_overflow  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-05 22:30:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( m_corner_clipper_id . has_value ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        VERIFY ( m_corner_clipper_id . has_value ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        auto  clip_rect  =  this - > calculate_overflow_clipped_rect ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        context . recording_painter ( ) . blit_corner_clipping ( * m_corner_clipper_id ,  context . recording_painter ( ) . state ( ) . translation . map ( context . rounded_device_rect ( * clip_rect ) . to_type < int > ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        m_corner_clipper_id  =  { } ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-04 20:49:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								static  void  paint_cursor_if_needed ( PaintContext &  context ,  Layout : : TextNode  const &  text_node ,  Layout : : LineBoxFragment  const &  fragment )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  const &  browsing_context  =  text_node . browsing_context ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! browsing_context . is_focused_context ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! browsing_context . cursor_blink_state ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 19:34:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( browsing_context . cursor_position ( ) - > node ( )  ! =  & text_node . dom_node ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // NOTE: This checks if the cursor is before the start or after the end of the fragment. If it is at the end, after all text, it should still be painted.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 19:34:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( browsing_context . cursor_position ( ) - > offset ( )  <  ( unsigned ) fragment . start ( )  | |  browsing_context . cursor_position ( ) - > offset ( )  >  ( unsigned ) ( fragment . start ( )  +  fragment . length ( ) ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! fragment . layout_node ( ) . dom_node ( )  | |  ! fragment . layout_node ( ) . dom_node ( ) - > is_editable ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:46:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  fragment_rect  =  fragment . absolute_rect ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-27 16:30:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    CSSPixelRect  cursor_rect  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 19:34:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        fragment_rect . x ( )  +  CSSPixels : : nearest_value_for ( text_node . font ( ) . width ( fragment . text ( ) . substring_view ( 0 ,  text_node . browsing_context ( ) . cursor_position ( ) - > offset ( )  -  fragment . start ( ) ) ) ) , 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-27 16:30:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        fragment_rect . top ( ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        1 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        fragment_rect . height ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  cursor_device_rect  =  context . rounded_device_rect ( cursor_rect ) . to_type < int > ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-11-27 18:49:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    context . recording_painter ( ) . draw_rect ( cursor_device_rect ,  text_node . computed_values ( ) . color ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-15 04:27:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								static  void  paint_text_decoration ( PaintContext &  context ,  Layout : : Node  const &  text_node ,  Layout : : LineBoxFragment  const &  fragment )  
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2023-11-27 18:49:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto &  painter  =  context . recording_painter ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto &  font  =  fragment . layout_node ( ) . font ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:46:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  fragment_box  =  fragment . absolute_rect ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-26 15:57:31 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    CSSPixels  glyph_height  =  CSSPixels : : nearest_value_for ( font . pixel_size ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  baseline  =  fragment_box . height ( )  /  2  -  ( glyph_height  +  4 )  /  2  +  glyph_height ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  line_color  =  text_node . computed_values ( ) . text_decoration_color ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-27 16:30:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    CSSPixels  css_line_thickness  =  [ & ]  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        CSS : : Length  computed_thickness  =  text_node . computed_values ( ) . text_decoration_thickness ( ) . resolved ( text_node ,  CSS : : Length ( 1 ,  CSS : : Length : : Type : : Em ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        if  ( computed_thickness . is_auto ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-26 15:03:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            return  max ( glyph_height . scaled ( 0.1 ) ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-26 15:03:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        return  computed_thickness . to_px ( text_node ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    } ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-27 16:30:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  device_line_thickness  =  context . rounded_device_pixels ( css_line_thickness ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 16:22:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto  text_decoration_lines  =  text_node . computed_values ( ) . text_decoration_line ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    for  ( auto  line  :  text_decoration_lines )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-27 16:30:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        DevicePixelPoint  line_start_point  { } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        DevicePixelPoint  line_end_point  { } ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 16:22:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        switch  ( line )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        case  CSS : : TextDecorationLine : : None : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            return ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        case  CSS : : TextDecorationLine : : Underline : 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-27 16:30:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            line_start_point  =  context . rounded_device_point ( fragment_box . top_left ( ) . translated ( 0 ,  baseline  +  2 ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-22 00:41:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            line_end_point  =  context . rounded_device_point ( fragment_box . top_right ( ) . translated ( - 1 ,  baseline  +  2 ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        case  CSS : : TextDecorationLine : : Overline : 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-27 16:30:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            line_start_point  =  context . rounded_device_point ( fragment_box . top_left ( ) . translated ( 0 ,  baseline  -  glyph_height ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-22 00:41:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            line_end_point  =  context . rounded_device_point ( fragment_box . top_right ( ) . translated ( - 1 ,  baseline  -  glyph_height ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            break ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 16:22:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        case  CSS : : TextDecorationLine : : LineThrough :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            auto  x_height  =  font . x_height ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-26 15:03:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            line_start_point  =  context . rounded_device_point ( fragment_box . top_left ( ) . translated ( 0 ,  baseline  -  x_height  *  CSSPixels ( 0.5f ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            line_end_point  =  context . rounded_device_point ( fragment_box . top_right ( ) . translated ( - 1 ,  baseline  -  x_height  *  CSSPixels ( 0.5f ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            break ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 16:22:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        case  CSS : : TextDecorationLine : : Blink : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            // Conforming user agents may simply not blink the text
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            return ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 16:22:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        switch  ( text_node . computed_values ( ) . text_decoration_style ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        case  CSS : : TextDecorationStyle : : Solid : 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-27 16:30:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            painter . draw_line ( line_start_point . to_type < int > ( ) ,  line_end_point . to_type < int > ( ) ,  line_color ,  device_line_thickness . value ( ) ,  Gfx : : Painter : : LineStyle : : Solid ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 16:22:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        case  CSS : : TextDecorationStyle : : Double : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            switch  ( line )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            case  CSS : : TextDecorationLine : : Underline : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            case  CSS : : TextDecorationLine : : Overline : 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-27 16:30:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								                line_start_point . translate_by ( 0 ,  - device_line_thickness  -  context . rounded_device_pixels ( 1 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                line_end_point . translate_by ( 0 ,  - device_line_thickness  -  context . rounded_device_pixels ( 1 ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 16:22:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								                break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            case  CSS : : TextDecorationLine : : LineThrough : 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-27 16:30:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								                line_start_point . translate_by ( 0 ,  - device_line_thickness  /  2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                line_end_point . translate_by ( 0 ,  - device_line_thickness  /  2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 16:22:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								                break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                VERIFY_NOT_REACHED ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-27 16:30:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            painter . draw_line ( line_start_point . to_type < int > ( ) ,  line_end_point . to_type < int > ( ) ,  line_color ,  device_line_thickness . value ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            painter . draw_line ( line_start_point . translated ( 0 ,  device_line_thickness  +  1 ) . to_type < int > ( ) ,  line_end_point . translated ( 0 ,  device_line_thickness  +  1 ) . to_type < int > ( ) ,  line_color ,  device_line_thickness . value ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 16:22:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        case  CSS : : TextDecorationStyle : : Dashed : 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-27 16:30:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            painter . draw_line ( line_start_point . to_type < int > ( ) ,  line_end_point . to_type < int > ( ) ,  line_color ,  device_line_thickness . value ( ) ,  Gfx : : Painter : : LineStyle : : Dashed ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 16:22:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        case  CSS : : TextDecorationStyle : : Dotted : 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-27 16:30:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            painter . draw_line ( line_start_point . to_type < int > ( ) ,  line_end_point . to_type < int > ( ) ,  line_color ,  device_line_thickness . value ( ) ,  Gfx : : Painter : : LineStyle : : Dotted ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 16:22:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        case  CSS : : TextDecorationStyle : : Wavy : 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-27 16:30:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            painter . draw_triangle_wave ( line_start_point . to_type < int > ( ) ,  line_end_point . to_type < int > ( ) ,  line_color ,  device_line_thickness . value ( )  +  1 ,  device_line_thickness . value ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 16:22:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-04-20 16:02:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								static  void  paint_text_fragment ( PaintContext &  context ,  Layout : : TextNode  const &  text_node ,  Layout : : LineBoxFragment  const &  fragment ,  PaintPhase  phase )  
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2023-11-27 18:49:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    auto &  painter  =  context . recording_painter ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-04-20 16:02:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( phase  = =  PaintPhase : : Foreground )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:46:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        auto  fragment_absolute_rect  =  fragment . absolute_rect ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-27 16:30:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        auto  fragment_absolute_device_rect  =  context . enclosing_device_rect ( fragment_absolute_rect ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-06-02 22:50:11 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        if  ( text_node . document ( ) . inspected_layout_node ( )  = =  & text_node ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-27 18:49:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            context . recording_painter ( ) . draw_rect ( fragment_absolute_device_rect . to_type < int > ( ) ,  Color : : Magenta ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        auto  text  =  text_node . text_for_rendering ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:46:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        DevicePixelPoint  baseline_start  {  fragment_absolute_device_rect . x ( ) ,  fragment_absolute_device_rect . y ( )  +  context . rounded_device_pixels ( fragment . baseline ( ) )  } ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-02 18:38:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        auto  const &  scaled_font  =  fragment . layout_node ( ) . scaled_font ( context ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        Vector < Gfx : : DrawGlyphOrEmoji >  scaled_glyph_run ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        scaled_glyph_run . ensure_capacity ( fragment . glyph_run ( ) . size ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        for  ( auto  glyph  :  fragment . glyph_run ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            glyph . visit ( [ & ] ( auto &  glyph )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-09 23:14:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								                glyph . font  =  scaled_font ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-02 18:38:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								                glyph . position  =  glyph . position . scaled ( context . device_pixels_per_css_pixel ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            scaled_glyph_run . append ( move ( glyph ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        painter . draw_text_run ( baseline_start . to_type < int > ( ) ,  scaled_glyph_run ,  text_node . computed_values ( ) . color ( ) ,  fragment_absolute_device_rect . to_type < int > ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:46:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        auto  selection_rect  =  context . enclosing_device_rect ( fragment . selection_rect ( text_node . font ( ) ) ) . to_type < int > ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        if  ( ! selection_rect . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 17:18:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            painter . fill_rect ( selection_rect ,  CSS : : SystemColor : : highlight ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-15 04:27:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            RecordingPainterStateSaver  saver ( painter ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:46:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            painter . add_clip_rect ( selection_rect ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-03 22:32:28 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            painter . draw_text_run ( baseline_start . to_type < int > ( ) ,  scaled_glyph_run ,  CSS : : SystemColor : : highlight_text ( ) ,  fragment_absolute_device_rect . to_type < int > ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-15 04:27:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        paint_text_decoration ( context ,  text_node ,  fragment ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        paint_cursor_if_needed ( context ,  text_node ,  fragment ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								void  PaintableWithLines : : paint ( PaintContext &  context ,  PaintPhase  phase )  const  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! is_visible ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    PaintableBox : : paint ( context ,  phase ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( m_line_boxes . is_empty ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    bool  should_clip_overflow  =  computed_values ( ) . overflow_x ( )  ! =  CSS : : Overflow : : Visible  & &  computed_values ( ) . overflow_y ( )  ! =  CSS : : Overflow : : Visible ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-05 22:30:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < u32 >  corner_clip_id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  clip_box  =  context . rounded_device_rect ( absolute_padding_box_rect ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    auto  border_radius_clip_rect  =  context . recording_painter ( ) . state ( ) . translation . map ( clip_box . to_type < int > ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( should_clip_overflow )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-27 18:49:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        context . recording_painter ( ) . save ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        // FIXME: Handle overflow-x and overflow-y being different values.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-27 18:49:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        context . recording_painter ( ) . add_clip_rect ( clip_box . to_type < int > ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-06 20:51:46 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        auto  scroll_offset  =  context . rounded_device_point ( this - > scroll_offset ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-27 18:49:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        context . recording_painter ( ) . translate ( - scroll_offset . to_type < int > ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-04 20:49:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-26 20:43:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        auto  border_radii  =  normalized_border_radii_data ( ShrinkRadiiForBorders : : Yes ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-15 04:27:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        CornerRadii  corner_radii  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            . top_left  =  border_radii . top_left . as_corner ( context ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            . top_right  =  border_radii . top_right . as_corner ( context ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            . bottom_right  =  border_radii . bottom_right . as_corner ( context ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            . bottom_left  =  border_radii . bottom_left . as_corner ( context ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        } ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-04 20:49:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        if  ( border_radii . has_any_radius ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-05 22:30:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            corner_clip_id  =  context . allocate_corner_clipper_id ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            context . recording_painter ( ) . sample_under_corners ( * corner_clip_id ,  corner_radii ,  border_radius_clip_rect ,  CornerClip : : Outside ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-04 20:49:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-24 15:20:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    // Text shadows
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // This is yet another loop, but done here because all shadows should appear under all text.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // So, we paint the shadows before painting any text.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    // FIXME: Find a smarter way to do this?
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( phase  = =  PaintPhase : : Foreground )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        for  ( auto &  line_box  :  m_line_boxes )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            for  ( auto &  fragment  :  line_box . fragments ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                if  ( is < Layout : : TextNode > ( fragment . layout_node ( ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    auto &  text_shadow  =  fragment . layout_node ( ) . computed_values ( ) . text_shadow ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    if  ( ! text_shadow . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                        Vector < ShadowData >  resolved_shadow_data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                        resolved_shadow_data . ensure_capacity ( text_shadow . size ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                        for  ( auto  const &  layer  :  text_shadow )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                            resolved_shadow_data . empend ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                                layer . color , 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-27 16:22:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								                                layer . offset_x . to_px ( layout_box ( ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                                layer . offset_y . to_px ( layout_box ( ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                                layer . blur_radius . to_px ( layout_box ( ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                                layer . spread_distance . to_px ( layout_box ( ) ) , 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-24 15:20:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								                                ShadowPlacement : : Outer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                        } 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-27 18:49:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								                        context . recording_painter ( ) . set_font ( fragment . layout_node ( ) . font ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-20 16:02:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								                        paint_text_shadow ( context ,  fragment ,  resolved_shadow_data ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-24 15:20:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								                    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    for  ( auto &  line_box  :  m_line_boxes )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        for  ( auto &  fragment  :  line_box . fragments ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-23 11:27:16 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            auto  fragment_absolute_rect  =  fragment . absolute_rect ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            auto  fragment_absolute_device_rect  =  context . enclosing_device_rect ( fragment_absolute_rect ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 22:33:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            if  ( context . should_show_line_box_borders ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-27 18:49:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								                context . recording_painter ( ) . draw_rect ( fragment_absolute_device_rect . to_type < int > ( ) ,  Color : : Green ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                context . recording_painter ( ) . draw_line ( 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:46:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								                    context . rounded_device_point ( fragment_absolute_rect . top_left ( ) . translated ( 0 ,  fragment . baseline ( ) ) ) . to_type < int > ( ) , 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-22 00:41:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								                    context . rounded_device_point ( fragment_absolute_rect . top_right ( ) . translated ( - 1 ,  fragment . baseline ( ) ) ) . to_type < int > ( ) ,  Color : : Red ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-29 22:33:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 23:03:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            if  ( is < Layout : : TextNode > ( fragment . layout_node ( ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                paint_text_fragment ( context ,  static_cast < Layout : : TextNode  const & > ( fragment . layout_node ( ) ) ,  fragment ,  phase ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( should_clip_overflow )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-27 18:49:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        context . recording_painter ( ) . restore ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-05 22:30:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        if  ( corner_clip_id . has_value ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            context . recording_painter ( ) . blit_corner_clipping ( * corner_clip_id ,  border_radius_clip_rect ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            corner_clip_id  =  { } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-06 14:28:23 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								bool  PaintableBox : : handle_mousewheel ( Badge < EventHandler > ,  CSSPixelPoint ,  unsigned ,  unsigned ,  int  wheel_delta_x ,  int  wheel_delta_y )  
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2023-08-08 15:43:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! layout_box ( ) . is_user_scrollable ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-06 20:29:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    scroll_by ( wheel_delta_x ,  wheel_delta_y ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Layout : : BlockContainer  const &  PaintableWithLines : : layout_box ( )  const  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  static_cast < Layout : : BlockContainer  const & > ( PaintableBox : : layout_box ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Layout : : BlockContainer &  PaintableWithLines : : layout_box ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    return  static_cast < Layout : : BlockContainer & > ( PaintableBox : : layout_box ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-11 00:03:28 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								void  PaintableBox : : set_stacking_context ( NonnullOwnPtr < StackingContext >  stacking_context )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    m_stacking_context  =  move ( stacking_context ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-02 17:35:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Optional < HitTestResult >  PaintableBox : : hit_test ( CSSPixelPoint  position ,  HitTestType  type )  const  
						 
					
						
							
								
									
										
										
										
											2022-03-11 00:03:28 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2022-03-21 15:43:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! is_visible ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  { } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-25 11:04:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( layout_box ( ) . is_viewport ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-19 08:38:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        const_cast < ViewportPaintable & > ( static_cast < ViewportPaintable  const & > ( * this ) ) . build_stacking_context_tree_if_needed ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-11 00:03:28 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        return  stacking_context ( ) - > hit_test ( position ,  type ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-21 10:56:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-11 00:03:28 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:46:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! absolute_border_box_rect ( ) . contains ( position . x ( ) ,  position . y ( ) ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-03 18:43:20 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        return  { } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    for  ( auto *  child  =  first_child ( ) ;  child ;  child  =  child - > next_sibling ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        auto  result  =  child - > hit_test ( position ,  type ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        if  ( ! result . has_value ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        if  ( ! result - > paintable - > visible_for_hit_testing ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  result ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-18 20:28:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! visible_for_hit_testing ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  { } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-11 12:51:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    return  HitTestResult  {  const_cast < PaintableBox & > ( * this )  } ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-11 00:03:28 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-02 17:35:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Optional < HitTestResult >  PaintableWithLines : : hit_test ( CSSPixelPoint  position ,  HitTestType  type )  const  
						 
					
						
							
								
									
										
										
										
											2022-03-11 00:03:28 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( ! layout_box ( ) . children_are_inline ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        return  PaintableBox : : hit_test ( position ,  type ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-21 11:11:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Optional < HitTestResult >  last_good_candidate ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-11 00:03:28 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    for  ( auto &  line_box  :  m_line_boxes )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        for  ( auto &  fragment  :  line_box . fragments ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-20 16:00:42 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            if  ( is < Layout : : Box > ( fragment . layout_node ( ) )  & &  static_cast < Layout : : Box  const & > ( fragment . layout_node ( ) ) . paintable_box ( ) - > stacking_context ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-11 00:03:28 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								                continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-06 23:50:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            if  ( ! fragment . layout_node ( ) . containing_block ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                dbgln ( " FIXME: PaintableWithLines::hit_test(): Missing containing block on {} " ,  fragment . layout_node ( ) . debug_description ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:46:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            auto  fragment_absolute_rect  =  fragment . absolute_rect ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-21 12:16:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            if  ( fragment_absolute_rect . contains ( position ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-11 00:03:28 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								                if  ( is < Layout : : BlockContainer > ( fragment . layout_node ( ) )  & &  fragment . layout_node ( ) . paintable ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    return  fragment . layout_node ( ) . paintable ( ) - > hit_test ( position ,  type ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-11 12:51:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								                return  HitTestResult  {  const_cast < Paintable & > ( const_cast < Paintable & > ( * fragment . layout_node ( ) . paintable ( ) ) ) ,  fragment . text_index_at ( position . x ( ) )  } ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-11 00:03:28 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-30 01:51:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            // If we reached this point, the position is not within the fragment. However, the fragment start or end might be the place to place the cursor.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            // This determines whether the fragment is a good candidate for the position. The last such good fragment is chosen.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            // The best candidate is either the end of the line above, the beginning of the line below, or the beginning or end of the current line.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            // We arbitrarily choose to consider the end of the line above and ignore the beginning of the line below.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            // If we knew the direction of selection, we could make a better choice.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-22 00:41:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            if  ( fragment_absolute_rect . bottom ( )  -  1  < =  position . y ( ) )  {  // fully below the fragment
 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-11 12:51:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								                last_good_candidate  =  HitTestResult  {  const_cast < Paintable & > ( * fragment . layout_node ( ) . paintable ( ) ) ,  fragment . start ( )  +  fragment . length ( )  } ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-30 01:51:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            }  else  if  ( fragment_absolute_rect . top ( )  < =  position . y ( ) )  {  // vertically within the fragment
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                if  ( position . x ( )  <  fragment_absolute_rect . left ( ) )  {     // left of the fragment
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    if  ( ! last_good_candidate . has_value ( ) )  {             // first fragment of the line
 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-11 12:51:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								                        last_good_candidate  =  HitTestResult  {  const_cast < Paintable & > ( * fragment . layout_node ( ) . paintable ( ) ) ,  fragment . start ( )  } ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-30 01:51:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								                    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                }  else  {  // right of the fragment
 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-11 12:51:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								                    last_good_candidate  =  HitTestResult  {  const_cast < Paintable & > ( * fragment . layout_node ( ) . paintable ( ) ) ,  fragment . start ( )  +  fragment . length ( )  } ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-30 01:51:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-11 00:03:28 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-21 11:11:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( type  = =  HitTestType : : TextCursor  & &  last_good_candidate . has_value ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-11 00:03:28 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        return  last_good_candidate ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:46:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if  ( is_visible ( )  & &  absolute_border_box_rect ( ) . contains ( position . x ( ) ,  position . y ( ) ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-11 12:51:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        return  HitTestResult  {  const_cast < PaintableWithLines & > ( * this )  } ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-21 11:11:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    return  { } ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-11 00:03:28 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 23:13:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}