mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Auto merge of #8795 - cheba:zero-rect, r=SimonSapin
Replace ZERO_RECT with Rect::zero() This is a proposed in servo/servo#8792 clean up. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8795) <!-- Reviewable:end -->
This commit is contained in:
commit
3995a7672d
6 changed files with 8 additions and 22 deletions
|
@ -43,7 +43,7 @@ use style::properties::ComputedValues;
|
||||||
use text::TextRun;
|
use text::TextRun;
|
||||||
use text::glyph::CharIndex;
|
use text::glyph::CharIndex;
|
||||||
use util::cursor::Cursor;
|
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::linked_list::prepend_from;
|
||||||
use util::mem::HeapSizeOf;
|
use util::mem::HeapSizeOf;
|
||||||
use util::opts;
|
use util::opts;
|
||||||
|
@ -1043,7 +1043,7 @@ impl ClippingRegion {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn empty() -> ClippingRegion {
|
pub fn empty() -> ClippingRegion {
|
||||||
ClippingRegion {
|
ClippingRegion {
|
||||||
main: ZERO_RECT,
|
main: Rect::zero(),
|
||||||
complex: Vec::new(),
|
complex: Vec::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1073,7 +1073,7 @@ impl ClippingRegion {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn intersect_rect(self, rect: &Rect<Au>) -> ClippingRegion {
|
pub fn intersect_rect(self, rect: &Rect<Au>) -> ClippingRegion {
|
||||||
ClippingRegion {
|
ClippingRegion {
|
||||||
main: self.main.intersection(rect).unwrap_or(ZERO_RECT),
|
main: self.main.intersection(rect).unwrap_or(Rect::zero()),
|
||||||
complex: self.complex,
|
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 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, ZERO_RECT};
|
use util::geometry::{self, MAX_RECT, PagePx, ScreenPx, ZERO_POINT};
|
||||||
use util::opts;
|
use util::opts;
|
||||||
use util::range::Range;
|
use util::range::Range;
|
||||||
|
|
||||||
|
@ -1580,7 +1580,7 @@ impl<'a> PaintContext<'a> {
|
||||||
let side_inflation = blur_radius * BLUR_INFLATION_FACTOR;
|
let side_inflation = blur_radius * BLUR_INFLATION_FACTOR;
|
||||||
let tile_box_bounds =
|
let tile_box_bounds =
|
||||||
geometry::f32_rect_to_au_rect(self.page_rect.to_untyped()).intersection(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);
|
.inflate(side_inflation, side_inflation);
|
||||||
TemporaryDrawTarget::from_bounds(&self.draw_target, &tile_box_bounds)
|
TemporaryDrawTarget::from_bounds(&self.draw_target, &tile_box_bounds)
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,6 @@ use table_colgroup::TableColGroupFlow;
|
||||||
use table_row::TableRowFlow;
|
use table_row::TableRowFlow;
|
||||||
use table_rowgroup::TableRowGroupFlow;
|
use table_rowgroup::TableRowGroupFlow;
|
||||||
use table_wrapper::TableWrapperFlow;
|
use table_wrapper::TableWrapperFlow;
|
||||||
use util::geometry::ZERO_RECT;
|
|
||||||
use util::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
|
use util::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
|
||||||
use util::print_tree::PrintTree;
|
use util::print_tree::PrintTree;
|
||||||
use wrapper::{PseudoElementType, ThreadSafeLayoutNode};
|
use wrapper::{PseudoElementType, ThreadSafeLayoutNode};
|
||||||
|
@ -1054,7 +1053,7 @@ impl BaseFlow {
|
||||||
children: FlowList::new(),
|
children: FlowList::new(),
|
||||||
intrinsic_inline_sizes: IntrinsicISizes::new(),
|
intrinsic_inline_sizes: IntrinsicISizes::new(),
|
||||||
position: LogicalRect::zero(writing_mode),
|
position: LogicalRect::zero(writing_mode),
|
||||||
overflow: ZERO_RECT,
|
overflow: Rect::zero(),
|
||||||
parallel: FlowParallelInfo::new(),
|
parallel: FlowParallelInfo::new(),
|
||||||
floats: Floats::new(writing_mode),
|
floats: Floats::new(writing_mode),
|
||||||
collapsible_margins: CollapsibleMargins::new(),
|
collapsible_margins: CollapsibleMargins::new(),
|
||||||
|
|
|
@ -31,7 +31,6 @@ use style::values::computed::LengthOrPercentage;
|
||||||
use text;
|
use text;
|
||||||
use unicode_bidi;
|
use unicode_bidi;
|
||||||
use util;
|
use util;
|
||||||
use util::geometry::ZERO_RECT;
|
|
||||||
use util::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
|
use util::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
|
||||||
use util::print_tree::PrintTree;
|
use util::print_tree::PrintTree;
|
||||||
use util::range::{Range, RangeIndex};
|
use util::range::{Range, RangeIndex};
|
||||||
|
@ -1749,7 +1748,7 @@ impl Flow for InlineFlow {
|
||||||
fn repair_style(&mut self, _: &Arc<ComputedValues>) {}
|
fn repair_style(&mut self, _: &Arc<ComputedValues>) {}
|
||||||
|
|
||||||
fn compute_overflow(&self) -> Rect<Au> {
|
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 flow_size = self.base.position.size.to_physical(self.base.writing_mode);
|
||||||
let relative_containing_block_size =
|
let relative_containing_block_size =
|
||||||
&self.base.early_absolute_position_info.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 std::sync::Arc;
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
use style::values::computed::LengthOrPercentageOrAuto;
|
use style::values::computed::LengthOrPercentageOrAuto;
|
||||||
use util::geometry::ZERO_RECT;
|
|
||||||
use util::logical_geometry::LogicalSize;
|
use util::logical_geometry::LogicalSize;
|
||||||
|
|
||||||
/// A table formatting context.
|
/// A table formatting context.
|
||||||
|
@ -96,7 +95,7 @@ impl Flow for TableColGroupFlow {
|
||||||
fn repair_style(&mut self, _: &Arc<ComputedValues>) {}
|
fn repair_style(&mut self, _: &Arc<ComputedValues>) {}
|
||||||
|
|
||||||
fn compute_overflow(&self) -> Rect<Au> {
|
fn compute_overflow(&self) -> Rect<Au> {
|
||||||
ZERO_RECT
|
Rect::zero()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn generated_containing_block_size(&self, _: OpaqueFlow) -> LogicalSize<Au> {
|
fn generated_containing_block_size(&self, _: OpaqueFlow) -> LogicalSize<Au> {
|
||||||
|
|
|
@ -64,17 +64,6 @@ pub static ZERO_POINT: Point2D<Au> = Point2D {
|
||||||
y: Au(0),
|
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 {
|
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