mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update for language changes.
This commit is contained in:
parent
76f541f06f
commit
21e8ba6c8a
23 changed files with 50 additions and 47 deletions
2
src/rust
2
src/rust
|
@ -1 +1 @@
|
|||
Subproject commit 783392f70fcfd6770782796bef06bed47043cabf
|
||||
Subproject commit 2b09267b762398a3c851ecfd55d5d01aee906352
|
|
@ -1 +1 @@
|
|||
Subproject commit a8ebe76090dd67f24a9da41404878f5316afbf6a
|
||||
Subproject commit 556c56eac1843120f6ce6c58a2de116b4c214c27
|
|
@ -1 +1 @@
|
|||
Subproject commit 6ce668e09fb378643bb37d1ec5338fa09a8a4d3d
|
||||
Subproject commit edfb494a1a28d9e3e779ee521d2925bc3244664a
|
|
@ -1 +1 @@
|
|||
Subproject commit 5ca8bdfcdbb4c715cd22136f582f2b81df9c7adb
|
||||
Subproject commit a65a9768384d0ef06f47049fb639aab312ee453a
|
|
@ -1 +1 @@
|
|||
Subproject commit 1afc08b508d4980342a715a5d3faef63ac4389c3
|
||||
Subproject commit 6a338951c6a8bf76b235f64f3903da84dac0b705
|
|
@ -34,8 +34,8 @@ pub enum DisplayItem {
|
|||
Border(DisplayItemData, Au, Color)
|
||||
}
|
||||
|
||||
pub impl DisplayItem {
|
||||
fn d(&self) -> &'self DisplayItemData {
|
||||
pub impl<'self> DisplayItem {
|
||||
fn d(&'self self) -> &'self DisplayItemData {
|
||||
match *self {
|
||||
SolidColor(ref d, _) => d,
|
||||
Text(ref d, _, _, _) => d,
|
||||
|
|
|
@ -73,7 +73,7 @@ pub impl<'self> FontContext {
|
|||
}
|
||||
}
|
||||
|
||||
priv fn get_font_list(&self) -> &'self FontList {
|
||||
priv fn get_font_list(&'self self) -> &'self FontList {
|
||||
self.font_list.get_ref()
|
||||
}
|
||||
|
||||
|
|
|
@ -52,15 +52,17 @@ pub fn RenderTask<C:Compositor + Owned>(compositor: C, opts: Opts) -> RenderTask
|
|||
f
|
||||
};
|
||||
|
||||
Renderer {
|
||||
// FIXME: rust/#5967
|
||||
let mut r = Renderer {
|
||||
port: po,
|
||||
compositor: compositor,
|
||||
mut layer_buffer_set_port: Cell(layer_buffer_set_port),
|
||||
layer_buffer_set_port: Cell(layer_buffer_set_port),
|
||||
thread_pool: thread_pool,
|
||||
opts: opts_cell.take()
|
||||
}.start();
|
||||
};
|
||||
r.start();
|
||||
};
|
||||
SharedChan(render_task)
|
||||
SharedChan::new(render_task)
|
||||
}
|
||||
|
||||
/// Data that needs to be kept around for each render thread.
|
||||
|
@ -79,7 +81,7 @@ priv struct Renderer<C> {
|
|||
}
|
||||
|
||||
impl<C: Compositor + Owned> Renderer<C> {
|
||||
fn start(&self) {
|
||||
fn start(&mut self) {
|
||||
debug!("renderer: beginning rendering loop");
|
||||
|
||||
loop {
|
||||
|
@ -93,7 +95,7 @@ impl<C: Compositor + Owned> Renderer<C> {
|
|||
}
|
||||
}
|
||||
|
||||
fn render(&self, render_layer: RenderLayer) {
|
||||
fn render(&mut self, render_layer: RenderLayer) {
|
||||
debug!("renderer: got render request");
|
||||
|
||||
let layer_buffer_set_port = self.layer_buffer_set_port.take();
|
||||
|
|
|
@ -12,7 +12,7 @@ pub fn factory() -> LoaderTask {
|
|||
let f: LoaderTask = |url, progress_chan| {
|
||||
assert!(url.scheme == ~"http");
|
||||
|
||||
let progress_chan = SharedChan(progress_chan);
|
||||
let progress_chan = SharedChan::new(progress_chan);
|
||||
do spawn {
|
||||
debug!("http_loader: requesting via http: %?", url.clone());
|
||||
let mut request = uv_http_request(url.clone());
|
||||
|
|
|
@ -96,7 +96,7 @@ pub fn ImageCacheTask_(resource_task: ResourceTask,
|
|||
let decoder_factory_cell = Cell(decoder_factory);
|
||||
|
||||
let (port, chan) = stream();
|
||||
let chan = SharedChan(chan);
|
||||
let chan = SharedChan::new(chan);
|
||||
let port_cell = Cell(port);
|
||||
let chan_cell = Cell(chan.clone());
|
||||
|
||||
|
@ -140,7 +140,7 @@ fn SyncImageCacheTask(resource_task: ResourceTask) -> ImageCacheTask {
|
|||
}
|
||||
}
|
||||
|
||||
return SharedChan(chan);
|
||||
return SharedChan::new(chan);
|
||||
}
|
||||
|
||||
struct ImageCache {
|
||||
|
|
|
@ -59,7 +59,7 @@ fn create_resource_task_with_loaders(loaders: ~[(~str, LoaderTaskFactory)]) -> R
|
|||
// TODO: change copy to move once we can move out of closures
|
||||
ResourceManager(from_client, loaders_cell.take()).start()
|
||||
};
|
||||
SharedChan(chan)
|
||||
SharedChan::new(chan)
|
||||
}
|
||||
|
||||
pub struct ResourceManager {
|
||||
|
|
|
@ -306,7 +306,7 @@ struct DetailedGlyphStore {
|
|||
lookup_is_sorted: bool,
|
||||
}
|
||||
|
||||
impl DetailedGlyphStore {
|
||||
impl<'self> DetailedGlyphStore {
|
||||
fn new() -> DetailedGlyphStore {
|
||||
DetailedGlyphStore {
|
||||
detail_buffer: ~[], // TODO: default size?
|
||||
|
@ -339,7 +339,7 @@ impl DetailedGlyphStore {
|
|||
self.lookup_is_sorted = false;
|
||||
}
|
||||
|
||||
fn get_detailed_glyphs_for_entry(&self, entry_offset: uint, count: u16)
|
||||
fn get_detailed_glyphs_for_entry(&'self self, entry_offset: uint, count: u16)
|
||||
-> &'self [DetailedGlyph] {
|
||||
debug!("Requesting detailed glyphs[n=%u] for entry[off=%u]", count as uint, entry_offset);
|
||||
|
||||
|
@ -369,7 +369,7 @@ impl DetailedGlyphStore {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_detailed_glyph_with_index(&self,
|
||||
fn get_detailed_glyph_with_index(&'self self,
|
||||
entry_offset: uint,
|
||||
detail_offset: u16)
|
||||
-> &'self DetailedGlyph {
|
||||
|
@ -507,7 +507,7 @@ pub struct GlyphStore {
|
|||
detail_store: DetailedGlyphStore,
|
||||
}
|
||||
|
||||
pub impl GlyphStore {
|
||||
pub impl<'self> GlyphStore {
|
||||
// Initializes the glyph store, but doesn't actually shape anything.
|
||||
// Use the set_glyph, set_glyphs() methods to store glyph data.
|
||||
fn new(length: uint) -> GlyphStore {
|
||||
|
@ -585,7 +585,7 @@ pub impl GlyphStore {
|
|||
self.entry_buffer[i] = entry;
|
||||
}
|
||||
|
||||
fn iter_glyphs_for_char_index(&self,
|
||||
fn iter_glyphs_for_char_index(&'self self,
|
||||
i: uint,
|
||||
cb: &fn(uint, &GlyphInfo<'self>) -> bool)
|
||||
-> bool {
|
||||
|
@ -609,7 +609,8 @@ pub impl GlyphStore {
|
|||
true
|
||||
}
|
||||
|
||||
fn iter_glyphs_for_char_range(&self, range: &Range, cb: &fn(uint, &GlyphInfo<'self>) -> bool) {
|
||||
fn iter_glyphs_for_char_range(&'self self, range: &Range,
|
||||
cb: &fn(uint, &GlyphInfo<'self>) -> bool) {
|
||||
if range.begin() >= self.entry_buffer.len() {
|
||||
error!("iter_glyphs_for_range: range.begin beyond length!");
|
||||
return;
|
||||
|
@ -626,7 +627,7 @@ pub impl GlyphStore {
|
|||
}
|
||||
}
|
||||
|
||||
fn iter_all_glyphs(&self, cb: &fn(uint, &GlyphInfo<'self>) -> bool) {
|
||||
fn iter_all_glyphs(&'self self, cb: &fn(uint, &GlyphInfo<'self>) -> bool) {
|
||||
for uint::range(0, self.entry_buffer.len()) |i| {
|
||||
if !self.iter_glyphs_for_char_index(i, cb) {
|
||||
break;
|
||||
|
|
|
@ -37,7 +37,7 @@ impl SendableTextRun {
|
|||
}
|
||||
}
|
||||
|
||||
pub impl TextRun {
|
||||
pub impl<'self> TextRun {
|
||||
fn new(font: @mut Font, text: ~str) -> TextRun {
|
||||
let mut glyph_store = GlyphStore::new(str::char_len(text));
|
||||
TextRun::compute_potential_breaks(text, &mut glyph_store);
|
||||
|
@ -102,7 +102,7 @@ pub impl TextRun {
|
|||
}
|
||||
|
||||
fn char_len(&self) -> uint { self.glyphs.entry_buffer.len() }
|
||||
fn glyphs(&self) -> &'self GlyphStore { &self.glyphs }
|
||||
fn glyphs(&'self self) -> &'self GlyphStore { &self.glyphs }
|
||||
|
||||
fn range_is_trimmable_whitespace(&self, range: &Range) -> bool {
|
||||
for range.eachi |i| {
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
|
||||
use core::cmp::{Ord, Eq};
|
||||
|
||||
pub trait BinarySearchMethods<T: Ord + Eq> {
|
||||
pub trait BinarySearchMethods<'self, T: Ord + Eq> {
|
||||
fn binary_search(&self, key: &T) -> Option<&'self T>;
|
||||
fn binary_search_index(&self, key: &T) -> Option<uint>;
|
||||
}
|
||||
|
||||
impl<'self, T: Ord + Eq> BinarySearchMethods<T> for &'self [T] {
|
||||
impl<'self, T: Ord + Eq> BinarySearchMethods<'self, T> for &'self [T] {
|
||||
fn binary_search(&self, key: &T) -> Option<&'self T> {
|
||||
match self.binary_search_index(key) {
|
||||
None => None,
|
||||
|
|
|
@ -60,7 +60,7 @@ pub fn ContentTask(layout_task: LayoutTask,
|
|||
-> ContentTask {
|
||||
let (control_port, control_chan) = comm::stream();
|
||||
|
||||
let control_chan = SharedChan(control_chan);
|
||||
let control_chan = SharedChan::new(control_chan);
|
||||
let control_chan_copy = control_chan.clone();
|
||||
let control_port = Cell(control_port);
|
||||
let dom_event_port = Cell(dom_event_port);
|
||||
|
|
|
@ -10,11 +10,11 @@ use newcss::complete::CompleteStyle;
|
|||
|
||||
/// Node mixin providing `style` method that returns a `NodeStyle`
|
||||
pub trait StyledNode {
|
||||
fn style(&self) -> CompleteStyle<'self>;
|
||||
fn style<'a>(&'a self) -> CompleteStyle<'a>;
|
||||
}
|
||||
|
||||
impl StyledNode for AbstractNode {
|
||||
fn style(&self) -> CompleteStyle<'self> {
|
||||
fn style<'a>(&'a self) -> CompleteStyle<'a> {
|
||||
assert!(self.is_element()); // Only elements can have styles
|
||||
let results = self.get_css_select_results();
|
||||
results.computed_style()
|
||||
|
|
|
@ -112,7 +112,7 @@ pub struct HTMLImageElement {
|
|||
// Element methods
|
||||
//
|
||||
|
||||
pub impl Element {
|
||||
pub impl<'self> Element {
|
||||
pub fn new(type_id: ElementTypeId, tag_name: ~str) -> Element {
|
||||
Element {
|
||||
parent: Node::new(ElementNodeTypeId(type_id)),
|
||||
|
@ -121,7 +121,7 @@ pub impl Element {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_attr(&self, name: &str) -> Option<&'self str> {
|
||||
fn get_attr(&'self self, name: &str) -> Option<&'self str> {
|
||||
// FIXME: Need an each() that links lifetimes in Rust.
|
||||
for uint::range(0, self.attrs.len()) |i| {
|
||||
if eq_slice(self.attrs[i].name, name) {
|
||||
|
|
|
@ -211,7 +211,7 @@ pub fn parse_html(url: Url,
|
|||
css_chan: Chan<Option<Stylesheet>>| {
|
||||
css_link_listener(css_chan, css_port, resource_task2.clone());
|
||||
};
|
||||
let css_chan = SharedChan(css_chan);
|
||||
let css_chan = SharedChan::new(css_chan);
|
||||
|
||||
// Spawn a JS parser to receive JavaScript.
|
||||
let resource_task2 = resource_task.clone();
|
||||
|
@ -220,7 +220,7 @@ pub fn parse_html(url: Url,
|
|||
js_chan: Chan<JSResult>| {
|
||||
js_script_listener(js_chan, js_port, resource_task2.clone());
|
||||
};
|
||||
let js_chan = SharedChan(js_chan);
|
||||
let js_chan = SharedChan::new(js_chan);
|
||||
|
||||
let url2 = url.clone(), url3 = url.clone();
|
||||
|
||||
|
|
|
@ -113,8 +113,8 @@ pub fn RenderBoxData(node: AbstractNode, ctx: @mut FlowContext, id: int) -> Rend
|
|||
}
|
||||
}
|
||||
|
||||
impl RenderBox {
|
||||
fn d(&mut self) -> &'self mut RenderBoxData {
|
||||
impl<'self> RenderBox {
|
||||
fn d(&'self mut self) -> &'self mut RenderBoxData {
|
||||
unsafe {
|
||||
//Rust #5074 - we can't take mutable references to the
|
||||
// data that needs to be returned right now.
|
||||
|
@ -351,7 +351,7 @@ impl RenderBox {
|
|||
self.content_box()
|
||||
}
|
||||
|
||||
fn style(&mut self) -> CompleteStyle<'self> {
|
||||
fn style(&'self mut self) -> CompleteStyle<'self> {
|
||||
let d: &'self mut RenderBoxData = self.d();
|
||||
d.node.style()
|
||||
}
|
||||
|
|
|
@ -96,8 +96,8 @@ pub fn FlowData(id: int) -> FlowData {
|
|||
}
|
||||
}
|
||||
|
||||
pub impl FlowContext {
|
||||
fn d(&mut self) -> &'self mut FlowData {
|
||||
pub impl<'self> FlowContext {
|
||||
fn d(&'self mut self) -> &'self mut FlowData {
|
||||
unsafe {
|
||||
match *self {
|
||||
AbsoluteFlow(ref d) => cast::transmute(d),
|
||||
|
@ -111,21 +111,21 @@ pub impl FlowContext {
|
|||
}
|
||||
}
|
||||
|
||||
fn inline(&mut self) -> &'self mut InlineFlowData {
|
||||
fn inline(&'self mut self) -> &'self mut InlineFlowData {
|
||||
match self {
|
||||
&InlineFlow(_, ref i) => unsafe { cast::transmute(i) },
|
||||
_ => fail!(fmt!("Tried to access inline data of non-inline: f%d", self.d().id))
|
||||
}
|
||||
}
|
||||
|
||||
fn block(&mut self) -> &'self mut BlockFlowData {
|
||||
fn block(&'self mut self) -> &'self mut BlockFlowData {
|
||||
match self {
|
||||
&BlockFlow(_, ref mut b) => unsafe { cast::transmute(b) },
|
||||
_ => fail!(fmt!("Tried to access block data of non-block: f%d", self.d().id))
|
||||
}
|
||||
}
|
||||
|
||||
fn root(&mut self) -> &'self mut RootFlowData {
|
||||
fn root(&'self mut self) -> &'self mut RootFlowData {
|
||||
match self {
|
||||
&RootFlow(_, ref r) => unsafe { cast::transmute(r) },
|
||||
_ => fail!(fmt!("Tried to access root data of non-root: f%d", self.d().id))
|
||||
|
|
|
@ -86,7 +86,7 @@ pub struct BuildData {
|
|||
pub fn LayoutTask(render_task: RenderTask,
|
||||
img_cache_task: ImageCacheTask,
|
||||
opts: Opts) -> LayoutTask {
|
||||
SharedChan(spawn_listener::<Msg>(|from_content| {
|
||||
SharedChan::new(spawn_listener::<Msg>(|from_content| {
|
||||
let mut layout = Layout(render_task.clone(), img_cache_task.clone(), from_content, &opts);
|
||||
layout.start();
|
||||
}))
|
||||
|
|
|
@ -56,7 +56,7 @@ pub enum Msg {
|
|||
pub fn OSMain(dom_event_chan: comm::SharedChan<Event>, opts: Opts) -> OSMain {
|
||||
let dom_event_chan = Cell(dom_event_chan);
|
||||
OSMain {
|
||||
chan: SharedChan(on_osmain::<Msg>(|po| {
|
||||
chan: SharedChan::new(on_osmain::<Msg>(|po| {
|
||||
let po = Cell(po);
|
||||
do platform::runmain {
|
||||
debug!("preparing to enter main loop");
|
||||
|
|
|
@ -135,7 +135,7 @@ fn run(opts: &Opts) {
|
|||
|
||||
fn run_pipeline_screen(opts: &Opts) {
|
||||
let (dom_event_port, dom_event_chan) = comm::stream();
|
||||
let dom_event_chan = comm::SharedChan(dom_event_chan);
|
||||
let dom_event_chan = comm::SharedChan::new(dom_event_chan);
|
||||
|
||||
// The platform event handler thread
|
||||
let osmain = OSMain(dom_event_chan.clone(), copy *opts);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue