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