mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 13:32:45 +00:00 
			
		
		
		
	WebContent+LibWebView: Add support for user style sheets
This commit is contained in:
		
							parent
							
								
									6dcd8d4a2c
								
							
						
					
					
						commit
						ec340f03a5
					
				
					 7 changed files with 24 additions and 1 deletions
				
			
		|  | @ -516,4 +516,9 @@ void OutOfProcessWebView::set_content_scales_to_viewport(bool b) | |||
|     m_content_scales_to_viewport = b; | ||||
| } | ||||
| 
 | ||||
| void OutOfProcessWebView::set_user_style_sheet(String source) | ||||
| { | ||||
|     client().async_set_user_style(source); | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -54,6 +54,8 @@ public: | |||
|     // In practice, this means that OOPWV may render scaled stale versions of the content while resizing.
 | ||||
|     void set_content_scales_to_viewport(bool); | ||||
| 
 | ||||
|     void set_user_style_sheet(String source); | ||||
| 
 | ||||
| private: | ||||
|     OutOfProcessWebView(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| /*
 | ||||
|  * Copyright (c) 2020-2023, Andreas Kling <kling@serenityos.org> | ||||
|  * Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org> | ||||
|  * Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org> | ||||
|  * Copyright (c) 2021-2023, Linus Groh <linusg@serenityos.org> | ||||
|  * Copyright (c) 2022, Tobias Christiansen <tobyase@serenityos.org> | ||||
|  * Copyright (c) 2022, Tim Flynn <trflynn89@serenityos.org> | ||||
|  | @ -859,6 +859,11 @@ void ConnectionFromClient::toggle_media_controls_state() | |||
|     m_page_host->toggle_media_controls_state().release_value_but_fixme_should_propagate_errors(); | ||||
| } | ||||
| 
 | ||||
| void ConnectionFromClient::set_user_style(String const& source) | ||||
| { | ||||
|     m_page_host->set_user_style(source); | ||||
| } | ||||
| 
 | ||||
| void ConnectionFromClient::inspect_accessibility_tree() | ||||
| { | ||||
|     if (auto* doc = page().top_level_browsing_context().active_document()) { | ||||
|  |  | |||
|  | @ -102,6 +102,8 @@ private: | |||
|     virtual void toggle_media_loop_state() override; | ||||
|     virtual void toggle_media_controls_state() override; | ||||
| 
 | ||||
|     virtual void set_user_style(String const&) override; | ||||
| 
 | ||||
|     virtual Messages::WebContentServer::TakeDocumentScreenshotResponse take_document_screenshot() override; | ||||
| 
 | ||||
|     virtual Messages::WebContentServer::GetLocalStorageEntriesResponse get_local_storage_entries() override; | ||||
|  |  | |||
|  | @ -366,6 +366,11 @@ Web::WebIDL::ExceptionOr<void> PageHost::toggle_media_controls_state() | |||
|     return page().toggle_media_controls_state(); | ||||
| } | ||||
| 
 | ||||
| void PageHost::set_user_style(String source) | ||||
| { | ||||
|     page().set_user_style(source); | ||||
| } | ||||
| 
 | ||||
| void PageHost::page_did_request_accept_dialog() | ||||
| { | ||||
|     m_client.async_did_request_accept_dialog(); | ||||
|  |  | |||
|  | @ -56,6 +56,8 @@ public: | |||
| 
 | ||||
|     [[nodiscard]] Gfx::Color background_color() const; | ||||
| 
 | ||||
|     void set_user_style(String source); | ||||
| 
 | ||||
| private: | ||||
|     // ^PageClient
 | ||||
|     virtual bool is_connection_open() const override; | ||||
|  |  | |||
|  | @ -83,4 +83,6 @@ endpoint WebContentServer | |||
|     toggle_media_mute_state() =| | ||||
|     toggle_media_loop_state() =| | ||||
|     toggle_media_controls_state() =| | ||||
| 
 | ||||
|     set_user_style(String source) =| | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Sam Atkins
						Sam Atkins