mirror of
https://github.com/servo/servo.git
synced 2025-08-15 10:25:32 +01:00
Merge pull request #435 from metajack/syntax-futurism
Update to latest Rust
This commit is contained in:
commit
6e395af88c
20 changed files with 113 additions and 143 deletions
2
src/rust
2
src/rust
|
@ -1 +1 @@
|
|||
Subproject commit 9d966aef060030b1d13a55f6768a8e3afb9a842f
|
||||
Subproject commit d546493096f35e68cbcd9b5d3d7654e7a9345744
|
|
@ -1 +1 @@
|
|||
Subproject commit e57128019bb804ec99ef1d6cebd57f5e6c221a3e
|
||||
Subproject commit 98e2d7e3870759fe91c93ba520452a700fec8756
|
|
@ -1 +1 @@
|
|||
Subproject commit 0a95e429655d51e96de45af91a5ee02fad5a99f6
|
||||
Subproject commit aaa25872d7f6ba5eb4c61651f369d8d06e759d87
|
|
@ -25,6 +25,6 @@ pub struct LayerBufferSet {
|
|||
/// submit them to be drawn to the display.
|
||||
pub trait Compositor {
|
||||
fn begin_drawing(&self, next_dt: comm::Chan<LayerBufferSet>);
|
||||
fn draw(&self, next_dt: comm::Chan<LayerBufferSet>, +draw_me: LayerBufferSet);
|
||||
fn draw(&self, next_dt: comm::Chan<LayerBufferSet>, draw_me: LayerBufferSet);
|
||||
}
|
||||
|
||||
|
|
|
@ -96,10 +96,9 @@ impl FontFamily {
|
|||
}
|
||||
|
||||
fn load_family_variations(@mut self, list: &FontListHandle) {
|
||||
let this : &mut FontFamily = self; // FIXME: borrow checker workaround
|
||||
if this.entries.len() > 0 { return; }
|
||||
if self.entries.len() > 0 { return; }
|
||||
list.load_variations_for_family(self);
|
||||
assert!(this.entries.len() > 0);
|
||||
assert!(self.entries.len() > 0);
|
||||
}
|
||||
|
||||
pub fn find_font_for_style(@mut self, list: &FontListHandle, style: &SpecifiedFontStyle)
|
||||
|
|
|
@ -22,8 +22,8 @@ impl Mul<Au,Au> for Au {
|
|||
fn mul(&self, other: &Au) -> Au { Au(**self * **other) }
|
||||
}
|
||||
|
||||
impl Quot<Au,Au> for Au {
|
||||
fn quot(&self, other: &Au) -> Au { Au(**self / **other) }
|
||||
impl Div<Au,Au> for Au {
|
||||
fn div(&self, other: &Au) -> Au { Au(**self / **other) }
|
||||
}
|
||||
|
||||
impl Rem<Au,Au> for Au {
|
||||
|
|
|
@ -16,7 +16,7 @@ use geometry::Au;
|
|||
use platform::macos::font_context::FontContextHandle;
|
||||
use text::glyph::GlyphIndex;
|
||||
|
||||
use core_foundation::base::{CFIndex, CFWrapper};
|
||||
use core_foundation::base::CFIndex;
|
||||
use core_foundation::data::CFData;
|
||||
use core_foundation::string::UniChar;
|
||||
use core_graphics::data_provider::CGDataProvider;
|
||||
|
@ -106,7 +106,7 @@ impl FontHandleMethods for FontHandle {
|
|||
|
||||
fn boldness(&self) -> CSSFontWeight {
|
||||
// -1.0 to 1.0
|
||||
let normalized = unsafe { self.ctfont.all_traits().normalized_weight() };
|
||||
let normalized = self.ctfont.all_traits().normalized_weight();
|
||||
// 0.0 to 9.0
|
||||
let normalized = (normalized + 1.0) / 2.0 * 9.0;
|
||||
if normalized < 1.0 { return FontWeight100; }
|
||||
|
@ -146,13 +146,11 @@ impl FontHandleMethods for FontHandle {
|
|||
|
||||
fn glyph_h_advance(&self, glyph: GlyphIndex) -> Option<FractionalPixel> {
|
||||
let glyphs = [glyph as CGGlyph];
|
||||
unsafe {
|
||||
let advance = self.ctfont.get_advances_for_glyphs(kCTFontDefaultOrientation,
|
||||
&glyphs[0],
|
||||
ptr::null(),
|
||||
1);
|
||||
return Some(advance as FractionalPixel);
|
||||
}
|
||||
Some(advance as FractionalPixel)
|
||||
}
|
||||
|
||||
fn get_metrics(&self) -> FontMetrics {
|
||||
|
|
|
@ -42,11 +42,9 @@ pub impl FontListHandle {
|
|||
}
|
||||
|
||||
fn load_variations_for_family(&self, family: @mut FontFamily) {
|
||||
let fam: &mut FontFamily = family; // FIXME: borrow checker workaround
|
||||
let family_name = &fam.family_name;
|
||||
debug!("Looking for faces of family: %s", *family_name);
|
||||
debug!("Looking for faces of family: %s", family.family_name);
|
||||
|
||||
let family_collection = core_text::font_collection::create_for_family(*family_name);
|
||||
let family_collection = core_text::font_collection::create_for_family(family.family_name);
|
||||
for family_collection.get_descriptors().each |descref: &CTFontDescriptorRef| {
|
||||
let desc = CFWrapper::wrap_shared(*descref);
|
||||
let font = core_text::font::new_from_descriptor(&desc, 0.0);
|
||||
|
|
|
@ -373,18 +373,11 @@ impl ImageCache {
|
|||
}
|
||||
|
||||
priv fn purge_waiters(&self, url: Url, f: &fn() -> ImageResponseMsg) {
|
||||
match self.wait_map.find(&url) {
|
||||
match self.wait_map.pop(&url) {
|
||||
Some(waiters) => {
|
||||
let waiters = *waiters;
|
||||
let mut new_waiters = ~[];
|
||||
new_waiters <-> *waiters;
|
||||
|
||||
for new_waiters.each |response| {
|
||||
for waiters.each |response| {
|
||||
response.send(f());
|
||||
}
|
||||
|
||||
*waiters <-> new_waiters;
|
||||
self.wait_map.remove(&url);
|
||||
}
|
||||
None => ()
|
||||
}
|
||||
|
@ -410,15 +403,13 @@ impl ImageCache {
|
|||
|
||||
Prefetching(DoDecode) | Decoding => {
|
||||
// We don't have this image yet
|
||||
match self.wait_map.find(&url) {
|
||||
Some(waiters) => {
|
||||
vec::push(*waiters, response);
|
||||
}
|
||||
None => {
|
||||
if self.wait_map.contains_key(&url) {
|
||||
let waiters = self.wait_map.find_mut(&url).unwrap();
|
||||
waiters.push(response);
|
||||
} else {
|
||||
self.wait_map.insert(url, @mut ~[response]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Decoded(image) => {
|
||||
response.send(ImageReady(clone_arc(image)));
|
||||
|
|
|
@ -76,13 +76,10 @@ pub impl LocalImageCache {
|
|||
|
||||
match state.last_response {
|
||||
ImageReady(ref image) => {
|
||||
// FIXME: appease borrowck
|
||||
unsafe {
|
||||
let (port, chan) = comm::stream();
|
||||
chan.send(ImageReady(clone_arc(image)));
|
||||
return port;
|
||||
}
|
||||
}
|
||||
ImageNotReady => {
|
||||
if last_round == self.round_number {
|
||||
let (port, chan) = comm::stream();
|
||||
|
@ -138,18 +135,14 @@ pub impl LocalImageCache {
|
|||
}
|
||||
|
||||
priv fn get_state(&self, url: &Url) -> @mut ImageState {
|
||||
match self.state_map.find(url) {
|
||||
Some(state) => *state,
|
||||
None => {
|
||||
*do self.state_map.find_or_insert_with(url.clone()) |_| {
|
||||
let new_state = @mut ImageState {
|
||||
prefetched: false,
|
||||
decoded: false,
|
||||
last_request_round: 0,
|
||||
last_response: ImageNotReady
|
||||
};
|
||||
self.state_map.insert(copy *url, new_state);
|
||||
self.get_state(url)
|
||||
}
|
||||
new_state
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ Create a URL object from a string. Does various helpful browsery things like
|
|||
*/
|
||||
#[allow(non_implicitly_copyable_typarams)]
|
||||
pub fn make_url(str_url: ~str, current_url: Option<Url>) -> Url {
|
||||
let mut schm = url::get_scheme(str_url);
|
||||
let schm = url::get_scheme(str_url);
|
||||
let str_url = if result::is_err(&schm) {
|
||||
if current_url.is_none() {
|
||||
// Assume we've been given a file path. If it's absolute just return
|
||||
|
|
|
@ -288,7 +288,10 @@ fn Surface(backend: BackendType) -> Surface {
|
|||
/// A function for spawning into the platform's main thread.
|
||||
fn on_osmain<T: Owned>(f: ~fn(po: Port<T>)) -> Chan<T> {
|
||||
let (setup_po, setup_ch) = comm::stream();
|
||||
do task::task().sched_mode(task::PlatformThread).spawn {
|
||||
// FIXME: rust#6399
|
||||
let mut main_task = task::task();
|
||||
main_task.sched_mode(task::PlatformThread);
|
||||
do main_task.spawn {
|
||||
let (po, ch) = comm::stream();
|
||||
setup_ch.send(ch);
|
||||
f(po);
|
||||
|
|
|
@ -65,7 +65,10 @@ pub fn ContentTask(layout_task: LayoutTask,
|
|||
let dom_event_port = Cell(dom_event_port);
|
||||
let dom_event_chan = Cell(dom_event_chan);
|
||||
|
||||
do task().sched_mode(SingleThreaded).spawn {
|
||||
// FIXME: rust#6399
|
||||
let mut the_task = task();
|
||||
the_task.sched_mode(SingleThreaded);
|
||||
do the_task.spawn {
|
||||
let content = Content(layout_task.clone(),
|
||||
control_port.take(),
|
||||
control_chan_copy.clone(),
|
||||
|
@ -150,7 +153,7 @@ pub fn Content(layout_task: LayoutTask,
|
|||
};
|
||||
|
||||
cx.set_cx_private(ptr::to_unsafe_ptr(&*content) as *());
|
||||
unsafe { task::local_data::local_data_set(global_content_key, cast::transmute(content)); }
|
||||
unsafe { local_data::local_data_set(global_content_key, cast::transmute(content)); }
|
||||
|
||||
content
|
||||
}
|
||||
|
@ -159,7 +162,7 @@ fn global_content_key(_: @Content) {}
|
|||
|
||||
pub fn global_content() -> @Content {
|
||||
unsafe {
|
||||
return task::local_data::local_data_get(global_content_key).get();
|
||||
return local_data::local_data_get(global_content_key).get();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,7 +173,7 @@ pub fn task_from_context(cx: *JSContext) -> *mut Content {
|
|||
#[unsafe_destructor]
|
||||
impl Drop for Content {
|
||||
fn finalize(&self) {
|
||||
unsafe { task::local_data::local_data_pop(global_content_key) };
|
||||
unsafe { local_data::local_data_pop(global_content_key) };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,7 +186,7 @@ pub impl Content {
|
|||
}
|
||||
|
||||
fn handle_msg(&mut self) -> bool {
|
||||
match select2i(&self.control_port, &self.event_port) {
|
||||
match select2i(&mut self.control_port, &mut self.event_port) {
|
||||
either::Left(*) => {
|
||||
let msg = self.control_port.recv();
|
||||
self.handle_control_msg(msg)
|
||||
|
|
|
@ -608,8 +608,8 @@ pub fn WrapNewBindingObject(cx: *JSContext, scope: *JSObject,
|
|||
mut value: @mut CacheableWrapper,
|
||||
vp: *mut JSVal) -> bool {
|
||||
unsafe {
|
||||
let mut cache = value.get_wrappercache();
|
||||
let mut obj = cache.get_wrapper();
|
||||
let cache = value.get_wrappercache();
|
||||
let obj = cache.get_wrapper();
|
||||
if obj.is_not_null() /*&& js::GetObjectCompartment(obj) == js::GetObjectCompartment(scope)*/ {
|
||||
*vp = RUST_OBJECT_TO_JSVAL(obj);
|
||||
return true;
|
||||
|
|
|
@ -65,14 +65,12 @@ impl BlockLayout for FlowContext {
|
|||
fn with_block_box(&self, callback: &fn(box: RenderBox) -> ()) -> () {
|
||||
match *self {
|
||||
BlockFlow(*) => {
|
||||
let box = self.block().box;
|
||||
for box.each |&b| {
|
||||
for self.block().box.each |&b| {
|
||||
callback(b);
|
||||
}
|
||||
},
|
||||
RootFlow(*) => {
|
||||
let mut box = self.root().box;
|
||||
for box.each |&b| {
|
||||
for self.root().box.each |&b| {
|
||||
callback(b);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -30,7 +30,7 @@ use servo_net::image::holder::ImageHolder;
|
|||
use servo_net::local_image_cache::LocalImageCache;
|
||||
use servo_util::range::*;
|
||||
use std::arc;
|
||||
use std::cmp::FuzzyEq;
|
||||
use core::cmp::ApproxEq;
|
||||
use std::net::url::Url;
|
||||
|
||||
/// Render boxes (`struct RenderBox`) are the leaves of the layout tree. They cannot position
|
||||
|
@ -168,15 +168,12 @@ pub impl RenderBox {
|
|||
match *self {
|
||||
GenericRenderBoxClass(generic_box) => callback(generic_box),
|
||||
ImageRenderBoxClass(image_box) => {
|
||||
let image_box = &*image_box; // FIXME: Borrow check workaround.
|
||||
callback(&image_box.base)
|
||||
}
|
||||
TextRenderBoxClass(text_box) => {
|
||||
let text_box = &*text_box; // FIXME: Borrow check workaround.
|
||||
callback(&text_box.base)
|
||||
}
|
||||
UnscannedTextRenderBoxClass(unscanned_text_box) => {
|
||||
let unscanned_text_box = &*unscanned_text_box; // FIXME: Borrow check workaround.
|
||||
callback(&unscanned_text_box.base)
|
||||
}
|
||||
}
|
||||
|
@ -188,16 +185,12 @@ pub impl RenderBox {
|
|||
match *self {
|
||||
GenericRenderBoxClass(generic_box) => callback(generic_box),
|
||||
ImageRenderBoxClass(image_box) => {
|
||||
let image_box = &mut *image_box; // FIXME: Borrow check workaround.
|
||||
callback(&mut image_box.base)
|
||||
}
|
||||
TextRenderBoxClass(text_box) => {
|
||||
let text_box = &mut *text_box; // FIXME: Borrow check workaround.
|
||||
callback(&mut text_box.base)
|
||||
}
|
||||
UnscannedTextRenderBoxClass(unscanned_text_box) => {
|
||||
// FIXME: Borrow check workaround.
|
||||
let unscanned_text_box = &mut *unscanned_text_box;
|
||||
callback(&mut unscanned_text_box.base)
|
||||
}
|
||||
}
|
||||
|
@ -238,7 +231,6 @@ pub impl RenderBox {
|
|||
fn is_whitespace_only(&self) -> bool {
|
||||
match *self {
|
||||
UnscannedTextRenderBoxClass(unscanned_text_box) => {
|
||||
let mut unscanned_text_box = &mut *unscanned_text_box; // FIXME: Borrow check.
|
||||
unscanned_text_box.text.is_whitespace()
|
||||
}
|
||||
_ => false
|
||||
|
@ -269,8 +261,6 @@ pub impl RenderBox {
|
|||
}
|
||||
|
||||
TextRenderBoxClass(text_box) => {
|
||||
let text_box = &mut *text_box; // FIXME: Borrow check.
|
||||
|
||||
let mut pieces_processed_count: uint = 0;
|
||||
let mut remaining_width: Au = max_width;
|
||||
let mut left_range = Range::new(text_box.text_data.range.begin(), 0);
|
||||
|
@ -379,7 +369,6 @@ pub impl RenderBox {
|
|||
}
|
||||
|
||||
TextRenderBoxClass(text_box) => {
|
||||
let mut text_box = &mut *text_box; // FIXME: Borrow check.
|
||||
text_box.text_data.run.min_width_for_range(&text_box.text_data.range)
|
||||
}
|
||||
|
||||
|
@ -401,8 +390,6 @@ pub impl RenderBox {
|
|||
}
|
||||
|
||||
TextRenderBoxClass(text_box) => {
|
||||
let mut text_box = &mut *text_box; // FIXME: Borrow check bug.
|
||||
|
||||
// A text box cannot span lines, so assume that this is an unsplit text box.
|
||||
//
|
||||
// TODO: If text boxes have been split to wrap lines, then they could report a
|
||||
|
@ -567,8 +554,6 @@ pub impl RenderBox {
|
|||
match *self {
|
||||
UnscannedTextRenderBoxClass(*) => fail!(~"Shouldn't see unscanned boxes here."),
|
||||
TextRenderBoxClass(text_box) => {
|
||||
let text_box = &mut *text_box; // FIXME: Borrow check bug.
|
||||
|
||||
let nearest_ancestor_element = self.nearest_ancestor_element();
|
||||
let color = nearest_ancestor_element.style().color().to_gfx_color();
|
||||
|
||||
|
@ -650,7 +635,7 @@ pub impl RenderBox {
|
|||
let nearest_ancestor_element = self.nearest_ancestor_element();
|
||||
|
||||
let bgcolor = nearest_ancestor_element.style().background_color();
|
||||
if !bgcolor.alpha.fuzzy_eq(&0.0) {
|
||||
if !bgcolor.alpha.approx_eq(&0.0) {
|
||||
let mut l = list.take(); // FIXME: use with_mut_ref when available
|
||||
l.append_item(~DisplayItem::new_SolidColor(absolute_bounds, bgcolor.to_gfx_color()));
|
||||
list.put_back(l);
|
||||
|
@ -783,13 +768,11 @@ impl DebugMethods for RenderBox {
|
|||
GenericRenderBoxClass(*) => ~"GenericRenderBox",
|
||||
ImageRenderBoxClass(*) => ~"ImageRenderBox",
|
||||
TextRenderBoxClass(text_box) => {
|
||||
let mut text_box = &mut *text_box; // FIXME: Borrow check bug.
|
||||
fmt!("TextRenderBox(text=%s)", str::substr(text_box.text_data.run.text,
|
||||
text_box.text_data.range.begin(),
|
||||
text_box.text_data.range.length()))
|
||||
}
|
||||
UnscannedTextRenderBoxClass(text_box) => {
|
||||
let mut text_box = &mut *text_box; // FIXME: Borrow check bug.
|
||||
fmt!("UnscannedTextRenderBox(%s)", text_box.text)
|
||||
}
|
||||
};
|
||||
|
|
|
@ -125,7 +125,6 @@ impl BoxGenerator {
|
|||
// depending on flow, make a box for this node.
|
||||
match self.flow {
|
||||
InlineFlow(inline) => {
|
||||
let mut inline = &mut *inline;
|
||||
let node_range_start = inline.boxes.len();
|
||||
self.range_stack.push(node_range_start);
|
||||
|
||||
|
@ -387,24 +386,38 @@ pub impl LayoutTreeBuilder {
|
|||
// check first/last child for whitespace-ness
|
||||
for first_child.each |first_flow| {
|
||||
if first_flow.starts_inline_flow() {
|
||||
let boxes = &mut first_flow.inline().boxes;
|
||||
// FIXME: workaround for rust#6393
|
||||
let mut do_remove = false;
|
||||
{
|
||||
let boxes = &first_flow.inline().boxes;
|
||||
if boxes.len() == 1 && boxes[0].is_whitespace_only() {
|
||||
debug!("LayoutTreeBuilder: pruning whitespace-only first child flow \
|
||||
f%d from parent f%d",
|
||||
first_flow.id(),
|
||||
parent_flow.id());
|
||||
do_remove = true;
|
||||
}
|
||||
}
|
||||
if (do_remove) {
|
||||
parent_flow.remove_child(*first_flow);
|
||||
}
|
||||
}
|
||||
}
|
||||
for last_child.each |last_flow| {
|
||||
if last_flow.starts_inline_flow() {
|
||||
let boxes = &mut last_flow.inline().boxes;
|
||||
// FIXME: workaround for rust#6393
|
||||
let mut do_remove = false;
|
||||
{
|
||||
let boxes = &last_flow.inline().boxes;
|
||||
if boxes.len() == 1 && boxes.last().is_whitespace_only() {
|
||||
debug!("LayoutTreeBuilder: pruning whitespace-only last child flow \
|
||||
f%d from parent f%d",
|
||||
last_flow.id(),
|
||||
parent_flow.id());
|
||||
do_remove = true;
|
||||
}
|
||||
}
|
||||
if (do_remove) {
|
||||
parent_flow.remove_child(*last_flow);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,17 +76,14 @@ impl TreeNodeRef<FlowData> for FlowContext {
|
|||
match *self {
|
||||
AbsoluteFlow(info) => callback(info),
|
||||
BlockFlow(info) => {
|
||||
let info = &*info; // FIXME: Borrow check workaround.
|
||||
callback(&info.common)
|
||||
}
|
||||
FloatFlow(info) => callback(info),
|
||||
InlineBlockFlow(info) => callback(info),
|
||||
InlineFlow(info) => {
|
||||
let info = &*info; // FIXME: Borrow check workaround.
|
||||
callback(&info.common)
|
||||
}
|
||||
RootFlow(info) => {
|
||||
let info = &*info; // FIXME: Borrow check workaround.
|
||||
callback(&info.common)
|
||||
}
|
||||
TableFlow(info) => callback(info),
|
||||
|
@ -96,17 +93,14 @@ impl TreeNodeRef<FlowData> for FlowContext {
|
|||
match *self {
|
||||
AbsoluteFlow(info) => callback(info),
|
||||
BlockFlow(info) => {
|
||||
let info = &mut *info; // FIXME: Borrow check workaround.
|
||||
callback(&mut info.common)
|
||||
}
|
||||
FloatFlow(info) => callback(info),
|
||||
InlineBlockFlow(info) => callback(info),
|
||||
InlineFlow(info) => {
|
||||
let info = &mut *info; // FIXME: Borrow check workaround.
|
||||
callback(&mut info.common)
|
||||
}
|
||||
RootFlow(info) => {
|
||||
let info = &mut *info; // FIXME: Borrow check workaround.
|
||||
callback(&mut info.common)
|
||||
}
|
||||
TableFlow(info) => callback(info),
|
||||
|
@ -388,7 +382,6 @@ impl DebugMethods for FlowContext {
|
|||
fn debug_str(&self) -> ~str {
|
||||
let repr = match *self {
|
||||
InlineFlow(inline) => {
|
||||
let inline = &mut *inline;
|
||||
let mut s = inline.boxes.foldl(~"InlineFlow(children=", |s, box| {
|
||||
fmt!("%s b%d", *s, box.id())
|
||||
});
|
||||
|
@ -396,14 +389,12 @@ impl DebugMethods for FlowContext {
|
|||
s
|
||||
},
|
||||
BlockFlow(block) => {
|
||||
let block = &mut *block;
|
||||
match block.box {
|
||||
Some(box) => fmt!("BlockFlow(box=b%d)", box.id()),
|
||||
None => ~"BlockFlow",
|
||||
}
|
||||
},
|
||||
RootFlow(root) => {
|
||||
let root = &mut *root;
|
||||
match root.box {
|
||||
Some(box) => fmt!("RootFlow(box=b%d)", box.id()),
|
||||
None => ~"RootFlow",
|
||||
|
|
|
@ -173,7 +173,7 @@ impl TextRunScanner {
|
|||
|
||||
impl TextRunScanner {
|
||||
fn scan_for_runs(&mut self, ctx: &mut LayoutContext, flow: FlowContext) {
|
||||
let inline = &mut *flow.inline();
|
||||
let inline = flow.inline();
|
||||
assert!(inline.boxes.len() > 0);
|
||||
debug!("TextRunScanner: scanning %u boxes for text runs...", inline.boxes.len());
|
||||
|
||||
|
@ -334,8 +334,7 @@ impl TextRunScanner {
|
|||
debug!("------------------");
|
||||
|
||||
debug!("--- Elem ranges: ---");
|
||||
let elems: &mut ElementMapping = &mut flow.inline().elems;
|
||||
for elems.eachi_mut |i: uint, nr: &NodeRange| {
|
||||
for flow.inline().elems.eachi_mut |i: uint, nr: &NodeRange| {
|
||||
debug!("%u: %? --> %s", i, nr.range, nr.node.debug_str()); ()
|
||||
}
|
||||
debug!("--------------------");
|
||||
|
@ -386,16 +385,17 @@ impl LineboxScanner {
|
|||
pub fn scan_for_lines(&mut self, ctx: &LayoutContext) {
|
||||
self.reset_scanner();
|
||||
|
||||
let boxes = &mut self.flow.inline().boxes;
|
||||
{ // FIXME: manually control borrow length
|
||||
let inline: &InlineFlowData = self.flow.inline();
|
||||
let mut i = 0u;
|
||||
|
||||
loop {
|
||||
// acquire the next box to lay out from work list or box list
|
||||
let cur_box = if self.work_list.is_empty() {
|
||||
if i == boxes.len() {
|
||||
if i == inline.boxes.len() {
|
||||
break
|
||||
}
|
||||
let box = boxes[i]; i += 1;
|
||||
let box = inline.boxes[i]; i += 1;
|
||||
debug!("LineboxScanner: Working with box from box list: b%d", box.id());
|
||||
box
|
||||
} else {
|
||||
|
@ -419,10 +419,12 @@ impl LineboxScanner {
|
|||
self.line_spans.len());
|
||||
self.flush_current_line();
|
||||
}
|
||||
}
|
||||
|
||||
let boxes = &mut self.flow.inline().boxes;
|
||||
let elems = &mut self.flow.inline().elems;
|
||||
elems.repair_for_box_changes(*boxes, self.new_boxes);
|
||||
{ // FIXME: scope the borrow
|
||||
let inline: &mut InlineFlowData = self.flow.inline();
|
||||
inline.elems.repair_for_box_changes(inline.boxes, self.new_boxes);
|
||||
}
|
||||
self.swap_out_results();
|
||||
}
|
||||
|
||||
|
@ -431,10 +433,9 @@ impl LineboxScanner {
|
|||
self.line_spans.len(),
|
||||
self.flow.id());
|
||||
|
||||
let inline_boxes = &mut self.flow.inline().boxes;
|
||||
util::swap(inline_boxes, &mut self.new_boxes);
|
||||
let lines = &mut self.flow.inline().lines;
|
||||
util::swap(lines, &mut self.line_spans);
|
||||
let inline: &mut InlineFlowData = self.flow.inline();
|
||||
util::swap(&mut inline.boxes, &mut self.new_boxes);
|
||||
util::swap(&mut inline.lines, &mut self.line_spans);
|
||||
}
|
||||
|
||||
fn flush_current_line(&mut self) {
|
||||
|
@ -763,7 +764,6 @@ impl InlineFlowData {
|
|||
// TODO: We can use font metrics directly instead of re-measuring for the
|
||||
// bounding box.
|
||||
TextRenderBoxClass(text_box) => {
|
||||
let text_box = &mut *text_box; // FIXME: borrow check workaround
|
||||
let range = &text_box.text_data.range;
|
||||
let run = &text_box.text_data.run;
|
||||
let text_bounds = run.metrics_for_range(range).bounding_box;
|
||||
|
@ -814,7 +814,7 @@ impl InlineFlowData {
|
|||
self.common.position.size.height = cur_y;
|
||||
}
|
||||
|
||||
pub fn build_display_list_inline(&mut self,
|
||||
pub fn build_display_list_inline(&self,
|
||||
builder: &DisplayListBuilder,
|
||||
dirty: &Rect<Au>,
|
||||
offset: &Point2D<Au>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue