Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced ZERO_POINT with Point2D::zero() #8796

Merged
merged 1 commit into from Dec 4, 2015
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Replaced ZERO_POINT with Point2D::zero()

  • Loading branch information
pointlessone committed Dec 3, 2015
commit ee746e252cc9f3888f3f122f27daa64f7384aad1
@@ -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,15 +1351,15 @@ 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();
let y = text.baseline_origin.y.to_f32_px();
self.draw_target.set_transform(&draw_target_transform.mul(&Matrix2D::new(0., 1.,
-1., 0.,
x, y)));
ZERO_POINT
Point2D::zero()
}
};

@@ -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);
@@ -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),
@@ -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.
@@ -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,
@@ -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());
}
@@ -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),
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.