diff --git a/Cargo.lock b/Cargo.lock index 80ba227042eb..e1301f6a7d2f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2332,7 +2332,7 @@ name = "layout_2020" version = "0.0.1" dependencies = [ "app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "gfx 0.0.1", "gfx_traits 0.0.1", diff --git a/components/layout_2020/Cargo.toml b/components/layout_2020/Cargo.toml index ece58df9a0d1..96ca5265f288 100644 --- a/components/layout_2020/Cargo.toml +++ b/components/layout_2020/Cargo.toml @@ -14,7 +14,7 @@ doctest = false [dependencies] app_units = "0.7" -euclid = "0.19" +euclid = "0.20" fnv = "1.0" gfx = {path = "../gfx"} gfx_traits = {path = "../gfx_traits"} diff --git a/components/layout_2020/display_list/builder.rs b/components/layout_2020/display_list/builder.rs index bc3756654faf..5cba1e7f7b11 100644 --- a/components/layout_2020/display_list/builder.rs +++ b/components/layout_2020/display_list/builder.rs @@ -10,7 +10,7 @@ use crate::display_list::items::OpaqueNode; use app_units::Au; -use euclid::Point2D; +use euclid::default::Point2D; use fnv::FnvHashMap; use gfx::text::glyph::ByteIndex; use gfx::text::TextRun; diff --git a/components/layout_2020/display_list/items.rs b/components/layout_2020/display_list/items.rs index 8cfa145b43c6..68ec3fcc1885 100644 --- a/components/layout_2020/display_list/items.rs +++ b/components/layout_2020/display_list/items.rs @@ -6,6 +6,7 @@ use euclid::Vector2D; use gfx_traits; use std::collections::HashMap; use std::f32; +use webrender_api::units::LayoutPixel; use webrender_api::ExternalScrollId; pub use style::dom::OpaqueNode; @@ -20,4 +21,4 @@ impl gfx_traits::DisplayList for DisplayList { } /// The type of the scroll offset list. This is only populated if WebRender is in use. -pub type ScrollOffsetMap = HashMap>; +pub type ScrollOffsetMap = HashMap>; diff --git a/components/layout_2020/display_list/webrender_helpers.rs b/components/layout_2020/display_list/webrender_helpers.rs index 801e404a64bc..23ca4138e3e0 100644 --- a/components/layout_2020/display_list/webrender_helpers.rs +++ b/components/layout_2020/display_list/webrender_helpers.rs @@ -4,8 +4,8 @@ use crate::display_list::items::DisplayList; use msg::constellation_msg::PipelineId; +use webrender_api::units::LayoutSize; use webrender_api::{self, DisplayListBuilder}; -use webrender_api::units::{LayoutSize}; pub trait WebRenderDisplayListConverter { fn convert_to_webrender(&mut self, pipeline_id: PipelineId) -> DisplayListBuilder; diff --git a/components/layout_2020/fragment.rs b/components/layout_2020/fragment.rs index b48aa1967857..aa0e7a2bb0ee 100644 --- a/components/layout_2020/fragment.rs +++ b/components/layout_2020/fragment.rs @@ -8,7 +8,7 @@ use crate::context::LayoutContext; use crate::display_list::items::OpaqueNode; use crate::ServoArc; use app_units::Au; -use euclid::Rect; +use euclid::default::Rect; use script_layout_interface::wrapper_traits::{PseudoElementType, ThreadSafeLayoutNode}; use serde::ser::{Serialize, SerializeStruct, Serializer}; use style::logical_geometry::{LogicalMargin, LogicalRect}; diff --git a/components/layout_2020/query.rs b/components/layout_2020/query.rs index 2dfb2eebaa07..4b7ab517ff43 100644 --- a/components/layout_2020/query.rs +++ b/components/layout_2020/query.rs @@ -10,7 +10,7 @@ use crate::display_list::IndexableText; use crate::fragment::{Fragment, FragmentBorderBoxIterator}; use crate::opaque_node::OpaqueNodeMethods; use app_units::Au; -use euclid::{Point2D, Rect, Size2D, Vector2D}; +use euclid::default::{Point2D, Rect, Size2D, Vector2D}; use ipc_channel::ipc::IpcSender; use msg::constellation_msg::PipelineId; use script_layout_interface::rpc::TextIndexResponse; @@ -358,15 +358,11 @@ impl FragmentBorderBoxIterator for MarginRetrievingFragmentBorderBoxIterator { } } -pub fn process_content_box_request( - requested_node: OpaqueNode, -) -> Option> { +pub fn process_content_box_request(requested_node: OpaqueNode) -> Option> { UnioningFragmentBorderBoxIterator::new(requested_node).rect } -pub fn process_content_boxes_request( - requested_node: OpaqueNode, -) -> Vec> { +pub fn process_content_boxes_request(requested_node: OpaqueNode) -> Vec> { // FIXME(pcwalton): This has not been updated to handle the stacking context relative // stuff. So the position is wrong in most cases. CollectingFragmentBorderBoxIterator::new(requested_node).rects @@ -583,7 +579,6 @@ impl FragmentBorderBoxIterator for ParentOffsetBorderBoxIterator { // 2) Is static position *and* is a table or table cell // 3) Is not static position (true, _, _) | - (false, Position::Sticky, _) | (false, Position::Absolute, _) | (false, Position::Relative, _) | (false, Position::Fixed, _) => true, @@ -614,9 +609,7 @@ impl FragmentBorderBoxIterator for ParentOffsetBorderBoxIterator { } } -pub fn process_node_geometry_request( - requested_node: OpaqueNode, -) -> Rect { +pub fn process_node_geometry_request(requested_node: OpaqueNode) -> Rect { FragmentLocatingFragmentIterator::new(requested_node).client_rect } @@ -629,9 +622,7 @@ pub fn process_node_scroll_id_request( } /// https://drafts.csswg.org/cssom-view/#scrolling-area -pub fn process_node_scroll_area_request( - requested_node: OpaqueNode, -) -> Rect { +pub fn process_node_scroll_area_request(requested_node: OpaqueNode) -> Rect { let iterator = UnioningFragmentScrollAreaIterator::new(requested_node); match iterator.overflow_direction { OverflowDirection::RightAndDown => { @@ -768,7 +759,7 @@ where }; let positioned = match style.get_box().position { - Position::Relative | Position::Sticky | Position::Fixed | Position::Absolute => true, + Position::Relative | Position::Fixed | Position::Absolute => true, _ => false, }; @@ -855,9 +846,7 @@ where } } -pub fn process_offset_parent_query( - requested_node: OpaqueNode, -) -> OffsetParentResponse { +pub fn process_offset_parent_query(requested_node: OpaqueNode) -> OffsetParentResponse { let iterator = ParentOffsetBorderBoxIterator::new(requested_node); let node_offset_box = iterator.node_offset_box; @@ -999,17 +988,7 @@ fn inner_text_collection_steps( } match display { - Display::TableCell if !is_last_table_cell() => { - // Step 6. - items.push(InnerTextItem::Text(String::from("\u{0009}" /* tab */))); - }, - Display::TableRow if !is_last_table_row() => { - // Step 7. - items.push(InnerTextItem::Text(String::from( - "\u{000A}", /* line feed */ - ))); - }, - Display::Block | Display::Flex | Display::TableCaption | Display::Table => { + Display::Block => { // Step 9. items.insert(0, InnerTextItem::RequiredLineBreakCount(1)); items.push(InnerTextItem::RequiredLineBreakCount(1)); @@ -1020,13 +999,3 @@ fn inner_text_collection_steps( results.append(&mut items); } - -fn is_last_table_cell() -> bool { - // FIXME(ferjm) Implement this. - false -} - -fn is_last_table_row() -> bool { - // FIXME(ferjm) Implement this. - false -} diff --git a/components/layout_thread_2020/lib.rs b/components/layout_thread_2020/lib.rs index 2e3f5956e43c..ad08ea4dc326 100644 --- a/components/layout_thread_2020/lib.rs +++ b/components/layout_thread_2020/lib.rs @@ -26,7 +26,7 @@ use crate::dom_wrapper::{ServoLayoutDocument, ServoLayoutElement, ServoLayoutNod use app_units::Au; use crossbeam_channel::{unbounded, Receiver, Sender}; use embedder_traits::resources::{self, Resource}; -use euclid::{Point2D, Rect, Size2D, TypedScale, TypedSize2D}; +use euclid::{default::Size2D as UntypedSize2D, Point2D, Rect, Scale, Size2D}; use fnv::FnvHashMap; use fxhash::FxHashMap; use gfx::font; @@ -57,8 +57,8 @@ use metrics::{PaintTimeMetrics, ProfilerMetadataFactory, ProgressiveWebMetric}; use msg::constellation_msg::{ BackgroundHangMonitor, BackgroundHangMonitorRegister, HangAnnotation, }; -use msg::constellation_msg::{MonitoredComponentId, TopLevelBrowsingContextId}; use msg::constellation_msg::{LayoutHangAnnotation, MonitoredComponentType, PipelineId}; +use msg::constellation_msg::{MonitoredComponentId, TopLevelBrowsingContextId}; use net_traits::image_cache::ImageCache; use parking_lot::RwLock; use profile_traits::mem::{self as profile_mem, Report, ReportKind, ReportsChan}; @@ -194,7 +194,7 @@ pub struct LayoutThread { /// The size of the viewport. This may be different from the size of the screen due to viewport /// constraints. - viewport_size: Size2D, + viewport_size: UntypedSize2D, /// A mutex to allow for fast, read-only RPC of layout's internal data /// structures, while still letting the LayoutThread modify them. @@ -228,7 +228,7 @@ pub struct LayoutThread { load_webfonts_synchronously: bool, /// The initial request size of the window - initial_window_size: TypedSize2D, + initial_window_size: Size2D, /// The ratio of device pixels per px at the default scale. /// If unspecified, will use the platform default setting. @@ -506,7 +506,7 @@ impl LayoutThread { paint_time_metrics: PaintTimeMetrics, busy: Arc, load_webfonts_synchronously: bool, - initial_window_size: TypedSize2D, + initial_window_size: Size2D, device_pixels_per_px: Option, dump_display_list: bool, dump_display_list_json: bool, @@ -521,8 +521,8 @@ impl LayoutThread { // but it will be set correctly when the initial reflow takes place. let device = Device::new( MediaType::screen(), - initial_window_size.to_f32() * TypedScale::new(1.0), - TypedScale::new(device_pixels_per_px.unwrap_or(1.0)), + initial_window_size.to_f32() * Scale::new(1.0), + Scale::new(device_pixels_per_px.unwrap_or(1.0)), ); // Create the channel on which new animations can be sent. @@ -785,7 +785,7 @@ impl LayoutThread { let point = Point2D::new(-state.scroll_offset.x, -state.scroll_offset.y); let mut txn = webrender_api::Transaction::new(); txn.scroll_node_with_id( - webrender_api::units::LayoutPoint::from_untyped(&point), + webrender_api::units::LayoutPoint::from_untyped(point), state.scroll_id, webrender_api::ScrollClamping::ToContentBounds, ); @@ -1035,7 +1035,7 @@ impl LayoutThread { epoch.next(); self.epoch.set(epoch); - let viewport_size = webrender_api::units::LayoutSize::from_untyped(&viewport_size); + let viewport_size = webrender_api::units::LayoutSize::from_untyped(viewport_size); // Observe notifications about rendered frames if needed right before // sending the display list to WebRender in order to set time related @@ -1372,11 +1372,7 @@ impl LayoutThread { } self.first_reflow.set(false); - self.respond_to_query_if_necessary( - &data.reflow_goal, - &mut *rw_data, - &mut layout_context, - ); + self.respond_to_query_if_necessary(&data.reflow_goal, &mut *rw_data, &mut layout_context); } fn respond_to_query_if_necessary( @@ -1405,8 +1401,7 @@ impl LayoutThread { rw_data.client_rect_response = process_node_geometry_request(node); }, &QueryMsg::NodeScrollGeometryQuery(node) => { - rw_data.scroll_area_response = - process_node_scroll_area_request(node); + rw_data.scroll_area_response = process_node_scroll_area_request(node); }, &QueryMsg::NodeScrollIdQuery(node) => { let node = unsafe { ServoLayoutNode::new(&node) }; @@ -1435,8 +1430,7 @@ impl LayoutThread { // particular pipeline, so we need to tell WebRender about that. flags.insert(webrender_api::HitTestFlags::POINT_RELATIVE_TO_PIPELINE_VIEWPORT); - let client_point = - webrender_api::units::WorldPoint::from_untyped(&client_point); + let client_point = webrender_api::units::WorldPoint::from_untyped(client_point); let results = self.webrender_api.hit_test( self.webrender_document, Some(self.id.to_webrender()), @@ -1534,12 +1528,7 @@ impl LayoutThread { || {}, ); - self.perform_post_main_layout_passes( - root_flow, - reflow_goal, - document, - rw_data, - ); + self.perform_post_main_layout_passes(root_flow, reflow_goal, document, rw_data); } fn perform_post_main_layout_passes( @@ -1708,8 +1697,8 @@ impl RegisteredSpeculativePainter for RegisteredPainterImpl { impl Painter for RegisteredPainterImpl { fn draw_a_paint_image( &self, - size: TypedSize2D, - device_pixel_ratio: TypedScale, + size: Size2D, + device_pixel_ratio: Scale, properties: Vec<(Atom, String)>, arguments: Vec, ) -> Result { diff --git a/components/style/properties/longhands/inherited_text.mako.rs b/components/style/properties/longhands/inherited_text.mako.rs index 01e84cee2ec9..f45369c27c77 100644 --- a/components/style/properties/longhands/inherited_text.mako.rs +++ b/components/style/properties/longhands/inherited_text.mako.rs @@ -196,7 +196,7 @@ ${helpers.predefined_type( spec="https://drafts.csswg.org/css-text/#propdef-white-space" servo_restyle_damage="rebuild_and_reflow" > - % if engine == "servo-2013": + % if engine in ["servo-2013", "servo-2020"]: impl SpecifiedValue { pub fn allow_wrap(&self) -> bool { match *self {