Auto merge of #7052 - mbrubeck:rollup, r=mbrubeck

Rollup of 2 pull requests

- Successful merges: #7014, #7015
- Failed merges:
This commit is contained in:
bors-servo 2015-08-06 16:13:12 -06:00
commit b21584c862
6 changed files with 15 additions and 17 deletions

View file

@ -824,7 +824,7 @@ pub struct TextDisplayItem {
/// The text run. /// The text run.
#[ignore_heap_size_of = "Because it is non-owning"] #[ignore_heap_size_of = "Because it is non-owning"]
pub text_run: Arc<Box<TextRun>>, pub text_run: Arc<TextRun>,
/// The range of text within the text run. /// The range of text within the text run.
pub range: Range<CharIndex>, pub range: Range<CharIndex>,

View file

@ -1264,7 +1264,7 @@ impl ToRadiiPx for BorderRadii<Au> {
trait ScaledFontExtensionMethods { trait ScaledFontExtensionMethods {
fn draw_text(&self, fn draw_text(&self,
draw_target: &DrawTarget, draw_target: &DrawTarget,
run: &Box<TextRun>, run: &TextRun,
range: &Range<CharIndex>, range: &Range<CharIndex>,
baseline_origin: Point2D<Au>, baseline_origin: Point2D<Au>,
color: Color, color: Color,
@ -1274,7 +1274,7 @@ trait ScaledFontExtensionMethods {
impl ScaledFontExtensionMethods for ScaledFont { impl ScaledFontExtensionMethods for ScaledFont {
fn draw_text(&self, fn draw_text(&self,
draw_target: &DrawTarget, draw_target: &DrawTarget,
run: &Box<TextRun>, run: &TextRun,
range: &Range<CharIndex>, range: &Range<CharIndex>,
baseline_origin: Point2D<Au>, baseline_origin: Point2D<Au>,
color: Color, color: Color,

View file

@ -626,7 +626,7 @@ impl IframeFragmentInfo {
#[derive(Clone)] #[derive(Clone)]
pub struct ScannedTextFragmentInfo { pub struct ScannedTextFragmentInfo {
/// The text run that this represents. /// The text run that this represents.
pub run: Arc<Box<TextRun>>, pub run: Arc<TextRun>,
/// The intrinsic size of the text fragment. /// The intrinsic size of the text fragment.
pub content_size: LogicalSize<Au>, pub content_size: LogicalSize<Au>,
@ -646,7 +646,7 @@ pub struct ScannedTextFragmentInfo {
impl ScannedTextFragmentInfo { impl ScannedTextFragmentInfo {
/// Creates the information specific to a scanned text fragment from a range and a text run. /// Creates the information specific to a scanned text fragment from a range and a text run.
pub fn new(run: Arc<Box<TextRun>>, pub fn new(run: Arc<TextRun>,
range: Range<CharIndex>, range: Range<CharIndex>,
content_size: LogicalSize<Au>, content_size: LogicalSize<Au>,
requires_line_break_afterward_if_wrapping_on_newlines: bool) requires_line_break_afterward_if_wrapping_on_newlines: bool)
@ -689,7 +689,7 @@ pub struct SplitResult {
/// The part of the fragment that goes on the second line. /// The part of the fragment that goes on the second line.
pub inline_end: Option<SplitInfo>, pub inline_end: Option<SplitInfo>,
/// The text run which is being split. /// The text run which is being split.
pub text_run: Arc<Box<TextRun>>, pub text_run: Arc<TextRun>,
} }
/// Describes how a fragment should be truncated. /// Describes how a fragment should be truncated.
@ -697,7 +697,7 @@ pub struct TruncationResult {
/// The part of the fragment remaining after truncation. /// The part of the fragment remaining after truncation.
pub split: SplitInfo, pub split: SplitInfo,
/// The text run which is being truncated. /// The text run which is being truncated.
pub text_run: Arc<Box<TextRun>>, pub text_run: Arc<TextRun>,
} }
/// Data for an unscanned text fragment. Unscanned text fragments are the results of flow /// Data for an unscanned text fragment. Unscanned text fragments are the results of flow
@ -705,10 +705,7 @@ pub struct TruncationResult {
#[derive(Clone)] #[derive(Clone)]
pub struct UnscannedTextFragmentInfo { pub struct UnscannedTextFragmentInfo {
/// The text inside the fragment. /// The text inside the fragment.
/// pub text: Box<str>,
/// FIXME(pcwalton): Is there something more clever we can do here that avoids the double
/// indirection while not penalizing all fragments?
pub text: Box<String>,
} }
impl UnscannedTextFragmentInfo { impl UnscannedTextFragmentInfo {
@ -716,7 +713,7 @@ impl UnscannedTextFragmentInfo {
#[inline] #[inline]
pub fn from_text(text: String) -> UnscannedTextFragmentInfo { pub fn from_text(text: String) -> UnscannedTextFragmentInfo {
UnscannedTextFragmentInfo { UnscannedTextFragmentInfo {
text: box text, text: text.into_boxed_slice(),
} }
} }
} }
@ -847,7 +844,7 @@ impl Fragment {
} }
/// Transforms this fragment using the given `SplitInfo`, preserving all the other data. /// Transforms this fragment using the given `SplitInfo`, preserving all the other data.
pub fn transform_with_split_info(&self, split: &SplitInfo, text_run: Arc<Box<TextRun>>) pub fn transform_with_split_info(&self, split: &SplitInfo, text_run: Arc<TextRun>)
-> Fragment { -> Fragment {
let size = LogicalSize::new(self.style.writing_mode, let size = LogicalSize::new(self.style.writing_mode,
split.inline_size, split.inline_size,

View file

@ -408,7 +408,7 @@ impl LineBreaker {
fragment.specific { fragment.specific {
let scanned_text_fragment_info = &mut **scanned_text_fragment_info; let scanned_text_fragment_info = &mut **scanned_text_fragment_info;
let mut range = &mut scanned_text_fragment_info.range; let mut range = &mut scanned_text_fragment_info.range;
strip_trailing_whitespace_if_necessary(&**scanned_text_fragment_info.run, range); strip_trailing_whitespace_if_necessary(&*scanned_text_fragment_info.run, range);
let old_fragment_inline_size = fragment.border_box.size.inline + let old_fragment_inline_size = fragment.border_box.size.inline +
fragment.margin.inline_start_end(); fragment.margin.inline_start_end();

View file

@ -4,6 +4,7 @@
#![feature(append)] #![feature(append)]
#![feature(arc_unique)] #![feature(arc_unique)]
#![feature(box_str)]
#![feature(box_syntax)] #![feature(box_syntax)]
#![feature(cell_extras)] #![feature(cell_extras)]
#![feature(custom_derive)] #![feature(custom_derive)]

View file

@ -276,7 +276,7 @@ impl TextRunScanner {
options.flags.insert(RTL_FLAG); options.flags.insert(RTL_FLAG);
} }
let mut font = fontgroup.fonts.get(run_info.font_index).unwrap().borrow_mut(); let mut font = fontgroup.fonts.get(run_info.font_index).unwrap().borrow_mut();
Arc::new(box TextRun::new(&mut *font, run_info.text, &options, run_info.bidi_level)) Arc::new(TextRun::new(&mut *font, run_info.text, &options, run_info.bidi_level))
}).collect::<Vec<_>>() }).collect::<Vec<_>>()
}; };
@ -398,9 +398,9 @@ fn split_first_fragment_at_newline_if_necessary(fragments: &mut LinkedList<Fragm
}; };
string_before = string_before =
box unscanned_text_fragment_info.text[..(position + 1)].to_owned(); unscanned_text_fragment_info.text[..(position + 1)].to_owned().into_boxed_slice();
unscanned_text_fragment_info.text = unscanned_text_fragment_info.text =
box unscanned_text_fragment_info.text[(position + 1)..].to_owned(); unscanned_text_fragment_info.text[(position + 1)..].to_owned().into_boxed_slice();
} }
first_fragment.transform(first_fragment.border_box.size, first_fragment.transform(first_fragment.border_box.size,
SpecificFragmentInfo::UnscannedText(UnscannedTextFragmentInfo { SpecificFragmentInfo::UnscannedText(UnscannedTextFragmentInfo {