mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Add support for <iframe> elements for Layout 2020
This change adds support for the <iframe> element to Layout 2020. In addition, certain aspects of the implementation are made the same between both layout systems.
This commit is contained in:
parent
e09acf88f4
commit
9e0b41ebc4
38 changed files with 281 additions and 164 deletions
|
@ -10,8 +10,10 @@ use crate::replaced::IntrinsicSizes;
|
|||
use crate::style_ext::ComputedValuesExt;
|
||||
use embedder_traits::Cursor;
|
||||
use euclid::{Point2D, SideOffsets2D, Size2D};
|
||||
use fnv::FnvHashMap;
|
||||
use gfx::text::glyph::GlyphStore;
|
||||
use mitochondria::OnceCell;
|
||||
use msg::constellation_msg::BrowsingContextId;
|
||||
use net_traits::image_cache::UsePlaceholder;
|
||||
use script_traits::compositor::CompositorDisplayListInfo;
|
||||
use std::sync::Arc;
|
||||
|
@ -22,6 +24,7 @@ use style::properties::ComputedValues;
|
|||
use style::values::computed::{BorderStyle, Length, LengthPercentage};
|
||||
use style::values::specified::text::TextDecorationLine;
|
||||
use style::values::specified::ui::CursorKind;
|
||||
use style_traits::CSSPixel;
|
||||
use webrender_api::{self as wr, units};
|
||||
|
||||
mod background;
|
||||
|
@ -48,6 +51,7 @@ pub struct DisplayListBuilder<'a> {
|
|||
pub context: &'a LayoutContext<'a>,
|
||||
pub wr: wr::DisplayListBuilder,
|
||||
pub compositor_info: CompositorDisplayListInfo,
|
||||
pub iframe_sizes: FnvHashMap<BrowsingContextId, Size2D<f32, CSSPixel>>,
|
||||
|
||||
/// Contentful paint, for the purpose of
|
||||
/// https://w3c.github.io/paint-timing/#first-contentful-paint
|
||||
|
@ -69,6 +73,7 @@ impl<'a> DisplayListBuilder<'a> {
|
|||
context,
|
||||
wr: wr::DisplayListBuilder::new(pipeline_id, fragment_tree.scrollable_overflow()),
|
||||
compositor_info: CompositorDisplayListInfo::default(),
|
||||
iframe_sizes: FnvHashMap::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,6 +147,34 @@ impl Fragment {
|
|||
Visibility::Hidden => (),
|
||||
Visibility::Collapse => (),
|
||||
},
|
||||
Fragment::IFrame(iframe) => match iframe.style.get_inherited_box().visibility {
|
||||
Visibility::Visible => {
|
||||
builder.is_contentful = true;
|
||||
let rect = iframe
|
||||
.rect
|
||||
.to_physical(iframe.style.writing_mode, containing_block)
|
||||
.translate(containing_block.origin.to_vector());
|
||||
|
||||
builder.iframe_sizes.insert(
|
||||
iframe.browsing_context_id,
|
||||
Size2D::new(rect.size.width.px(), rect.size.height.px()),
|
||||
);
|
||||
|
||||
let common = builder.common_properties(rect.to_webrender(), &iframe.style);
|
||||
builder.wr.push_iframe(
|
||||
rect.to_webrender(),
|
||||
common.clip_rect,
|
||||
&wr::SpaceAndClipInfo {
|
||||
spatial_id: common.spatial_id,
|
||||
clip_id: common.clip_id,
|
||||
},
|
||||
iframe.pipeline_id.to_webrender(),
|
||||
true,
|
||||
);
|
||||
},
|
||||
Visibility::Hidden => (),
|
||||
Visibility::Collapse => (),
|
||||
},
|
||||
Fragment::Text(t) => match t.parent_style.get_inherited_box().visibility {
|
||||
Visibility::Visible => {
|
||||
self.build_display_list_for_text_fragment(t, builder, containing_block)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue