servo: Merge #8795 - Replace ZERO_RECT with Rect::zero() (from pointlessone:zero-rect); r=SimonSapin

This is a proposed in servo/servo#8792 clean up.

Source-Repo: https://github.com/servo/servo
Source-Revision: 3995a7672d4b4ee3f2d6f348f2fe0a88964fc9c6
This commit is contained in:
Alexander Mankuta 2015-12-03 21:12:03 +05:01
Родитель 98d9056a44
Коммит 01d0a231d9
6 изменённых файлов: 8 добавлений и 22 удалений

Просмотреть файл

@ -43,7 +43,7 @@ use style::properties::ComputedValues;
use text::TextRun;
use text::glyph::CharIndex;
use util::cursor::Cursor;
use util::geometry::{self, MAX_RECT, ZERO_RECT};
use util::geometry::{self, MAX_RECT};
use util::linked_list::prepend_from;
use util::mem::HeapSizeOf;
use util::opts;
@ -1043,7 +1043,7 @@ impl ClippingRegion {
#[inline]
pub fn empty() -> ClippingRegion {
ClippingRegion {
main: ZERO_RECT,
main: Rect::zero(),
complex: Vec::new(),
}
}
@ -1073,7 +1073,7 @@ impl ClippingRegion {
#[inline]
pub fn intersect_rect(self, rect: &Rect<Au>) -> ClippingRegion {
ClippingRegion {
main: self.main.intersection(rect).unwrap_or(ZERO_RECT),
main: self.main.intersection(rect).unwrap_or(Rect::zero()),
complex: self.complex,
}
}

Просмотреть файл

@ -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, ZERO_RECT};
use util::geometry::{self, MAX_RECT, PagePx, ScreenPx, ZERO_POINT};
use util::opts;
use util::range::Range;
@ -1580,7 +1580,7 @@ impl<'a> PaintContext<'a> {
let side_inflation = blur_radius * BLUR_INFLATION_FACTOR;
let tile_box_bounds =
geometry::f32_rect_to_au_rect(self.page_rect.to_untyped()).intersection(box_bounds)
.unwrap_or(ZERO_RECT)
.unwrap_or(Rect::zero())
.inflate(side_inflation, side_inflation);
TemporaryDrawTarget::from_bounds(&self.draw_target, &tile_box_bounds)
}

Просмотреть файл

@ -56,7 +56,6 @@ use table_colgroup::TableColGroupFlow;
use table_row::TableRowFlow;
use table_rowgroup::TableRowGroupFlow;
use table_wrapper::TableWrapperFlow;
use util::geometry::ZERO_RECT;
use util::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
use util::print_tree::PrintTree;
use wrapper::{PseudoElementType, ThreadSafeLayoutNode};
@ -1054,7 +1053,7 @@ impl BaseFlow {
children: FlowList::new(),
intrinsic_inline_sizes: IntrinsicISizes::new(),
position: LogicalRect::zero(writing_mode),
overflow: ZERO_RECT,
overflow: Rect::zero(),
parallel: FlowParallelInfo::new(),
floats: Floats::new(writing_mode),
collapsible_margins: CollapsibleMargins::new(),

Просмотреть файл

@ -31,7 +31,6 @@ use style::values::computed::LengthOrPercentage;
use text;
use unicode_bidi;
use util;
use util::geometry::ZERO_RECT;
use util::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
use util::print_tree::PrintTree;
use util::range::{Range, RangeIndex};
@ -1749,7 +1748,7 @@ impl Flow for InlineFlow {
fn repair_style(&mut self, _: &Arc<ComputedValues>) {}
fn compute_overflow(&self) -> Rect<Au> {
let mut overflow = ZERO_RECT;
let mut overflow = Rect::zero();
let flow_size = self.base.position.size.to_physical(self.base.writing_mode);
let relative_containing_block_size =
&self.base.early_absolute_position_info.relative_containing_block_size;

Просмотреть файл

@ -17,7 +17,6 @@ use std::fmt;
use std::sync::Arc;
use style::properties::ComputedValues;
use style::values::computed::LengthOrPercentageOrAuto;
use util::geometry::ZERO_RECT;
use util::logical_geometry::LogicalSize;
/// A table formatting context.
@ -96,7 +95,7 @@ impl Flow for TableColGroupFlow {
fn repair_style(&mut self, _: &Arc<ComputedValues>) {}
fn compute_overflow(&self) -> Rect<Au> {
ZERO_RECT
Rect::zero()
}
fn generated_containing_block_size(&self, _: OpaqueFlow) -> LogicalSize<Au> {

Просмотреть файл

@ -64,17 +64,6 @@ pub static ZERO_POINT: Point2D<Au> = Point2D {
y: Au(0),
};
pub static ZERO_RECT: Rect<Au> = Rect {
origin: Point2D {
x: Au(0),
y: Au(0),
},
size: Size2D {
width: Au(0),
height: Au(0),
}
};
pub static MAX_RECT: Rect<Au> = Rect {
origin: Point2D {
x: Au(i32::MIN / 2),