Replace DisplayList::is_contentful with tracking during conversion to WR display lists

This commit is contained in:
Simon Sapin 2019-09-06 17:11:36 +02:00
parent 526619a78a
commit e9f7079c70
8 changed files with 53 additions and 42 deletions

View file

@ -3,7 +3,6 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use euclid::Vector2D;
use gfx_traits;
use std::collections::HashMap;
use std::f32;
use webrender_api::units::LayoutPixel;
@ -14,11 +13,5 @@ pub use style::dom::OpaqueNode;
#[derive(Serialize)]
pub struct DisplayList {}
impl gfx_traits::DisplayList for DisplayList {
fn is_contentful(&self) -> bool {
false
}
}
/// The type of the scroll offset list. This is only populated if WebRender is in use.
pub type ScrollOffsetMap = HashMap<ExternalScrollId, Vector2D<f32, LayoutPixel>>;

View file

@ -7,8 +7,17 @@ use msg::constellation_msg::PipelineId;
use webrender_api::units::LayoutSize;
use webrender_api::{self, DisplayListBuilder};
/// Contentful paint, for the purpose of
/// https://w3c.github.io/paint-timing/#first-contentful-paint
/// (i.e. the display list contains items of type text,
/// image, non-white canvas or SVG). Used by metrics.
pub struct IsContentful(pub bool);
impl DisplayList {
pub fn convert_to_webrender(&mut self, pipeline_id: PipelineId) -> DisplayListBuilder {
pub fn convert_to_webrender(
&mut self,
pipeline_id: PipelineId,
) -> (DisplayListBuilder, IsContentful) {
let webrender_pipeline = pipeline_id.to_webrender();
let builder = DisplayListBuilder::with_capacity(
@ -17,6 +26,8 @@ impl DisplayList {
1024 * 1024, // 1 MB of space
);
builder
let is_contentful = IsContentful(false);
(builder, is_contentful)
}
}