Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More conversions of with_imm_base to with_base #498

Closed
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -176,7 +176,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<R>(&self, callback: &fn(&RenderBoxBase) -> R) -> R {
fn with_base<R>(&self, callback: &fn(&RenderBoxBase) -> R) -> R {
match *self {
GenericRenderBoxClass(generic_box) => callback(generic_box),
ImageRenderBoxClass(image_box) => {
@@ -210,7 +210,7 @@ pub impl RenderBox {

/// A convenience function to return the position of this box.
fn position(&self) -> Rect<Au> {
do self.with_imm_base |base| {
do self.with_base |base| {
base.position
}
}
@@ -491,28 +491,28 @@ pub impl RenderBox {

/// A convenience function to determine whether this render box represents a DOM element.
fn is_element(&self) -> bool {
do self.with_imm_base |base| {
do self.with_base |base| {
base.node.is_element()
}
}

/// 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<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
/// represents.
///
/// If there is no ancestor-or-self `Element` node, fails.
fn nearest_ancestor_element(&self) -> AbstractNode<LayoutView> {
do self.with_imm_base |base| {
do self.with_base |base| {
let mut node = base.node;
while !node.is_element() {
match node.parent_node() {
@@ -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));
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.