aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2015-12-04 11:09:59 +0530
committerbors-servo <lbergstrom+bors@mozilla.com>2015-12-04 11:09:59 +0530
commit2dbc314e2dec39b8798d4e922dd5220d32083b56 (patch)
tree861ebb11050ea8fc0c621aa523bcfa1005f1adaa
parent3c0cd5eb068945860fb357c975bfbe6070eebe49 (diff)
parentee746e252cc9f3888f3f122f27daa64f7384aad1 (diff)
downloadservo-2dbc314e2dec39b8798d4e922dd5220d32083b56.tar.gz
servo-2dbc314e2dec39b8798d4e922dd5220d32083b56.zip
Auto merge of #8796 - cheba:zero-point, r=SimonSapin
Replaced ZERO_POINT with Point2D::zero() This is a proposed in servo/servo#8792 clean up. Fixes #8792. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8796) <!-- Reviewable:end -->
-rw-r--r--components/gfx/paint_context.rs6
-rw-r--r--components/gfx/paint_task.rs4
-rw-r--r--components/layout/display_list_builder.rs7
-rw-r--r--components/layout/fragment.rs3
-rw-r--r--components/layout/query.rs5
-rw-r--r--components/layout/sequential.rs3
-rw-r--r--components/util/geometry.rs5
7 files changed, 12 insertions, 21 deletions
diff --git a/components/gfx/paint_context.rs b/components/gfx/paint_context.rs
index 33422fe076a..2f9049db39d 100644
--- a/components/gfx/paint_context.rs
+++ b/components/gfx/paint_context.rs
@@ -35,7 +35,7 @@ use std::{f32, mem, ptr};
use style::computed_values::{border_style, filter, image_rendering, mix_blend_mode};
use text::TextRun;
use text::glyph::CharIndex;
-use util::geometry::{self, MAX_RECT, PagePx, ScreenPx, ZERO_POINT};
+use util::geometry::{self, MAX_RECT, PagePx, ScreenPx};
use util::opts;
use util::range::Range;
@@ -1351,7 +1351,7 @@ impl<'a> PaintContext<'a> {
self.draw_target.set_transform(&draw_target_transform.mul(&Matrix2D::new(0., -1.,
1., 0.,
x, y)));
- ZERO_POINT
+ Point2D::zero()
}
SidewaysRight => {
let x = text.baseline_origin.x.to_f32_px();
@@ -1359,7 +1359,7 @@ impl<'a> PaintContext<'a> {
self.draw_target.set_transform(&draw_target_transform.mul(&Matrix2D::new(0., 1.,
-1., 0.,
x, y)));
- ZERO_POINT
+ Point2D::zero()
}
};
diff --git a/components/gfx/paint_task.rs b/components/gfx/paint_task.rs
index 6a91da70089..78e7a9e6e66 100644
--- a/components/gfx/paint_task.rs
+++ b/components/gfx/paint_task.rs
@@ -34,7 +34,7 @@ use std::mem as std_mem;
use std::sync::Arc;
use std::sync::mpsc::{Receiver, Select, Sender, channel};
use url::Url;
-use util::geometry::{ExpandToPixelBoundaries, ZERO_POINT};
+use util::geometry::{ExpandToPixelBoundaries};
use util::opts;
use util::task;
use util::task_state;
@@ -454,7 +454,7 @@ impl<C> PaintTask<C> where C: PaintListener + Send + 'static {
let mut properties = Vec::new();
build_from_paint_layer(&mut properties,
root_paint_layer,
- &ZERO_POINT,
+ &Point2D::zero(),
&Matrix4::identity(),
&Matrix4::identity(),
None);
diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs
index 048177467c1..96632c5d47d 100644
--- a/components/layout/display_list_builder.rs
+++ b/components/layout/display_list_builder.rs
@@ -58,7 +58,6 @@ use style::values::specified::{AngleOrCorner, HorizontalDirection, VerticalDirec
use table_cell::CollapsedBordersForCell;
use url::Url;
use util::cursor::Cursor;
-use util::geometry::ZERO_POINT;
use util::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMode};
use util::opts;
use util::range::Range;
@@ -1208,7 +1207,7 @@ impl FragmentDisplayListBuilding for Fragment {
CoordinateSystem::Parent)
}
StackingContextCreationMode::InnerScrollWrapper => {
- Rect::new(ZERO_POINT, base_flow.overflow.size)
+ Rect::new(Point2D::zero(), base_flow.overflow.size)
}
};
let overflow = match mode {
@@ -1222,7 +1221,7 @@ impl FragmentDisplayListBuilding for Fragment {
}
StackingContextCreationMode::InnerScrollWrapper |
StackingContextCreationMode::OuterScrollWrapper => {
- Rect::new(ZERO_POINT, border_box.size)
+ Rect::new(Point2D::zero(), border_box.size)
}
};
@@ -1498,7 +1497,7 @@ impl FragmentDisplayListBuilding for Fragment {
(*clip).clone()),
box_bounds: stacking_relative_box,
color: color.to_gfx_color(),
- offset: ZERO_POINT,
+ offset: Point2D::zero(),
blur_radius: blur_radius,
spread_radius: Au(0),
border_radius: Au(0),
diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs
index 5eae8be6891..9113088889f 100644
--- a/components/layout/fragment.rs
+++ b/components/layout/fragment.rs
@@ -46,7 +46,6 @@ use text;
use text::TextRunScanner;
use url::Url;
use util;
-use util::geometry::ZERO_POINT;
use util::logical_geometry::{LogicalMargin, LogicalRect, LogicalSize, WritingMode};
use util::range::*;
use util::str::slice_chars;
@@ -2053,7 +2052,7 @@ impl Fragment {
relative_containing_block_size.to_physical(relative_containing_block_mode);
let border_box = self.border_box.to_physical(self.style.writing_mode, container_size);
if coordinate_system == CoordinateSystem::Own && self.establishes_stacking_context() {
- return Rect::new(ZERO_POINT, border_box.size)
+ return Rect::new(Point2D::zero(), border_box.size)
}
// FIXME(pcwalton): This can double-count relative position sometimes for inlines (e.g.
diff --git a/components/layout/query.rs b/components/layout/query.rs
index 076b972061d..68b454b4cba 100644
--- a/components/layout/query.rs
+++ b/components/layout/query.rs
@@ -29,7 +29,6 @@ use style::properties::longhands::{display, position};
use style::properties::style_structs;
use style::values::AuExtensionMethods;
use util::cursor::Cursor;
-use util::geometry::ZERO_POINT;
use util::logical_geometry::WritingMode;
use wrapper::{LayoutNode, ThreadSafeLayoutNode};
@@ -487,9 +486,9 @@ pub fn process_resolved_style_request<'ln, N: LayoutNode<'ln>>(
flow::base(flow_ref.deref()).stacking_relative_position,
// TODO(dzbarsky) search parents until we find node with a flow ref.
// https://github.com/servo/servo/issues/8307
- _ => ZERO_POINT
+ _ => Point2D::zero()
}
- }).unwrap_or(ZERO_POINT);
+ }).unwrap_or(Point2D::zero());
let property = match *property {
atom!("bottom") => PositionProperty::Bottom,
atom!("top") => PositionProperty::Top,
diff --git a/components/layout/sequential.rs b/components/layout/sequential.rs
index 275f4ed0429..5f33e5f352c 100644
--- a/components/layout/sequential.rs
+++ b/components/layout/sequential.rs
@@ -17,7 +17,6 @@ use traversal::{AssignBSizesAndStoreOverflow, AssignISizes};
use traversal::{BubbleISizes, ConstructFlows, RecalcStyleForNode};
use traversal::{BuildDisplayList, ComputeAbsolutePositions};
use traversal::{PostorderDomTraversal, PreorderDomTraversal};
-use util::geometry::ZERO_POINT;
use util::opts;
use wrapper::LayoutNode;
@@ -151,5 +150,5 @@ pub fn iterate_through_flow_tree_fragment_border_boxes(root: &mut FlowRef,
}
}
- doit(flow_ref::deref_mut(root), 0, iterator, &ZERO_POINT);
+ doit(flow_ref::deref_mut(root), 0, iterator, &Point2D::zero());
}
diff --git a/components/util/geometry.rs b/components/util/geometry.rs
index 4d89a817853..dc84d90b202 100644
--- a/components/util/geometry.rs
+++ b/components/util/geometry.rs
@@ -59,11 +59,6 @@ pub enum PagePx {}
// originally proposed in 2002 as a standard unit of measure in Gecko.
// See https://bugzilla.mozilla.org/show_bug.cgi?id=177805 for more info.
-pub static ZERO_POINT: Point2D<Au> = Point2D {
- x: Au(0),
- y: Au(0),
-};
-
pub static MAX_RECT: Rect<Au> = Rect {
origin: Point2D {
x: Au(i32::MIN / 2),