Skip to content

Commit

Permalink
Fix compilation errors due to the rebase
Browse files Browse the repository at this point in the history
It's too complicated to make all the commits in that branch compile properly.
  • Loading branch information
nox committed Aug 1, 2019
1 parent 317d700 commit f8341da
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 72 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/layout_2020/Cargo.toml
Expand Up @@ -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"}
Expand Down
2 changes: 1 addition & 1 deletion components/layout_2020/display_list/builder.rs
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion components/layout_2020/display_list/items.rs
Expand Up @@ -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;
Expand All @@ -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<ExternalScrollId, Vector2D<f32>>;
pub type ScrollOffsetMap = HashMap<ExternalScrollId, Vector2D<f32, LayoutPixel>>;
2 changes: 1 addition & 1 deletion components/layout_2020/display_list/webrender_helpers.rs
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion components/layout_2020/fragment.rs
Expand Up @@ -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};
Expand Down
47 changes: 8 additions & 39 deletions components/layout_2020/query.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -358,15 +358,11 @@ impl FragmentBorderBoxIterator for MarginRetrievingFragmentBorderBoxIterator {
}
}

pub fn process_content_box_request(
requested_node: OpaqueNode,
) -> Option<Rect<Au>> {
pub fn process_content_box_request(requested_node: OpaqueNode) -> Option<Rect<Au>> {
UnioningFragmentBorderBoxIterator::new(requested_node).rect
}

pub fn process_content_boxes_request(
requested_node: OpaqueNode,
) -> Vec<Rect<Au>> {
pub fn process_content_boxes_request(requested_node: OpaqueNode) -> Vec<Rect<Au>> {
// 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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -614,9 +609,7 @@ impl FragmentBorderBoxIterator for ParentOffsetBorderBoxIterator {
}
}

pub fn process_node_geometry_request(
requested_node: OpaqueNode,
) -> Rect<i32> {
pub fn process_node_geometry_request(requested_node: OpaqueNode) -> Rect<i32> {
FragmentLocatingFragmentIterator::new(requested_node).client_rect
}

Expand All @@ -629,9 +622,7 @@ pub fn process_node_scroll_id_request<N: LayoutNode>(
}

/// https://drafts.csswg.org/cssom-view/#scrolling-area
pub fn process_node_scroll_area_request(
requested_node: OpaqueNode,
) -> Rect<i32> {
pub fn process_node_scroll_area_request(requested_node: OpaqueNode) -> Rect<i32> {
let iterator = UnioningFragmentScrollAreaIterator::new(requested_node);
match iterator.overflow_direction {
OverflowDirection::RightAndDown => {
Expand Down Expand Up @@ -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,
};

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -999,17 +988,7 @@ fn inner_text_collection_steps<N: LayoutNode>(
}

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));
Expand All @@ -1020,13 +999,3 @@ fn inner_text_collection_steps<N: LayoutNode>(

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
}
41 changes: 15 additions & 26 deletions components/layout_thread_2020/lib.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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};
Expand Down Expand Up @@ -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<Au>,
viewport_size: UntypedSize2D<Au>,

/// A mutex to allow for fast, read-only RPC of layout's internal data
/// structures, while still letting the LayoutThread modify them.
Expand Down Expand Up @@ -228,7 +228,7 @@ pub struct LayoutThread {
load_webfonts_synchronously: bool,

/// 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.
/// If unspecified, will use the platform default setting.
Expand Down Expand Up @@ -506,7 +506,7 @@ impl LayoutThread {
paint_time_metrics: PaintTimeMetrics,
busy: Arc<AtomicBool>,
load_webfonts_synchronously: bool,
initial_window_size: TypedSize2D<u32, DeviceIndependentPixel>,
initial_window_size: Size2D<u32, DeviceIndependentPixel>,
device_pixels_per_px: Option<f32>,
dump_display_list: bool,
dump_display_list_json: bool,
Expand All @@ -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.
Expand Down Expand Up @@ -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,
);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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) };
Expand Down Expand Up @@ -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()),
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -1708,8 +1697,8 @@ impl RegisteredSpeculativePainter for RegisteredPainterImpl {
impl Painter for RegisteredPainterImpl {
fn draw_a_paint_image(
&self,
size: TypedSize2D<f32, CSSPixel>,
device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>,
size: Size2D<f32, CSSPixel>,
device_pixel_ratio: Scale<f32, CSSPixel, DevicePixel>,
properties: Vec<(Atom, String)>,
arguments: Vec<String>,
) -> Result<DrawAPaintImageResult, PaintWorkletError> {
Expand Down
Expand Up @@ -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 {
Expand Down

0 comments on commit f8341da

Please sign in to comment.