Start supporting images in layout 2020

This commit is contained in:
Anthony Ramine 2019-11-29 09:28:44 +01:00 committed by Simon Sapin
parent f24e8d0557
commit 5a360ac63d
11 changed files with 254 additions and 47 deletions

View file

@ -10,12 +10,13 @@ use std::sync::Arc;
use style::properties::ComputedValues;
use style::values::computed::Length;
use style::Zero;
use webrender_api::FontInstanceKey;
use webrender_api::{FontInstanceKey, ImageKey};
pub(crate) enum Fragment {
Box(BoxFragment),
Anonymous(AnonymousFragment),
Text(TextFragment),
Image(ImageFragment),
}
pub(crate) struct BoxFragment {
@ -61,6 +62,12 @@ pub(crate) struct TextFragment {
pub glyphs: Vec<Arc<GlyphStore>>,
}
pub(crate) struct ImageFragment {
pub style: ServoArc<ComputedValues>,
pub content_rect: Rect<Length>,
pub image_key: ImageKey,
}
impl AnonymousFragment {
pub fn no_op(mode: (WritingMode, Direction)) -> Self {
Self {