mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Auto merge of #8167 - Ms2ger:util, r=nox
Various cleanup in util. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8167) <!-- Reviewable:end -->
This commit is contained in:
commit
94aa8ca80a
3 changed files with 8 additions and 6 deletions
|
@ -89,7 +89,9 @@ pub static MAX_RECT: Rect<Au> = Rect {
|
||||||
/// Returns true if the rect contains the given point. Points on the top or left sides of the rect
|
/// Returns true if the rect contains the given point. Points on the top or left sides of the rect
|
||||||
/// are considered inside the rectangle, while points on the right or bottom sides of the rect are
|
/// are considered inside the rectangle, while points on the right or bottom sides of the rect are
|
||||||
/// not considered inside the rectangle.
|
/// not considered inside the rectangle.
|
||||||
pub fn rect_contains_point<T: PartialOrd + Add<T, Output=T>>(rect: Rect<T>, point: Point2D<T>) -> bool {
|
pub fn rect_contains_point<T>(rect: Rect<T>, point: Point2D<T>) -> bool
|
||||||
|
where T: PartialOrd + Add<T, Output=T>
|
||||||
|
{
|
||||||
point.x >= rect.origin.x && point.x < rect.origin.x + rect.size.width &&
|
point.x >= rect.origin.x && point.x < rect.origin.x + rect.size.width &&
|
||||||
point.y >= rect.origin.y && point.y < rect.origin.y + rect.size.height
|
point.y >= rect.origin.y && point.y < rect.origin.y + rect.size.height
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,8 +319,10 @@ impl<T: Sub<T, Output=T>> Sub for LogicalSize<T> {
|
||||||
/// A 2D point in flow-relative dimensions
|
/// A 2D point in flow-relative dimensions
|
||||||
#[derive(PartialEq, RustcEncodable, Eq, Clone, Copy)]
|
#[derive(PartialEq, RustcEncodable, Eq, Clone, Copy)]
|
||||||
pub struct LogicalPoint<T> {
|
pub struct LogicalPoint<T> {
|
||||||
pub i: T, /// inline-axis coordinate
|
/// inline-axis coordinate
|
||||||
pub b: T, /// block-axis coordinate
|
pub i: T,
|
||||||
|
/// block-axis coordinate
|
||||||
|
pub b: T,
|
||||||
debug_writing_mode: DebugWritingMode,
|
debug_writing_mode: DebugWritingMode,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,7 @@ pub fn spawn_named<F>(name: String, f: F)
|
||||||
where F: FnOnce() + Send + 'static
|
where F: FnOnce() + Send + 'static
|
||||||
{
|
{
|
||||||
let builder = thread::Builder::new().name(name);
|
let builder = thread::Builder::new().name(name);
|
||||||
builder.spawn(move || {
|
builder.spawn(f).unwrap();
|
||||||
f()
|
|
||||||
}).unwrap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Arrange to send a particular message to a channel if the task fails.
|
/// Arrange to send a particular message to a channel if the task fails.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue