From 4ab3936ebbee363daec7a079b6940618004dea9a Mon Sep 17 00:00:00 2001 From: Nelson Carrillo Date: Fri, 20 Apr 2018 22:59:28 -0400 Subject: [PATCH] Remove layer space --- webrender/src/batch.rs | 8 +- webrender/src/border.rs | 96 +++++----- webrender/src/box_shadow.rs | 18 +- webrender/src/clip.rs | 68 ++++---- webrender/src/clip_scroll_node.rs | 102 +++++------ webrender/src/clip_scroll_tree.rs | 32 ++-- webrender/src/display_list_flattener.rs | 222 ++++++++++++------------ webrender/src/ellipse.rs | 20 +-- webrender/src/frame_builder.rs | 14 +- webrender/src/glyph_rasterizer.rs | 6 +- webrender/src/gpu_types.rs | 10 +- webrender/src/hit_test.rs | 28 +-- webrender/src/image.rs | 28 +-- webrender/src/picture.rs | 8 +- webrender/src/prim_store.rs | 122 ++++++------- webrender/src/render_backend.rs | 4 +- webrender/src/scene.rs | 6 +- webrender/src/segment.rs | 160 ++++++++--------- webrender/src/tiling.rs | 6 +- webrender/src/util.rs | 21 ++- webrender_api/src/display_item.rs | 11 +- webrender_api/src/display_list.rs | 6 +- webrender_api/src/units.rs | 48 ++--- wrench/src/scene.rs | 6 +- wrench/src/wrench.rs | 14 +- wrench/src/yaml_frame_reader.rs | 8 +- wrench/src/yaml_frame_writer.rs | 2 +- 27 files changed, 530 insertions(+), 544 deletions(-) diff --git a/webrender/src/batch.rs b/webrender/src/batch.rs index 224ea27d84..ca3f40cd65 100644 --- a/webrender/src/batch.rs +++ b/webrender/src/batch.rs @@ -3,9 +3,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use api::{AlphaType, ClipMode, DeviceIntRect, DeviceIntSize}; -use api::{DeviceUintRect, DeviceUintPoint, DeviceUintSize, ExternalImageType, FilterOp, ImageRendering, LayerRect}; +use api::{DeviceUintRect, DeviceUintPoint, DeviceUintSize, ExternalImageType, FilterOp, ImageRendering, LayoutRect}; use api::{DeviceIntPoint, SubpixelDirection, YuvColorSpace, YuvFormat}; -use api::{LayerToWorldTransform, WorldPixel}; +use api::{LayoutToWorldTransform, WorldPixel}; use border::{BorderCornerInstance, BorderCornerSide, BorderEdgeKind}; use clip::{ClipSource, ClipStore, ClipWorkItem}; use clip_scroll_tree::{CoordinateSystemId}; @@ -1587,8 +1587,8 @@ pub fn resolve_image( /// `anchor` here is an index that's going to be preserved in all the /// splits of the polygon. fn make_polygon( - rect: LayerRect, - transform: &LayerToWorldTransform, + rect: LayoutRect, + transform: &LayoutToWorldTransform, anchor: usize, ) -> Polygon { let mat = TypedTransform3D::row_major( diff --git a/webrender/src/border.rs b/webrender/src/border.rs index 417809126b..789c150925 100644 --- a/webrender/src/border.rs +++ b/webrender/src/border.rs @@ -2,8 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use api::{BorderRadius, BorderSide, BorderStyle, BorderWidths, ClipMode, ColorF, LayerPoint}; -use api::{LayerPrimitiveInfo, LayerRect, LayerSize, NormalBorder, RepeatMode, TexelRect}; +use api::{BorderRadius, BorderSide, BorderStyle, BorderWidths, ClipMode, ColorF, LayoutPoint}; +use api::{LayoutPrimitiveInfo, LayoutRect, LayoutSize, NormalBorder, RepeatMode, TexelRect}; use clip::ClipSource; use ellipse::Ellipse; use display_list_flattener::DisplayListFlattener; @@ -42,8 +42,8 @@ pub enum BorderCornerKind { Clip(BorderCornerInstance), Mask( BorderCornerClipData, - LayerSize, - LayerSize, + LayoutSize, + LayoutSize, BorderCornerClipKind, ), } @@ -54,10 +54,10 @@ impl BorderCornerKind { width0: f32, width1: f32, corner: BorderCorner, - radius: LayerSize, - border_rect: LayerRect, + radius: LayoutSize, + border_rect: LayoutRect, ) -> BorderCornerKind { - let size = LayerSize::new(width0.max(radius.width), width1.max(radius.height)); + let size = LayoutSize::new(width0.max(radius.width), width1.max(radius.height)); let (origin, clip_center) = match corner { BorderCorner::TopLeft => { let origin = border_rect.origin; @@ -65,11 +65,11 @@ impl BorderCornerKind { (origin, clip_center) } BorderCorner::TopRight => { - let origin = LayerPoint::new( + let origin = LayoutPoint::new( border_rect.origin.x + border_rect.size.width - size.width, border_rect.origin.y, ); - let clip_center = origin + LayerSize::new(0.0, size.height); + let clip_center = origin + LayoutSize::new(0.0, size.height); (origin, clip_center) } BorderCorner::BottomRight => { @@ -78,24 +78,24 @@ impl BorderCornerKind { (origin, clip_center) } BorderCorner::BottomLeft => { - let origin = LayerPoint::new( + let origin = LayoutPoint::new( border_rect.origin.x, border_rect.origin.y + border_rect.size.height - size.height, ); - let clip_center = origin + LayerSize::new(size.width, 0.0); + let clip_center = origin + LayoutSize::new(size.width, 0.0); (origin, clip_center) } }; let clip_data = BorderCornerClipData { - corner_rect: LayerRect::new(origin, size), + corner_rect: LayoutRect::new(origin, size), clip_center, corner: pack_as_float(corner as u32), kind: pack_as_float(kind as u32), }; - BorderCornerKind::Mask(clip_data, radius, LayerSize::new(width0, width1), kind) + BorderCornerKind::Mask(clip_data, radius, LayoutSize::new(width0, width1), kind) } - fn get_radius(&self, original_radius: &LayerSize) -> LayerSize { + fn get_radius(&self, original_radius: &LayoutSize) -> LayoutSize { match *self { BorderCornerKind::Solid => *original_radius, BorderCornerKind::Clip(..) => *original_radius, @@ -117,9 +117,9 @@ fn get_corner( width0: f32, edge1: &BorderSide, width1: f32, - radius: &LayerSize, + radius: &LayoutSize, corner: BorderCorner, - border_rect: &LayerRect, + border_rect: &LayoutRect, ) -> BorderCornerKind { // If both widths are zero, a corner isn't formed. if width0 == 0.0 && width1 == 0.0 { @@ -236,7 +236,7 @@ fn get_edge(edge: &BorderSide, width: f32, height: f32) -> (BorderEdgeKind, f32) pub fn ensure_no_corner_overlap( radius: &mut BorderRadius, - rect: &LayerRect, + rect: &LayoutRect, ) { let mut ratio = 1.0; let top_left_radius = &mut radius.top_left; @@ -282,7 +282,7 @@ pub fn ensure_no_corner_overlap( impl<'a> DisplayListFlattener<'a> { fn add_normal_border_primitive( &mut self, - info: &LayerPrimitiveInfo, + info: &LayoutPrimitiveInfo, border: &NormalBorder, radius: &BorderRadius, widths: &BorderWidths, @@ -350,7 +350,7 @@ impl<'a> DisplayListFlattener<'a> { // border code path. pub fn add_normal_border( &mut self, - info: &LayerPrimitiveInfo, + info: &LayoutPrimitiveInfo, border: &NormalBorder, widths: &BorderWidths, clip_and_scroll: ScrollNodeAndClipChain, @@ -387,30 +387,30 @@ impl<'a> DisplayListFlattener<'a> { ClipMode::Clip, ), ClipSource::new_rounded_rect( - LayerRect::new( - LayerPoint::new( + LayoutRect::new( + LayoutPoint::new( info.rect.origin.x + widths.left, info.rect.origin.y + widths.top, ), - LayerSize::new( + LayoutSize::new( info.rect.size.width - widths.left - widths.right, info.rect.size.height - widths.top - widths.bottom, ), ), BorderRadius { - top_left: LayerSize::new( + top_left: LayoutSize::new( (border.radius.top_left.width - widths.left).max(0.0), (border.radius.top_left.height - widths.top).max(0.0), ), - top_right: LayerSize::new( + top_right: LayoutSize::new( (border.radius.top_right.width - widths.right).max(0.0), (border.radius.top_right.height - widths.top).max(0.0), ), - bottom_left: LayerSize::new( + bottom_left: LayoutSize::new( (border.radius.bottom_left.width - widths.left).max(0.0), (border.radius.bottom_left.height - widths.bottom).max(0.0), ), - bottom_right: LayerSize::new( + bottom_right: LayoutSize::new( (border.radius.bottom_right.width - widths.right).max(0.0), (border.radius.bottom_right.height - widths.bottom).max(0.0), ), @@ -493,19 +493,19 @@ impl<'a> DisplayListFlattener<'a> { if has_no_curve && all_corners_simple && all_edges_simple { let p0 = info.rect.origin; - let p1 = LayerPoint::new( + let p1 = LayoutPoint::new( info.rect.origin.x + left_len, info.rect.origin.y + top_len, ); - let p2 = LayerPoint::new( + let p2 = LayoutPoint::new( info.rect.origin.x + info.rect.size.width - right_len, info.rect.origin.y + info.rect.size.height - bottom_len, ); let p3 = info.rect.bottom_right(); let segment = |x0, y0, x1, y1| BrushSegment::new( - LayerPoint::new(x0, y0), - LayerSize::new(x1-x0, y1-y0), + LayoutPoint::new(x0, y0), + LayoutSize::new(x1-x0, y1-y0), true, EdgeAaSegmentMask::all() // Note: this doesn't seem right, needs revision ); @@ -679,15 +679,15 @@ pub struct BorderCornerClipSource { pub max_clip_count: usize, pub actual_clip_count: usize, kind: BorderCornerClipKind, - widths: LayerSize, + widths: LayoutSize, ellipse: Ellipse, } impl BorderCornerClipSource { pub fn new( corner_data: BorderCornerClipData, - corner_radius: LayerSize, - widths: LayerSize, + corner_radius: LayoutSize, + widths: LayoutSize, kind: BorderCornerClipKind, ) -> BorderCornerClipSource { // Work out a dash length (and therefore dash count) @@ -786,7 +786,7 @@ impl BorderCornerClipSource { BorderCornerClipKind::Dot if self.max_clip_count == 1 => { let dot_diameter = lerp(self.widths.width, self.widths.height, 0.5); let dot = BorderCornerDotClipData { - center: LayerPoint::new(self.widths.width / 2.0, self.widths.height / 2.0), + center: LayoutPoint::new(self.widths.width / 2.0, self.widths.height / 2.0), radius: 0.5 * dot_diameter, }; self.actual_clip_count = 1; @@ -887,10 +887,10 @@ impl BorderCornerClipSource { #[repr(C)] pub struct BorderCornerClipData { /// Local space rect of the border corner. - corner_rect: LayerRect, + corner_rect: LayoutRect, /// Local space point that is the center of the /// circle or ellipse that we are clipping against. - clip_center: LayerPoint, + clip_center: LayoutPoint, /// The shader needs to know which corner, to /// be able to flip the dash tangents to the /// right orientation. @@ -918,10 +918,10 @@ impl BorderCornerClipData { #[derive(Debug, Clone)] #[repr(C)] pub struct BorderCornerDashClipData { - pub point0: LayerPoint, - pub tangent0: LayerPoint, - pub point1: LayerPoint, - pub tangent1: LayerPoint, + pub point0: LayoutPoint, + pub tangent0: LayoutPoint, + pub point1: LayoutPoint, + pub tangent1: LayoutPoint, } impl BorderCornerDashClipData { @@ -961,7 +961,7 @@ impl BorderCornerDashClipData { #[derive(Debug, Clone)] #[repr(C)] pub struct BorderCornerDotClipData { - pub center: LayerPoint, + pub center: LayoutPoint, pub radius: f32, } @@ -992,25 +992,25 @@ impl DotInfo { #[derive(Debug, Clone)] pub struct ImageBorderSegment { - pub geom_rect: LayerRect, + pub geom_rect: LayoutRect, pub sub_rect: TexelRect, - pub stretch_size: LayerSize, - pub tile_spacing: LayerSize, + pub stretch_size: LayoutSize, + pub tile_spacing: LayoutSize, } impl ImageBorderSegment { pub fn new( - rect: LayerRect, + rect: LayoutRect, sub_rect: TexelRect, repeat_horizontal: RepeatMode, repeat_vertical: RepeatMode, ) -> ImageBorderSegment { - let tile_spacing = LayerSize::zero(); + let tile_spacing = LayoutSize::zero(); debug_assert!(sub_rect.uv1.x >= sub_rect.uv0.x); debug_assert!(sub_rect.uv1.y >= sub_rect.uv0.y); - let image_size = LayerSize::new( + let image_size = LayoutSize::new( sub_rect.uv1.x - sub_rect.uv0.x, sub_rect.uv1.y - sub_rect.uv0.y, ); @@ -1036,7 +1036,7 @@ impl ImageBorderSegment { ImageBorderSegment { geom_rect: rect, sub_rect, - stretch_size: LayerSize::new(stretch_size_x, stretch_size_y), + stretch_size: LayoutSize::new(stretch_size_x, stretch_size_y), tile_spacing, } } diff --git a/webrender/src/box_shadow.rs b/webrender/src/box_shadow.rs index 15e639f970..db016bb6bc 100644 --- a/webrender/src/box_shadow.rs +++ b/webrender/src/box_shadow.rs @@ -2,8 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use api::{BorderRadius, BoxShadowClipMode, ClipMode, ColorF, DeviceIntSize, LayerPrimitiveInfo}; -use api::{LayerRect, LayerSize, LayerVector2D, LayoutSize}; +use api::{BorderRadius, BoxShadowClipMode, ClipMode, ColorF, DeviceIntSize, LayoutPrimitiveInfo}; +use api::{LayoutRect, LayoutSize, LayoutVector2D}; use clip::ClipSource; use display_list_flattener::DisplayListFlattener; use gpu_cache::GpuCacheHandle; @@ -29,15 +29,15 @@ pub struct BoxShadowClipSource { pub clip_data_handle: GpuCacheHandle, // Local-space size of the required render task size. - pub shadow_rect_alloc_size: LayerSize, + pub shadow_rect_alloc_size: LayoutSize, // The minimal shadow rect for the parameters above, // used when drawing the shadow rect to be blurred. - pub minimal_shadow_rect: LayerRect, + pub minimal_shadow_rect: LayoutRect, // Local space rect for the shadow to be drawn or // stretched in the shadow primitive. - pub prim_shadow_rect: LayerRect, + pub prim_shadow_rect: LayoutRect, } // The blur shader samples BLUR_SAMPLE_SCALE * blur_radius surrounding texels. @@ -67,8 +67,8 @@ impl<'a> DisplayListFlattener<'a> { pub fn add_box_shadow( &mut self, clip_and_scroll: ScrollNodeAndClipChain, - prim_info: &LayerPrimitiveInfo, - box_offset: &LayerVector2D, + prim_info: &LayoutPrimitiveInfo, + box_offset: &LayoutVector2D, color: &ColorF, mut blur_radius: f32, spread_radius: f32, @@ -147,7 +147,7 @@ impl<'a> DisplayListFlattener<'a> { self.add_primitive( clip_and_scroll, - &LayerPrimitiveInfo::with_clip_rect(final_prim_rect, prim_info.clip_rect), + &LayoutPrimitiveInfo::with_clip_rect(final_prim_rect, prim_info.clip_rect), clips, PrimitiveContainer::Brush( BrushPrimitive::new(BrushKind::Solid { @@ -204,7 +204,7 @@ impl<'a> DisplayListFlattener<'a> { // Outset shadows are expanded by the shadow // region from the original primitive. - LayerPrimitiveInfo::with_clip_rect(dest_rect, prim_info.clip_rect) + LayoutPrimitiveInfo::with_clip_rect(dest_rect, prim_info.clip_rect) } BoxShadowClipMode::Inset => { // If the inner shadow rect contains the prim diff --git a/webrender/src/clip.rs b/webrender/src/clip.rs index 1f6c92a305..804c33ec8f 100644 --- a/webrender/src/clip.rs +++ b/webrender/src/clip.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use api::{BorderRadius, ClipMode, ComplexClipRegion, DeviceIntRect, DevicePixelScale, ImageMask}; -use api::{ImageRendering, LayerRect, LayerSize, LayoutPoint, LayoutVector2D, LocalClip}; -use api::{BoxShadowClipMode, LayerPoint, LayerToWorldScale, LineOrientation, LineStyle}; +use api::{ImageRendering, LayoutRect, LayoutSize, LayoutPoint, LayoutVector2D, LocalClip}; +use api::{BoxShadowClipMode, LayoutToWorldScale, LineOrientation, LineStyle}; use border::{BorderCornerClipSource, ensure_no_corner_overlap}; use box_shadow::{BLUR_SAMPLE_SCALE, BoxShadowClipSource, BoxShadowCacheKey}; use clip_scroll_tree::{ClipChainIndex, CoordinateSystemId}; @@ -15,7 +15,7 @@ use gpu_types::{BoxShadowStretchMode, ClipScrollNodeIndex}; use prim_store::{ClipData, ImageMaskData}; use render_task::to_cache_size; use resource_cache::{ImageRequest, ResourceCache}; -use util::{LayerToWorldFastTransform, MaxRect, calculate_screen_bounding_rect}; +use util::{LayoutToWorldFastTransform, MaxRect, calculate_screen_bounding_rect}; use util::{extract_inner_rect_safe, pack_as_float}; use std::sync::Arc; @@ -28,7 +28,7 @@ pub type ClipSourcesWeakHandle = WeakFreeListHandle; #[derive(Debug)] pub struct LineDecorationClipSource { - rect: LayerRect, + rect: LayoutRect, style: LineStyle, orientation: LineOrientation, wavy_line_thickness: f32, @@ -36,14 +36,14 @@ pub struct LineDecorationClipSource { #[derive(Clone, Debug)] pub struct ClipRegion { - pub main: LayerRect, + pub main: LayoutRect, pub image_mask: Option, pub complex_clips: Vec, } impl ClipRegion { pub fn create_for_clip_node( - rect: LayerRect, + rect: LayoutRect, mut complex_clips: Vec, mut image_mask: Option, reference_frame_relative_offset: &LayoutVector2D, @@ -84,8 +84,8 @@ impl ClipRegion { #[derive(Debug)] pub enum ClipSource { - Rectangle(LayerRect, ClipMode), - RoundedRectangle(LayerRect, BorderRadius, ClipMode), + Rectangle(LayoutRect, ClipMode), + RoundedRectangle(LayoutRect, BorderRadius, ClipMode), Image(ImageMask), /// TODO(gw): This currently only handles dashed style /// clips, where the border style is dashed for both @@ -120,7 +120,7 @@ impl From for ClipSources { impl ClipSource { pub fn new_rounded_rect( - rect: LayerRect, + rect: LayoutRect, mut radii: BorderRadius, clip_mode: ClipMode ) -> ClipSource { @@ -137,7 +137,7 @@ impl ClipSource { } pub fn new_line_decoration( - rect: LayerRect, + rect: LayoutRect, style: LineStyle, orientation: LineOrientation, wavy_line_thickness: f32, @@ -153,19 +153,19 @@ impl ClipSource { } pub fn new_box_shadow( - shadow_rect: LayerRect, + shadow_rect: LayoutRect, shadow_radius: BorderRadius, - prim_shadow_rect: LayerRect, + prim_shadow_rect: LayoutRect, blur_radius: f32, clip_mode: BoxShadowClipMode, ) -> ClipSource { // Get the fractional offsets required to match the // source rect with a minimal rect. - let fract_offset = LayerPoint::new( + let fract_offset = LayoutPoint::new( shadow_rect.origin.x.fract().abs(), shadow_rect.origin.y.fract().abs(), ); - let fract_size = LayerSize::new( + let fract_size = LayoutSize::new( shadow_rect.size.width.fract().abs(), shadow_rect.size.height.fract().abs(), ); @@ -192,18 +192,18 @@ impl ClipSource { let used_corner_height = max_corner_height.max(blur_region); // Minimal nine-patch size, corner + internal + corner. - let min_shadow_rect_size = LayerSize::new( + let min_shadow_rect_size = LayoutSize::new( 2.0 * used_corner_width + blur_region, 2.0 * used_corner_height + blur_region, ); // The minimal rect to blur. - let mut minimal_shadow_rect = LayerRect::new( - LayerPoint::new( + let mut minimal_shadow_rect = LayoutRect::new( + LayoutPoint::new( blur_region + fract_offset.x, blur_region + fract_offset.y, ), - LayerSize::new( + LayoutSize::new( min_shadow_rect_size.width + fract_size.width, min_shadow_rect_size.height + fract_size.height, ), @@ -227,7 +227,7 @@ impl ClipSource { } // Expand the shadow rect by enough room for the blur to take effect. - let shadow_rect_alloc_size = LayerSize::new( + let shadow_rect_alloc_size = LayoutSize::new( 2.0 * blur_region + minimal_shadow_rect.size.width.ceil(), 2.0 * blur_region + minimal_shadow_rect.size.height.ceil(), ); @@ -267,8 +267,8 @@ impl ClipSource { #[derive(Debug)] pub struct ClipSources { pub clips: Vec<(ClipSource, GpuCacheHandle)>, - pub local_inner_rect: LayerRect, - pub local_outer_rect: Option + pub local_inner_rect: LayoutRect, + pub local_outer_rect: Option } impl ClipSources { @@ -291,16 +291,16 @@ impl ClipSources { &self.clips } - fn calculate_inner_and_outer_rects(clips: &Vec) -> (LayerRect, Option) { + fn calculate_inner_and_outer_rects(clips: &Vec) -> (LayoutRect, Option) { if clips.is_empty() { - return (LayerRect::zero(), None); + return (LayoutRect::zero(), None); } // Depending on the complexity of the clip, we may either know the outer and/or inner // rect, or neither or these. In the case of a clip-out, we currently set the mask bounds // to be unknown. This is conservative, but ensures correctness. In the future we can make // this a lot more clever with some proper region handling. - let mut local_outer = Some(LayerRect::max_rect()); + let mut local_outer = Some(LayoutRect::max_rect()); let mut local_inner = local_outer; let mut can_calculate_inner_rect = true; let mut can_calculate_outer_rect = false; @@ -350,15 +350,15 @@ impl ClipSources { } let outer = if can_calculate_outer_rect { - Some(local_outer.unwrap_or_else(LayerRect::zero)) + Some(local_outer.unwrap_or_else(LayoutRect::zero)) } else { None }; let inner = if can_calculate_inner_rect { - local_inner.unwrap_or_else(LayerRect::zero) + local_inner.unwrap_or_else(LayoutRect::zero) } else { - LayerRect::zero() + LayoutRect::zero() }; (inner, outer) @@ -433,7 +433,7 @@ impl ClipSources { let blur_radius_dp = (info.blur_radius * 0.5 * device_pixel_scale.0).round(); // Create the cache key for this box-shadow render task. - let content_scale = LayerToWorldScale::new(1.0) * device_pixel_scale; + let content_scale = LayoutToWorldScale::new(1.0) * device_pixel_scale; let cache_size = to_cache_size(info.shadow_rect_alloc_size * content_scale); let bs_cache_key = BoxShadowCacheKey { blur_radius_dp: blur_radius_dp as i32, @@ -464,7 +464,7 @@ impl ClipSources { pub fn get_screen_bounds( &self, - transform: &LayerToWorldFastTransform, + transform: &LayoutToWorldFastTransform, device_pixel_scale: DevicePixelScale, ) -> (DeviceIntRect, Option) { // If this translation isn't axis aligned or has a perspective component, don't try to @@ -493,12 +493,12 @@ impl ClipSources { /// rectangles that are either outside or inside bounds. #[derive(Clone, Debug, PartialEq)] pub struct Geometry { - pub local_rect: LayerRect, + pub local_rect: LayoutRect, pub device_rect: DeviceIntRect, } -impl From for Geometry { - fn from(local_rect: LayerRect) -> Self { +impl From for Geometry { + fn from(local_rect: LayoutRect) -> Self { Geometry { local_rect, device_rect: DeviceIntRect::zero(), @@ -508,7 +508,7 @@ impl From for Geometry { pub fn rounded_rectangle_contains_point( point: &LayoutPoint, - rect: &LayerRect, + rect: &LayoutRect, radii: &BorderRadius ) -> bool { if !rect.contains(point) { @@ -549,7 +549,7 @@ pub type ClipChainNodeRef = Option>; #[derive(Debug, Clone)] pub struct ClipChainNode { pub work_item: ClipWorkItem, - pub local_clip_rect: LayerRect, + pub local_clip_rect: LayoutRect, pub screen_outer_rect: DeviceIntRect, pub screen_inner_rect: DeviceIntRect, pub prev: ClipChainNodeRef, diff --git a/webrender/src/clip_scroll_node.rs b/webrender/src/clip_scroll_node.rs index cbb1136af3..a0ca7e44e0 100644 --- a/webrender/src/clip_scroll_node.rs +++ b/webrender/src/clip_scroll_node.rs @@ -2,8 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use api::{DevicePixelScale, ExternalScrollId, LayerPixel, LayerPoint, LayerRect, LayerSize}; -use api::{LayerVector2D, LayoutTransform, LayoutVector2D, PipelineId, PropertyBinding}; +use api::{DevicePixelScale, ExternalScrollId, LayoutPixel, LayoutPoint, LayoutRect, LayoutSize}; +use api::{LayoutVector2D, LayoutTransform, PipelineId, PropertyBinding}; use api::{ScrollClamping, ScrollLocation, ScrollSensitivity, StickyOffsetBounds}; use api::WorldPoint; use clip::{ClipChain, ClipChainNode, ClipSourcesHandle, ClipStore, ClipWorkItem}; @@ -15,7 +15,7 @@ use gpu_cache::GpuCache; use gpu_types::{ClipScrollNodeIndex as GPUClipScrollNodeIndex, ClipScrollNodeData}; use resource_cache::ResourceCache; use scene::SceneProperties; -use util::{LayerToWorldFastTransform, LayerFastTransform, LayoutFastTransform}; +use util::{LayoutToWorldFastTransform, LayoutFastTransform}; use util::{TransformedRectKind}; #[derive(Debug)] @@ -24,7 +24,7 @@ pub struct StickyFrameInfo { pub vertical_offset_bounds: StickyOffsetBounds, pub horizontal_offset_bounds: StickyOffsetBounds, pub previously_applied_offset: LayoutVector2D, - pub current_offset: LayerVector2D, + pub current_offset: LayoutVector2D, } impl StickyFrameInfo { @@ -39,7 +39,7 @@ impl StickyFrameInfo { vertical_offset_bounds, horizontal_offset_bounds, previously_applied_offset, - current_offset: LayerVector2D::zero(), + current_offset: LayoutVector2D::zero(), } } } @@ -89,17 +89,17 @@ impl NodeType { #[derive(Debug)] pub struct ClipScrollNode { /// Viewing rectangle in the coordinate system of the parent reference frame. - pub local_viewport_rect: LayerRect, + pub local_viewport_rect: LayoutRect, /// The transformation for this viewport in world coordinates is the transformation for /// our parent reference frame, plus any accumulated scrolling offsets from nodes /// between our reference frame and this node. For reference frames, we also include /// whatever local transformation this reference frame provides. This can be combined /// with the local_viewport_rect to get its position in world space. - pub world_viewport_transform: LayerToWorldFastTransform, + pub world_viewport_transform: LayoutToWorldFastTransform, /// World transform for content transformed by this node. - pub world_content_transform: LayerToWorldFastTransform, + pub world_content_transform: LayoutToWorldFastTransform, /// Pipeline that this layer belongs to pub pipeline_id: PipelineId, @@ -124,7 +124,7 @@ pub struct ClipScrollNode { /// The transformation from the coordinate system which established our compatible coordinate /// system (same coordinate system id) and us. This can change via scroll offsets and via new /// reference frame transforms. - pub coordinate_system_relative_transform: LayerFastTransform, + pub coordinate_system_relative_transform: LayoutFastTransform, /// A linear ID / index of this clip-scroll node. Used as a reference to /// pass to shaders, to allow them to fetch a given clip-scroll node. @@ -135,39 +135,39 @@ impl ClipScrollNode { pub fn new( pipeline_id: PipelineId, parent_index: Option, - rect: &LayerRect, + rect: &LayoutRect, node_type: NodeType ) -> Self { ClipScrollNode { local_viewport_rect: *rect, - world_viewport_transform: LayerToWorldFastTransform::identity(), - world_content_transform: LayerToWorldFastTransform::identity(), + world_viewport_transform: LayoutToWorldFastTransform::identity(), + world_content_transform: LayoutToWorldFastTransform::identity(), parent: parent_index, children: Vec::new(), pipeline_id, node_type: node_type, invertible: true, coordinate_system_id: CoordinateSystemId(0), - coordinate_system_relative_transform: LayerFastTransform::identity(), + coordinate_system_relative_transform: LayoutFastTransform::identity(), node_data_index: GPUClipScrollNodeIndex(0), } } pub fn empty() -> ClipScrollNode { - ClipScrollNode::new(PipelineId::dummy(), None, &LayerRect::zero(), NodeType::Empty) + ClipScrollNode::new(PipelineId::dummy(), None, &LayoutRect::zero(), NodeType::Empty) } pub fn new_scroll_frame( pipeline_id: PipelineId, parent_index: ClipScrollNodeIndex, external_id: Option, - frame_rect: &LayerRect, - content_size: &LayerSize, + frame_rect: &LayoutRect, + content_size: &LayoutSize, scroll_sensitivity: ScrollSensitivity, ) -> Self { let node_type = NodeType::ScrollFrame(ScrollFrameInfo::new( scroll_sensitivity, - LayerSize::new( + LayoutSize::new( (content_size.width - frame_rect.size.width).max(0.0), (content_size.height - frame_rect.size.height).max(0.0) ), @@ -179,17 +179,17 @@ impl ClipScrollNode { pub fn new_reference_frame( parent_index: Option, - frame_rect: &LayerRect, + frame_rect: &LayoutRect, source_transform: Option>, source_perspective: Option, - origin_in_parent_reference_frame: LayerVector2D, + origin_in_parent_reference_frame: LayoutVector2D, pipeline_id: PipelineId, ) -> Self { let identity = LayoutTransform::identity(); let source_perspective = source_perspective.map_or_else( LayoutFastTransform::identity, |perspective| perspective.into()); let info = ReferenceFrameInfo { - resolved_transform: LayerFastTransform::identity(), + resolved_transform: LayoutFastTransform::identity(), source_transform: source_transform.unwrap_or(PropertyBinding::Value(identity)), source_perspective: source_perspective, origin_in_parent_reference_frame, @@ -200,7 +200,7 @@ impl ClipScrollNode { pub fn new_sticky_frame( parent_index: ClipScrollNodeIndex, - frame_rect: LayerRect, + frame_rect: LayoutRect, sticky_frame_info: StickyFrameInfo, pipeline_id: PipelineId, ) -> Self { @@ -222,14 +222,14 @@ impl ClipScrollNode { scrolling.scroll_sensitivity = scroll_sensitivity; scrolling.scrollable_size = scrollable_size; } - _ if old_scrolling_state.offset != LayerVector2D::zero() => { + _ if old_scrolling_state.offset != LayoutVector2D::zero() => { warn!("Tried to scroll a non-scroll node.") } _ => {} } } - pub fn set_scroll_origin(&mut self, origin: &LayerPoint, clamp: ScrollClamping) -> bool { + pub fn set_scroll_origin(&mut self, origin: &LayoutPoint, clamp: ScrollClamping) -> bool { let scrollable_size = self.scrollable_size(); let scrollable_width = scrollable_size.width; let scrollable_height = scrollable_size.height; @@ -248,13 +248,13 @@ impl ClipScrollNode { return false; } - let origin = LayerPoint::new(origin.x.max(0.0), origin.y.max(0.0)); - LayerVector2D::new( + let origin = LayoutPoint::new(origin.x.max(0.0), origin.y.max(0.0)); + LayoutVector2D::new( (-origin.x).max(-scrollable_width).min(0.0).round(), (-origin.y).max(-scrollable_height).min(0.0).round(), ) } - ScrollClamping::NoClamping => LayerPoint::zero() - *origin, + ScrollClamping::NoClamping => LayoutPoint::zero() - *origin, }; if new_offset == scrolling.offset { @@ -267,8 +267,8 @@ impl ClipScrollNode { pub fn mark_uninvertible(&mut self) { self.invertible = false; - self.world_content_transform = LayerToWorldFastTransform::identity(); - self.world_viewport_transform = LayerToWorldFastTransform::identity(); + self.world_content_transform = LayoutToWorldFastTransform::identity(); + self.world_viewport_transform = LayoutToWorldFastTransform::identity(); } pub fn push_gpu_node_data(&mut self, node_data: &mut Vec) { @@ -424,7 +424,7 @@ impl ClipScrollNode { // transform, plus any accumulated scroll offset from our parents, plus any offset // provided by our own sticky positioning. let accumulated_offset = state.parent_accumulated_scroll_offset + sticky_offset; - self.world_viewport_transform = if accumulated_offset != LayerVector2D::zero() { + self.world_viewport_transform = if accumulated_offset != LayoutVector2D::zero() { state.parent_reference_frame_transform.pre_translate(&accumulated_offset) } else { state.parent_reference_frame_transform @@ -433,7 +433,7 @@ impl ClipScrollNode { // The transformation for any content inside of us is the viewport transformation, plus // whatever scrolling offset we supply as well. let scroll_offset = self.scroll_offset(); - self.world_content_transform = if scroll_offset != LayerVector2D::zero() { + self.world_content_transform = if scroll_offset != LayoutVector2D::zero() { self.world_viewport_transform.pre_translate(&scroll_offset) } else { self.world_viewport_transform @@ -465,7 +465,7 @@ impl ClipScrollNode { // Resolve the transform against any property bindings. let source_transform = scene_properties.resolve_layout_transform(&info.source_transform); info.resolved_transform = - LayerFastTransform::with_vector(info.origin_in_parent_reference_frame) + LayoutFastTransform::with_vector(info.origin_in_parent_reference_frame) .pre_mul(&source_transform.into()) .pre_mul(&info.source_perspective); @@ -477,7 +477,7 @@ impl ClipScrollNode { let relative_transform = info.resolved_transform .post_translate(state.parent_accumulated_scroll_offset) .to_transform() - .with_destination::(); + .with_destination::(); self.world_viewport_transform = state.parent_reference_frame_transform.pre_mul(&relative_transform.into()); self.world_content_transform = self.world_viewport_transform; @@ -492,7 +492,7 @@ impl ClipScrollNode { match state.coordinate_system_relative_transform.update(relative_transform) { Some(offset) => self.coordinate_system_relative_transform = offset, None => { - self.coordinate_system_relative_transform = LayerFastTransform::identity(); + self.coordinate_system_relative_transform = LayoutFastTransform::identity(); state.current_coordinate_system_id = *next_coordinate_system_id; next_coordinate_system_id.advance(); } @@ -503,17 +503,17 @@ impl ClipScrollNode { fn calculate_sticky_offset( &self, - viewport_scroll_offset: &LayerVector2D, - viewport_rect: &LayerRect, - ) -> LayerVector2D { + viewport_scroll_offset: &LayoutVector2D, + viewport_rect: &LayoutRect, + ) -> LayoutVector2D { let info = match self.node_type { NodeType::StickyFrame(ref info) => info, - _ => return LayerVector2D::zero(), + _ => return LayoutVector2D::zero(), }; if info.margins.top.is_none() && info.margins.bottom.is_none() && info.margins.left.is_none() && info.margins.right.is_none() { - return LayerVector2D::zero(); + return LayoutVector2D::zero(); } // The viewport and margins of the item establishes the maximum amount that it can @@ -523,7 +523,7 @@ impl ClipScrollNode { // page. let sticky_rect = self.local_viewport_rect.translate(viewport_scroll_offset); - let mut sticky_offset = LayerVector2D::zero(); + let mut sticky_offset = LayoutVector2D::zero(); if let Some(margin) = info.margins.top { let top_viewport_edge = viewport_rect.min_y() + margin; if sticky_rect.min_y() < top_viewport_edge { @@ -623,7 +623,7 @@ impl ClipScrollNode { match self.node_type { NodeType::ReferenceFrame(ref info) => { state.parent_reference_frame_transform = self.world_viewport_transform; - state.parent_accumulated_scroll_offset = LayerVector2D::zero(); + state.parent_accumulated_scroll_offset = LayoutVector2D::zero(); state.coordinate_system_relative_transform = self.coordinate_system_relative_transform.clone(); let translation = -info.origin_in_parent_reference_frame; @@ -649,10 +649,10 @@ impl ClipScrollNode { } } - pub fn scrollable_size(&self) -> LayerSize { + pub fn scrollable_size(&self) -> LayoutSize { match self.node_type { NodeType:: ScrollFrame(state) => state.scrollable_size, - _ => LayerSize::zero(), + _ => LayoutSize::zero(), } } @@ -719,7 +719,7 @@ impl ClipScrollNode { let p0 = inv.transform_point3d(&cursor.extend(z0)); let p1 = inv.transform_point3d(&cursor.extend(z1)); - if self.scrollable_size() == LayerSize::zero() { + if self.scrollable_size() == LayoutSize::zero() { return false; } @@ -730,10 +730,10 @@ impl ClipScrollNode { ) } - pub fn scroll_offset(&self) -> LayerVector2D { + pub fn scroll_offset(&self) -> LayoutVector2D { match self.node_type { NodeType::ScrollFrame(ref scrolling) => scrolling.offset, - _ => LayerVector2D::zero(), + _ => LayoutVector2D::zero(), } } @@ -747,11 +747,11 @@ impl ClipScrollNode { #[derive(Copy, Clone, Debug)] pub struct ScrollFrameInfo { - pub offset: LayerVector2D, + pub offset: LayoutVector2D, pub scroll_sensitivity: ScrollSensitivity, /// Amount that this ScrollFrame can scroll in both directions. - pub scrollable_size: LayerSize, + pub scrollable_size: LayoutSize, /// An external id to identify this scroll frame to API clients. This /// allows setting scroll positions via the API without relying on ClipsIds @@ -764,11 +764,11 @@ pub struct ScrollFrameInfo { impl ScrollFrameInfo { pub fn new( scroll_sensitivity: ScrollSensitivity, - scrollable_size: LayerSize, + scrollable_size: LayoutSize, external_id: Option, ) -> ScrollFrameInfo { ScrollFrameInfo { - offset: LayerVector2D::zero(), + offset: LayoutVector2D::zero(), scroll_sensitivity, scrollable_size, external_id, @@ -788,7 +788,7 @@ impl ScrollFrameInfo { pub struct ReferenceFrameInfo { /// The transformation that establishes this reference frame, relative to the parent /// reference frame. The origin of the reference frame is included in the transformation. - pub resolved_transform: LayerFastTransform, + pub resolved_transform: LayoutFastTransform, /// The source transform and perspective matrices provided by the stacking context /// that forms this reference frame. We maintain the property binding information @@ -800,7 +800,7 @@ pub struct ReferenceFrameInfo { /// The original, not including the transform and relative to the parent reference frame, /// origin of this reference frame. This is already rolled into the `transform' property, but /// we also store it here to properly transform the viewport for sticky positioning. - pub origin_in_parent_reference_frame: LayerVector2D, + pub origin_in_parent_reference_frame: LayoutVector2D, /// True if the resolved transform is invertible. pub invertible: bool, diff --git a/webrender/src/clip_scroll_tree.rs b/webrender/src/clip_scroll_tree.rs index c698617c74..ae5a9ac544 100644 --- a/webrender/src/clip_scroll_tree.rs +++ b/webrender/src/clip_scroll_tree.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use api::{DeviceIntRect, DevicePixelScale, ExternalScrollId, LayerPoint, LayerRect, LayerVector2D}; +use api::{DeviceIntRect, DevicePixelScale, ExternalScrollId, LayoutPoint, LayoutRect, LayoutVector2D}; use api::{PipelineId, ScrollClamping, ScrollLocation, ScrollNodeState}; use api::WorldPoint; use clip::{ClipChain, ClipSourcesHandle, ClipStore}; @@ -13,7 +13,7 @@ use internal_types::{FastHashMap, FastHashSet}; use print_tree::{PrintTree, PrintTreePrinter}; use resource_cache::ResourceCache; use scene::SceneProperties; -use util::{LayerFastTransform, LayerToWorldFastTransform}; +use util::{LayoutFastTransform, LayoutToWorldFastTransform}; pub type ScrollStates = FastHashMap; @@ -68,7 +68,7 @@ pub struct ClipScrollTree { /// ClipChainDescriptors and also those defined by the clipping node hierarchy. pub clip_chains: Vec, - pub pending_scroll_offsets: FastHashMap, + pub pending_scroll_offsets: FastHashMap, /// The current frame id, used for giving a unique id to all new dynamically /// added frames and clips. The ClipScrollTree increments this by one every @@ -82,10 +82,10 @@ pub struct ClipScrollTree { #[derive(Clone)] pub struct TransformUpdateState { - pub parent_reference_frame_transform: LayerToWorldFastTransform, - pub parent_accumulated_scroll_offset: LayerVector2D, - pub nearest_scrolling_ancestor_offset: LayerVector2D, - pub nearest_scrolling_ancestor_viewport: LayerRect, + pub parent_reference_frame_transform: LayoutToWorldFastTransform, + pub parent_accumulated_scroll_offset: LayoutVector2D, + pub nearest_scrolling_ancestor_offset: LayoutVector2D, + pub nearest_scrolling_ancestor_viewport: LayoutRect, /// The index of the current parent's clip chain. pub parent_clip_chain_index: ClipChainIndex, @@ -97,7 +97,7 @@ pub struct TransformUpdateState { pub current_coordinate_system_id: CoordinateSystemId, /// Transform from the coordinate system that started this compatible coordinate system. - pub coordinate_system_relative_transform: LayerFastTransform, + pub coordinate_system_relative_transform: LayoutFastTransform, /// True if this node is transformed by an invertible transform. If not, display items /// transformed by this node will not be displayed and display items not transformed by this @@ -200,7 +200,7 @@ impl ClipScrollTree { pub fn scroll_node( &mut self, - origin: LayerPoint, + origin: LayoutPoint, id: ExternalScrollId, clamp: ScrollClamping ) -> bool { @@ -246,13 +246,13 @@ impl ClipScrollTree { let root_reference_frame_index = self.root_reference_frame_index(); let mut state = TransformUpdateState { - parent_reference_frame_transform: LayerVector2D::new(pan.x, pan.y).into(), - parent_accumulated_scroll_offset: LayerVector2D::zero(), - nearest_scrolling_ancestor_offset: LayerVector2D::zero(), - nearest_scrolling_ancestor_viewport: LayerRect::zero(), + parent_reference_frame_transform: LayoutVector2D::new(pan.x, pan.y).into(), + parent_accumulated_scroll_offset: LayoutVector2D::zero(), + nearest_scrolling_ancestor_offset: LayoutVector2D::zero(), + nearest_scrolling_ancestor_viewport: LayoutRect::zero(), parent_clip_chain_index: ClipChainIndex(0), current_coordinate_system_id: CoordinateSystemId::root(), - coordinate_system_relative_transform: LayerFastTransform::identity(), + coordinate_system_relative_transform: LayoutFastTransform::identity(), invertible: true, }; let mut next_coordinate_system_id = state.current_coordinate_system_id.next(); @@ -380,7 +380,7 @@ impl ClipScrollTree { index: ClipScrollNodeIndex, parent_index: ClipScrollNodeIndex, handle: ClipSourcesHandle, - clip_rect: LayerRect, + clip_rect: LayoutRect, pipeline_id: PipelineId, ) -> ClipChainIndex { let clip_chain_index = self.allocate_clip_chain(); @@ -394,7 +394,7 @@ impl ClipScrollTree { &mut self, index: ClipScrollNodeIndex, parent_index: ClipScrollNodeIndex, - frame_rect: LayerRect, + frame_rect: LayoutRect, sticky_frame_info: StickyFrameInfo, pipeline_id: PipelineId, ) { diff --git a/webrender/src/display_list_flattener.rs b/webrender/src/display_list_flattener.rs index f3c48240b7..c22b8052ec 100644 --- a/webrender/src/display_list_flattener.rs +++ b/webrender/src/display_list_flattener.rs @@ -7,9 +7,9 @@ use api::{AlphaType, BorderDetails, BorderDisplayItem, BuiltDisplayListIter, Cli use api::{ClipId, ColorF, ComplexClipRegion, DeviceIntPoint, DeviceIntRect, DeviceIntSize}; use api::{DevicePixelScale, DeviceUintRect, DisplayItemRef, Epoch, ExtendMode, ExternalScrollId}; use api::{FilterOp, FontInstanceKey, FontRenderMode, GlyphInstance, GlyphOptions, GlyphRasterSpace, GradientStop}; -use api::{IframeDisplayItem, ImageKey, ImageRendering, ItemRange, LayerPoint, LayerPrimitiveInfo}; -use api::{LayerRect, LayerSize, LayerVector2D, LayoutRect, LayoutSize, LayoutTransform}; -use api::{LayoutVector2D, LineOrientation, LineStyle, LocalClip, PipelineId, PropertyBinding}; +use api::{IframeDisplayItem, ImageKey, ImageRendering, ItemRange, LayoutPoint, LayoutPrimitiveInfo}; +use api::{LayoutRect, LayoutVector2D, LayoutSize, LayoutTransform}; +use api::{LineOrientation, LineStyle, LocalClip, PipelineId, PropertyBinding}; use api::{RepeatMode, ScrollFrameDisplayItem, ScrollPolicy, ScrollSensitivity, Shadow}; use api::{SpecificDisplayItem, StackingContext, StickyFrameDisplayItem, TexelRect, TileOffset}; use api::{TransformStyle, YuvColorSpace, YuvData}; @@ -342,8 +342,8 @@ impl<'a> DisplayListFlattener<'a> { if self.scene.root_pipeline_id != Some(pipeline_id) { if let Some(pipeline) = self.scene.pipelines.get(&pipeline_id) { if let Some(bg_color) = pipeline.background_color { - let root_bounds = LayerRect::new(LayerPoint::zero(), *frame_size); - let info = LayerPrimitiveInfo::new(root_bounds); + let root_bounds = LayoutRect::new(LayoutPoint::zero(), *frame_size); + let info = LayoutPrimitiveInfo::new(root_bounds); self.add_solid_rectangle( reference_frame_info, &info, @@ -355,14 +355,14 @@ impl<'a> DisplayListFlattener<'a> { } } - self.flatten_items(&mut pipeline.display_list.iter(), pipeline_id, LayerVector2D::zero()); + self.flatten_items(&mut pipeline.display_list.iter(), pipeline_id, LayoutVector2D::zero()); if self.config.enable_scrollbars { - let scrollbar_rect = LayerRect::new(LayerPoint::zero(), LayerSize::new(10.0, 70.0)); - let container_rect = LayerRect::new(LayerPoint::zero(), *frame_size); + let scrollbar_rect = LayoutRect::new(LayoutPoint::zero(), LayoutSize::new(10.0, 70.0)); + let container_rect = LayoutRect::new(LayoutPoint::zero(), *frame_size); self.add_scroll_bar( reference_frame_info, - &LayerPrimitiveInfo::new(scrollbar_rect), + &LayoutPrimitiveInfo::new(scrollbar_rect), DEFAULT_SCROLLBAR_COLOR, ScrollbarInfo(scroll_frame_info.scroll_node_id, container_rect), ); @@ -375,7 +375,7 @@ impl<'a> DisplayListFlattener<'a> { &mut self, traversal: &mut BuiltDisplayListIter<'a>, pipeline_id: PipelineId, - reference_frame_relative_offset: LayerVector2D, + reference_frame_relative_offset: LayoutVector2D, ) { loop { let subtraversal = { @@ -409,7 +409,7 @@ impl<'a> DisplayListFlattener<'a> { info: &StickyFrameDisplayItem, clip_and_scroll: &ScrollNodeAndClipChain, parent_id: &ClipId, - reference_frame_relative_offset: &LayerVector2D, + reference_frame_relative_offset: &LayoutVector2D, ) { let frame_rect = item.rect().translate(reference_frame_relative_offset); let sticky_frame_info = StickyFrameInfo::new( @@ -436,7 +436,7 @@ impl<'a> DisplayListFlattener<'a> { info: &ScrollFrameDisplayItem, pipeline_id: PipelineId, clip_and_scroll_ids: &ClipAndScrollInfo, - reference_frame_relative_offset: &LayerVector2D, + reference_frame_relative_offset: &LayoutVector2D, ) { let complex_clips = self.get_complex_clips(pipeline_id, item.complex_clip().0); let clip_region = ClipRegion::create_for_clip_node( @@ -475,7 +475,7 @@ impl<'a> DisplayListFlattener<'a> { stacking_context: &StackingContext, unreplaced_scroll_id: ClipId, mut scroll_node_id: ClipId, - mut reference_frame_relative_offset: LayerVector2D, + mut reference_frame_relative_offset: LayoutVector2D, is_backface_visible: bool, ) { // Avoid doing unnecessary work for empty stacking contexts. @@ -515,7 +515,7 @@ impl<'a> DisplayListFlattener<'a> { stacking_context.perspective.is_some() ); - let reference_frame_bounds = LayerRect::new(LayerPoint::zero(), bounds.size); + let reference_frame_bounds = LayoutRect::new(LayoutPoint::zero(), bounds.size); self.push_reference_frame( reference_frame_id, Some(scroll_node_id), @@ -526,7 +526,7 @@ impl<'a> DisplayListFlattener<'a> { reference_frame_relative_offset, ); self.replacements.push((unreplaced_scroll_id, reference_frame_id)); - reference_frame_relative_offset = LayerVector2D::zero(); + reference_frame_relative_offset = LayoutVector2D::zero(); } // We apply the replacements one more time in case we need to set it to a replacement @@ -566,7 +566,7 @@ impl<'a> DisplayListFlattener<'a> { item: &DisplayItemRef, info: &IframeDisplayItem, clip_and_scroll_ids: &ClipAndScrollInfo, - reference_frame_relative_offset: &LayerVector2D, + reference_frame_relative_offset: &LayoutVector2D, ) { let iframe_pipeline_id = info.pipeline_id; let pipeline = match self.scene.pipelines.get(&iframe_pipeline_id) { @@ -593,7 +593,7 @@ impl<'a> DisplayListFlattener<'a> { self.pipeline_epochs.push((iframe_pipeline_id, epoch)); let bounds = item.rect(); - let iframe_rect = LayerRect::new(LayerPoint::zero(), bounds.size); + let iframe_rect = LayoutRect::new(LayoutPoint::zero(), bounds.size); let origin = *reference_frame_relative_offset + bounds.origin.to_vector(); self.push_reference_frame( ClipId::root_reference_frame(iframe_pipeline_id), @@ -624,7 +624,7 @@ impl<'a> DisplayListFlattener<'a> { &'b mut self, item: DisplayItemRef<'a, 'b>, pipeline_id: PipelineId, - reference_frame_relative_offset: LayerVector2D, + reference_frame_relative_offset: LayoutVector2D, ) -> Option> { let mut clip_and_scroll_ids = item.clip_and_scroll(); let unreplaced_scroll_id = clip_and_scroll_ids.scroll_node_id; @@ -632,7 +632,7 @@ impl<'a> DisplayListFlattener<'a> { self.apply_scroll_frame_id_replacement(clip_and_scroll_ids.scroll_node_id); let clip_and_scroll = self.id_to_index_mapper.map_clip_and_scroll(&clip_and_scroll_ids); - let prim_info = item.get_layer_primitive_info(&reference_frame_relative_offset); + let prim_info = item.get_layout_primitive_info(&reference_frame_relative_offset); match *item.item() { SpecificDisplayItem::Image(ref info) => { match self.tiled_image_map.get(&info.image_key).cloned() { @@ -848,7 +848,7 @@ impl<'a> DisplayListFlattener<'a> { } SpecificDisplayItem::PushShadow(shadow) => { let mut prim_info = prim_info.clone(); - prim_info.rect = LayerRect::zero(); + prim_info.rect = LayoutRect::zero(); self .push_shadow(shadow, clip_and_scroll, &prim_info); } @@ -864,7 +864,7 @@ impl<'a> DisplayListFlattener<'a> { /// sub-primitives. pub fn create_primitive( &mut self, - info: &LayerPrimitiveInfo, + info: &LayoutPrimitiveInfo, clip_sources: Vec, container: PrimitiveContainer, ) -> PrimitiveIndex { @@ -888,7 +888,7 @@ impl<'a> DisplayListFlattener<'a> { pub fn add_primitive_to_hit_testing_list( &mut self, - info: &LayerPrimitiveInfo, + info: &LayoutPrimitiveInfo, clip_and_scroll: ScrollNodeAndClipChain ) { let tag = match info.tag { @@ -926,7 +926,7 @@ impl<'a> DisplayListFlattener<'a> { pub fn add_primitive( &mut self, clip_and_scroll: ScrollNodeAndClipChain, - info: &LayerPrimitiveInfo, + info: &LayoutPrimitiveInfo, clip_sources: Vec, container: PrimitiveContainer, ) { @@ -997,7 +997,7 @@ impl<'a> DisplayListFlattener<'a> { // primitives, we can apply any kind of clip mask // to them, as for a normal primitive. This is needed // to correctly handle some CSS cases (see #1957). - let max_clip = LayerRect::max_rect(); + let max_clip = LayoutRect::max_rect(); // If there is no root picture, create one for the main framebuffer. if self.sc_stack.is_empty() { @@ -1075,7 +1075,7 @@ impl<'a> DisplayListFlattener<'a> { let prim = BrushPrimitive::new_picture(container_index); let prim_index = self.prim_store.add_primitive( - &LayerRect::zero(), + &LayoutRect::zero(), &max_clip, is_backface_visible, None, @@ -1124,7 +1124,7 @@ impl<'a> DisplayListFlattener<'a> { let src_prim = BrushPrimitive::new_picture(src_pic_index); let src_prim_index = self.prim_store.add_primitive( - &LayerRect::zero(), + &LayoutRect::zero(), &max_clip, is_backface_visible, None, @@ -1154,7 +1154,7 @@ impl<'a> DisplayListFlattener<'a> { let src_prim = BrushPrimitive::new_picture(src_pic_index); let src_prim_index = self.prim_store.add_primitive( - &LayerRect::zero(), + &LayoutRect::zero(), &max_clip, is_backface_visible, None, @@ -1211,7 +1211,7 @@ impl<'a> DisplayListFlattener<'a> { // Add the brush to the parent picture. let sc_prim_index = self.prim_store.add_primitive( - &LayerRect::zero(), + &LayoutRect::zero(), &max_clip, is_backface_visible, None, @@ -1282,10 +1282,10 @@ impl<'a> DisplayListFlattener<'a> { reference_frame_id: ClipId, parent_id: Option, pipeline_id: PipelineId, - rect: &LayerRect, + rect: &LayoutRect, source_transform: Option>, source_perspective: Option, - origin_in_parent_reference_frame: LayerVector2D, + origin_in_parent_reference_frame: LayoutVector2D, ) -> ClipScrollNodeIndex { let index = self.id_to_index_mapper.get_node_index(reference_frame_id); let node = ClipScrollNode::new_reference_frame( @@ -1325,17 +1325,17 @@ impl<'a> DisplayListFlattener<'a> { let root_node = &mut self.clip_scroll_tree.nodes[root_id.0]; if let NodeType::ReferenceFrame(ref mut info) = root_node.node_type { info.resolved_transform = - LayerVector2D::new(viewport_offset.x, viewport_offset.y).into(); + LayoutVector2D::new(viewport_offset.x, viewport_offset.y).into(); } } pub fn push_root( &mut self, pipeline_id: PipelineId, - viewport_size: &LayerSize, - content_size: &LayerSize, + viewport_size: &LayoutSize, + content_size: &LayoutSize, ) { - let viewport_rect = LayerRect::new(LayerPoint::zero(), *viewport_size); + let viewport_rect = LayoutRect::new(LayoutPoint::zero(), *viewport_size); self.push_reference_frame( ClipId::root_reference_frame(pipeline_id), @@ -1344,7 +1344,7 @@ impl<'a> DisplayListFlattener<'a> { &viewport_rect, None, None, - LayerVector2D::zero(), + LayoutVector2D::zero(), ); self.add_scroll_frame( @@ -1386,8 +1386,8 @@ impl<'a> DisplayListFlattener<'a> { parent_id: ClipId, external_id: Option, pipeline_id: PipelineId, - frame_rect: &LayerRect, - content_size: &LayerSize, + frame_rect: &LayoutRect, + content_size: &LayoutSize, scroll_sensitivity: ScrollSensitivity, ) -> ClipScrollNodeIndex { let node_index = self.id_to_index_mapper.get_node_index(new_node_id); @@ -1413,11 +1413,11 @@ impl<'a> DisplayListFlattener<'a> { &mut self, shadow: Shadow, clip_and_scroll: ScrollNodeAndClipChain, - info: &LayerPrimitiveInfo, + info: &LayoutPrimitiveInfo, ) { let pipeline_id = self.sc_stack.last().unwrap().pipeline_id; let current_reference_frame_index = self.current_reference_frame_index(); - let max_clip = LayerRect::max_rect(); + let max_clip = LayoutRect::max_rect(); // Quote from https://drafts.csswg.org/css-backgrounds-3/#shadow-blur // "the image that would be generated by applying to the shadow a @@ -1446,7 +1446,7 @@ impl<'a> DisplayListFlattener<'a> { // Create the primitive to draw the shadow picture into the scene. let shadow_prim = BrushPrimitive::new_picture(shadow_pic_index); let shadow_prim_index = self.prim_store.add_primitive( - &LayerRect::zero(), + &LayoutRect::zero(), &max_clip, info.is_backface_visible, None, @@ -1468,7 +1468,7 @@ impl<'a> DisplayListFlattener<'a> { pub fn add_solid_rectangle( &mut self, clip_and_scroll: ScrollNodeAndClipChain, - info: &LayerPrimitiveInfo, + info: &LayoutPrimitiveInfo, color: ColorF, segments: Option, extra_clips: Vec, @@ -1498,7 +1498,7 @@ impl<'a> DisplayListFlattener<'a> { pub fn add_clear_rectangle( &mut self, clip_and_scroll: ScrollNodeAndClipChain, - info: &LayerPrimitiveInfo, + info: &LayoutPrimitiveInfo, ) { let prim = BrushPrimitive::new( BrushKind::Clear, @@ -1516,7 +1516,7 @@ impl<'a> DisplayListFlattener<'a> { pub fn add_scroll_bar( &mut self, clip_and_scroll: ScrollNodeAndClipChain, - info: &LayerPrimitiveInfo, + info: &LayoutPrimitiveInfo, color: ColorF, scrollbar_info: ScrollbarInfo, ) { @@ -1552,7 +1552,7 @@ impl<'a> DisplayListFlattener<'a> { pub fn add_line( &mut self, clip_and_scroll: ScrollNodeAndClipChain, - info: &LayerPrimitiveInfo, + info: &LayoutPrimitiveInfo, wavy_line_thickness: f32, orientation: LineOrientation, line_color: &ColorF, @@ -1594,7 +1594,7 @@ impl<'a> DisplayListFlattener<'a> { pub fn add_border( &mut self, clip_and_scroll: ScrollNodeAndClipChain, - info: &LayerPrimitiveInfo, + info: &LayoutPrimitiveInfo, border_item: &BorderDisplayItem, gradient_stops: ItemRange, gradient_stops_count: usize, @@ -1602,23 +1602,23 @@ impl<'a> DisplayListFlattener<'a> { let rect = info.rect; let create_segments = |outset: SideOffsets2D| { // Calculate the modified rect as specific by border-image-outset - let origin = LayerPoint::new(rect.origin.x - outset.left, rect.origin.y - outset.top); - let size = LayerSize::new( + let origin = LayoutPoint::new(rect.origin.x - outset.left, rect.origin.y - outset.top); + let size = LayoutSize::new( rect.size.width + outset.left + outset.right, rect.size.height + outset.top + outset.bottom, ); - let rect = LayerRect::new(origin, size); + let rect = LayoutRect::new(origin, size); - let tl_outer = LayerPoint::new(rect.origin.x, rect.origin.y); + let tl_outer = LayoutPoint::new(rect.origin.x, rect.origin.y); let tl_inner = tl_outer + vec2(border_item.widths.left, border_item.widths.top); - let tr_outer = LayerPoint::new(rect.origin.x + rect.size.width, rect.origin.y); + let tr_outer = LayoutPoint::new(rect.origin.x + rect.size.width, rect.origin.y); let tr_inner = tr_outer + vec2(-border_item.widths.right, border_item.widths.top); - let bl_outer = LayerPoint::new(rect.origin.x, rect.origin.y + rect.size.height); + let bl_outer = LayoutPoint::new(rect.origin.x, rect.origin.y + rect.size.height); let bl_inner = bl_outer + vec2(border_item.widths.left, -border_item.widths.bottom); - let br_outer = LayerPoint::new( + let br_outer = LayoutPoint::new( rect.origin.x + rect.size.width, rect.origin.y + rect.size.height, ); @@ -1627,36 +1627,36 @@ impl<'a> DisplayListFlattener<'a> { // Build the list of gradient segments vec![ // Top left - LayerRect::from_floats(tl_outer.x, tl_outer.y, tl_inner.x, tl_inner.y), + LayoutRect::from_floats(tl_outer.x, tl_outer.y, tl_inner.x, tl_inner.y), // Top right - LayerRect::from_floats(tr_inner.x, tr_outer.y, tr_outer.x, tr_inner.y), + LayoutRect::from_floats(tr_inner.x, tr_outer.y, tr_outer.x, tr_inner.y), // Bottom right - LayerRect::from_floats(br_inner.x, br_inner.y, br_outer.x, br_outer.y), + LayoutRect::from_floats(br_inner.x, br_inner.y, br_outer.x, br_outer.y), // Bottom left - LayerRect::from_floats(bl_outer.x, bl_inner.y, bl_inner.x, bl_outer.y), + LayoutRect::from_floats(bl_outer.x, bl_inner.y, bl_inner.x, bl_outer.y), // Top - LayerRect::from_floats(tl_inner.x, tl_outer.y, tr_inner.x, tl_inner.y), + LayoutRect::from_floats(tl_inner.x, tl_outer.y, tr_inner.x, tl_inner.y), // Bottom - LayerRect::from_floats(bl_inner.x, bl_inner.y, br_inner.x, bl_outer.y), + LayoutRect::from_floats(bl_inner.x, bl_inner.y, br_inner.x, bl_outer.y), // Left - LayerRect::from_floats(tl_outer.x, tl_inner.y, tl_inner.x, bl_inner.y), + LayoutRect::from_floats(tl_outer.x, tl_inner.y, tl_inner.x, bl_inner.y), // Right - LayerRect::from_floats(tr_inner.x, tr_inner.y, br_outer.x, br_inner.y), + LayoutRect::from_floats(tr_inner.x, tr_inner.y, br_outer.x, br_inner.y), ] }; match border_item.details { BorderDetails::Image(ref border) => { // Calculate the modified rect as specific by border-image-outset - let origin = LayerPoint::new( + let origin = LayoutPoint::new( rect.origin.x - border.outset.left, rect.origin.y - border.outset.top, ); - let size = LayerSize::new( + let size = LayoutSize::new( rect.size.width + border.outset.left + border.outset.right, rect.size.height + border.outset.top + border.outset.bottom, ); - let rect = LayerRect::new(origin, size); + let rect = LayoutRect::new(origin, size); // Calculate the local texel coords of the slices. let px0 = 0.0; @@ -1669,16 +1669,16 @@ impl<'a> DisplayListFlattener<'a> { let py2 = border.patch.height as f32 - border.patch.slice.bottom as f32; let py3 = border.patch.height as f32; - let tl_outer = LayerPoint::new(rect.origin.x, rect.origin.y); + let tl_outer = LayoutPoint::new(rect.origin.x, rect.origin.y); let tl_inner = tl_outer + vec2(border_item.widths.left, border_item.widths.top); - let tr_outer = LayerPoint::new(rect.origin.x + rect.size.width, rect.origin.y); + let tr_outer = LayoutPoint::new(rect.origin.x + rect.size.width, rect.origin.y); let tr_inner = tr_outer + vec2(-border_item.widths.right, border_item.widths.top); - let bl_outer = LayerPoint::new(rect.origin.x, rect.origin.y + rect.size.height); + let bl_outer = LayoutPoint::new(rect.origin.x, rect.origin.y + rect.size.height); let bl_inner = bl_outer + vec2(border_item.widths.left, -border_item.widths.bottom); - let br_outer = LayerPoint::new( + let br_outer = LayoutPoint::new( rect.origin.x + rect.size.width, rect.origin.y + rect.size.height, ); @@ -1686,7 +1686,7 @@ impl<'a> DisplayListFlattener<'a> { fn add_segment( segments: &mut Vec, - rect: LayerRect, + rect: LayoutRect, uv_rect: TexelRect, repeat_horizontal: RepeatMode, repeat_vertical: RepeatMode) { @@ -1707,7 +1707,7 @@ impl<'a> DisplayListFlattener<'a> { // Top left add_segment( &mut segments, - LayerRect::from_floats(tl_outer.x, tl_outer.y, tl_inner.x, tl_inner.y), + LayoutRect::from_floats(tl_outer.x, tl_outer.y, tl_inner.x, tl_inner.y), TexelRect::new(px0, py0, px1, py1), RepeatMode::Stretch, RepeatMode::Stretch @@ -1715,7 +1715,7 @@ impl<'a> DisplayListFlattener<'a> { // Top right add_segment( &mut segments, - LayerRect::from_floats(tr_inner.x, tr_outer.y, tr_outer.x, tr_inner.y), + LayoutRect::from_floats(tr_inner.x, tr_outer.y, tr_outer.x, tr_inner.y), TexelRect::new(px2, py0, px3, py1), RepeatMode::Stretch, RepeatMode::Stretch @@ -1723,7 +1723,7 @@ impl<'a> DisplayListFlattener<'a> { // Bottom right add_segment( &mut segments, - LayerRect::from_floats(br_inner.x, br_inner.y, br_outer.x, br_outer.y), + LayoutRect::from_floats(br_inner.x, br_inner.y, br_outer.x, br_outer.y), TexelRect::new(px2, py2, px3, py3), RepeatMode::Stretch, RepeatMode::Stretch @@ -1731,7 +1731,7 @@ impl<'a> DisplayListFlattener<'a> { // Bottom left add_segment( &mut segments, - LayerRect::from_floats(bl_outer.x, bl_inner.y, bl_inner.x, bl_outer.y), + LayoutRect::from_floats(bl_outer.x, bl_inner.y, bl_inner.x, bl_outer.y), TexelRect::new(px0, py2, px1, py3), RepeatMode::Stretch, RepeatMode::Stretch @@ -1741,7 +1741,7 @@ impl<'a> DisplayListFlattener<'a> { if border.fill { add_segment( &mut segments, - LayerRect::from_floats(tl_inner.x, tl_inner.y, tr_inner.x, bl_inner.y), + LayoutRect::from_floats(tl_inner.x, tl_inner.y, tr_inner.x, bl_inner.y), TexelRect::new(px1, py1, px2, py2), border.repeat_horizontal, border.repeat_vertical @@ -1753,7 +1753,7 @@ impl<'a> DisplayListFlattener<'a> { // Top add_segment( &mut segments, - LayerRect::from_floats(tl_inner.x, tl_outer.y, tr_inner.x, tl_inner.y), + LayoutRect::from_floats(tl_inner.x, tl_outer.y, tr_inner.x, tl_inner.y), TexelRect::new(px1, py0, px2, py1), border.repeat_horizontal, RepeatMode::Stretch, @@ -1761,7 +1761,7 @@ impl<'a> DisplayListFlattener<'a> { // Bottom add_segment( &mut segments, - LayerRect::from_floats(bl_inner.x, bl_inner.y, br_inner.x, bl_outer.y), + LayoutRect::from_floats(bl_inner.x, bl_inner.y, br_inner.x, bl_outer.y), TexelRect::new(px1, py2, px2, py3), border.repeat_horizontal, RepeatMode::Stretch, @@ -1769,7 +1769,7 @@ impl<'a> DisplayListFlattener<'a> { // Left add_segment( &mut segments, - LayerRect::from_floats(tl_outer.x, tl_inner.y, tl_inner.x, bl_inner.y), + LayoutRect::from_floats(tl_outer.x, tl_inner.y, tl_inner.x, bl_inner.y), TexelRect::new(px0, py1, px1, py2), RepeatMode::Stretch, border.repeat_vertical, @@ -1777,7 +1777,7 @@ impl<'a> DisplayListFlattener<'a> { // Right add_segment( &mut segments, - LayerRect::from_floats(tr_inner.x, tr_inner.y, br_outer.x, br_inner.y), + LayoutRect::from_floats(tr_inner.x, tr_inner.y, br_outer.x, br_inner.y), TexelRect::new(px2, py1, px3, py2), RepeatMode::Stretch, border.repeat_vertical, @@ -1816,7 +1816,7 @@ impl<'a> DisplayListFlattener<'a> { gradient_stops_count, border.gradient.extend_mode, segment.size, - LayerSize::zero(), + LayoutSize::zero(), ); }, BorderDetails::RadialGradient(ref border) => { @@ -1835,7 +1835,7 @@ impl<'a> DisplayListFlattener<'a> { gradient_stops, border.gradient.extend_mode, segment.size, - LayerSize::zero(), + LayoutSize::zero(), ); } } @@ -1845,9 +1845,9 @@ impl<'a> DisplayListFlattener<'a> { fn add_gradient_impl( &mut self, clip_and_scroll: ScrollNodeAndClipChain, - info: &LayerPrimitiveInfo, - start_point: LayerPoint, - end_point: LayerPoint, + info: &LayoutPrimitiveInfo, + start_point: LayoutPoint, + end_point: LayoutPoint, stops: ItemRange, stops_count: usize, extend_mode: ExtendMode, @@ -1892,14 +1892,14 @@ impl<'a> DisplayListFlattener<'a> { pub fn add_gradient( &mut self, clip_and_scroll: ScrollNodeAndClipChain, - info: &LayerPrimitiveInfo, - start_point: LayerPoint, - end_point: LayerPoint, + info: &LayoutPrimitiveInfo, + start_point: LayoutPoint, + end_point: LayoutPoint, stops: ItemRange, stops_count: usize, extend_mode: ExtendMode, - tile_size: LayerSize, - tile_spacing: LayerSize, + tile_size: LayoutSize, + tile_spacing: LayoutSize, ) { let gradient_index = CachedGradientIndex(self.cached_gradients.len()); self.cached_gradients.push(CachedGradient::new()); @@ -1940,8 +1940,8 @@ impl<'a> DisplayListFlattener<'a> { fn add_radial_gradient_impl( &mut self, clip_and_scroll: ScrollNodeAndClipChain, - info: &LayerPrimitiveInfo, - center: LayerPoint, + info: &LayoutPrimitiveInfo, + center: LayoutPoint, start_radius: f32, end_radius: f32, ratio_xy: f32, @@ -1973,15 +1973,15 @@ impl<'a> DisplayListFlattener<'a> { pub fn add_radial_gradient( &mut self, clip_and_scroll: ScrollNodeAndClipChain, - info: &LayerPrimitiveInfo, - center: LayerPoint, + info: &LayoutPrimitiveInfo, + center: LayoutPoint, start_radius: f32, end_radius: f32, ratio_xy: f32, stops: ItemRange, extend_mode: ExtendMode, - tile_size: LayerSize, - tile_spacing: LayerSize, + tile_size: LayoutSize, + tile_spacing: LayoutSize, ) { let gradient_index = CachedGradientIndex(self.cached_gradients.len()); self.cached_gradients.push(CachedGradient::new()); @@ -2025,7 +2025,7 @@ impl<'a> DisplayListFlattener<'a> { &mut self, clip_and_scroll: ScrollNodeAndClipChain, run_offset: LayoutVector2D, - prim_info: &LayerPrimitiveInfo, + prim_info: &LayoutPrimitiveInfo, font_instance_key: &FontInstanceKey, text_color: &ColorF, glyph_range: ItemRange, @@ -2122,9 +2122,9 @@ impl<'a> DisplayListFlattener<'a> { pub fn add_image( &mut self, clip_and_scroll: ScrollNodeAndClipChain, - info: &LayerPrimitiveInfo, - stretch_size: LayerSize, - mut tile_spacing: LayerSize, + info: &LayoutPrimitiveInfo, + stretch_size: LayoutSize, + mut tile_spacing: LayoutSize, sub_rect: Option, image_key: ImageKey, image_rendering: ImageRendering, @@ -2136,7 +2136,7 @@ impl<'a> DisplayListFlattener<'a> { // in prim_store to detect if an image can be considered // opaque. if tile_spacing == info.rect.size { - tile_spacing = LayerSize::zero(); + tile_spacing = LayoutSize::zero(); } let request = ImageRequest { @@ -2160,7 +2160,7 @@ impl<'a> DisplayListFlattener<'a> { // See if conditions are met to run through the new // image brush shader, which supports segments. - if tile_spacing == LayerSize::zero() && + if tile_spacing == LayoutSize::zero() && stretch_size == info.rect.size && tile_offset.is_none() { let prim = BrushPrimitive::new( @@ -2207,7 +2207,7 @@ impl<'a> DisplayListFlattener<'a> { pub fn add_yuv_image( &mut self, clip_and_scroll: ScrollNodeAndClipChain, - info: &LayerPrimitiveInfo, + info: &LayoutPrimitiveInfo, yuv_data: YuvData, color_space: YuvColorSpace, image_rendering: ImageRendering, @@ -2266,19 +2266,19 @@ pub fn build_scene(config: &FrameBuilderConfig, request: SceneRequest) -> BuiltS trait PrimitiveInfoTiler { fn decompose( &self, - tile_size: LayerSize, - tile_spacing: LayerSize, + tile_size: LayoutSize, + tile_spacing: LayoutSize, max_prims: usize, - ) -> Vec; + ) -> Vec; } -impl PrimitiveInfoTiler for LayerPrimitiveInfo { +impl PrimitiveInfoTiler for LayoutPrimitiveInfo { fn decompose( &self, - tile_size: LayerSize, - tile_spacing: LayerSize, + tile_size: LayoutSize, + tile_spacing: LayoutSize, max_prims: usize, - ) -> Vec { + ) -> Vec { let mut prims = Vec::new(); let tile_repeat = tile_size + tile_spacing; @@ -2300,9 +2300,9 @@ impl PrimitiveInfoTiler for LayerPrimitiveInfo { let mut x0 = rect_p0.x; while x0 < rect_p1.x { - prims.push(LayerPrimitiveInfo { - rect: LayerRect::new( - LayerPoint::new(x0, y0), + prims.push(LayoutPrimitiveInfo { + rect: LayoutRect::new( + LayoutPoint::new(x0, y0), tile_size, ), clip_rect, @@ -2361,4 +2361,4 @@ struct FlattenedStackingContext { } #[derive(Debug)] -pub struct ScrollbarInfo(pub ClipScrollNodeIndex, pub LayerRect); +pub struct ScrollbarInfo(pub ClipScrollNodeIndex, pub LayoutRect); diff --git a/webrender/src/ellipse.rs b/webrender/src/ellipse.rs index 65257a34a6..060fb975ce 100644 --- a/webrender/src/ellipse.rs +++ b/webrender/src/ellipse.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use api::{LayerPoint, LayerSize, LayerVector2D}; +use api::{LayoutPoint, LayoutSize, LayoutVector2D}; use std::f32::consts::FRAC_PI_2; /// Number of steps to integrate arc length over. @@ -11,12 +11,12 @@ const STEP_COUNT: usize = 20; /// Represents an ellipse centred at a local space origin. #[derive(Debug, Clone)] pub struct Ellipse { - pub radius: LayerSize, + pub radius: LayoutSize, pub total_arc_length: f32, } impl Ellipse { - pub fn new(radius: LayerSize) -> Ellipse { + pub fn new(radius: LayoutSize) -> Ellipse { // Approximate the total length of the first quadrant of this ellipse. let total_arc_length = get_simpson_length(FRAC_PI_2, radius.width, radius.height); @@ -56,32 +56,32 @@ impl Ellipse { /// Get a point and tangent on this ellipse from a given angle. /// This only works for the first quadrant of the ellipse. - pub fn get_point_and_tangent(&self, theta: f32) -> (LayerPoint, LayerPoint) { + pub fn get_point_and_tangent(&self, theta: f32) -> (LayoutPoint, LayoutPoint) { let (sin_theta, cos_theta) = theta.sin_cos(); - let point = LayerPoint::new( + let point = LayoutPoint::new( self.radius.width * cos_theta, self.radius.height * sin_theta, ); - let tangent = LayerPoint::new( + let tangent = LayoutPoint::new( -self.radius.width * sin_theta, self.radius.height * cos_theta, ); (point, tangent) } - pub fn contains(&self, point: LayerPoint) -> bool { + pub fn contains(&self, point: LayoutPoint) -> bool { self.signed_distance(point.to_vector()) <= 0.0 } /// Find the signed distance from this ellipse given a point. /// Taken from http://www.iquilezles.org/www/articles/ellipsedist/ellipsedist.htm - fn signed_distance(&self, point: LayerVector2D) -> f32 { + fn signed_distance(&self, point: LayoutVector2D) -> f32 { // This algorithm fails for circles, so we handle them here. if self.radius.width == self.radius.height { return point.length() - self.radius.width; } - let mut p = LayerVector2D::new(point.x.abs(), point.y.abs()); + let mut p = LayoutVector2D::new(point.x.abs(), point.y.abs()); let mut ab = self.radius.to_vector(); if p.x > p.y { p = p.yx(); @@ -121,7 +121,7 @@ impl Ellipse { }; let si = (1.0 - co * co).sqrt(); - let r = LayerVector2D::new(ab.x * co, ab.y * si); + let r = LayoutVector2D::new(ab.x * co, ab.y * si); (r - p).length() * (p.y - r.y).signum() } } diff --git a/webrender/src/frame_builder.rs b/webrender/src/frame_builder.rs index 4bc98e2585..cf2a306167 100644 --- a/webrender/src/frame_builder.rs +++ b/webrender/src/frame_builder.rs @@ -4,7 +4,7 @@ use api::{BuiltDisplayList, ColorF, DeviceIntPoint, DeviceIntRect, DevicePixelScale}; use api::{DeviceUintPoint, DeviceUintRect, DeviceUintSize, DocumentLayer, FontRenderMode}; -use api::{LayerRect, LayerSize, PipelineId, WorldPoint}; +use api::{LayoutRect, LayoutSize, PipelineId, WorldPoint}; use clip::{ClipChain, ClipStore}; use clip_scroll_node::{ClipScrollNode}; use clip_scroll_tree::{ClipScrollNodeIndex, ClipScrollTree}; @@ -24,7 +24,7 @@ use std::{mem, f32}; use std::sync::Arc; use tiling::{Frame, RenderPass, RenderPassKind, RenderTargetContext}; use tiling::{ScrollbarPrimitive, SpecialRenderPasses}; -use util::{self, MaxRect, WorldToLayerFastTransform}; +use util::{self, MaxRect, WorldToLayoutFastTransform}; #[derive(Clone, Copy)] #[cfg_attr(feature = "capture", derive(Serialize))] @@ -62,7 +62,7 @@ pub struct FrameBuildingState<'a> { pub render_tasks: &'a mut RenderTaskTree, pub profile_counters: &'a mut FrameProfileCounters, pub clip_store: &'a mut ClipStore, - pub local_clip_rects: &'a mut Vec, + pub local_clip_rects: &'a mut Vec, pub resource_cache: &'a mut ResourceCache, pub gpu_cache: &'a mut GpuCache, pub cached_gradients: &'a mut [CachedGradient], @@ -74,7 +74,7 @@ pub struct PictureContext<'a> { pub prim_runs: Vec, pub original_reference_frame_index: Option, pub display_list: &'a BuiltDisplayList, - pub inv_world_transform: Option, + pub inv_world_transform: Option, pub apply_local_clip_rect: bool, pub inflation_factor: f32, } @@ -165,7 +165,7 @@ impl FrameBuilder { profile_counters: &mut FrameProfileCounters, device_pixel_scale: DevicePixelScale, scene_properties: &SceneProperties, - local_clip_rects: &mut Vec, + local_clip_rects: &mut Vec, node_data: &[ClipScrollNodeData], ) -> Option { profile_scope!("cull"); @@ -250,7 +250,7 @@ impl FrameBuilder { let scrollable_distance = scroll_frame.scrollable_size().height; if scrollable_distance <= 0.0 { - metadata.local_clip_rect.size = LayerSize::zero(); + metadata.local_clip_rect.size = LayoutSize::zero(); continue; } let amount_scrolled = -scroll_frame.scroll_offset().y / scrollable_distance; @@ -299,7 +299,7 @@ impl FrameBuilder { let total_prim_runs = self.prim_store.pictures.iter().fold(1, |count, pic| count + pic.runs.len()); let mut clip_chain_local_clip_rects = Vec::with_capacity(total_prim_runs); - clip_chain_local_clip_rects.push(LayerRect::max_rect()); + clip_chain_local_clip_rects.push(LayoutRect::max_rect()); clip_scroll_tree.update_tree( &self.screen_rect.to_i32(), diff --git a/webrender/src/glyph_rasterizer.rs b/webrender/src/glyph_rasterizer.rs index 03b0c6b7b0..a33c1e175e 100644 --- a/webrender/src/glyph_rasterizer.rs +++ b/webrender/src/glyph_rasterizer.rs @@ -7,7 +7,7 @@ use api::{IdNamespace, LayoutPoint}; use api::{ColorF, ColorU}; use api::{FontInstanceFlags, FontInstancePlatformOptions}; use api::{FontKey, FontRenderMode, FontTemplate, FontVariation}; -use api::{GlyphDimensions, GlyphKey, LayerToWorldTransform, SubpixelDirection}; +use api::{GlyphDimensions, GlyphKey, LayoutToWorldTransform, SubpixelDirection}; #[cfg(feature = "pathfinder")] use api::NativeFontHandle; #[cfg(any(test, feature = "pathfinder"))] @@ -184,8 +184,8 @@ impl FontTransform { } } -impl<'a> From<&'a LayerToWorldTransform> for FontTransform { - fn from(xform: &'a LayerToWorldTransform) -> Self { +impl<'a> From<&'a LayoutToWorldTransform> for FontTransform { + fn from(xform: &'a LayoutToWorldTransform) -> Self { FontTransform::new(xform.m11, xform.m21, xform.m12, xform.m22) } } diff --git a/webrender/src/gpu_types.rs b/webrender/src/gpu_types.rs index 2cddb4a1d1..b9a4ea9cdc 100644 --- a/webrender/src/gpu_types.rs +++ b/webrender/src/gpu_types.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use api::{DevicePoint, LayerToWorldTransform, WorldToLayerTransform}; +use api::{DevicePoint, LayoutToWorldTransform, WorldToLayoutTransform}; use gpu_cache::{GpuCacheAddress, GpuDataRequest}; use prim_store::EdgeAaSegmentMask; use render_task::RenderTaskAddress; @@ -246,8 +246,8 @@ pub struct ClipScrollNodeIndex(pub u32); #[cfg_attr(feature = "replay", derive(Deserialize))] #[repr(C)] pub struct ClipScrollNodeData { - pub transform: LayerToWorldTransform, - pub inv_transform: WorldToLayerTransform, + pub transform: LayoutToWorldTransform, + pub inv_transform: WorldToLayoutTransform, pub transform_kind: f32, pub padding: [f32; 3], } @@ -255,8 +255,8 @@ pub struct ClipScrollNodeData { impl ClipScrollNodeData { pub fn invalid() -> Self { ClipScrollNodeData { - transform: LayerToWorldTransform::identity(), - inv_transform: WorldToLayerTransform::identity(), + transform: LayoutToWorldTransform::identity(), + inv_transform: WorldToLayoutTransform::identity(), transform_kind: 0.0, padding: [0.0; 3], } diff --git a/webrender/src/hit_test.rs b/webrender/src/hit_test.rs index 2fafd81e42..7f8d6fda77 100644 --- a/webrender/src/hit_test.rs +++ b/webrender/src/hit_test.rs @@ -2,14 +2,14 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use api::{BorderRadius, ClipMode, HitTestFlags, HitTestItem, HitTestResult, ItemTag, LayerPoint}; -use api::{LayerPrimitiveInfo, LayerRect, PipelineId, WorldPoint}; +use api::{BorderRadius, ClipMode, HitTestFlags, HitTestItem, HitTestResult, ItemTag, LayoutPoint}; +use api::{LayoutPrimitiveInfo, LayoutRect, PipelineId, WorldPoint}; use clip::{ClipSource, ClipStore, rounded_rectangle_contains_point}; use clip_scroll_node::{ClipScrollNode, NodeType}; use clip_scroll_tree::{ClipChainIndex, ClipScrollNodeIndex, ClipScrollTree}; use internal_types::FastHashMap; use prim_store::ScrollNodeAndClipChain; -use util::LayerToWorldFastTransform; +use util::LayoutToWorldFastTransform; /// A copy of important clip scroll node data to use during hit testing. This a copy of /// data from the ClipScrollTree that will persist as a new frame is under construction, @@ -23,13 +23,13 @@ pub struct HitTestClipScrollNode { regions: Vec, /// World transform for content transformed by this node. - world_content_transform: LayerToWorldFastTransform, + world_content_transform: LayoutToWorldFastTransform, /// World viewport transform for content transformed by this node. - world_viewport_transform: LayerToWorldFastTransform, + world_viewport_transform: LayoutToWorldFastTransform, /// Origin of the viewport of the node, used to calculate node-relative positions. - node_origin: LayerPoint, + node_origin: LayoutPoint, } /// A description of a clip chain in the HitTester. This is used to describe @@ -54,14 +54,14 @@ impl HitTestClipChainDescriptor { #[derive(Clone)] pub struct HitTestingItem { - rect: LayerRect, - clip_rect: LayerRect, + rect: LayoutRect, + clip_rect: LayoutRect, tag: ItemTag, is_backface_visible: bool, } impl HitTestingItem { - pub fn new(tag: ItemTag, info: &LayerPrimitiveInfo) -> HitTestingItem { + pub fn new(tag: ItemTag, info: &LayoutPrimitiveInfo) -> HitTestingItem { HitTestingItem { rect: info.rect, clip_rect: info.clip_rect, @@ -75,12 +75,12 @@ impl HitTestingItem { pub struct HitTestingRun(pub Vec, pub ScrollNodeAndClipChain); enum HitTestRegion { - Rectangle(LayerRect, ClipMode), - RoundedRectangle(LayerRect, BorderRadius, ClipMode), + Rectangle(LayoutRect, ClipMode), + RoundedRectangle(LayoutRect, BorderRadius, ClipMode), } impl HitTestRegion { - pub fn contains(&self, point: &LayerPoint) -> bool { + pub fn contains(&self, point: &LayoutPoint) -> bool { match *self { HitTestRegion::Rectangle(ref rectangle, ClipMode::Clip) => rectangle.contains(point), @@ -327,7 +327,7 @@ pub struct HitTest { pipeline_id: Option, point: WorldPoint, flags: HitTestFlags, - node_cache: FastHashMap>, + node_cache: FastHashMap>, clip_chain_cache: Vec>, } @@ -366,7 +366,7 @@ impl HitTest { return self.point; } - let point = &LayerPoint::new(self.point.x, self.point.y); + let point = &LayoutPoint::new(self.point.x, self.point.y); self.pipeline_id.map(|id| hit_tester.get_pipeline_root(id).world_viewport_transform.transform_point2d(point) ).unwrap_or_else(|| WorldPoint::new(self.point.x, self.point.y)) diff --git a/webrender/src/image.rs b/webrender/src/image.rs index 6126814140..4ada110452 100644 --- a/webrender/src/image.rs +++ b/webrender/src/image.rs @@ -2,22 +2,22 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use api::{TileOffset, LayerRect, LayerSize, LayerVector2D, DeviceUintSize}; +use api::{TileOffset, LayoutRect, LayoutSize, LayoutVector2D, DeviceUintSize}; use euclid::rect; pub struct DecomposedTile { - pub rect: LayerRect, - pub stretch_size: LayerSize, + pub rect: LayoutRect, + pub stretch_size: LayoutSize, pub tile_offset: TileOffset, } pub struct TiledImageInfo { /// The bounds of the item in layout space. - pub rect: LayerRect, + pub rect: LayoutRect, /// The space between each repeated pattern in layout space. - pub tile_spacing: LayerSize, + pub tile_spacing: LayoutSize, /// The size in layout space of each repetition of the image. - pub stretch_size: LayerSize, + pub stretch_size: LayoutSize, /// The size the image occupies in the cache in device space. pub device_image_size: DeviceUintSize, @@ -69,7 +69,7 @@ pub fn decompose_image(info: &TiledImageInfo, callback: &mut FnMut(&DecomposedTi } -fn decompose_row(item_rect: &LayerRect, info: &TiledImageInfo, callback: &mut FnMut(&DecomposedTile)) { +fn decompose_row(item_rect: &LayoutRect, info: &TiledImageInfo, callback: &mut FnMut(&DecomposedTile)) { let no_horizontal_tiling = info.device_image_size.width <= info.device_tile_size; let no_horizontal_spacing = info.tile_spacing.width == 0.0; @@ -98,7 +98,7 @@ fn decompose_row(item_rect: &LayerRect, info: &TiledImageInfo, callback: &mut Fn } fn decompose_cache_tiles( - item_rect: &LayerRect, + item_rect: &LayoutRect, info: &TiledImageInfo, callback: &mut FnMut(&DecomposedTile), ) { @@ -155,7 +155,7 @@ fn decompose_cache_tiles( let img_dh = tile_size_f32 / (info.device_image_size.height as f32); // Stretched size of the tile in layout space. - let stretched_tile_size = LayerSize::new( + let stretched_tile_size = LayoutSize::new( img_dw * info.stretch_size.width, img_dh * info.stretch_size.height, ); @@ -228,8 +228,8 @@ fn decompose_cache_tiles( } fn add_device_tile( - item_rect: &LayerRect, - stretched_tile_size: LayerSize, + item_rect: &LayoutRect, + stretched_tile_size: LayoutSize, tile_offset: TileOffset, tile_ratio_width: f32, tile_ratio_height: f32, @@ -246,13 +246,13 @@ fn add_device_tile( // axis). // See the shader_repeat_x/y code below. - let stretch_size = LayerSize::new( + let stretch_size = LayoutSize::new( stretched_tile_size.width * tile_ratio_width, stretched_tile_size.height * tile_ratio_height, ); - let mut prim_rect = LayerRect::new( - item_rect.origin + LayerVector2D::new( + let mut prim_rect = LayoutRect::new( + item_rect.origin + LayoutVector2D::new( tile_offset.x as f32 * stretched_tile_size.width, tile_offset.y as f32 * stretched_tile_size.height, ), diff --git a/webrender/src/picture.rs b/webrender/src/picture.rs index aef85c41c7..f7c320c000 100644 --- a/webrender/src/picture.rs +++ b/webrender/src/picture.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use api::{FilterOp, MixBlendMode, PipelineId, PremultipliedColorF}; -use api::{DeviceIntRect, DeviceIntSize, LayerRect}; +use api::{DeviceIntRect, DeviceIntSize, LayoutRect}; use api::{PictureIntPoint, PictureIntRect, PictureIntSize}; use box_shadow::{BLUR_SAMPLE_SCALE}; use clip_scroll_tree::ClipScrollNodeIndex; @@ -151,7 +151,7 @@ pub struct PicturePrimitive { // It is only different if this is part of a 3D // rendering context. pub reference_frame_index: ClipScrollNodeIndex, - pub real_local_rect: LayerRect, + pub real_local_rect: LayoutRect, // An optional cache handle for storing extra data // in the GPU cache, depending on the type of // picture. @@ -195,7 +195,7 @@ impl PicturePrimitive { is_in_3d_context, frame_output_pipeline_id, reference_frame_index, - real_local_rect: LayerRect::zero(), + real_local_rect: LayoutRect::zero(), extra_gpu_data_handle: GpuCacheHandle::new(), apply_local_clip_rect, pipeline_id, @@ -227,7 +227,7 @@ impl PicturePrimitive { pub fn update_local_rect( &mut self, prim_run_rect: PrimitiveRunLocalRect, - ) -> LayerRect { + ) -> LayoutRect { let local_content_rect = prim_run_rect.local_rect_in_actual_parent_space; self.real_local_rect = prim_run_rect.local_rect_in_original_parent_space; diff --git a/webrender/src/prim_store.rs b/webrender/src/prim_store.rs index de95dcbcb7..81cc0db774 100644 --- a/webrender/src/prim_store.rs +++ b/webrender/src/prim_store.rs @@ -5,7 +5,7 @@ use api::{AlphaType, BorderRadius, BoxShadowClipMode, BuiltDisplayList, ClipMode, ColorF, ComplexClipRegion}; use api::{DeviceIntRect, DeviceIntSize, DevicePixelScale, Epoch, ExtendMode, FontRenderMode}; use api::{FilterOp, GlyphInstance, GlyphKey, GradientStop, ImageKey, ImageRendering, ItemRange, ItemTag}; -use api::{GlyphRasterSpace, LayerPoint, LayerRect, LayerSize, LayerToWorldTransform, LayerVector2D}; +use api::{GlyphRasterSpace, LayoutPoint, LayoutRect, LayoutSize, LayoutToWorldTransform, LayoutVector2D}; use api::{PipelineId, PremultipliedColorF, Shadow, YuvColorSpace, YuvFormat}; use border::{BorderCornerInstance, BorderEdgeKind}; use box_shadow::BLUR_SAMPLE_SCALE; @@ -29,7 +29,7 @@ use resource_cache::{ImageProperties, ImageRequest}; use segment::SegmentBuilder; use std::{mem, usize}; use std::sync::Arc; -use util::{MatrixHelpers, WorldToLayerFastTransform, calculate_screen_bounding_rect}; +use util::{MatrixHelpers, WorldToLayoutFastTransform, calculate_screen_bounding_rect}; use util::{pack_as_float, recycle_vec}; @@ -110,8 +110,8 @@ impl CachedGradient { // in the picture structure. #[derive(Debug)] pub struct PrimitiveRunLocalRect { - pub local_rect_in_actual_parent_space: LayerRect, - pub local_rect_in_original_parent_space: LayerRect, + pub local_rect_in_actual_parent_space: LayoutRect, + pub local_rect_in_original_parent_space: LayoutRect, } /// For external images, it's not possible to know the @@ -184,8 +184,8 @@ pub struct PrimitiveMetadata { // TODO(gw): In the future, we should just pull these // directly from the DL item, instead of // storing them here. - pub local_rect: LayerRect, - pub local_clip_rect: LayerRect, + pub local_rect: LayoutRect, + pub local_clip_rect: LayoutRect, pub clip_chain_rect_index: ClipChainRectIndex, pub is_backface_visible: bool, pub screen_rect: Option, @@ -213,8 +213,8 @@ pub enum BrushKind { request: ImageRequest, current_epoch: Epoch, alpha_type: AlphaType, - stretch_size: LayerSize, - tile_spacing: LayerSize, + stretch_size: LayoutSize, + tile_spacing: LayoutSize, source: ImageSource, sub_rect: Option, }, @@ -228,7 +228,7 @@ pub enum BrushKind { gradient_index: CachedGradientIndex, stops_range: ItemRange, extend_mode: ExtendMode, - center: LayerPoint, + center: LayoutPoint, start_radius: f32, end_radius: f32, ratio_xy: f32, @@ -239,8 +239,8 @@ pub enum BrushKind { stops_count: usize, extend_mode: ExtendMode, reverse_stops: bool, - start_point: LayerPoint, - end_point: LayerPoint, + start_point: LayoutPoint, + end_point: LayoutPoint, } } @@ -279,7 +279,7 @@ bitflags! { #[derive(Debug)] pub struct BrushSegment { - pub local_rect: LayerRect, + pub local_rect: LayoutRect, pub clip_task_id: Option, pub may_need_clip_mask: bool, pub edge_flags: EdgeAaSegmentMask, @@ -287,13 +287,13 @@ pub struct BrushSegment { impl BrushSegment { pub fn new( - origin: LayerPoint, - size: LayerSize, + origin: LayoutPoint, + size: LayoutSize, may_need_clip_mask: bool, edge_flags: EdgeAaSegmentMask, ) -> BrushSegment { BrushSegment { - local_rect: LayerRect::new(origin, size), + local_rect: LayoutRect::new(origin, size), clip_task_id: None, may_need_clip_mask, edge_flags, @@ -418,9 +418,9 @@ pub enum ImageSource { #[derive(Debug)] pub struct ImagePrimitiveCpu { - pub tile_spacing: LayerSize, + pub tile_spacing: LayoutSize, pub alpha_type: AlphaType, - pub stretch_size: LayerSize, + pub stretch_size: LayoutSize, pub current_epoch: Epoch, pub source: ImageSource, pub key: ImageCacheKey, @@ -634,7 +634,7 @@ impl<'a> GradientGpuBlockBuilder<'a> { #[derive(Debug, Clone)] pub struct TextRunPrimitiveCpu { pub font: FontInstance, - pub offset: LayerVector2D, + pub offset: LayoutVector2D, pub glyph_range: ItemRange, pub glyph_keys: Vec, pub glyph_gpu_blocks: Vec, @@ -646,7 +646,7 @@ impl TextRunPrimitiveCpu { pub fn get_font( &self, device_pixel_scale: DevicePixelScale, - transform: Option, + transform: Option, ) -> FontInstance { let mut font = self.font.clone(); font.size = font.size.scale_by(device_pixel_scale.0); @@ -665,7 +665,7 @@ impl TextRunPrimitiveCpu { fn prepare_for_render( &mut self, device_pixel_scale: DevicePixelScale, - transform: Option, + transform: Option, display_list: &BuiltDisplayList, frame_building_state: &mut FrameBuildingState, ) { @@ -734,14 +734,14 @@ impl TextRunPrimitiveCpu { #[derive(Debug)] #[repr(C)] struct ClipRect { - rect: LayerRect, + rect: LayoutRect, mode: f32, } #[derive(Debug)] #[repr(C)] struct ClipCorner { - rect: LayerRect, + rect: LayoutRect, outer_radius_x: f32, outer_radius_y: f32, inner_radius_x: f32, @@ -765,7 +765,7 @@ impl ClipCorner { ]); } - fn uniform(rect: LayerRect, outer_radius: f32, inner_radius: f32) -> ClipCorner { + fn uniform(rect: LayoutRect, outer_radius: f32, inner_radius: f32) -> ClipCorner { ClipCorner { rect, outer_radius_x: outer_radius, @@ -779,7 +779,7 @@ impl ClipCorner { #[derive(Debug)] #[repr(C)] pub struct ImageMaskData { - pub local_rect: LayerRect, + pub local_rect: LayoutRect, } impl ToGpuBlocks for ImageMaskData { @@ -798,16 +798,16 @@ pub struct ClipData { } impl ClipData { - pub fn rounded_rect(rect: &LayerRect, radii: &BorderRadius, mode: ClipMode) -> ClipData { + pub fn rounded_rect(rect: &LayoutRect, radii: &BorderRadius, mode: ClipMode) -> ClipData { ClipData { rect: ClipRect { rect: *rect, mode: mode as u32 as f32, }, top_left: ClipCorner { - rect: LayerRect::new( - LayerPoint::new(rect.origin.x, rect.origin.y), - LayerSize::new(radii.top_left.width, radii.top_left.height), + rect: LayoutRect::new( + LayoutPoint::new(rect.origin.x, rect.origin.y), + LayoutSize::new(radii.top_left.width, radii.top_left.height), ), outer_radius_x: radii.top_left.width, outer_radius_y: radii.top_left.height, @@ -815,12 +815,12 @@ impl ClipData { inner_radius_y: 0.0, }, top_right: ClipCorner { - rect: LayerRect::new( - LayerPoint::new( + rect: LayoutRect::new( + LayoutPoint::new( rect.origin.x + rect.size.width - radii.top_right.width, rect.origin.y, ), - LayerSize::new(radii.top_right.width, radii.top_right.height), + LayoutSize::new(radii.top_right.width, radii.top_right.height), ), outer_radius_x: radii.top_right.width, outer_radius_y: radii.top_right.height, @@ -828,12 +828,12 @@ impl ClipData { inner_radius_y: 0.0, }, bottom_left: ClipCorner { - rect: LayerRect::new( - LayerPoint::new( + rect: LayoutRect::new( + LayoutPoint::new( rect.origin.x, rect.origin.y + rect.size.height - radii.bottom_left.height, ), - LayerSize::new(radii.bottom_left.width, radii.bottom_left.height), + LayoutSize::new(radii.bottom_left.width, radii.bottom_left.height), ), outer_radius_x: radii.bottom_left.width, outer_radius_y: radii.bottom_left.height, @@ -841,12 +841,12 @@ impl ClipData { inner_radius_y: 0.0, }, bottom_right: ClipCorner { - rect: LayerRect::new( - LayerPoint::new( + rect: LayoutRect::new( + LayoutPoint::new( rect.origin.x + rect.size.width - radii.bottom_right.width, rect.origin.y + rect.size.height - radii.bottom_right.height, ), - LayerSize::new(radii.bottom_right.width, radii.bottom_right.height), + LayoutSize::new(radii.bottom_right.width, radii.bottom_right.height), ), outer_radius_x: radii.bottom_right.width, outer_radius_y: radii.bottom_right.height, @@ -856,43 +856,43 @@ impl ClipData { } } - pub fn uniform(rect: LayerRect, radius: f32, mode: ClipMode) -> ClipData { + pub fn uniform(rect: LayoutRect, radius: f32, mode: ClipMode) -> ClipData { ClipData { rect: ClipRect { rect, mode: mode as u32 as f32, }, top_left: ClipCorner::uniform( - LayerRect::new( - LayerPoint::new(rect.origin.x, rect.origin.y), - LayerSize::new(radius, radius), + LayoutRect::new( + LayoutPoint::new(rect.origin.x, rect.origin.y), + LayoutSize::new(radius, radius), ), radius, 0.0, ), top_right: ClipCorner::uniform( - LayerRect::new( - LayerPoint::new(rect.origin.x + rect.size.width - radius, rect.origin.y), - LayerSize::new(radius, radius), + LayoutRect::new( + LayoutPoint::new(rect.origin.x + rect.size.width - radius, rect.origin.y), + LayoutSize::new(radius, radius), ), radius, 0.0, ), bottom_left: ClipCorner::uniform( - LayerRect::new( - LayerPoint::new(rect.origin.x, rect.origin.y + rect.size.height - radius), - LayerSize::new(radius, radius), + LayoutRect::new( + LayoutPoint::new(rect.origin.x, rect.origin.y + rect.size.height - radius), + LayoutSize::new(radius, radius), ), radius, 0.0, ), bottom_right: ClipCorner::uniform( - LayerRect::new( - LayerPoint::new( + LayoutRect::new( + LayoutPoint::new( rect.origin.x + rect.size.width - radius, rect.origin.y + rect.size.height - radius, ), - LayerSize::new(radius, radius), + LayoutSize::new(radius, radius), ), radius, 0.0, @@ -1077,8 +1077,8 @@ impl PrimitiveStore { pub fn add_primitive( &mut self, - local_rect: &LayerRect, - local_clip_rect: &LayerRect, + local_rect: &LayoutRect, + local_clip_rect: &LayoutRect, is_backface_visible: bool, clip_sources: Option, tag: Option, @@ -1631,7 +1631,7 @@ impl PrimitiveStore { let prim_transform = &prim_run_context.scroll_node.world_content_transform; let relative_transform = prim_transform .inverse() - .unwrap_or(WorldToLayerFastTransform::identity()) + .unwrap_or(WorldToLayoutFastTransform::identity()) .pre_mul(&clip_transform.into()); relative_transform.transform_rect(&local_clip_rect) @@ -1808,7 +1808,7 @@ impl PrimitiveStore { // It's used to calculate a local clipping rectangle before we reach this // point, so we can set it to zero here. It should be unused from this point // on. - local_clip_rect: LayerRect::zero(), + local_clip_rect: LayoutRect::zero(), screen_inner_rect, screen_outer_rect: screen_outer_rect.unwrap_or(prim_screen_rect), prev: None, @@ -1899,7 +1899,7 @@ impl PrimitiveStore { pic_state: &mut PictureState, frame_context: &FrameBuildingContext, frame_state: &mut FrameBuildingState, - ) -> Option { + ) -> Option { let mut may_need_clip_mask = true; let mut pic_state_for_children = PictureState::new(); @@ -2076,8 +2076,8 @@ impl PrimitiveStore { frame_state: &mut FrameBuildingState, ) -> PrimitiveRunLocalRect { let mut result = PrimitiveRunLocalRect { - local_rect_in_actual_parent_space: LayerRect::zero(), - local_rect_in_original_parent_space: LayerRect::zero(), + local_rect_in_actual_parent_space: LayoutRect::zero(), + local_rect_in_original_parent_space: LayoutRect::zero(), }; for run in &pic_context.prim_runs { @@ -2238,17 +2238,17 @@ fn convert_clip_chain_to_clip_vector( fn get_local_clip_rect_for_nodes( scroll_node: &ClipScrollNode, clip_chain: &ClipChain, -) -> Option { +) -> Option { let local_rect = ClipChainNodeIter { current: clip_chain.nodes.clone() }.fold( None, - |combined_local_clip_rect: Option, node| { + |combined_local_clip_rect: Option, node| { if node.work_item.coordinate_system_id != scroll_node.coordinate_system_id { return combined_local_clip_rect; } Some(match combined_local_clip_rect { Some(combined_rect) => - combined_rect.intersection(&node.local_clip_rect).unwrap_or_else(LayerRect::zero), + combined_rect.intersection(&node.local_clip_rect).unwrap_or_else(LayoutRect::zero), None => node.local_clip_rect, }) } @@ -2268,7 +2268,7 @@ impl<'a> GpuDataRequest<'a> { // part of an image. fn write_segment( &mut self, - local_rect: LayerRect, + local_rect: LayoutRect, ) { self.push(local_rect); self.push([ diff --git a/webrender/src/render_backend.rs b/webrender/src/render_backend.rs index 41dd893eeb..f96a7f9dde 100644 --- a/webrender/src/render_backend.rs +++ b/webrender/src/render_backend.rs @@ -7,7 +7,7 @@ use api::{ApiMsg, BuiltDisplayList, ClearCache, DebugCommand}; use api::{BuiltDisplayListIter, SpecificDisplayItem}; use api::{DeviceIntPoint, DevicePixelScale, DeviceUintPoint, DeviceUintRect, DeviceUintSize}; use api::{DocumentId, DocumentLayer, ExternalScrollId, FrameMsg, HitTestResult}; -use api::{IdNamespace, LayerPoint, PipelineId, RenderNotifier, SceneMsg, ScrollClamping}; +use api::{IdNamespace, LayoutPoint, PipelineId, RenderNotifier, SceneMsg, ScrollClamping}; use api::{ScrollLocation, ScrollNodeState, TransactionMsg, WorldPoint}; use api::channel::{MsgReceiver, Payload}; #[cfg(feature = "capture")] @@ -327,7 +327,7 @@ impl Document { /// Returns true if the node actually changed position or false otherwise. pub fn scroll_node( &mut self, - origin: LayerPoint, + origin: LayoutPoint, id: ExternalScrollId, clamp: ScrollClamping ) -> bool { diff --git a/webrender/src/scene.rs b/webrender/src/scene.rs index b2f7dc5751..afbeecd094 100644 --- a/webrender/src/scene.rs +++ b/webrender/src/scene.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use api::{BuiltDisplayList, ColorF, DynamicProperties, Epoch, LayerSize, LayoutSize}; +use api::{BuiltDisplayList, ColorF, DynamicProperties, Epoch, LayoutSize}; use api::{FilterOp, LayoutTransform, PipelineId, PropertyBinding, PropertyBindingId}; use api::{ItemRange, MixBlendMode, StackingContext}; use internal_types::FastHashMap; @@ -95,7 +95,7 @@ impl SceneProperties { #[derive(Clone)] pub struct ScenePipeline { pub pipeline_id: PipelineId, - pub viewport_size: LayerSize, + pub viewport_size: LayoutSize, pub content_size: LayoutSize, pub background_color: Option, pub display_list: BuiltDisplayList, @@ -130,7 +130,7 @@ impl Scene { epoch: Epoch, display_list: BuiltDisplayList, background_color: Option, - viewport_size: LayerSize, + viewport_size: LayoutSize, content_size: LayoutSize, ) { let new_pipeline = ScenePipeline { diff --git a/webrender/src/segment.rs b/webrender/src/segment.rs index c3a48a49f1..cfee1f01a3 100644 --- a/webrender/src/segment.rs +++ b/webrender/src/segment.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use api::{BorderRadius, ClipMode, LayerPoint, LayerPointAu, LayerRect, LayerSize}; +use api::{BorderRadius, ClipMode, LayoutPoint, LayoutPointAu, LayoutRect, LayoutSize}; use app_units::Au; use prim_store::EdgeAaSegmentMask; use std::{cmp, usize}; @@ -19,7 +19,7 @@ bitflags! { // The segment builder outputs a list of these segments. #[derive(Debug, PartialEq)] pub struct Segment { - pub rect: LayerRect, + pub rect: LayoutRect, pub has_mask: bool, pub edge_flags: EdgeAaSegmentMask, pub region_x: usize, @@ -143,14 +143,14 @@ impl Event { // a clip in/out rect, or a mask region). #[derive(Debug)] struct Item { - rect: LayerRect, + rect: LayoutRect, mode: Option, flags: ItemFlags, } impl Item { fn new( - rect: LayerRect, + rect: LayoutRect, mode: Option, has_mask: bool, ) -> Item { @@ -174,17 +174,17 @@ struct ItemIndex(usize); // The main public interface to the segment module. pub struct SegmentBuilder { items: Vec, - inner_rect: Option, - bounding_rect: Option, + inner_rect: Option, + bounding_rect: Option, } impl SegmentBuilder { // Create a new segment builder, supplying the primitive // local rect and associated local clip rect. pub fn new( - local_rect: LayerRect, - inner_rect: Option, - local_clip_rect: LayerRect, + local_rect: LayoutRect, + inner_rect: Option, + local_clip_rect: LayoutRect, ) -> SegmentBuilder { let mut builder = SegmentBuilder { items: Vec::new(), @@ -206,8 +206,8 @@ impl SegmentBuilder { // such as dashed and dotted borders in the future. pub fn push_mask_region( &mut self, - outer_rect: LayerRect, - inner_rect: LayerRect, + outer_rect: LayoutRect, + inner_rect: LayoutRect, inner_clip_mode: Option, ) { debug_assert!(outer_rect.contains_rect(&inner_rect)); @@ -218,37 +218,37 @@ impl SegmentBuilder { let p3 = outer_rect.bottom_right(); let segments = &[ - LayerRect::new( - LayerPoint::new(p0.x, p0.y), - LayerSize::new(p1.x - p0.x, p1.y - p0.y), + LayoutRect::new( + LayoutPoint::new(p0.x, p0.y), + LayoutSize::new(p1.x - p0.x, p1.y - p0.y), ), - LayerRect::new( - LayerPoint::new(p2.x, p0.y), - LayerSize::new(p3.x - p2.x, p1.y - p0.y), + LayoutRect::new( + LayoutPoint::new(p2.x, p0.y), + LayoutSize::new(p3.x - p2.x, p1.y - p0.y), ), - LayerRect::new( - LayerPoint::new(p2.x, p2.y), - LayerSize::new(p3.x - p2.x, p3.y - p2.y), + LayoutRect::new( + LayoutPoint::new(p2.x, p2.y), + LayoutSize::new(p3.x - p2.x, p3.y - p2.y), ), - LayerRect::new( - LayerPoint::new(p0.x, p2.y), - LayerSize::new(p1.x - p0.x, p3.y - p2.y), + LayoutRect::new( + LayoutPoint::new(p0.x, p2.y), + LayoutSize::new(p1.x - p0.x, p3.y - p2.y), ), - LayerRect::new( - LayerPoint::new(p1.x, p0.y), - LayerSize::new(p2.x - p1.x, p1.y - p0.y), + LayoutRect::new( + LayoutPoint::new(p1.x, p0.y), + LayoutSize::new(p2.x - p1.x, p1.y - p0.y), ), - LayerRect::new( - LayerPoint::new(p2.x, p1.y), - LayerSize::new(p3.x - p2.x, p2.y - p1.y), + LayoutRect::new( + LayoutPoint::new(p2.x, p1.y), + LayoutSize::new(p3.x - p2.x, p2.y - p1.y), ), - LayerRect::new( - LayerPoint::new(p1.x, p2.y), - LayerSize::new(p2.x - p1.x, p3.y - p2.y), + LayoutRect::new( + LayoutPoint::new(p1.x, p2.y), + LayoutSize::new(p2.x - p1.x, p3.y - p2.y), ), - LayerRect::new( - LayerPoint::new(p0.x, p1.y), - LayerSize::new(p1.x - p0.x, p2.y - p1.y), + LayoutRect::new( + LayoutPoint::new(p0.x, p1.y), + LayoutSize::new(p1.x - p0.x, p2.y - p1.y), ), ]; @@ -273,7 +273,7 @@ impl SegmentBuilder { // If radius is None, it's a simple rect. pub fn push_clip_rect( &mut self, - rect: LayerRect, + rect: LayoutRect, radius: Option, mode: ClipMode, ) { @@ -298,21 +298,21 @@ impl SegmentBuilder { let p3 = rect.bottom_right(); let corner_segments = &[ - LayerRect::new( - LayerPoint::new(p0.x, p0.y), - LayerSize::new(p1.x - p0.x, p1.y - p0.y), + LayoutRect::new( + LayoutPoint::new(p0.x, p0.y), + LayoutSize::new(p1.x - p0.x, p1.y - p0.y), ), - LayerRect::new( - LayerPoint::new(p2.x, p0.y), - LayerSize::new(p3.x - p2.x, p1.y - p0.y), + LayoutRect::new( + LayoutPoint::new(p2.x, p0.y), + LayoutSize::new(p3.x - p2.x, p1.y - p0.y), ), - LayerRect::new( - LayerPoint::new(p2.x, p2.y), - LayerSize::new(p3.x - p2.x, p3.y - p2.y), + LayoutRect::new( + LayoutPoint::new(p2.x, p2.y), + LayoutSize::new(p3.x - p2.x, p3.y - p2.y), ), - LayerRect::new( - LayerPoint::new(p0.x, p2.y), - LayerSize::new(p1.x - p0.x, p3.y - p2.y), + LayoutRect::new( + LayoutPoint::new(p0.x, p2.y), + LayoutSize::new(p1.x - p0.x, p3.y - p2.y), ), ]; @@ -325,25 +325,25 @@ impl SegmentBuilder { } let other_segments = &[ - LayerRect::new( - LayerPoint::new(p1.x, p0.y), - LayerSize::new(p2.x - p1.x, p1.y - p0.y), + LayoutRect::new( + LayoutPoint::new(p1.x, p0.y), + LayoutSize::new(p2.x - p1.x, p1.y - p0.y), ), - LayerRect::new( - LayerPoint::new(p2.x, p1.y), - LayerSize::new(p3.x - p2.x, p2.y - p1.y), + LayoutRect::new( + LayoutPoint::new(p2.x, p1.y), + LayoutSize::new(p3.x - p2.x, p2.y - p1.y), ), - LayerRect::new( - LayerPoint::new(p1.x, p2.y), - LayerSize::new(p2.x - p1.x, p3.y - p2.y), + LayoutRect::new( + LayoutPoint::new(p1.x, p2.y), + LayoutSize::new(p2.x - p1.x, p3.y - p2.y), ), - LayerRect::new( - LayerPoint::new(p0.x, p1.y), - LayerSize::new(p1.x - p0.x, p2.y - p1.y), + LayoutRect::new( + LayoutPoint::new(p0.x, p1.y), + LayoutSize::new(p1.x - p0.x, p2.y - p1.y), ), - LayerRect::new( - LayerPoint::new(p1.x, p1.y), - LayerSize::new(p2.x - p1.x, p2.y - p1.y), + LayoutRect::new( + LayoutPoint::new(p1.x, p1.y), + LayoutSize::new(p2.x - p1.x, p2.y - p1.y), ), ]; @@ -420,12 +420,12 @@ impl SegmentBuilder { // Get the minimal bounding rect in app units. We will // work in fixed point in order to avoid float precision // error while handling events. - let p0 = LayerPointAu::new( + let p0 = LayoutPointAu::new( Au::from_f32_px(bounding_rect.origin.x), Au::from_f32_px(bounding_rect.origin.y), ); - let p1 = LayerPointAu::new( + let p1 = LayoutPointAu::new( Au::from_f32_px(bounding_rect.origin.x + bounding_rect.size.width), Au::from_f32_px(bounding_rect.origin.y + bounding_rect.size.height), ); @@ -558,12 +558,12 @@ fn emit_segment_if_needed( } } - let segment_rect = LayerRect::new( - LayerPoint::new( + let segment_rect = LayoutRect::new( + LayoutPoint::new( x0.to_f32_px(), y0.to_f32_px(), ), - LayerSize::new( + LayoutSize::new( (x1 - x0).to_f32_px(), (y1 - y0).to_f32_px(), ), @@ -580,15 +580,15 @@ fn emit_segment_if_needed( #[cfg(test)] mod test { - use api::{BorderRadius, ClipMode, LayerPoint, LayerRect, LayerSize}; + use api::{BorderRadius, ClipMode, LayoutPoint, LayoutRect, LayoutSize}; use prim_store::EdgeAaSegmentMask; use super::{Segment, SegmentBuilder}; use std::cmp; - fn rect(x0: f32, y0: f32, x1: f32, y1: f32) -> LayerRect { - LayerRect::new( - LayerPoint::new(x0, y0), - LayerSize::new(x1-x0, y1-y0), + fn rect(x0: f32, y0: f32, x1: f32, y1: f32) -> LayoutRect { + LayoutRect::new( + LayoutPoint::new(x0, y0), + LayoutSize::new(x1-x0, y1-y0), ) } @@ -614,9 +614,9 @@ mod test { edge_flags: Option, ) -> Segment { Segment { - rect: LayerRect::new( - LayerPoint::new(x0, y0), - LayerSize::new(x1-x0, y1-y0), + rect: LayoutRect::new( + LayoutPoint::new(x0, y0), + LayoutSize::new(x1-x0, y1-y0), ), has_mask, edge_flags: edge_flags.unwrap_or(EdgeAaSegmentMask::empty()), @@ -637,10 +637,10 @@ mod test { } fn seg_test( - local_rect: LayerRect, - inner_rect: Option, - local_clip_rect: LayerRect, - clips: &[(LayerRect, Option, ClipMode)], + local_rect: LayoutRect, + inner_rect: Option, + local_clip_rect: LayoutRect, + clips: &[(LayoutRect, Option, ClipMode)], expected_segments: &mut [Segment] ) { let mut sb = SegmentBuilder::new( diff --git a/webrender/src/tiling.rs b/webrender/src/tiling.rs index c689abfd7e..ebaf5721b8 100644 --- a/webrender/src/tiling.rs +++ b/webrender/src/tiling.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use api::{ColorF, DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePixelScale, DeviceUintPoint}; -use api::{DeviceUintRect, DeviceUintSize, DocumentLayer, FilterOp, ImageFormat, LayerRect}; +use api::{DeviceUintRect, DeviceUintSize, DocumentLayer, FilterOp, ImageFormat, LayoutRect}; use api::{MixBlendMode, PipelineId}; use batch::{AlphaBatchBuilder, AlphaBatchContainer, ClipBatcher, resolve_image}; use clip::{ClipStore}; @@ -34,7 +34,7 @@ const MIN_TARGET_SIZE: u32 = 2048; pub struct ScrollbarPrimitive { pub scroll_frame_index: ClipScrollNodeIndex, pub prim_index: PrimitiveIndex, - pub frame_rect: LayerRect, + pub frame_rect: LayoutRect, } #[derive(Debug, Copy, Clone)] @@ -938,7 +938,7 @@ pub struct Frame { pub profile_counters: FrameProfileCounters, pub node_data: Vec, - pub clip_chain_local_clip_rects: Vec, + pub clip_chain_local_clip_rects: Vec, pub render_tasks: RenderTaskTree, /// The GPU cache frame that the contents of Self depend on diff --git a/webrender/src/util.rs b/webrender/src/util.rs index dd67f300d8..b54b2fa685 100644 --- a/webrender/src/util.rs +++ b/webrender/src/util.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use api::{BorderRadius, DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePixelScale}; -use api::{DevicePoint, DeviceRect, DeviceSize, LayerPixel, LayerPoint, LayerRect, LayerSize}; -use api::{LayoutPixel, WorldPixel, WorldRect}; +use api::{DevicePoint, DeviceRect, DeviceSize, LayoutPixel, LayoutPoint, LayoutRect, LayoutSize}; +use api::{WorldPixel, WorldRect}; use euclid::{Point2D, Rect, Size2D, TypedPoint2D, TypedPoint3D, TypedRect, TypedSize2D}; use euclid::{TypedTransform2D, TypedTransform3D, TypedVector2D}; use num_traits::Zero; @@ -157,8 +157,8 @@ pub fn lerp(a: f32, b: f32, t: f32) -> f32 { } pub fn calculate_screen_bounding_rect( - transform: &LayerToWorldFastTransform, - rect: &LayerRect, + transform: &LayoutToWorldFastTransform, + rect: &LayoutRect, device_pixel_scale: DevicePixelScale, ) -> DeviceIntRect { let points = [ @@ -309,11 +309,11 @@ pub trait MaxRect { fn max_rect() -> Self; } -impl MaxRect for LayerRect { +impl MaxRect for LayoutRect { fn max_rect() -> Self { - LayerRect::new( - LayerPoint::new(f32::MIN / 2.0, f32::MIN / 2.0), - LayerSize::new(f32::MAX, f32::MAX), + LayoutRect::new( + LayoutPoint::new(f32::MIN / 2.0, f32::MIN / 2.0), + LayoutSize::new(f32::MAX, f32::MAX), ) } } @@ -556,6 +556,5 @@ impl From> for FastTransform { } pub type LayoutFastTransform = FastTransform; -pub type LayerFastTransform = FastTransform; -pub type LayerToWorldFastTransform = FastTransform; -pub type WorldToLayerFastTransform = FastTransform; +pub type LayoutToWorldFastTransform = FastTransform; +pub type WorldToLayoutFastTransform = FastTransform; \ No newline at end of file diff --git a/webrender_api/src/display_item.rs b/webrender_api/src/display_item.rs index 837dc9096d..23f244c021 100644 --- a/webrender_api/src/display_item.rs +++ b/webrender_api/src/display_item.rs @@ -6,7 +6,7 @@ use GlyphInstance; use euclid::{SideOffsets2D, TypedRect}; use std::ops::Not; -use {ColorF, FontInstanceKey, GlyphOptions, ImageKey, LayerPixel, LayoutPixel, LayoutPoint}; +use {ColorF, FontInstanceKey, GlyphOptions, ImageKey, LayoutPixel, LayoutPoint}; use {LayoutRect, LayoutSize, LayoutTransform, LayoutVector2D, PipelineId, PropertyBinding}; @@ -69,14 +69,14 @@ pub struct PrimitiveInfo { pub tag: Option, } -impl LayerPrimitiveInfo { - pub fn new(rect: TypedRect) -> Self { +impl LayoutPrimitiveInfo { + pub fn new(rect: TypedRect) -> Self { Self::with_clip_rect(rect, rect) } pub fn with_clip_rect( - rect: TypedRect, - clip_rect: TypedRect, + rect: TypedRect, + clip_rect: TypedRect, ) -> Self { PrimitiveInfo { rect, @@ -88,7 +88,6 @@ impl LayerPrimitiveInfo { } pub type LayoutPrimitiveInfo = PrimitiveInfo; -pub type LayerPrimitiveInfo = PrimitiveInfo; #[repr(u8)] #[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] diff --git a/webrender_api/src/display_list.rs b/webrender_api/src/display_list.rs index 122d048f8d..24adc74ca5 100644 --- a/webrender_api/src/display_list.rs +++ b/webrender_api/src/display_list.rs @@ -17,7 +17,7 @@ use {AlphaType, BorderDetails, BorderDisplayItem, BorderRadius, BorderWidths, Bo use {BoxShadowDisplayItem, ClipAndScrollInfo, ClipChainId, ClipChainItem, ClipDisplayItem, ClipId}; use {ColorF, ComplexClipRegion, DisplayItem, ExtendMode, ExternalScrollId, FilterOp}; use {FontInstanceKey, GlyphInstance, GlyphOptions, GlyphRasterSpace, Gradient, GradientDisplayItem, GradientStop}; -use {IframeDisplayItem, ImageDisplayItem, ImageKey, ImageMask, ImageRendering, LayerPrimitiveInfo}; +use {IframeDisplayItem, ImageDisplayItem, ImageKey, ImageMask, ImageRendering}; use {LayoutPoint, LayoutPrimitiveInfo, LayoutRect, LayoutSize, LayoutTransform, LayoutVector2D}; use {LineDisplayItem, LineOrientation, LineStyle, MixBlendMode, PipelineId, PropertyBinding}; use {PushStackingContextDisplayItem, RadialGradient, RadialGradientDisplayItem}; @@ -331,9 +331,9 @@ impl<'a, 'b> DisplayItemRef<'a, 'b> { self.iter.cur_item.info.rect } - pub fn get_layer_primitive_info(&self, offset: &LayoutVector2D) -> LayerPrimitiveInfo { + pub fn get_layout_primitive_info(&self, offset: &LayoutVector2D) -> LayoutPrimitiveInfo { let info = self.iter.cur_item.info; - LayerPrimitiveInfo { + LayoutPrimitiveInfo { rect: info.rect.translate(offset), clip_rect: info.clip_rect.translate(offset), is_backface_visible: info.is_backface_visible, diff --git a/webrender_api/src/units.rs b/webrender_api/src/units.rs index 8dcdc3d8b0..7e4916a306 100644 --- a/webrender_api/src/units.rs +++ b/webrender_api/src/units.rs @@ -45,26 +45,15 @@ pub type PictureIntPoint = TypedPoint2D; pub type PictureIntSize = TypedSize2D; /// Geometry in a stacking context's local coordinate space (logical pixels). -/// -/// For now layout pixels are equivalent to layer pixels, but it may change. -pub type LayoutPixel = LayerPixel; - -pub type LayoutRect = LayerRect; -pub type LayoutPoint = LayerPoint; -pub type LayoutVector2D = LayerVector2D; -pub type LayoutVector3D = LayerVector3D; -pub type LayoutSize = LayerSize; - -/// Geometry in a layer's local coordinate space (logical pixels). #[derive(Hash, Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Deserialize, Serialize)] -pub struct LayerPixel; +pub struct LayoutPixel; -pub type LayerRect = TypedRect; -pub type LayerPoint = TypedPoint2D; -pub type LayerPoint3D = TypedPoint3D; -pub type LayerVector2D = TypedVector2D; -pub type LayerVector3D = TypedVector3D; -pub type LayerSize = TypedSize2D; +pub type LayoutRect = TypedRect; +pub type LayoutPoint = TypedPoint2D; +pub type LayoutPoint3D = TypedPoint3D; +pub type LayoutVector2D = TypedVector2D; +pub type LayoutVector3D = TypedVector3D; +pub type LayoutSize = TypedSize2D; /// Geometry in a layer's scrollable parent coordinate space (logical pixels). /// @@ -99,28 +88,27 @@ pub type TileOffset = TypedPoint2D; /// Scaling ratio from world pixels to device pixels. pub type DevicePixelScale = TypedScale; -/// Scaling ratio from layer to world. Used for cases where we know the layer +/// Scaling ratio from layout to world. Used for cases where we know the layout /// is in world space, or specifically want to treat it this way. -pub type LayerToWorldScale = TypedScale; +pub type LayoutToWorldScale = TypedScale; pub type LayoutTransform = TypedTransform3D; -pub type LayerTransform = TypedTransform3D; -pub type LayerToScrollTransform = TypedTransform3D; -pub type ScrollToLayerTransform = TypedTransform3D; -pub type LayerToWorldTransform = TypedTransform3D; -pub type WorldToLayerTransform = TypedTransform3D; +pub type LayoutToScrollTransform = TypedTransform3D; +pub type ScrollToLayoutTransform = TypedTransform3D; +pub type LayoutToWorldTransform = TypedTransform3D; +pub type WorldToLayoutTransform = TypedTransform3D; pub type ScrollToWorldTransform = TypedTransform3D; // Fixed position coordinates, to avoid float precision errors. -pub type LayerPointAu = TypedPoint2D; -pub type LayerRectAu = TypedRect; -pub type LayerSizeAu = TypedSize2D; +pub type LayoutPointAu = TypedPoint2D; +pub type LayoutRectAu = TypedRect; +pub type LayoutSizeAu = TypedSize2D; -pub fn as_scroll_parent_rect(rect: &LayerRect) -> ScrollLayerRect { +pub fn as_scroll_parent_rect(rect: &LayoutRect) -> ScrollLayerRect { ScrollLayerRect::from_untyped(&rect.to_untyped()) } -pub fn as_scroll_parent_vector(vector: &LayerVector2D) -> ScrollLayerVector2D { +pub fn as_scroll_parent_vector(vector: &LayoutVector2D) -> ScrollLayerVector2D { ScrollLayerVector2D::from_untyped(&vector.to_untyped()) } diff --git a/wrench/src/scene.rs b/wrench/src/scene.rs index 4e6d5753a2..c2040104c9 100644 --- a/wrench/src/scene.rs +++ b/wrench/src/scene.rs @@ -4,7 +4,7 @@ use std::collections::HashMap; use webrender::api::{BuiltDisplayList, ColorF, Epoch}; -use webrender::api::{LayerSize, PipelineId}; +use webrender::api::{LayoutSize, PipelineId}; use webrender::api::{PropertyBinding, PropertyBindingId, LayoutTransform, DynamicProperties}; /// Stores a map of the animated property bindings for the current display list. These @@ -74,7 +74,7 @@ impl SceneProperties { #[derive(Debug)] pub struct ScenePipeline { pub epoch: Epoch, - pub viewport_size: LayerSize, + pub viewport_size: LayoutSize, pub background_color: Option, } @@ -113,7 +113,7 @@ impl Scene { pipeline_id: &PipelineId, epoch: &Epoch, background_color: &Option, - viewport_size: &LayerSize, + viewport_size: &LayoutSize, ) { let new_pipeline = ScenePipeline { epoch: epoch.clone(), diff --git a/wrench/src/wrench.rs b/wrench/src/wrench.rs index cce2f2a095..1735439567 100644 --- a/wrench/src/wrench.rs +++ b/wrench/src/wrench.rs @@ -283,9 +283,9 @@ impl Wrench { render_mode: Option, text: &str, size: Au, - origin: LayerPoint, + origin: LayoutPoint, flags: FontInstanceFlags, - ) -> (Vec, Vec, LayoutRect) { + ) -> (Vec, Vec, LayoutRect) { // Map the string codepoints to glyph indices in this font. // Just drop any glyph that isn't present in this font. let indices: Vec = self.api @@ -302,7 +302,7 @@ impl Wrench { for glyph_index in &indices { keys.push(GlyphKey::new( *glyph_index, - LayerPoint::zero(), + LayoutPoint::zero(), render_mode, subpx_dir, )); @@ -314,12 +314,12 @@ impl Wrench { let mut cursor = origin; let direction = if flags.contains(FontInstanceFlags::TRANSPOSE) { - LayerVector2D::new( + LayoutVector2D::new( 0.0, if flags.contains(FontInstanceFlags::FLIP_Y) { -1.0 } else { 1.0 }, ) } else { - LayerVector2D::new( + LayoutVector2D::new( if flags.contains(FontInstanceFlags::FLIP_X) { -1.0 } else { 1.0 }, 0.0, ) @@ -500,8 +500,8 @@ impl Wrench { pub fn send_lists( &mut self, frame_number: u32, - display_lists: Vec<(PipelineId, LayerSize, BuiltDisplayList)>, - scroll_offsets: &HashMap, + display_lists: Vec<(PipelineId, LayoutSize, BuiltDisplayList)>, + scroll_offsets: &HashMap, ) { let root_background_color = Some(ColorF::new(1.0, 1.0, 1.0, 1.0)); diff --git a/wrench/src/yaml_frame_reader.rs b/wrench/src/yaml_frame_reader.rs index 7a83e7717e..406e6e5d0e 100644 --- a/wrench/src/yaml_frame_reader.rs +++ b/wrench/src/yaml_frame_reader.rs @@ -193,7 +193,7 @@ pub struct YamlFrameReader { /// A HashMap of offsets which specify what scroll offsets particular /// scroll layers should be initialized with. - scroll_offsets: HashMap, + scroll_offsets: HashMap, image_map: HashMap<(PathBuf, Option), (ImageKey, LayoutSize)>, @@ -1351,7 +1351,7 @@ impl YamlFrameReader { .as_rect() .expect("scroll frame must have a bounds"); let content_size = yaml["content-size"].as_size().unwrap_or(clip_rect.size); - let content_rect = LayerRect::new(clip_rect.origin, content_size); + let content_rect = LayoutRect::new(clip_rect.origin, content_size); let numeric_id = yaml["id"].as_i64().map(|id| id as u64); @@ -1360,7 +1360,7 @@ impl YamlFrameReader { let external_id = yaml["scroll-offset"].as_point().map(|size| { let id = ExternalScrollId((self.scroll_offsets.len() + 1) as u64, dl.pipeline_id); - self.scroll_offsets.insert(id, LayerPoint::new(size.x, size.y)); + self.scroll_offsets.insert(id, LayoutPoint::new(size.x, size.y)); id }); @@ -1541,7 +1541,7 @@ impl YamlFrameReader { if is_root { if let Some(size) = yaml["scroll-offset"].as_point() { let external_id = ExternalScrollId(0, dl.pipeline_id); - self.scroll_offsets.insert(external_id, LayerPoint::new(size.x, size.y)); + self.scroll_offsets.insert(external_id, LayoutPoint::new(size.x, size.y)); } } diff --git a/wrench/src/yaml_frame_writer.rs b/wrench/src/yaml_frame_writer.rs index 28b397bbe5..8aa58d3d87 100644 --- a/wrench/src/yaml_frame_writer.rs +++ b/wrench/src/yaml_frame_writer.rs @@ -707,7 +707,7 @@ impl YamlFrameWriter { }; let mut v = new_table(); - let info = base.get_layer_primitive_info(&LayoutVector2D::zero()); + let info = base.get_layout_primitive_info(&LayoutVector2D::zero()); rect_node(&mut v, "bounds", &info.rect); rect_node(&mut v, "clip-rect", &info.clip_rect);