diff options
author | Keegan McAllister <kmcallister@mozilla.com> | 2013-08-12 11:03:07 -0700 |
---|---|---|
committer | Keegan McAllister <kmcallister@mozilla.com> | 2013-08-15 13:56:29 -0700 |
commit | a2d9810b698f0fb70698ff97c113178becec1374 (patch) | |
tree | e6e9d53e4aa453a4bfa8a32849dbe33b87dafd29 /src | |
parent | ef50acfa899789c5d581084fb475c047d7ee7706 (diff) | |
download | servo-a2d9810b698f0fb70698ff97c113178becec1374.tar.gz servo-a2d9810b698f0fb70698ff97c113178becec1374.zip |
Update Rust version again
This gets us the new runtime.
Diffstat (limited to 'src')
49 files changed, 114 insertions, 114 deletions
diff --git a/src/compiler/rust b/src/compiler/rust -Subproject 29ffbbaaa850d3f8fe1b35e3a63defe9206a3eb +Subproject 0a677bcf6e359f6f013a7e580ef467b5f389e5b diff --git a/src/components/gfx/display_list.rs b/src/components/gfx/display_list.rs index 71203470c5d..8a5bb04d7a4 100644 --- a/src/components/gfx/display_list.rs +++ b/src/components/gfx/display_list.rs @@ -156,7 +156,7 @@ impl<E> DisplayItem<E> { } } - fn base<'a>(&'a self) -> &'a BaseDisplayItem<E> { + pub fn base<'a>(&'a self) -> &'a BaseDisplayItem<E> { // FIXME(tkuehn): Workaround for Rust region bug. unsafe { match *self { @@ -168,7 +168,7 @@ impl<E> DisplayItem<E> { } } - fn bounds(&self) -> Rect<Au> { + pub fn bounds(&self) -> Rect<Au> { self.base().bounds } } diff --git a/src/components/gfx/font.rs b/src/components/gfx/font.rs index bfb61781323..c8b2680dbfb 100644 --- a/src/components/gfx/font.rs +++ b/src/components/gfx/font.rs @@ -57,12 +57,12 @@ pub type FractionalPixel = float; pub type FontTableTag = u32; -trait FontTableTagConversions { - pub fn tag_to_str(&self) -> ~str; +pub trait FontTableTagConversions { + fn tag_to_str(&self) -> ~str; } impl FontTableTagConversions for FontTableTag { - pub fn tag_to_str(&self) -> ~str { + fn tag_to_str(&self) -> ~str { unsafe { let reversed = str::raw::from_buf_len(cast::transmute(self), 4); return str::from_chars([reversed.char_at(3), @@ -301,7 +301,7 @@ impl Font { return Ok(Font::new_from_adopted_handle(fctx, styled_handle, style, backend, profiler_chan)); } - priv fn get_shaper(@mut self) -> @Shaper { + fn get_shaper(@mut self) -> @Shaper { // fast path: already created a shaper match self.shaper { Some(shaper) => { return shaper; }, @@ -332,7 +332,7 @@ impl Font { // TODO: this should return a borrowed pointer, but I can't figure // out why borrowck doesn't like my implementation. - priv fn get_azure_font(&mut self) -> AzScaledFontRef { + fn get_azure_font(&mut self) -> AzScaledFontRef { // fast path: we've already created the azure font resource match self.azure_font { Some(ref azfont) => return azfont.get_ref(), @@ -346,14 +346,14 @@ impl Font { } #[cfg(target_os="macos")] - priv fn create_azure_font(&mut self) -> ScaledFont { + fn create_azure_font(&mut self) -> ScaledFont { let cg_font = self.handle.get_CGFont(); let size = self.style.pt_size as AzFloat; ScaledFont::new(self.backend, &cg_font, size) } #[cfg(target_os="linux")] - priv fn create_azure_font(&self) -> ScaledFont { + fn create_azure_font(&self) -> ScaledFont { let freetype_font = self.handle.face; let size = self.style.pt_size as AzFloat; ScaledFont::new(self.backend, freetype_font, size) @@ -392,7 +392,7 @@ impl Font { for (glyphs, _offset, slice_range) in run.iter_slices_for_range(range) { for (_i, glyph) in glyphs.iter_glyphs_for_char_range(&slice_range) { - let glyph_advance = glyph.advance_(); + let glyph_advance = glyph.advance(); let glyph_offset = glyph.offset().unwrap_or_default(Au::zero_point()); let azglyph = struct__AzGlyph { @@ -432,7 +432,7 @@ impl Font { let mut advance = Au(0); for (glyphs, _offset, slice_range) in run.iter_slices_for_range(range) { for (_i, glyph) in glyphs.iter_glyphs_for_char_range(&slice_range) { - advance = advance + glyph.advance_(); + advance = advance + glyph.advance(); } } RunMetrics::new(advance, self.metrics.ascent, self.metrics.descent) @@ -444,7 +444,7 @@ impl Font { -> RunMetrics { let mut advance = Au(0); for (_i, glyph) in glyphs.iter_glyphs_for_char_range(slice_range) { - advance = advance + glyph.advance_(); + advance = advance + glyph.advance(); } RunMetrics::new(advance, self.metrics.ascent, self.metrics.descent) } diff --git a/src/components/gfx/font_context.rs b/src/components/gfx/font_context.rs index 45b2a4b28c1..a9d71cf1aa7 100644 --- a/src/components/gfx/font_context.rs +++ b/src/components/gfx/font_context.rs @@ -72,7 +72,7 @@ impl<'self> FontContext { } } - priv fn get_font_list(&'self self) -> &'self FontList { + fn get_font_list(&'self self) -> &'self FontList { self.font_list.get_ref() } @@ -110,7 +110,7 @@ impl<'self> FontContext { } } - priv fn transform_family(&self, family: &str) -> ~str { + fn transform_family(&self, family: &str) -> ~str { // FIXME: Need a find_like() in HashMap. let family = family.to_str(); debug!("(transform family) searching for `%s`", family); @@ -120,7 +120,7 @@ impl<'self> FontContext { } } - priv fn create_font_group(&mut self, style: &SpecifiedFontStyle) -> @FontGroup { + fn create_font_group(&mut self, style: &SpecifiedFontStyle) -> @FontGroup { let mut fonts = ~[]; debug!("(create font group) --- starting ---"); @@ -182,7 +182,7 @@ impl<'self> FontContext { @FontGroup::new(style.families.to_managed(), &used_style, fonts) } - priv fn create_font_instance(&self, desc: &FontDescriptor) -> Result<@mut Font, ()> { + fn create_font_instance(&self, desc: &FontDescriptor) -> Result<@mut Font, ()> { return match &desc.selector { // TODO(Issue #174): implement by-platform-name font selectors. &SelectorPlatformIdentifier(ref identifier) => { diff --git a/src/components/gfx/font_list.rs b/src/components/gfx/font_list.rs index 42b35c9b996..f96558a1b4c 100644 --- a/src/components/gfx/font_list.rs +++ b/src/components/gfx/font_list.rs @@ -42,7 +42,7 @@ impl FontList { list } - priv fn refresh(&mut self, _: &FontContextHandle) { + fn refresh(&mut self, _: &FontContextHandle) { // TODO(Issue #186): don't refresh unless something actually // changed. Does OSX have a notification for this event? // @@ -76,7 +76,7 @@ impl FontList { result } - priv fn find_family(&self, family_name: &str) -> Option<@mut FontFamily> { + fn find_family(&self, family_name: &str) -> Option<@mut FontFamily> { // look up canonical name let family = self.family_map.find_equiv(&family_name); diff --git a/src/components/gfx/gfx.rc b/src/components/gfx/gfx.rc index 85cb38b47c5..4b86374cd9a 100644 --- a/src/components/gfx/gfx.rc +++ b/src/components/gfx/gfx.rc @@ -35,7 +35,7 @@ pub use gfx_font_list = font_list; pub use servo_gfx_font = font; pub use servo_gfx_font_list = font_list; -priv mod render_context; +mod render_context; // Rendering pub mod color; diff --git a/src/components/gfx/platform/linux/font.rs b/src/components/gfx/platform/linux/font.rs index 57a36e6faed..aff744cae2d 100644 --- a/src/components/gfx/platform/linux/font.rs +++ b/src/components/gfx/platform/linux/font.rs @@ -73,7 +73,7 @@ impl Drop for FontHandle { } impl FontHandleMethods for FontHandle { - pub fn new_from_buffer(fctx: &FontContextHandle, + fn new_from_buffer(fctx: &FontContextHandle, buf: ~[u8], style: &SpecifiedFontStyle) -> Result<FontHandle, ()> { @@ -178,7 +178,7 @@ impl FontHandleMethods for FontHandle { } } - pub fn glyph_index(&self, + fn glyph_index(&self, codepoint: char) -> Option<GlyphIndex> { assert!(self.face.is_not_null()); unsafe { @@ -192,7 +192,7 @@ impl FontHandleMethods for FontHandle { } } - pub fn glyph_h_advance(&self, + fn glyph_h_advance(&self, glyph: GlyphIndex) -> Option<FractionalPixel> { assert!(self.face.is_not_null()); unsafe { @@ -213,7 +213,7 @@ impl FontHandleMethods for FontHandle { } } - pub fn get_metrics(&self) -> FontMetrics { + fn get_metrics(&self) -> FontMetrics { /* TODO(Issue #76): complete me */ let face = self.get_face_rec(); @@ -242,7 +242,7 @@ impl FontHandleMethods for FontHandle { } impl<'self> FontHandle { - priv fn set_char_size(face: FT_Face, pt_size: float) -> Result<(), ()>{ + fn set_char_size(face: FT_Face, pt_size: float) -> Result<(), ()>{ let char_width = float_to_fixed_ft(pt_size) as FT_F26Dot6; let char_height = float_to_fixed_ft(pt_size) as FT_F26Dot6; let h_dpi = 72; @@ -262,7 +262,7 @@ impl<'self> FontHandle { let mut face: FT_Face = ptr::null(); let face_index = 0 as FT_Long; - do file.as_c_str |file_str| { + do file.to_c_str().with_ref |file_str| { FT_New_Face(ft_ctx, file_str, face_index, ptr::to_mut_unsafe_ptr(&mut face)); } @@ -289,7 +289,7 @@ impl<'self> FontHandle { let mut face: FT_Face = ptr::null(); let face_index = 0 as FT_Long; - do file.as_c_str |file_str| { + do file.to_c_str().with_ref |file_str| { FT_New_Face(ft_ctx, file_str, face_index, ptr::to_mut_unsafe_ptr(&mut face)); } @@ -305,13 +305,13 @@ impl<'self> FontHandle { } } - priv fn get_face_rec(&'self self) -> &'self FT_FaceRec { + fn get_face_rec(&'self self) -> &'self FT_FaceRec { unsafe { &(*self.face) } } - priv fn font_units_to_au(&self, value: float) -> Au { + fn font_units_to_au(&self, value: float) -> Au { let face = self.get_face_rec(); // face.size is a *c_void in the bindings, presumably to avoid diff --git a/src/components/gfx/platform/linux/font_list.rs b/src/components/gfx/platform/linux/font_list.rs index 27630db43aa..5af148d0626 100644 --- a/src/components/gfx/platform/linux/font_list.rs +++ b/src/components/gfx/platform/linux/font_list.rs @@ -26,7 +26,7 @@ use platform::font_context::FontContextHandle; use std::hashmap::HashMap; use std::libc; -use std::libc::c_int; +use std::libc::{c_int, c_char}; use std::ptr; use std::str; @@ -48,9 +48,9 @@ impl FontListHandle { let font = (*fontSet).fonts.offset(i); let family: *FcChar8 = ptr::null(); let mut v: c_int = 0; - do "family".as_c_str |FC_FAMILY| { + do "family".to_c_str().with_ref |FC_FAMILY| { while FcPatternGetString(*font, FC_FAMILY, v, &family) == FcResultMatch { - let family_name = str::raw::from_buf(family as *u8); + let family_name = str::raw::from_c_str(family as *c_char); debug!("Creating new FontFamily for family: %s", family_name); let new_family = @mut FontFamily::new(family_name); family_map.insert(family_name, new_family); @@ -70,8 +70,8 @@ impl FontListHandle { let font_set_array_ptr = ptr::to_unsafe_ptr(&font_set); let pattern = FcPatternCreate(); assert!(pattern.is_not_null()); - do "family".as_c_str |FC_FAMILY| { - do family.family_name.as_c_str |family_name| { + do "family".to_c_str().with_ref |FC_FAMILY| { + do family.family_name.to_c_str().with_ref |family_name| { let ok = FcPatternAddString(pattern, FC_FAMILY, family_name as *FcChar8); assert!(ok != 0); } @@ -80,10 +80,10 @@ impl FontListHandle { let object_set = FcObjectSetCreate(); assert!(object_set.is_not_null()); - do "file".as_c_str |FC_FILE| { + do "file".to_c_str().with_ref |FC_FILE| { FcObjectSetAdd(object_set, FC_FILE); } - do "index".as_c_str |FC_INDEX| { + do "index".to_c_str().with_ref |FC_INDEX| { FcObjectSetAdd(object_set, FC_INDEX); } @@ -93,7 +93,7 @@ impl FontListHandle { for i in range(0, (*matches).nfont as int) { let font = (*matches).fonts.offset(i); - let file = do "file".as_c_str |FC_FILE| { + let file = do "file".to_c_str().with_ref |FC_FILE| { let file: *FcChar8 = ptr::null(); if FcPatternGetString(*font, FC_FILE, 0, &file) == FcResultMatch { str::raw::from_c_str(file as *libc::c_char) @@ -101,7 +101,7 @@ impl FontListHandle { fail!(); } }; - let index = do "index".as_c_str |FC_INDEX| { + let index = do "index".to_c_str().with_ref |FC_INDEX| { let index: libc::c_int = 0; if FcPatternGetInteger(*font, FC_INDEX, 0, &index) == FcResultMatch { index @@ -150,8 +150,8 @@ pub fn path_from_identifier(name: ~str, style: &UsedFontStyle) -> Result<~str, ( let config = FcConfigGetCurrent(); let wrapper = AutoPattern { pattern: FcPatternCreate() }; let pattern = wrapper.pattern; - let res = do "family".as_c_str |FC_FAMILY| { - do name.as_c_str |family| { + let res = do "family".to_c_str().with_ref |FC_FAMILY| { + do name.to_c_str().with_ref |family| { FcPatternAddString(pattern, FC_FAMILY, family as *FcChar8) } }; @@ -161,7 +161,7 @@ pub fn path_from_identifier(name: ~str, style: &UsedFontStyle) -> Result<~str, ( } if style.italic { - let res = do "slant".as_c_str |FC_SLANT| { + let res = do "slant".to_c_str().with_ref |FC_SLANT| { FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC) }; if res != 1 { @@ -170,7 +170,7 @@ pub fn path_from_identifier(name: ~str, style: &UsedFontStyle) -> Result<~str, ( } } if style.weight.is_bold() { - let res = do "weight".as_c_str |FC_WEIGHT| { + let res = do "weight".to_c_str().with_ref |FC_WEIGHT| { FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD) }; if res != 1 { @@ -193,13 +193,13 @@ pub fn path_from_identifier(name: ~str, style: &UsedFontStyle) -> Result<~str, ( } let file: *FcChar8 = ptr::null(); - let res = do "file".as_c_str |FC_FILE| { + let res = do "file".to_c_str().with_ref |FC_FILE| { FcPatternGetString(result_pattern, FC_FILE, 0, &file) }; if res != FcResultMatch { debug!("getting filename for font failed"); return Err(()); } - Ok(str::raw::from_buf(file as *u8)) + Ok(str::raw::from_c_str(file as *c_char)) } } diff --git a/src/components/gfx/render_task.rs b/src/components/gfx/render_task.rs index b4574b82a8e..6ddbb19df64 100644 --- a/src/components/gfx/render_task.rs +++ b/src/components/gfx/render_task.rs @@ -71,7 +71,7 @@ impl RenderChan { } } -priv struct RenderTask<C> { +struct RenderTask<C> { id: PipelineId, port: Port<Msg>, compositor: C, diff --git a/src/components/gfx/text/glyph.rs b/src/components/gfx/text/glyph.rs index e45201f67a3..d5e7bcd8ebb 100644 --- a/src/components/gfx/text/glyph.rs +++ b/src/components/gfx/text/glyph.rs @@ -461,7 +461,7 @@ enum GlyphInfo<'self> { } impl<'self> GlyphInfo<'self> { - fn index(self) -> GlyphIndex { + pub fn index(self) -> GlyphIndex { match self { SimpleGlyphInfo(store, entry_i) => store.entry_buffer[entry_i].index(), DetailGlyphInfo(store, entry_i, detail_j) => { @@ -472,7 +472,7 @@ impl<'self> GlyphInfo<'self> { #[inline(always)] // FIXME: Resolution conflicts with IteratorUtil trait so adding trailing _ - fn advance_(self) -> Au { + pub fn advance(self) -> Au { match self { SimpleGlyphInfo(store, entry_i) => store.entry_buffer[entry_i].advance(), DetailGlyphInfo(store, entry_i, detail_j) => { @@ -481,7 +481,7 @@ impl<'self> GlyphInfo<'self> { } } - fn offset(self) -> Option<Point2D<Au>> { + pub fn offset(self) -> Option<Point2D<Au>> { match self { SimpleGlyphInfo(_, _) => None, DetailGlyphInfo(store, entry_i, detail_j) => { @@ -490,14 +490,14 @@ impl<'self> GlyphInfo<'self> { } } - fn is_ligature_start(self) -> bool { + pub fn is_ligature_start(self) -> bool { match self { SimpleGlyphInfo(store, entry_i) => store.entry_buffer[entry_i].is_ligature_start(), DetailGlyphInfo(store, entry_i, _) => store.entry_buffer[entry_i].is_ligature_start() } } - fn is_cluster_start(self) -> bool { + pub fn is_cluster_start(self) -> bool { match self { SimpleGlyphInfo(store, entry_i) => store.entry_buffer[entry_i].is_cluster_start(), DetailGlyphInfo(store, entry_i, _) => store.entry_buffer[entry_i].is_cluster_start() diff --git a/src/components/main/compositing/compositor_layer.rs b/src/components/main/compositing/compositor_layer.rs index 0c0198cb503..c846e58a175 100644 --- a/src/components/main/compositing/compositor_layer.rs +++ b/src/components/main/compositing/compositor_layer.rs @@ -197,7 +197,7 @@ impl CompositorLayer { } }; self.children.mut_iter().filter(|x| !x.child.hidden) - .transform(transform) + .map(transform) .fold(false, |a, b| a || b) || redisplay } @@ -219,7 +219,7 @@ impl CompositorLayer { } // ID does not match any of our immediate children, so recurse on descendents (including hidden children) - self.children.mut_iter().transform(|x| &mut x.child).any(|x| x.set_clipping_rect(pipeline_id, new_rect)) + self.children.mut_iter().map(|x| &mut x.child).any(|x| x.set_clipping_rect(pipeline_id, new_rect)) } @@ -349,7 +349,7 @@ impl CompositorLayer { return true; } // ID does not match ours, so recurse on descendents (including hidden children). - self.children.mut_iter().transform(|x| &mut x.child).any(|x| x.add_buffers(pipeline_id, new_buffers)) + self.children.mut_iter().map(|x| &mut x.child).any(|x| x.add_buffers(pipeline_id, new_buffers)) } // Deletes a specified sublayer, including hidden children. Returns false if the layer is not found. @@ -362,7 +362,7 @@ impl CompositorLayer { true } None => { - self.children.mut_iter().transform(|x| &mut x.child).any(|x| x.delete(pipeline_id)) + self.children.mut_iter().map(|x| &mut x.child).any(|x| x.delete(pipeline_id)) } } } diff --git a/src/components/main/compositing/quadtree.rs b/src/components/main/compositing/quadtree.rs index b7a941a99a9..d58f568694d 100644 --- a/src/components/main/compositing/quadtree.rs +++ b/src/components/main/compositing/quadtree.rs @@ -47,7 +47,7 @@ struct QuadtreeNode<T> { tile_mem: uint, } -priv enum Quadrant { +enum Quadrant { TL = 0, TR = 1, BL = 2, diff --git a/src/components/main/constellation.rs b/src/components/main/constellation.rs index e64197a7b51..32da23206b0 100644 --- a/src/components/main/constellation.rs +++ b/src/components/main/constellation.rs @@ -49,7 +49,7 @@ struct FrameTree { // Need to clone the FrameTrees, but _not_ the Pipelines impl Clone for FrameTree { fn clone(&self) -> FrameTree { - let mut children = do self.children.iter().transform |&frame_tree| { + let mut children = do self.children.iter().map |&frame_tree| { @mut (*frame_tree).clone() }; FrameTree { @@ -113,7 +113,7 @@ impl FrameTree { fn to_sendable(&self) -> SendableFrameTree { let sendable_frame_tree = SendableFrameTree { pipeline: (*self.pipeline).clone(), - children: self.children.iter().transform(|frame_tree| frame_tree.to_sendable()).collect(), + children: self.children.iter().map(|frame_tree| frame_tree.to_sendable()).collect(), }; sendable_frame_tree } @@ -202,7 +202,7 @@ impl NavigationContext { let from_prev = do self.previous.iter().filter_map |frame_tree| { frame_tree.find_mut(pipeline_id) }; - from_prev.chain_(from_current).chain_(from_next).collect() + from_prev.chain(from_current).chain(from_next).collect() } pub fn contains(&mut self, pipeline_id: PipelineId) -> bool { @@ -210,7 +210,7 @@ impl NavigationContext { let from_next = self.next.iter(); let from_prev = self.previous.iter(); - let mut all_contained = from_prev.chain_(from_current).chain_(from_next); + let mut all_contained = from_prev.chain(from_current).chain(from_next); do all_contained.any |frame_tree| { frame_tree.contains(pipeline_id) } @@ -337,7 +337,7 @@ impl Constellation { let matching_pending_frames = do self.pending_frames.iter().filter_map |frame_change| { frame_change.after.find_mut(source_pipeline_id) }; - matching_navi_frames.consume_iter().chain_(matching_pending_frames).collect() + matching_navi_frames.move_iter().chain(matching_pending_frames).collect() }; if frame_trees.is_empty() { diff --git a/src/components/main/layout/aux.rs b/src/components/main/layout/aux.rs index 1f4c063dcce..f49d73de913 100644 --- a/src/components/main/layout/aux.rs +++ b/src/components/main/layout/aux.rs @@ -37,7 +37,7 @@ impl LayoutData { /// Functionality useful for querying the layout-specific data on DOM nodes. pub trait LayoutAuxMethods { fn layout_data(self) -> @mut LayoutData; - pub fn has_layout_data(self) -> bool; + fn has_layout_data(self) -> bool; fn set_layout_data(self, data: @mut LayoutData); fn initialize_layout_data(self) -> Option<@mut LayoutData>; @@ -45,17 +45,17 @@ pub trait LayoutAuxMethods { } impl LayoutAuxMethods for AbstractNode<LayoutView> { - pub fn layout_data(self) -> @mut LayoutData { + fn layout_data(self) -> @mut LayoutData { unsafe { self.unsafe_layout_data() } } - pub fn has_layout_data(self) -> bool { + fn has_layout_data(self) -> bool { unsafe { self.unsafe_has_layout_data() } } - pub fn set_layout_data(self, data: @mut LayoutData) { + fn set_layout_data(self, data: @mut LayoutData) { unsafe { self.unsafe_set_layout_data(data) } diff --git a/src/components/main/layout/block.rs b/src/components/main/layout/block.rs index 34d9f423c98..b30794a0343 100644 --- a/src/components/main/layout/block.rs +++ b/src/components/main/layout/block.rs @@ -124,7 +124,7 @@ impl BlockFlowData { /// Computes left and right margins and width based on CSS 2.1 secion 10.3.3. /// Requires borders and padding to already be computed - priv fn compute_horiz( &self, + fn compute_horiz( &self, width: MaybeAuto, left_margin: MaybeAuto, right_margin: MaybeAuto, diff --git a/src/components/main/layout/box.rs b/src/components/main/layout/box.rs index 56f6e04627c..ac37c30d9a8 100644 --- a/src/components/main/layout/box.rs +++ b/src/components/main/layout/box.rs @@ -383,7 +383,7 @@ impl RenderBox { // // TODO(eatkinson): integrate with // get_min_width and get_pref_width? - priv fn guess_width (&self) -> Au { + fn guess_width (&self) -> Au { do self.with_base |base| { if(!base.node.is_element()) { Au(0) @@ -820,7 +820,7 @@ impl RenderBox { self.nearest_ancestor_element().style().text_align() } - fn line_height(&self) -> CSSLineHeight { + pub fn line_height(&self) -> CSSLineHeight { self.nearest_ancestor_element().style().line_height() } diff --git a/src/components/main/layout/box_builder.rs b/src/components/main/layout/box_builder.rs index d7674ae696c..3e7cd563206 100644 --- a/src/components/main/layout/box_builder.rs +++ b/src/components/main/layout/box_builder.rs @@ -60,7 +60,7 @@ enum InlineSpacerSide { LogicalAfter, } -priv fn simulate_UA_display_rules(node: AbstractNode<LayoutView>) -> CSSDisplay { +fn simulate_UA_display_rules(node: AbstractNode<LayoutView>) -> CSSDisplay { // FIXME /*let resolved = do node.aux |nd| { match nd.style.display_type { diff --git a/src/components/main/layout/flow.rs b/src/components/main/layout/flow.rs index 0d3545b1f62..83edbfa61ba 100644 --- a/src/components/main/layout/flow.rs +++ b/src/components/main/layout/flow.rs @@ -83,7 +83,7 @@ impl FlowContext { // // FIXME: Unify this with traverse_preorder_prune, which takes a separate // 'prune' function. - fn partially_traverse_preorder(&self, callback: &fn(FlowContext) -> bool) { + pub fn partially_traverse_preorder(&self, callback: &fn(FlowContext) -> bool) { if !callback((*self).clone()) { return; } @@ -94,7 +94,7 @@ impl FlowContext { } } - fn traverse_bu_sub_inorder (&self, callback: &fn(FlowContext)) { + pub fn traverse_bu_sub_inorder (&self, callback: &fn(FlowContext)) { for kid in self.children() { // FIXME: Work around rust#2202. We should be able to pass the callback directly. kid.traverse_bu_sub_inorder(|a| callback(a)); diff --git a/src/components/main/platform/common/glfw_windowing.rs b/src/components/main/platform/common/glfw_windowing.rs index 327d7423540..b589258f88c 100644 --- a/src/components/main/platform/common/glfw_windowing.rs +++ b/src/components/main/platform/common/glfw_windowing.rs @@ -25,7 +25,7 @@ static THROBBER: [char, ..8] = [ '⣾', '⣽', '⣻', '⢿', '⡿', '⣟', '⣯' pub struct Application; impl ApplicationMethods for Application { - pub fn new() -> Application { + fn new() -> Application { glfw::init(); Application } diff --git a/src/components/main/servo.rc b/src/components/main/servo.rc index 53e6e2fd917..d3c898486fc 100755 --- a/src/components/main/servo.rc +++ b/src/components/main/servo.rc @@ -56,8 +56,8 @@ pub mod compositing; pub mod macros; pub mod css { - priv mod select_handler; - priv mod node_util; + mod select_handler; + mod node_util; pub mod select; pub mod matching; diff --git a/src/components/main/windowing.rs b/src/components/main/windowing.rs index f4fbca5d58c..dcf94615831 100644 --- a/src/components/main/windowing.rs +++ b/src/components/main/windowing.rs @@ -51,21 +51,21 @@ pub trait ApplicationMethods { pub trait WindowMethods<A> { /// Creates a new window. - pub fn new(app: &A) -> @mut Self; + fn new(app: &A) -> @mut Self; /// Returns the size of the window. - pub fn size(&self) -> Size2D<f32>; + fn size(&self) -> Size2D<f32>; /// Presents the window to the screen (perhaps by page flipping). - pub fn present(&mut self); + fn present(&mut self); /// Spins the event loop and returns the next event. - pub fn recv(@mut self) -> WindowEvent; + fn recv(@mut self) -> WindowEvent; /// Sets the ready state of the current page. - pub fn set_ready_state(@mut self, ready_state: ReadyState); + fn set_ready_state(@mut self, ready_state: ReadyState); /// Sets the render state of the current page. - pub fn set_render_state(@mut self, render_state: RenderState); + fn set_render_state(@mut self, render_state: RenderState); /// Returns the hidpi factor of the monitor. - pub fn hidpi_factor(@mut self) -> f32; + fn hidpi_factor(@mut self) -> f32; } diff --git a/src/components/net/image_cache_task.rs b/src/components/net/image_cache_task.rs index d7f68cbaf5c..a6f3dfb529f 100644 --- a/src/components/net/image_cache_task.rs +++ b/src/components/net/image_cache_task.rs @@ -232,18 +232,18 @@ impl ImageCache { } } - priv fn get_state(&self, url: Url) -> ImageState { + fn get_state(&self, url: Url) -> ImageState { match self.state_map.find(&url) { Some(state) => *state, None => Init } } - priv fn set_state(&self, url: Url, state: ImageState) { + fn set_state(&self, url: Url, state: ImageState) { self.state_map.insert(url, state); } - priv fn prefetch(&self, url: Url) { + fn prefetch(&self, url: Url) { match self.get_state(url.clone()) { Init => { let to_cache = self.chan.clone(); @@ -274,7 +274,7 @@ impl ImageCache { } } - priv fn store_prefetched_image_data(&self, url: Url, data: Result<Cell<~[u8]>, ()>) { + fn store_prefetched_image_data(&self, url: Url, data: Result<Cell<~[u8]>, ()>) { match self.get_state(url.clone()) { Prefetching(next_step) => { match data { @@ -303,7 +303,7 @@ impl ImageCache { } } - priv fn decode(&self, url: Url) { + fn decode(&self, url: Url) { match self.get_state(url.clone()) { Init => fail!(~"decoding image before prefetch"), @@ -346,7 +346,7 @@ impl ImageCache { } } - priv fn store_image(&self, url: Url, image: Option<Arc<~Image>>) { + fn store_image(&self, url: Url, image: Option<Arc<~Image>>) { match self.get_state(url.clone()) { Decoding => { @@ -373,7 +373,7 @@ impl ImageCache { } - priv fn purge_waiters(&self, url: Url, f: &fn() -> ImageResponseMsg) { + fn purge_waiters(&self, url: Url, f: &fn() -> ImageResponseMsg) { match self.wait_map.pop(&url) { Some(waiters) => { for response in waiters.iter() { @@ -384,7 +384,7 @@ impl ImageCache { } } - priv fn get_image(&self, url: Url, response: Chan<ImageResponseMsg>) { + fn get_image(&self, url: Url, response: Chan<ImageResponseMsg>) { match self.get_state(url.clone()) { Init => fail!(~"request for image before prefetch"), Prefetching(DoDecode) => response.send(ImageNotReady), @@ -395,7 +395,7 @@ impl ImageCache { } } - priv fn wait_for_image(&self, url: Url, response: Chan<ImageResponseMsg>) { + fn wait_for_image(&self, url: Url, response: Chan<ImageResponseMsg>) { match self.get_state(url.clone()) { Init => fail!(~"request for image before prefetch"), diff --git a/src/components/net/local_image_cache.rs b/src/components/net/local_image_cache.rs index 2c0685bf326..9c6bf12191c 100644 --- a/src/components/net/local_image_cache.rs +++ b/src/components/net/local_image_cache.rs @@ -33,7 +33,7 @@ pub struct LocalImageCache { priv state_map: UrlMap<@mut ImageState> } -priv struct ImageState { +struct ImageState { prefetched: bool, decoded: bool, last_request_round: uint, @@ -133,7 +133,7 @@ impl LocalImageCache { return port; } - priv fn get_state(&self, url: &Url) -> @mut ImageState { + fn get_state(&self, url: &Url) -> @mut ImageState { let state = do self.state_map.find_or_insert_with(url.clone()) |_| { let new_state = @mut ImageState { prefetched: false, diff --git a/src/components/script/dom/bindings/codegen/CodegenRust.py b/src/components/script/dom/bindings/codegen/CodegenRust.py index 8a1c647b6e5..22bd6ca6db3 100644 --- a/src/components/script/dom/bindings/codegen/CodegenRust.py +++ b/src/components/script/dom/bindings/codegen/CodegenRust.py @@ -3935,7 +3935,7 @@ class CGDOMJSProxyHandler_obj_toString(CGAbstractExternMethod): JSString* jsresult; return xpc_qsStringToJsstring(cx, result, &jsresult) ? jsresult : NULL;""" - return """ do "%s".as_c_str |s| { + return """ do "%s".to_c_str().with_ref |s| { _obj_toString(cx, s) }""" % self.descriptor.name @@ -4461,9 +4461,9 @@ class CGDictionary(CGThing): # NOTE: jsids are per-runtime, so don't use them in workers if True or self.workers: #XXXjdm hack until 'static mut' exists for global jsids propName = member.identifier.name - propCheck = ('"%s".as_c_str(|s| { JS_HasProperty(cx, RUST_JSVAL_TO_OBJECT(val), s, ptr::to_unsafe_ptr(&found)) })' % + propCheck = ('"%s".to_c_str().with_ref(|s| { JS_HasProperty(cx, RUST_JSVAL_TO_OBJECT(val), s, ptr::to_unsafe_ptr(&found)) })' % propName) - propGet = ('"%s".as_c_str(|s| { JS_GetProperty(cx, RUST_JSVAL_TO_OBJECT(val), s, ptr::to_unsafe_ptr(&temp)) })' % + propGet = ('"%s".to_c_str().with_ref(|s| { JS_GetProperty(cx, RUST_JSVAL_TO_OBJECT(val), s, ptr::to_unsafe_ptr(&temp)) })' % propName) else: propId = self.makeIdName(member.identifier.name); diff --git a/src/components/script/dom/bindings/element.rs b/src/components/script/dom/bindings/element.rs index 5a3075efacc..8ca841772de 100644 --- a/src/components/script/dom/bindings/element.rs +++ b/src/components/script/dom/bindings/element.rs @@ -54,7 +54,7 @@ pub extern fn trace(tracer: *mut JSTracer, obj: *JSObject) { unsafe { (*tracer).debugPrinter = ptr::null(); (*tracer).debugPrintIndex = -1; - do name.as_c_str |name| { + do name.to_c_str().with_ref |name| { (*tracer).debugPrintArg = name as *libc::c_void; JS_CallTracer(cast::transmute(tracer), wrapper, JSTRACE_OBJECT as u32); } diff --git a/src/components/script/dom/bindings/proxyhandler.rs b/src/components/script/dom/bindings/proxyhandler.rs index 3b724b1257a..2aac4a14918 100644 --- a/src/components/script/dom/bindings/proxyhandler.rs +++ b/src/components/script/dom/bindings/proxyhandler.rs @@ -68,7 +68,7 @@ pub extern fn defineProperty(cx: *JSContext, proxy: *JSObject, id: jsid, pub fn _obj_toString(cx: *JSContext, className: *libc::c_char) -> *JSString { unsafe { - let name = str::raw::from_buf(className as *u8); + let name = str::raw::from_c_str(className); let nchars = "[object ]".len() + name.len(); let chars: *mut jschar = cast::transmute(JS_malloc(cx, (nchars + 1) as u64 * (size_of::<jschar>() as u64))); if chars.is_null() { diff --git a/src/components/script/dom/bindings/utils.rs b/src/components/script/dom/bindings/utils.rs index af53986b9e2..d8722af9d09 100644 --- a/src/components/script/dom/bindings/utils.rs +++ b/src/components/script/dom/bindings/utils.rs @@ -202,7 +202,7 @@ pub fn jsval_to_str(cx: *JSContext, v: JSVal) -> Result<~str, ()> { } let strbuf = JS_EncodeString(cx, jsstr); - let buf = str::raw::from_buf(strbuf as *u8); + let buf = str::raw::from_c_str(strbuf); JS_free(cx, strbuf as *libc::c_void); Ok(buf) } @@ -454,7 +454,7 @@ pub fn CreateInterfaceObjects2(cx: *JSContext, global: *JSObject, receiver: *JSO let mut interface = ptr::null(); if constructorClass.is_not_null() || constructor.is_not_null() { - interface = do name.as_c_str |s| { + interface = do name.to_c_str().with_ref |s| { CreateInterfaceObject(cx, global, receiver, constructorClass, constructor, ctorNargs, proto, staticMethods, constants, s) @@ -506,7 +506,7 @@ fn CreateInterfaceObject(cx: *JSContext, global: *JSObject, receiver: *JSObject, } if constructorClass.is_not_null() { - let toString = do "toString".as_c_str |s| { + let toString = do "toString".to_c_str().with_ref |s| { DefineFunctionWithReserved(cx, constructor, s, InterfaceObjectToString, 0, 0) diff --git a/src/components/script/dom/document.rs b/src/components/script/dom/document.rs index e2ade617dad..8547a0e3cc7 100644 --- a/src/components/script/dom/document.rs +++ b/src/components/script/dom/document.rs @@ -115,7 +115,7 @@ impl Document { } impl WrappableDocument for Document { - pub fn init_wrapper(@mut self, cx: *JSContext) { + fn init_wrapper(@mut self, cx: *JSContext) { self.wrap_object_shared(cx, ptr::null()); //XXXjdm a proper scope would be nice } } diff --git a/src/components/script/dom/htmldocument.rs b/src/components/script/dom/htmldocument.rs index c36ffbd46aa..b8b56b1d850 100644 --- a/src/components/script/dom/htmldocument.rs +++ b/src/components/script/dom/htmldocument.rs @@ -43,7 +43,7 @@ impl HTMLDocument { } impl WrappableDocument for HTMLDocument { - pub fn init_wrapper(@mut self, cx: *JSContext) { + fn init_wrapper(@mut self, cx: *JSContext) { self.wrap_object_shared(cx, ptr::null()); //XXXjdm a proper scope would be nice } } diff --git a/src/components/script/dom/node.rs b/src/components/script/dom/node.rs index 7b07a795ec4..e06c77577ed 100644 --- a/src/components/script/dom/node.rs +++ b/src/components/script/dom/node.rs @@ -463,7 +463,7 @@ impl<'self, View> AbstractNode<View> { } impl<View> Iterator<AbstractNode<View>> for AbstractNodeChildrenIterator<View> { - pub fn next(&mut self) -> Option<AbstractNode<View>> { + fn next(&mut self) -> Option<AbstractNode<View>> { let node = self.current_node; self.current_node = self.current_node.chain(|node| node.next_sibling()); node diff --git a/src/components/script/layout_interface.rs b/src/components/script/layout_interface.rs index c7c7634f80b..b9e349bf50e 100644 --- a/src/components/script/layout_interface.rs +++ b/src/components/script/layout_interface.rs @@ -62,7 +62,7 @@ impl DocumentDamageLevel { /// /// FIXME(pcwalton): This could be refactored to use `max` and the `Ord` trait, and this /// function removed. - fn add(&mut self, new_damage: DocumentDamageLevel) { + pub fn add(&mut self, new_damage: DocumentDamageLevel) { match (*self, new_damage) { (ReflowDocumentDamage, new_damage) => *self = new_damage, (MatchSelectorsDocumentDamage, _) => *self = MatchSelectorsDocumentDamage, diff --git a/src/components/script/script_task.rs b/src/components/script/script_task.rs index dcc3979205b..cbe8eac763d 100644 --- a/src/components/script/script_task.rs +++ b/src/components/script/script_task.rs @@ -756,7 +756,7 @@ impl ScriptTask { } } - priv fn load_url_from_element(&self, page: @mut Page, element: &Element) { + fn load_url_from_element(&self, page: @mut Page, element: &Element) { // if the node's element is "a," load url from href attr let attr = element.get_attr("href"); for href in attr.iter() { diff --git a/src/components/util/time.rs b/src/components/util/time.rs index 3c9c6066450..cfdb037c4f0 100644 --- a/src/components/util/time.rs +++ b/src/components/util/time.rs @@ -70,7 +70,7 @@ impl ProfilerCategory { // enumeration of all ProfilerCategory types // TODO(tkuehn): is there a better way to ensure proper order of categories? - priv fn empty_buckets() -> ProfilerBuckets { + fn empty_buckets() -> ProfilerBuckets { let buckets = [ (CompositingCategory, ~[]), (LayoutQueryCategory, ~[]), @@ -92,7 +92,7 @@ impl ProfilerCategory { } // ensure that the order of the buckets matches the order of the enum categories - priv fn check_order(vec: &ProfilerBuckets) { + fn check_order(vec: &ProfilerBuckets) { for &(category, _) in vec.iter() { if category != vec[category as uint].first() { fail!("Enum category does not match bucket index. This is a bug."); @@ -136,7 +136,7 @@ impl Profiler { } } - priv fn handle_msg(&mut self, msg: ProfilerMsg) { + fn handle_msg(&mut self, msg: ProfilerMsg) { match msg { TimeMsg(category, t) => match self.buckets[category as uint] { //TODO(tkuehn): would be nice to have tuple.second_mut() @@ -151,7 +151,7 @@ impl Profiler { self.last_msg = Some(msg); } - priv fn print_buckets(&mut self) { + fn print_buckets(&mut self) { println(fmt!("%31s %15s %15s %15s %15s %15s", "_category_", "_mean (ms)_", "_median (ms)_", "_min (ms)_", "_max (ms)_", "_bucket size_")); @@ -163,7 +163,7 @@ impl Profiler { let data_len = data.len(); if data_len > 0 { let (mean, median, &min, &max) = - (data.iter().transform(|&x|x).sum() / (data_len as float), + (data.iter().map(|&x|x).sum() / (data_len as float), data[data_len / 2], data.iter().min().unwrap(), data.iter().max().unwrap()); diff --git a/src/components/util/tree.rs b/src/components/util/tree.rs index 3b4aba07cc5..3664bae9ac1 100644 --- a/src/components/util/tree.rs +++ b/src/components/util/tree.rs @@ -7,13 +7,13 @@ // Macros to make add_child etc. less painful to write. // Code outside this module should instead implement TreeNode // and use its default methods. -priv macro_rules! get( +macro_rules! get( ($node:expr, $fun:ident) => ( TreeNodeRef::$fun::<Node,Self>($node) ) ) -priv macro_rules! set( +macro_rules! set( ($node:expr, $fun:ident, $val:expr) => ( TreeNodeRef::$fun::<Node,Self>($node, $val) ) @@ -44,7 +44,7 @@ pub struct TreeIterator<Ref> { } impl<Ref> TreeIterator<Ref> { - priv fn new(nodes: ~[Ref]) -> TreeIterator<Ref> { + fn new(nodes: ~[Ref]) -> TreeIterator<Ref> { TreeIterator { nodes: nodes, index: 0, @@ -220,8 +220,8 @@ pub trait TreeNodeRef<Node>: Clone { } } -priv fn gather<Node, Ref: TreeNodeRef<Node>>(cur: &Ref, refs: &mut ~[Ref], - postorder: bool, prune: &fn(&Ref) -> bool) { +fn gather<Node, Ref: TreeNodeRef<Node>>(cur: &Ref, refs: &mut ~[Ref], + postorder: bool, prune: &fn(&Ref) -> bool) { // prune shouldn't mutate, so don't clone if prune(cur) { return; diff --git a/src/components/util/url.rs b/src/components/util/url.rs index 71bef0203a2..bdfef004335 100644 --- a/src/components/util/url.rs +++ b/src/components/util/url.rs @@ -43,7 +43,7 @@ pub fn make_url(str_url: ~str, current_url: Option<Url>) -> Url { path.push(p.to_str()); } let path = path.init(); - let mut path = path.iter().transform(|x| (*x).clone()).collect::<~[~str]>(); + let mut path = path.iter().map(|x| (*x).clone()).collect::<~[~str]>(); path.push(str_url); let path = path.connect("/"); diff --git a/src/support/alert/rust-alert b/src/support/alert/rust-alert -Subproject 68875af396cb583e670dd5caad99431dac62f8d +Subproject 4e9340d2549d0f62468254809b59d833c2e8259 diff --git a/src/support/azure/rust-azure b/src/support/azure/rust-azure -Subproject 113e2c37ad772511c473010c4d944459689778a +Subproject 4e883bc2754d9d3b1ba21baa0603dd43b093cff diff --git a/src/support/css/rust-css b/src/support/css/rust-css -Subproject 1c5e9e74b2857c254a8a0743747bffab6c05933 +Subproject b66cc67a1fa0a5a85eefdb0073d29e410f34f1f diff --git a/src/support/css/rust-cssparser b/src/support/css/rust-cssparser -Subproject fc4a1cc0ff62aba5a32a66eee5dc087f11daa55 +Subproject 3e2179942cb679a4f08c81674f4f8e4777f88cf diff --git a/src/support/geom/rust-geom b/src/support/geom/rust-geom -Subproject 5b9a447946b736802a0791eb1c24687849ad398 +Subproject 690f9062746e1fed5e0f027acc1b095db6b50c6 diff --git a/src/support/glfw/glfw-rs b/src/support/glfw/glfw-rs -Subproject 6d634549f24c87629cfa3401159b67a5766d5b6 +Subproject 41e63b6856b21ee21549dcb98618404d088513b diff --git a/src/support/hubbub/rust-hubbub b/src/support/hubbub/rust-hubbub -Subproject 4c6a69ad0f074d4e03cd25d8cf753e8559712c3 +Subproject 065db559d51051bd786836e2aba9c0bef4031ad diff --git a/src/support/layers/rust-layers b/src/support/layers/rust-layers -Subproject cbd5e01469797b5f12df6679ff11365a3d4c34d +Subproject e036183e152542cb2080e5b098b66efce1decf5 diff --git a/src/support/netsurfcss/rust-netsurfcss b/src/support/netsurfcss/rust-netsurfcss -Subproject 93df6bd75c5ecd13855ea73be83d3c9a2d5d9d0 +Subproject 9ea9b1411e0b98358c757e27eb026aac2c5948b diff --git a/src/support/opengles/rust-opengles b/src/support/opengles/rust-opengles -Subproject 795d0d6e5a9c8645f738d36111ef23021e64687 +Subproject 69de03ef7e447d22593eb3e405257b07ff38aa7 diff --git a/src/support/sharegl/sharegl b/src/support/sharegl/sharegl -Subproject 8850fa10cdea9218be0fb470a6de3691766fa09 +Subproject 73f46084428a37021e7d0d77daaa7b8a18fface diff --git a/src/support/spidermonkey/rust-mozjs b/src/support/spidermonkey/rust-mozjs -Subproject f634f6c5e6de7c3ef4ad62f28d36ea94e782b09 +Subproject f19be6340c2d3fa9a12a53889ba5021a8f15507 diff --git a/src/support/stb-image/rust-stb-image b/src/support/stb-image/rust-stb-image -Subproject d9854ec23b9c6348c0b3fef38fe1890124391b8 +Subproject ae5fe3138298d276656715f5fdef021ce0a98c9 diff --git a/src/support/wapcaplet/rust-wapcaplet b/src/support/wapcaplet/rust-wapcaplet -Subproject 14a02310b547ee91126c0761b041be04edacd7d +Subproject caa31c98eee0334b5881f6ced37ccee4eba7d28 |