mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
parent
eb86e5086e
commit
cfffd05424
3 changed files with 7 additions and 30 deletions
|
@ -8,7 +8,7 @@ use geom::size::Size2D;
|
||||||
|
|
||||||
use std::num::{NumCast, One, Zero};
|
use std::num::{NumCast, One, Zero};
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone,Eq)]
|
||||||
pub struct Au(i32);
|
pub struct Au(i32);
|
||||||
|
|
||||||
impl Add<Au,Au> for Au {
|
impl Add<Au,Au> for Au {
|
||||||
|
@ -42,11 +42,6 @@ impl Ord for Au {
|
||||||
fn gt(&self, other: &Au) -> bool { **self > **other }
|
fn gt(&self, other: &Au) -> bool { **self > **other }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Eq for Au {
|
|
||||||
fn eq(&self, other: &Au) -> bool { **self == **other }
|
|
||||||
fn ne(&self, other: &Au) -> bool { **self != **other }
|
|
||||||
}
|
|
||||||
|
|
||||||
impl One for Au {
|
impl One for Au {
|
||||||
fn one() -> Au { Au(1) }
|
fn one() -> Au { Au(1) }
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#[deriving(Eq)]
|
||||||
enum CompressionMode {
|
enum CompressionMode {
|
||||||
CompressNone,
|
CompressNone,
|
||||||
CompressWhitespace,
|
CompressWhitespace,
|
||||||
|
@ -9,21 +10,6 @@ enum CompressionMode {
|
||||||
DiscardNewline
|
DiscardNewline
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Eq for CompressionMode {
|
|
||||||
fn eq(&self, other: &CompressionMode) -> bool {
|
|
||||||
match (*self, *other) {
|
|
||||||
(CompressNone, CompressNone) => true,
|
|
||||||
(CompressWhitespace, CompressWhitespace) => true,
|
|
||||||
(CompressWhitespaceNewline, CompressWhitespaceNewline) => true,
|
|
||||||
(DiscardNewline, DiscardNewline) => true,
|
|
||||||
_ => false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fn ne(&self, other: &CompressionMode) -> bool {
|
|
||||||
!(*self).eq(other)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ported from Gecko's nsTextFrameUtils::TransformText.
|
// ported from Gecko's nsTextFrameUtils::TransformText.
|
||||||
//
|
//
|
||||||
// High level TODOs:
|
// High level TODOs:
|
||||||
|
|
|
@ -28,29 +28,25 @@ use servo_util::tree::{TreeNode, TreeNodeRef, TreeUtils};
|
||||||
|
|
||||||
/// A phantom type representing the script task's view of this node. Script is able to mutate
|
/// A phantom type representing the script task's view of this node. Script is able to mutate
|
||||||
/// nodes but may not access layout data.
|
/// nodes but may not access layout data.
|
||||||
|
#[deriving(Eq)]
|
||||||
pub struct ScriptView;
|
pub struct ScriptView;
|
||||||
|
|
||||||
/// A phantom type representing the layout task's view of the node. Layout is not allowed to mutate
|
/// A phantom type representing the layout task's view of the node. Layout is not allowed to mutate
|
||||||
/// nodes but may access layout data.
|
/// nodes but may access layout data.
|
||||||
|
#[deriving(Eq)]
|
||||||
pub struct LayoutView;
|
pub struct LayoutView;
|
||||||
|
|
||||||
|
// We shouldn't need Eq for ScriptView and LayoutView; see Rust #7671.
|
||||||
|
|
||||||
/// This is what a Node looks like if you do not know what kind of node it is. To unpack it, use
|
/// This is what a Node looks like if you do not know what kind of node it is. To unpack it, use
|
||||||
/// downcast().
|
/// downcast().
|
||||||
///
|
///
|
||||||
/// FIXME: This should be replaced with a trait once they can inherit from structs.
|
/// FIXME: This should be replaced with a trait once they can inherit from structs.
|
||||||
|
#[deriving(Eq)]
|
||||||
pub struct AbstractNode<View> {
|
pub struct AbstractNode<View> {
|
||||||
priv obj: *mut Node<View>,
|
priv obj: *mut Node<View>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<View> Eq for AbstractNode<View> {
|
|
||||||
fn eq(&self, other: &AbstractNode<View>) -> bool {
|
|
||||||
self.obj == other.obj
|
|
||||||
}
|
|
||||||
fn ne(&self, other: &AbstractNode<View>) -> bool {
|
|
||||||
self.obj != other.obj
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// An HTML node.
|
/// An HTML node.
|
||||||
///
|
///
|
||||||
/// `View` describes extra data associated with this node that this task has access to. For
|
/// `View` describes extra data associated with this node that this task has access to. For
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue