Make layout use available image data before querying the image cache.

This commit is contained in:
Josh Matthews 2018-10-12 12:35:12 -04:00
parent 5f463d3c97
commit 49d2ea4f74
8 changed files with 102 additions and 5 deletions

View file

@ -13,10 +13,12 @@ use atomic_refcell::AtomicRef;
use gfx_traits::{ByteIndex, FragmentType, combine_id_with_fragment_type};
use html5ever::{Namespace, LocalName};
use msg::constellation_msg::{BrowsingContextId, PipelineId};
use net_traits::image::base::{Image, ImageMetadata};
use range::Range;
use servo_arc::Arc;
use servo_url::ServoUrl;
use std::fmt::Debug;
use std::sync::Arc as StdArc;
use style::attr::AttrValue;
use style::context::SharedStyleContext;
use style::data::ElementData;
@ -276,6 +278,9 @@ pub trait ThreadSafeLayoutNode:
/// If this is an image element, returns its current-pixel-density. If this is not an image element, fails.
fn image_density(&self) -> Option<f64>;
/// If this is an image element, returns its image data. Otherwise, returns `None`.
fn image_data(&self) -> Option<(Option<StdArc<Image>>, Option<ImageMetadata>)>;
fn canvas_data(&self) -> Option<HTMLCanvasData>;
fn svg_data(&self) -> Option<SVGSVGData>;