aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/layout_interface.rs
diff options
context:
space:
mode:
authorLars Bergstrom <lars@lars.com>2014-04-05 10:11:38 +0200
committerLars Bergstrom <lars@lars.com>2014-04-27 15:46:12 -0500
commit948daf242278b22d7a15c1c594129785d1cff538 (patch)
tree513345ea70f134bf4a85d8e2cdbe166bfee904f6 /src/components/script/layout_interface.rs
parent4942cc76bd2c88e5fdc2b4de4c1ac4576100b455 (diff)
downloadservo-948daf242278b22d7a15c1c594129785d1cff538.tar.gz
servo-948daf242278b22d7a15c1c594129785d1cff538.zip
This batch of changes upgrades Servo to work with the Rust upgrade as of
April 10, 2014. The main changes are to privacy, to work around the issues with incorrect bounds on the libstd `Arc<Mutex<T>>`, and the various API changes strewn throughout the libraries.
Diffstat (limited to 'src/components/script/layout_interface.rs')
-rw-r--r--src/components/script/layout_interface.rs41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/components/script/layout_interface.rs b/src/components/script/layout_interface.rs
index a29aa2fa08e..224c51918a8 100644
--- a/src/components/script/layout_interface.rs
+++ b/src/components/script/layout_interface.rs
@@ -12,11 +12,11 @@ use dom::node::{Node, LayoutDataRef};
use geom::point::Point2D;
use geom::rect::Rect;
use geom::size::Size2D;
+use libc::c_void;
use script_task::{ScriptChan};
use servo_util::geometry::Au;
use std::cmp;
use std::comm::{channel, Receiver, Sender};
-use std::libc::c_void;
use style::Stylesheet;
use url::Url;
@@ -65,15 +65,16 @@ pub enum LayoutQuery {
/// The address of a node known to be valid. These must only be sent from content -> layout,
/// because we do not trust layout.
-pub struct TrustedNodeAddress(*c_void);
+pub struct TrustedNodeAddress(pub *c_void);
-impl<S: Encoder> Encodable<S> for TrustedNodeAddress {
- fn encode(&self, s: &mut S) {
+impl<S: Encoder<E>, E> Encodable<S, E> for TrustedNodeAddress {
+ fn encode(&self, s: &mut S) -> Result<(), E> {
let TrustedNodeAddress(addr) = *self;
let node = addr as *Node as *mut Node;
unsafe {
JS::from_raw(node).encode(s)
- }
+ };
+ Ok(())
}
}
@@ -81,10 +82,10 @@ impl<S: Encoder> Encodable<S> for TrustedNodeAddress {
/// `from_untrusted_node_address` before they can be used, because we do not trust layout.
pub type UntrustedNodeAddress = *c_void;
-pub struct ContentBoxResponse(Rect<Au>);
-pub struct ContentBoxesResponse(~[Rect<Au>]);
-pub struct HitTestResponse(UntrustedNodeAddress);
-pub struct MouseOverResponse(~[UntrustedNodeAddress]);
+pub struct ContentBoxResponse(pub Rect<Au>);
+pub struct ContentBoxesResponse(pub ~[Rect<Au>]);
+pub struct HitTestResponse(pub UntrustedNodeAddress);
+pub struct MouseOverResponse(pub ~[UntrustedNodeAddress]);
/// Determines which part of the
#[deriving(Eq, Ord, TotalEq, TotalOrd, Encodable)]
@@ -110,9 +111,9 @@ impl DocumentDamageLevel {
#[deriving(Encodable)]
pub struct DocumentDamage {
/// The topmost node in the tree that has changed.
- root: TrustedNodeAddress,
+ pub root: TrustedNodeAddress,
/// The amount of damage that occurred.
- level: DocumentDamageLevel,
+ pub level: DocumentDamageLevel,
}
/// Why we're doing reflow.
@@ -127,26 +128,26 @@ pub enum ReflowGoal {
/// Information needed for a reflow.
pub struct Reflow {
/// The document node.
- document_root: TrustedNodeAddress,
+ pub document_root: TrustedNodeAddress,
/// The style changes that need to be done.
- damage: DocumentDamage,
+ pub damage: DocumentDamage,
/// The goal of reflow: either to render to the screen or to flush layout info for script.
- goal: ReflowGoal,
+ pub goal: ReflowGoal,
/// The URL of the page.
- url: Url,
+ pub url: Url,
/// The channel through which messages can be sent back to the script task.
- script_chan: ScriptChan,
+ pub script_chan: ScriptChan,
/// The current window size.
- window_size: Size2D<uint>,
+ pub window_size: Size2D<uint>,
/// The channel that we send a notification to.
- script_join_chan: Sender<()>,
+ pub script_join_chan: Sender<()>,
/// Unique identifier
- id: uint
+ pub id: uint
}
/// Encapsulates a channel to the layout task.
#[deriving(Clone)]
-pub struct LayoutChan(Sender<Msg>);
+pub struct LayoutChan(pub Sender<Msg>);
impl LayoutChan {
pub fn new() -> (Receiver<Msg>, LayoutChan) {