mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 13:12:46 +00:00 
			
		
		
		
	LibWeb: Dispatch "resize" events on the Window object
It's a little awkward that we do this in two places, but IPWV and OOPWV currently implement resizing a little differently from each other so we need to cover both paths.
This commit is contained in:
		
							parent
							
								
									d2d69f3efb
								
							
						
					
					
						commit
						efc6060df0
					
				
					 2 changed files with 13 additions and 4 deletions
				
			
		|  | @ -1,5 +1,5 @@ | |||
| /*
 | ||||
|  * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> | ||||
|  * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org> | ||||
|  * All rights reserved. | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without | ||||
|  | @ -25,12 +25,15 @@ | |||
|  */ | ||||
| 
 | ||||
| #include <LibWeb/DOM/Document.h> | ||||
| #include <LibWeb/DOM/Event.h> | ||||
| #include <LibWeb/DOM/Window.h> | ||||
| #include <LibWeb/HTML/HTMLAnchorElement.h> | ||||
| #include <LibWeb/InProcessWebView.h> | ||||
| #include <LibWeb/Layout/BreakNode.h> | ||||
| #include <LibWeb/Layout/InitialContainingBlockBox.h> | ||||
| #include <LibWeb/Layout/TextNode.h> | ||||
| #include <LibWeb/Page/Frame.h> | ||||
| #include <LibWeb/UIEvents/EventNames.h> | ||||
| 
 | ||||
| namespace Web { | ||||
| 
 | ||||
|  | @ -113,8 +116,10 @@ void Frame::set_viewport_rect(const Gfx::IntRect& rect) | |||
| 
 | ||||
|     if (m_size != rect.size()) { | ||||
|         m_size = rect.size(); | ||||
|         if (m_document) | ||||
|         if (m_document) { | ||||
|             m_document->window().dispatch_event(DOM::Event::create(UIEvents::EventNames::resize)); | ||||
|             m_document->update_layout(); | ||||
|         } | ||||
|         did_change = true; | ||||
|     } | ||||
| 
 | ||||
|  | @ -134,8 +139,10 @@ void Frame::set_size(const Gfx::IntSize& size) | |||
|     if (m_size == size) | ||||
|         return; | ||||
|     m_size = size; | ||||
|     if (m_document) | ||||
|     if (m_document) { | ||||
|         m_document->window().dispatch_event(DOM::Event::create(UIEvents::EventNames::resize)); | ||||
|         m_document->update_layout(); | ||||
|     } | ||||
| 
 | ||||
|     for (auto* client : m_viewport_clients) | ||||
|         client->frame_did_set_viewport_rect(viewport_rect()); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling