From fb2ce2c00c30c875769f0857e18269cff1882862 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Mon, 3 Jun 2013 16:06:38 -0700 Subject: [PATCH] Rename `with_imm_base` to `with_base`. --- src/components/main/layout/box.rs | 14 +++++++------- src/components/main/layout/inline.rs | 8 ++++---- src/components/main/layout/model.rs | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/components/main/layout/box.rs b/src/components/main/layout/box.rs index 3cfeaa9c10e..4e99a916b46 100644 --- a/src/components/main/layout/box.rs +++ b/src/components/main/layout/box.rs @@ -181,7 +181,7 @@ impl RenderBoxBase { pub impl RenderBox { /// Borrows this render box immutably in order to work with its common data. #[inline(always)] - fn with_imm_base(&self, callback: &fn(&RenderBoxBase) -> R) -> R { + fn with_base(&self, callback: &fn(&RenderBoxBase) -> R) -> R { match *self { GenericRenderBoxClass(generic_box) => callback(generic_box), ImageRenderBoxClass(image_box) => { @@ -215,7 +215,7 @@ pub impl RenderBox { /// A convenience function to return the position of this box. fn position(&self) -> Rect { - do self.with_imm_base |base| { + do self.with_base |base| { base.position } } @@ -455,7 +455,7 @@ pub impl RenderBox { } fn get_noncontent_width(&self) -> Au { - do self.with_imm_base |base| { + do self.with_base |base| { base.model.border.left + base.model.padding.left + base.model.border.right + base.model.padding.right } @@ -470,7 +470,7 @@ pub impl RenderBox { /// The box formed by the content edge as defined in CSS 2.1 ยง 8.1. Coordinates are relative to /// the owning flow. fn content_box(&self) -> Rect { - do self.with_imm_base |base| { + do self.with_base |base| { let origin = Point2D(base.position.origin.x + base.model.border.left + base.model.padding.left, @@ -498,12 +498,12 @@ pub impl RenderBox { /// A convenience function to access the computed style of the DOM node that this render box /// represents. fn style(&self) -> CompleteStyle { - self.with_imm_base(|base| base.node.style()) + self.with_base(|base| base.node.style()) } /// A convenience function to access the DOM node that this render box represents. fn node(&self) -> AbstractNode { - self.with_imm_base(|base| base.node) + self.with_base(|base| base.node) } /// Returns the nearest ancestor-or-self `Element` to the DOM node that this render box @@ -511,7 +511,7 @@ pub impl RenderBox { /// /// If there is no ancestor-or-self `Element` node, fails. fn nearest_ancestor_element(&self) -> AbstractNode { - do self.with_imm_base |base| { + do self.with_base |base| { let mut node = base.node; while !node.is_element() { match node.parent_node() { diff --git a/src/components/main/layout/inline.rs b/src/components/main/layout/inline.rs index 704c62c20c4..ffdad2f65e0 100644 --- a/src/components/main/layout/inline.rs +++ b/src/components/main/layout/inline.rs @@ -141,8 +141,8 @@ impl ElementMapping { // XXX: the following loop form causes segfaults; assigning to locals doesn't. // while new_j < new_boxes.len() && old_boxes[old_i].d().node != new_boxes[new_j].d().node { while new_j < new_boxes.len() { - let should_leave = do old_boxes[old_i].with_imm_base |old_box_base| { - do new_boxes[new_j].with_imm_base |new_box_base| { + let should_leave = do old_boxes[old_i].with_base |old_box_base| { + do new_boxes[new_j].with_base |new_box_base| { old_box_base.node != new_box_base.node } }; @@ -284,7 +284,7 @@ impl TextRunScanner { let run = @fontgroup.create_textrun(transformed_text, underline); debug!("TextRunScanner: pushing single text box in range: %?", self.clump); - let new_box = do old_box.with_imm_base |old_box_base| { + let new_box = do old_box.with_base |old_box_base| { let range = Range::new(0, run.char_len()); @mut adapt_textbox_with_range(*old_box_base, run, range) }; @@ -345,7 +345,7 @@ impl TextRunScanner { loop } - do in_boxes[i].with_imm_base |base| { + do in_boxes[i].with_base |base| { let new_box = @mut adapt_textbox_with_range(*base, run.get(), range); out_boxes.push(TextRenderBoxClass(new_box)); } diff --git a/src/components/main/layout/model.rs b/src/components/main/layout/model.rs index f7f012ee56c..4871ddb5c85 100644 --- a/src/components/main/layout/model.rs +++ b/src/components/main/layout/model.rs @@ -151,7 +151,7 @@ impl RenderBox { list: &Cell>, abs_bounds: &Rect) { // Fast path. - let border = do self.with_imm_base |base| { + let border = do self.with_base |base| { base.model.border }; if border.is_zero() {