mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-31 13:20:59 +00:00 
			
		
		
		
	LibWeb: Layout viewport rect was lagging behind when resizing
Layout was using an outdated viewport rect that we set *after* doing a layout due to resize. That meant that layout-in-response-to-resize was always lagging behind the current size of the view. The root of this problem was how Frame kept both a viewport rect (with both scroll offset and size) and a frame size. To fix this, only store the viewport scroll offset, and always use the frame size. This way they can't get out of sync and the problem goes away. :^) Fixes #4250.
This commit is contained in:
		
							parent
							
								
									766db673c1
								
							
						
					
					
						commit
						15e35b0d71
					
				
				
				Notes:
				
					sideshowbarker
				
				2024-07-19 01:04:50 +09:00 
				
			
			Author: https://github.com/awesomekling
Commit: 15e35b0d71
			
					 4 changed files with 11 additions and 11 deletions
				
			
		|  | @ -248,7 +248,7 @@ void InProcessWebView::layout_and_sync_size() | |||
|         set_content_size(layout_root()->size().to_type<int>()); | ||||
|     } | ||||
| 
 | ||||
|     page().main_frame().set_viewport_rect(viewport_rect_in_content_coordinates()); | ||||
|     page().main_frame().set_viewport_scroll_offset({ horizontal_scrollbar().value(), vertical_scrollbar().value() }); | ||||
| } | ||||
| 
 | ||||
| void InProcessWebView::resize_event(GUI::ResizeEvent& event) | ||||
|  | @ -409,7 +409,7 @@ void InProcessWebView::set_document(DOM::Document* document) | |||
| 
 | ||||
| void InProcessWebView::did_scroll() | ||||
| { | ||||
|     page().main_frame().set_viewport_rect(viewport_rect_in_content_coordinates()); | ||||
|     page().main_frame().set_viewport_scroll_offset({ horizontal_scrollbar().value(), vertical_scrollbar().value() }); | ||||
|     page().main_frame().did_scroll({}); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling