mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Remove CompletelyEncloses
This commit is contained in:
parent
495a0dd41a
commit
9825b85acd
1 changed files with 28 additions and 34 deletions
|
@ -565,11 +565,11 @@ impl ClippingRegion {
|
||||||
//
|
//
|
||||||
// http://www.inrg.csie.ntu.edu.tw/algorithm2014/presentation/D&C%20Lee-84.pdf
|
// http://www.inrg.csie.ntu.edu.tw/algorithm2014/presentation/D&C%20Lee-84.pdf
|
||||||
for existing_complex_region in &mut self.complex {
|
for existing_complex_region in &mut self.complex {
|
||||||
if existing_complex_region.completely_encloses(&new_complex_region) {
|
if completely_encloses(&existing_complex_region, &new_complex_region) {
|
||||||
*existing_complex_region = new_complex_region;
|
*existing_complex_region = new_complex_region;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if new_complex_region.completely_encloses(existing_complex_region) {
|
if completely_encloses(&new_complex_region, &existing_complex_region) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -618,38 +618,32 @@ impl fmt::Debug for ClippingRegion {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait CompletelyEncloses {
|
// TODO(pcwalton): This could be more aggressive by considering points that touch the inside of
|
||||||
fn completely_encloses(&self, other: &Self) -> bool;
|
// the border radius ellipse.
|
||||||
}
|
fn completely_encloses(this: &ComplexClipRegion, other: &ComplexClipRegion) -> bool {
|
||||||
|
let left = this.radii.top_left.width.max(this.radii.bottom_left.width);
|
||||||
impl CompletelyEncloses for ComplexClipRegion {
|
let top = this.radii.top_left.height.max(this.radii.top_right.height);
|
||||||
// TODO(pcwalton): This could be more aggressive by considering points that touch the inside of
|
let right = this
|
||||||
// the border radius ellipse.
|
.radii
|
||||||
fn completely_encloses(&self, other: &Self) -> bool {
|
.top_right
|
||||||
let left = self.radii.top_left.width.max(self.radii.bottom_left.width);
|
.width
|
||||||
let top = self.radii.top_left.height.max(self.radii.top_right.height);
|
.max(this.radii.bottom_right.width);
|
||||||
let right = self
|
let bottom = this
|
||||||
.radii
|
.radii
|
||||||
.top_right
|
.bottom_left
|
||||||
.width
|
.height
|
||||||
.max(self.radii.bottom_right.width);
|
.max(this.radii.bottom_right.height);
|
||||||
let bottom = self
|
let interior = LayoutRect::new(
|
||||||
.radii
|
LayoutPoint::new(this.rect.origin.x + left, this.rect.origin.y + top),
|
||||||
.bottom_left
|
LayoutSize::new(
|
||||||
.height
|
this.rect.size.width - left - right,
|
||||||
.max(self.radii.bottom_right.height);
|
this.rect.size.height - top - bottom,
|
||||||
let interior = LayoutRect::new(
|
),
|
||||||
LayoutPoint::new(self.rect.origin.x + left, self.rect.origin.y + top),
|
);
|
||||||
LayoutSize::new(
|
interior.origin.x <= other.rect.origin.x &&
|
||||||
self.rect.size.width - left - right,
|
interior.origin.y <= other.rect.origin.y &&
|
||||||
self.rect.size.height - top - bottom,
|
interior.max_x() >= other.rect.max_x() &&
|
||||||
),
|
interior.max_y() >= other.rect.max_y()
|
||||||
);
|
|
||||||
interior.origin.x <= other.rect.origin.x &&
|
|
||||||
interior.origin.y <= other.rect.origin.y &&
|
|
||||||
interior.max_x() >= other.rect.max_x() &&
|
|
||||||
interior.max_y() >= other.rect.max_y()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Metadata attached to each display item. This is useful for performing auxiliary threads with
|
/// Metadata attached to each display item. This is useful for performing auxiliary threads with
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue