aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbors-servo <release+servo@mozilla.com>2014-04-01 15:31:50 -0400
committerbors-servo <release+servo@mozilla.com>2014-04-01 15:31:50 -0400
commite3bf08ea537366a1624a082999c3548fa07d4650 (patch)
treec4cce3fe40576c578ad568cc7d82537d7c729555 /src
parent1c8ad2ce471019d621af22015a3cc82a58cbc303 (diff)
parentd4d6fcb5f06a21091960bd809282c5eadf99caa2 (diff)
downloadservo-e3bf08ea537366a1624a082999c3548fa07d4650.tar.gz
servo-e3bf08ea537366a1624a082999c3548fa07d4650.zip
auto merge of #2022 : lpy/servo/issue2019, r=jdm
see #2019
Diffstat (limited to 'src')
-rw-r--r--src/components/script/dom/element.rs39
-rw-r--r--src/components/script/dom/htmlimageelement.rs14
-rw-r--r--src/components/script/script_task.rs11
3 files changed, 24 insertions, 40 deletions
diff --git a/src/components/script/dom/element.rs b/src/components/script/dom/element.rs
index c7676a3a616..aa092bce325 100644
--- a/src/components/script/dom/element.rs
+++ b/src/components/script/dom/element.rs
@@ -571,19 +571,15 @@ impl Element {
let node: JS<Node> = NodeCast::from(abstract_self);
let (port, chan) = Chan::new();
let addr = node.to_trusted_node_address();
- let rects =
- match win.get().page().query_layout(ContentBoxesQuery(addr, chan), port) {
- ContentBoxesResponse(rects) => {
- rects.map(|r| {
- ClientRect::new(
- win,
- r.origin.y,
- r.origin.y + r.size.height,
- r.origin.x,
- r.origin.x + r.size.width)
- })
- },
- };
+ let ContentBoxesResponse(rects) = win.get().page().query_layout(ContentBoxesQuery(addr, chan), port);
+ let rects = rects.map(|r| {
+ ClientRect::new(
+ win,
+ r.origin.y,
+ r.origin.y + r.size.height,
+ r.origin.x,
+ r.origin.x + r.size.width)
+ });
ClientRectList::new(win, rects)
}
@@ -595,16 +591,13 @@ impl Element {
let node: JS<Node> = NodeCast::from(abstract_self);
let (port, chan) = Chan::new();
let addr = node.to_trusted_node_address();
- match win.get().page().query_layout(ContentBoxQuery(addr, chan), port) {
- ContentBoxResponse(rect) => {
- ClientRect::new(
- win,
- rect.origin.y,
- rect.origin.y + rect.size.height,
- rect.origin.x,
- rect.origin.x + rect.size.width)
- }
- }
+ let ContentBoxResponse(rect) = win.get().page().query_layout(ContentBoxQuery(addr, chan), port);
+ ClientRect::new(
+ win,
+ rect.origin.y,
+ rect.origin.y + rect.size.height,
+ rect.origin.x,
+ rect.origin.x + rect.size.width)
}
pub fn GetInnerHTML(&self, abstract_self: &JS<Element>) -> Fallible<DOMString> {
diff --git a/src/components/script/dom/htmlimageelement.rs b/src/components/script/dom/htmlimageelement.rs
index af1d70444a2..a70d6798431 100644
--- a/src/components/script/dom/htmlimageelement.rs
+++ b/src/components/script/dom/htmlimageelement.rs
@@ -140,11 +140,8 @@ impl HTMLImageElement {
let page = window.get().page();
let (port, chan) = Chan::new();
let addr = node.to_trusted_node_address();
- match page.query_layout(ContentBoxQuery(addr, chan), port) {
- ContentBoxResponse(rect) => {
- to_px(rect.size.width) as u32
- }
- }
+ let ContentBoxResponse(rect) = page.query_layout(ContentBoxQuery(addr, chan), port);
+ to_px(rect.size.width) as u32
}
pub fn SetWidth(&mut self, abstract_self: &JS<HTMLImageElement>, width: u32) -> ErrorResult {
@@ -159,11 +156,8 @@ impl HTMLImageElement {
let (port, chan) = Chan::new();
let this_node: JS<Node> = NodeCast::from(abstract_self);
let addr = this_node.to_trusted_node_address();
- match page.query_layout(ContentBoxQuery(addr, chan), port) {
- ContentBoxResponse(rect) => {
- to_px(rect.size.height) as u32
- }
- }
+ let ContentBoxResponse(rect) = page.query_layout(ContentBoxQuery(addr, chan), port);
+ to_px(rect.size.height) as u32
}
pub fn SetHeight(&mut self, abstract_self: &JS<HTMLImageElement>, height: u32) -> ErrorResult {
diff --git a/src/components/script/script_task.rs b/src/components/script/script_task.rs
index 22a03a7b680..2fba7693687 100644
--- a/src/components/script/script_task.rs
+++ b/src/components/script/script_task.rs
@@ -929,13 +929,10 @@ impl ScriptTask {
fn scroll_fragment_point(&self, pipeline_id: PipelineId, page: &Page, node: JS<Element>) {
let (port, chan) = Chan::new();
let node: JS<Node> = NodeCast::from(&node);
- match page.query_layout(ContentBoxQuery(node.to_trusted_node_address(), chan), port) {
- ContentBoxResponse(rect) => {
- let point = Point2D(to_frac_px(rect.origin.x).to_f32().unwrap(),
- to_frac_px(rect.origin.y).to_f32().unwrap());
- self.compositor.scroll_fragment_point(pipeline_id, point);
- }
- }
+ let ContentBoxResponse(rect) = page.query_layout(ContentBoxQuery(node.to_trusted_node_address(), chan), port);
+ let point = Point2D(to_frac_px(rect.origin.x).to_f32().unwrap(),
+ to_frac_px(rect.origin.y).to_f32().unwrap());
+ self.compositor.scroll_fragment_point(pipeline_id, point);
}
/// This is the main entry point for receiving and dispatching DOM events.