mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:12:43 +00:00 
			
		
		
		
	LibWeb: Make tiled backgrounds scroll with content
Previously the page background was always draw relative to the viewport instead of following with the content. This should eventually become an opt-in mode (via CSS "background-attachment") but for now let's have the default behavior be that backgrounds scroll with content. Also take this opportunity to move the background painting code from the two web views to a shared location in InitialContainingBlockBox.
This commit is contained in:
		
							parent
							
								
									6c087480cf
								
							
						
					
					
						commit
						7f9f916470
					
				
					 4 changed files with 21 additions and 15 deletions
				
			
		|  | @ -262,14 +262,7 @@ void InProcessWebView::paint_event(GUI::PaintEvent& event) | |||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     painter.fill_rect(event.rect(), document()->background_color(palette())); | ||||
| 
 | ||||
|     if (auto background_bitmap = document()->background_image()) { | ||||
|         painter.draw_tiled_bitmap(event.rect(), *background_bitmap); | ||||
|     } | ||||
| 
 | ||||
|     painter.translate(frame_thickness(), frame_thickness()); | ||||
|     painter.translate(-horizontal_scrollbar().value(), -vertical_scrollbar().value()); | ||||
| 
 | ||||
|     PaintContext context(painter, palette(), { horizontal_scrollbar().value(), vertical_scrollbar().value() }); | ||||
|     context.set_should_show_line_box_borders(m_should_show_line_box_borders); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling