mirror of
https://github.com/servo/servo.git
synced 2025-10-03 01:59:14 +01:00
Allow WebViews and fonts to have a RenderingGroupId. (#39140)
Motivation: The font cache currently has to store a cache of Keys which need to be given by the webrender instance. Having a cache for every WebViewId in the future when we have every webview have the different webrender::DocumentId might be too wasteful to store this key cache per DocumentId. This proposes to include in the WebViewId another id, the RenderingGroupId. This id can be easily changed to be equivalent to the DocumentId when we support multiple DocumentIds for a unique Webrender instance. Additionally this will keep it easier to integrate the currently out of tree patches for multiple rendering contexts with different webrenders. Change: We introduce the RenderingGroupId in the WebViewId and allow a method to extract it. The font key cache uses this cache and forwards it to the Compositor when requesting new changes. The compositor currently ignores this id. Additionally, the WebView can return the RenderingGroupId. The WebViewId also has an appropiate constructor for specifying a RenderingGroupId. Because there currently will be only one RenderingGroupId the performance will be minimal. Signed-off-by: Narfinger <Narfinger@users.noreply.github.com> Testing: This should be covered by WPT tests and normal browsing behavior works fine. --------- Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This commit is contained in:
parent
32b656adf4
commit
e64f021550
18 changed files with 240 additions and 63 deletions
|
@ -14,7 +14,7 @@ use std::time::{SystemTime, UNIX_EPOCH};
|
|||
use base::Epoch;
|
||||
use base::cross_process_instant::CrossProcessInstant;
|
||||
use base::generic_channel::{GenericSender, RoutedReceiver};
|
||||
use base::id::{PipelineId, WebViewId};
|
||||
use base::id::{PipelineId, RenderingGroupId, WebViewId};
|
||||
use bitflags::bitflags;
|
||||
use compositing_traits::display_list::{CompositorDisplayListInfo, ScrollTree, ScrollType};
|
||||
use compositing_traits::rendering_context::RenderingContext;
|
||||
|
@ -792,11 +792,13 @@ impl IOCompositor {
|
|||
number_of_font_keys,
|
||||
number_of_font_instance_keys,
|
||||
result_sender,
|
||||
rendering_group_id,
|
||||
) => {
|
||||
self.handle_generate_font_keys(
|
||||
number_of_font_keys,
|
||||
number_of_font_instance_keys,
|
||||
result_sender,
|
||||
rendering_group_id,
|
||||
);
|
||||
},
|
||||
CompositorMsg::Viewport(webview_id, viewport_description) => {
|
||||
|
@ -834,11 +836,13 @@ impl IOCompositor {
|
|||
number_of_font_keys,
|
||||
number_of_font_instance_keys,
|
||||
result_sender,
|
||||
rendering_group_id,
|
||||
) => {
|
||||
self.handle_generate_font_keys(
|
||||
number_of_font_keys,
|
||||
number_of_font_instance_keys,
|
||||
result_sender,
|
||||
rendering_group_id,
|
||||
);
|
||||
},
|
||||
CompositorMsg::NewWebRenderFrameReady(..) => {
|
||||
|
@ -852,11 +856,13 @@ impl IOCompositor {
|
|||
}
|
||||
|
||||
/// Generate the font keys and send them to the `result_sender`.
|
||||
/// Currently `RenderingGroupId` is not used.
|
||||
fn handle_generate_font_keys(
|
||||
&self,
|
||||
number_of_font_keys: usize,
|
||||
number_of_font_instance_keys: usize,
|
||||
result_sender: GenericSender<(Vec<FontKey>, Vec<FontInstanceKey>)>,
|
||||
_rendering_group_id: RenderingGroupId,
|
||||
) {
|
||||
let font_keys = (0..number_of_font_keys)
|
||||
.map(|_| self.global.borrow().webrender_api.generate_font_key())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue