mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
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 -->
This commit is contained in:
commit
2dbc314e2d
7 changed files with 12 additions and 21 deletions
|
@ -35,7 +35,7 @@ use std::{f32, mem, ptr};
|
||||||
use style::computed_values::{border_style, filter, image_rendering, mix_blend_mode};
|
use style::computed_values::{border_style, filter, image_rendering, mix_blend_mode};
|
||||||
use text::TextRun;
|
use text::TextRun;
|
||||||
use text::glyph::CharIndex;
|
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::opts;
|
||||||
use util::range::Range;
|
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.,
|
self.draw_target.set_transform(&draw_target_transform.mul(&Matrix2D::new(0., -1.,
|
||||||
1., 0.,
|
1., 0.,
|
||||||
x, y)));
|
x, y)));
|
||||||
ZERO_POINT
|
Point2D::zero()
|
||||||
}
|
}
|
||||||
SidewaysRight => {
|
SidewaysRight => {
|
||||||
let x = text.baseline_origin.x.to_f32_px();
|
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.,
|
self.draw_target.set_transform(&draw_target_transform.mul(&Matrix2D::new(0., 1.,
|
||||||
-1., 0.,
|
-1., 0.,
|
||||||
x, y)));
|
x, y)));
|
||||||
ZERO_POINT
|
Point2D::zero()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ use std::mem as std_mem;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::mpsc::{Receiver, Select, Sender, channel};
|
use std::sync::mpsc::{Receiver, Select, Sender, channel};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use util::geometry::{ExpandToPixelBoundaries, ZERO_POINT};
|
use util::geometry::{ExpandToPixelBoundaries};
|
||||||
use util::opts;
|
use util::opts;
|
||||||
use util::task;
|
use util::task;
|
||||||
use util::task_state;
|
use util::task_state;
|
||||||
|
@ -454,7 +454,7 @@ impl<C> PaintTask<C> where C: PaintListener + Send + 'static {
|
||||||
let mut properties = Vec::new();
|
let mut properties = Vec::new();
|
||||||
build_from_paint_layer(&mut properties,
|
build_from_paint_layer(&mut properties,
|
||||||
root_paint_layer,
|
root_paint_layer,
|
||||||
&ZERO_POINT,
|
&Point2D::zero(),
|
||||||
&Matrix4::identity(),
|
&Matrix4::identity(),
|
||||||
&Matrix4::identity(),
|
&Matrix4::identity(),
|
||||||
None);
|
None);
|
||||||
|
|
|
@ -58,7 +58,6 @@ use style::values::specified::{AngleOrCorner, HorizontalDirection, VerticalDirec
|
||||||
use table_cell::CollapsedBordersForCell;
|
use table_cell::CollapsedBordersForCell;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use util::cursor::Cursor;
|
use util::cursor::Cursor;
|
||||||
use util::geometry::ZERO_POINT;
|
|
||||||
use util::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMode};
|
use util::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMode};
|
||||||
use util::opts;
|
use util::opts;
|
||||||
use util::range::Range;
|
use util::range::Range;
|
||||||
|
@ -1208,7 +1207,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
CoordinateSystem::Parent)
|
CoordinateSystem::Parent)
|
||||||
}
|
}
|
||||||
StackingContextCreationMode::InnerScrollWrapper => {
|
StackingContextCreationMode::InnerScrollWrapper => {
|
||||||
Rect::new(ZERO_POINT, base_flow.overflow.size)
|
Rect::new(Point2D::zero(), base_flow.overflow.size)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let overflow = match mode {
|
let overflow = match mode {
|
||||||
|
@ -1222,7 +1221,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
}
|
}
|
||||||
StackingContextCreationMode::InnerScrollWrapper |
|
StackingContextCreationMode::InnerScrollWrapper |
|
||||||
StackingContextCreationMode::OuterScrollWrapper => {
|
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()),
|
(*clip).clone()),
|
||||||
box_bounds: stacking_relative_box,
|
box_bounds: stacking_relative_box,
|
||||||
color: color.to_gfx_color(),
|
color: color.to_gfx_color(),
|
||||||
offset: ZERO_POINT,
|
offset: Point2D::zero(),
|
||||||
blur_radius: blur_radius,
|
blur_radius: blur_radius,
|
||||||
spread_radius: Au(0),
|
spread_radius: Au(0),
|
||||||
border_radius: Au(0),
|
border_radius: Au(0),
|
||||||
|
|
|
@ -46,7 +46,6 @@ use text;
|
||||||
use text::TextRunScanner;
|
use text::TextRunScanner;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use util;
|
use util;
|
||||||
use util::geometry::ZERO_POINT;
|
|
||||||
use util::logical_geometry::{LogicalMargin, LogicalRect, LogicalSize, WritingMode};
|
use util::logical_geometry::{LogicalMargin, LogicalRect, LogicalSize, WritingMode};
|
||||||
use util::range::*;
|
use util::range::*;
|
||||||
use util::str::slice_chars;
|
use util::str::slice_chars;
|
||||||
|
@ -2053,7 +2052,7 @@ impl Fragment {
|
||||||
relative_containing_block_size.to_physical(relative_containing_block_mode);
|
relative_containing_block_size.to_physical(relative_containing_block_mode);
|
||||||
let border_box = self.border_box.to_physical(self.style.writing_mode, container_size);
|
let border_box = self.border_box.to_physical(self.style.writing_mode, container_size);
|
||||||
if coordinate_system == CoordinateSystem::Own && self.establishes_stacking_context() {
|
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.
|
// 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::properties::style_structs;
|
||||||
use style::values::AuExtensionMethods;
|
use style::values::AuExtensionMethods;
|
||||||
use util::cursor::Cursor;
|
use util::cursor::Cursor;
|
||||||
use util::geometry::ZERO_POINT;
|
|
||||||
use util::logical_geometry::WritingMode;
|
use util::logical_geometry::WritingMode;
|
||||||
use wrapper::{LayoutNode, ThreadSafeLayoutNode};
|
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,
|
flow::base(flow_ref.deref()).stacking_relative_position,
|
||||||
// TODO(dzbarsky) search parents until we find node with a flow ref.
|
// TODO(dzbarsky) search parents until we find node with a flow ref.
|
||||||
// https://github.com/servo/servo/issues/8307
|
// https://github.com/servo/servo/issues/8307
|
||||||
_ => ZERO_POINT
|
_ => Point2D::zero()
|
||||||
}
|
}
|
||||||
}).unwrap_or(ZERO_POINT);
|
}).unwrap_or(Point2D::zero());
|
||||||
let property = match *property {
|
let property = match *property {
|
||||||
atom!("bottom") => PositionProperty::Bottom,
|
atom!("bottom") => PositionProperty::Bottom,
|
||||||
atom!("top") => PositionProperty::Top,
|
atom!("top") => PositionProperty::Top,
|
||||||
|
|
|
@ -17,7 +17,6 @@ use traversal::{AssignBSizesAndStoreOverflow, AssignISizes};
|
||||||
use traversal::{BubbleISizes, ConstructFlows, RecalcStyleForNode};
|
use traversal::{BubbleISizes, ConstructFlows, RecalcStyleForNode};
|
||||||
use traversal::{BuildDisplayList, ComputeAbsolutePositions};
|
use traversal::{BuildDisplayList, ComputeAbsolutePositions};
|
||||||
use traversal::{PostorderDomTraversal, PreorderDomTraversal};
|
use traversal::{PostorderDomTraversal, PreorderDomTraversal};
|
||||||
use util::geometry::ZERO_POINT;
|
|
||||||
use util::opts;
|
use util::opts;
|
||||||
use wrapper::LayoutNode;
|
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.
|
// 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.
|
// 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 {
|
pub static MAX_RECT: Rect<Au> = Rect {
|
||||||
origin: Point2D {
|
origin: Point2D {
|
||||||
x: Au(i32::MIN / 2),
|
x: Au(i32::MIN / 2),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue