aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/main/layout
diff options
context:
space:
mode:
authorBrendan Zabarauskas <bjzaba@yahoo.com.au>2014-05-07 11:40:32 -0700
committerBrendan Zabarauskas <bjzaba@yahoo.com.au>2014-05-07 15:05:59 -0700
commit8c6eb08dcbc163cdca836bec21f89210a133085e (patch)
treed51efd59e57e7194f2bfb84cf9fa1789676cdcfc /src/components/main/layout
parent15d3257a29125103e368787f7e9790ee4314b29f (diff)
downloadservo-8c6eb08dcbc163cdca836bec21f89210a133085e.tar.gz
servo-8c6eb08dcbc163cdca836bec21f89210a133085e.zip
Make range generic
Diffstat (limited to 'src/components/main/layout')
-rw-r--r--src/components/main/layout/box_.rs8
-rw-r--r--src/components/main/layout/construct.rs2
-rw-r--r--src/components/main/layout/inline.rs8
-rw-r--r--src/components/main/layout/text.rs4
4 files changed, 11 insertions, 11 deletions
diff --git a/src/components/main/layout/box_.rs b/src/components/main/layout/box_.rs
index 416e9400106..d9484ba72ff 100644
--- a/src/components/main/layout/box_.rs
+++ b/src/components/main/layout/box_.rs
@@ -226,12 +226,12 @@ pub struct ScannedTextBoxInfo {
pub run: Arc<~TextRun>,
/// The range within the above text run that this represents.
- pub range: Range,
+ pub range: Range<uint>,
}
impl ScannedTextBoxInfo {
/// Creates the information specific to a scanned text box from a range and a text run.
- pub fn new(run: Arc<~TextRun>, range: Range) -> ScannedTextBoxInfo {
+ pub fn new(run: Arc<~TextRun>, range: Range<uint>) -> ScannedTextBoxInfo {
ScannedTextBoxInfo {
run: run,
range: range,
@@ -1146,7 +1146,7 @@ impl Box {
let mut pieces_processed_count: uint = 0;
let mut remaining_width: Au = max_width;
let mut left_range = Range::new(text_box_info.range.begin(), 0);
- let mut right_range: Option<Range> = None;
+ let mut right_range: Option<Range<uint>> = None;
debug!("split_to_width: splitting text box (strlen={:u}, range={}, \
avail_width={})",
@@ -1222,7 +1222,7 @@ impl Box {
None
};
- let right_box = right_range.map_or(None, |range: Range| {
+ let right_box = right_range.map_or(None, |range: Range<uint>| {
let new_text_box_info = ScannedTextBoxInfo::new(text_box_info.run.clone(),
range);
let mut new_metrics = new_text_box_info.run.metrics_for_range(&range);
diff --git a/src/components/main/layout/construct.rs b/src/components/main/layout/construct.rs
index e7523039551..a2236b6753d 100644
--- a/src/components/main/layout/construct.rs
+++ b/src/components/main/layout/construct.rs
@@ -189,7 +189,7 @@ impl InlineBoxAccumulator {
fn from_inline_node(node: &ThreadSafeLayoutNode) -> InlineBoxAccumulator {
let mut boxes = InlineBoxes::new();
- boxes.map.push(node.style().clone(), Range::new(0, 0));
+ boxes.map.push(node.style().clone(), Range::new(0u, 0));
InlineBoxAccumulator {
boxes: boxes,
has_enclosing_range: true,
diff --git a/src/components/main/layout/inline.rs b/src/components/main/layout/inline.rs
index 773618f9032..477018bfb5a 100644
--- a/src/components/main/layout/inline.rs
+++ b/src/components/main/layout/inline.rs
@@ -56,7 +56,7 @@ use sync::Arc;
/// left corner of the green zone is the same as that of the line, but
/// the green zone can be taller and wider than the line itself.
pub struct LineBox {
- pub range: Range,
+ pub range: Range<uint>,
pub bounds: Rect<Au>,
pub green_zone: Size2D<Au>
}
@@ -977,12 +977,12 @@ pub struct FragmentRange {
/// The style of the DOM node that this range refers to.
pub style: Arc<ComputedValues>,
/// The range, in indices into the fragment list.
- pub range: Range,
+ pub range: Range<uint>,
}
impl FragmentRange {
/// Creates a new fragment range from the given values.
- fn new(style: Arc<ComputedValues>, range: Range) -> FragmentRange {
+ fn new(style: Arc<ComputedValues>, range: Range<uint>) -> FragmentRange {
FragmentRange {
style: style,
range: range,
@@ -1053,7 +1053,7 @@ impl FragmentMap {
}
/// Adds the given node to the fragment map.
- pub fn push(&mut self, style: Arc<ComputedValues>, range: Range) {
+ pub fn push(&mut self, style: Arc<ComputedValues>, range: Range<uint>) {
self.list.push(FragmentRange::new(style, range))
}
diff --git a/src/components/main/layout/text.rs b/src/components/main/layout/text.rs
index c70aa8c0cb1..83dfb9d1b78 100644
--- a/src/components/main/layout/text.rs
+++ b/src/components/main/layout/text.rs
@@ -31,7 +31,7 @@ fn can_coalesce_text_nodes(boxes: &[Box], left_i: uint, right_i: uint) -> bool {
/// A stack-allocated object for scanning an inline flow into `TextRun`-containing `TextBox`es.
pub struct TextRunScanner {
- pub clump: Range,
+ pub clump: Range<uint>,
}
impl TextRunScanner {
@@ -210,7 +210,7 @@ impl TextRunScanner {
// Next, concatenate all of the transformed strings together, saving the new
// character indices.
let mut run_str: ~str = "".to_owned();
- let mut new_ranges: Vec<Range> = vec!();
+ let mut new_ranges: Vec<Range<uint>> = vec!();
let mut char_total = 0;
for i in range(0, transformed_strs.len()) {
let added_chars = transformed_strs.get(i).char_len();