mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
Rename with_imm_base
to with_base
.
This commit is contained in:
parent
cddf67a0e6
commit
fb2ce2c00c
3 changed files with 12 additions and 12 deletions
|
@ -181,7 +181,7 @@ impl RenderBoxBase {
|
||||||
pub impl RenderBox {
|
pub impl RenderBox {
|
||||||
/// Borrows this render box immutably in order to work with its common data.
|
/// Borrows this render box immutably in order to work with its common data.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn with_imm_base<R>(&self, callback: &fn(&RenderBoxBase) -> R) -> R {
|
fn with_base<R>(&self, callback: &fn(&RenderBoxBase) -> R) -> R {
|
||||||
match *self {
|
match *self {
|
||||||
GenericRenderBoxClass(generic_box) => callback(generic_box),
|
GenericRenderBoxClass(generic_box) => callback(generic_box),
|
||||||
ImageRenderBoxClass(image_box) => {
|
ImageRenderBoxClass(image_box) => {
|
||||||
|
@ -215,7 +215,7 @@ pub impl RenderBox {
|
||||||
|
|
||||||
/// A convenience function to return the position of this box.
|
/// A convenience function to return the position of this box.
|
||||||
fn position(&self) -> Rect<Au> {
|
fn position(&self) -> Rect<Au> {
|
||||||
do self.with_imm_base |base| {
|
do self.with_base |base| {
|
||||||
base.position
|
base.position
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -455,7 +455,7 @@ pub impl RenderBox {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_noncontent_width(&self) -> Au {
|
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.left + base.model.padding.left +
|
||||||
base.model.border.right + base.model.padding.right
|
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 box formed by the content edge as defined in CSS 2.1 § 8.1. Coordinates are relative to
|
||||||
/// the owning flow.
|
/// the owning flow.
|
||||||
fn content_box(&self) -> Rect<Au> {
|
fn content_box(&self) -> Rect<Au> {
|
||||||
do self.with_imm_base |base| {
|
do self.with_base |base| {
|
||||||
let origin = Point2D(base.position.origin.x +
|
let origin = Point2D(base.position.origin.x +
|
||||||
base.model.border.left +
|
base.model.border.left +
|
||||||
base.model.padding.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
|
/// A convenience function to access the computed style of the DOM node that this render box
|
||||||
/// represents.
|
/// represents.
|
||||||
fn style(&self) -> CompleteStyle {
|
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.
|
/// A convenience function to access the DOM node that this render box represents.
|
||||||
fn node(&self) -> AbstractNode<LayoutView> {
|
fn node(&self) -> AbstractNode<LayoutView> {
|
||||||
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
|
/// 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.
|
/// If there is no ancestor-or-self `Element` node, fails.
|
||||||
fn nearest_ancestor_element(&self) -> AbstractNode<LayoutView> {
|
fn nearest_ancestor_element(&self) -> AbstractNode<LayoutView> {
|
||||||
do self.with_imm_base |base| {
|
do self.with_base |base| {
|
||||||
let mut node = base.node;
|
let mut node = base.node;
|
||||||
while !node.is_element() {
|
while !node.is_element() {
|
||||||
match node.parent_node() {
|
match node.parent_node() {
|
||||||
|
|
|
@ -141,8 +141,8 @@ impl ElementMapping {
|
||||||
// XXX: the following loop form causes segfaults; assigning to locals doesn't.
|
// 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() && old_boxes[old_i].d().node != new_boxes[new_j].d().node {
|
||||||
while new_j < new_boxes.len() {
|
while new_j < new_boxes.len() {
|
||||||
let should_leave = do old_boxes[old_i].with_imm_base |old_box_base| {
|
let should_leave = do old_boxes[old_i].with_base |old_box_base| {
|
||||||
do new_boxes[new_j].with_imm_base |new_box_base| {
|
do new_boxes[new_j].with_base |new_box_base| {
|
||||||
old_box_base.node != new_box_base.node
|
old_box_base.node != new_box_base.node
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -284,7 +284,7 @@ impl TextRunScanner {
|
||||||
let run = @fontgroup.create_textrun(transformed_text, underline);
|
let run = @fontgroup.create_textrun(transformed_text, underline);
|
||||||
|
|
||||||
debug!("TextRunScanner: pushing single text box in range: %?", self.clump);
|
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());
|
let range = Range::new(0, run.char_len());
|
||||||
@mut adapt_textbox_with_range(*old_box_base, run, range)
|
@mut adapt_textbox_with_range(*old_box_base, run, range)
|
||||||
};
|
};
|
||||||
|
@ -345,7 +345,7 @@ impl TextRunScanner {
|
||||||
loop
|
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);
|
let new_box = @mut adapt_textbox_with_range(*base, run.get(), range);
|
||||||
out_boxes.push(TextRenderBoxClass(new_box));
|
out_boxes.push(TextRenderBoxClass(new_box));
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,7 @@ impl RenderBox {
|
||||||
list: &Cell<DisplayList<E>>,
|
list: &Cell<DisplayList<E>>,
|
||||||
abs_bounds: &Rect<Au>) {
|
abs_bounds: &Rect<Au>) {
|
||||||
// Fast path.
|
// Fast path.
|
||||||
let border = do self.with_imm_base |base| {
|
let border = do self.with_base |base| {
|
||||||
base.model.border
|
base.model.border
|
||||||
};
|
};
|
||||||
if border.is_zero() {
|
if border.is_zero() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue