Skip to content

Commit

Permalink
servo: Merge #17605 - Replace remaining usage of deprecated Range::st…
Browse files Browse the repository at this point in the history
…ep_by (from servo:maybereverse); r=nox

… which is being removed in rust-lang/rust#43012

Source-Repo: https://github.com/servo/servo
Source-Revision: 5baea7b73223283b551cf378bb714491a2383c28

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : bf5a743b537b8b238e83e8c84c69ce98e15ec410
  • Loading branch information
SimonSapin committed Jul 5, 2017
1 parent c9b6fbb commit b72787c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
26 changes: 21 additions & 5 deletions servo/components/layout/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -962,13 +962,29 @@ impl InlineFlow {
Some(ref runs) => runs[run_count - run_idx - 1], // reverse order for RTL runs
None => (line.range, bidi::Level::ltr())
};

struct MaybeReverse<I> {
iter: I,
reverse: bool,
}

impl<I: DoubleEndedIterator> Iterator for MaybeReverse<I> {
type Item = I::Item;

fn next(&mut self) -> Option<I::Item> {
if self.reverse {
self.iter.next_back()
} else {
self.iter.next()
}
}
}

// If the bidi embedding direction is opposite the layout direction, lay out this
// run in reverse order.
let reverse = level.is_ltr() != is_ltr;
let fragment_indices = if reverse {
(range.end().get() - 1..range.begin().get() - 1).step_by(-1)
} else {
(range.begin().get()..range.end().get()).step_by(1)
let fragment_indices = MaybeReverse {
iter: range.begin().get()..range.end().get(),
reverse: level.is_ltr() != is_ltr,
};

for fragment_index in fragment_indices {
Expand Down
1 change: 0 additions & 1 deletion servo/components/layout/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#![feature(conservative_impl_trait)]
#![feature(nonzero)]
#![feature(raw)]
#![feature(step_by)]

extern crate app_units;
extern crate atomic_refcell;
Expand Down
1 change: 0 additions & 1 deletion servo/components/selectors/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1572,7 +1572,6 @@ pub mod tests {
use builder::HAS_PSEUDO_BIT;
use cssparser::{Parser as CssParser, ToCss, serialize_identifier, ParserInput};
use parser;
use std::borrow::Cow;
use std::collections::HashMap;
use std::fmt;
use super::*;
Expand Down

0 comments on commit b72787c

Please sign in to comment.