mirror of
https://github.com/servo/servo.git
synced 2025-06-21 15:49:04 +01:00
Update Rust version again
This gets us the new runtime.
This commit is contained in:
parent
ef50acfa89
commit
a2d9810b69
49 changed files with 129 additions and 129 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit 29ffbbaaa850d3f8fe1b35e3a63defe9206a3eb7
|
Subproject commit 0a677bcf6e359f6f013a7e580ef467b5f389e5b7
|
|
@ -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.
|
// FIXME(tkuehn): Workaround for Rust region bug.
|
||||||
unsafe {
|
unsafe {
|
||||||
match *self {
|
match *self {
|
||||||
|
@ -168,7 +168,7 @@ impl<E> DisplayItem<E> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bounds(&self) -> Rect<Au> {
|
pub fn bounds(&self) -> Rect<Au> {
|
||||||
self.base().bounds
|
self.base().bounds
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,12 +57,12 @@ pub type FractionalPixel = float;
|
||||||
|
|
||||||
pub type FontTableTag = u32;
|
pub type FontTableTag = u32;
|
||||||
|
|
||||||
trait FontTableTagConversions {
|
pub trait FontTableTagConversions {
|
||||||
pub fn tag_to_str(&self) -> ~str;
|
fn tag_to_str(&self) -> ~str;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FontTableTagConversions for FontTableTag {
|
impl FontTableTagConversions for FontTableTag {
|
||||||
pub fn tag_to_str(&self) -> ~str {
|
fn tag_to_str(&self) -> ~str {
|
||||||
unsafe {
|
unsafe {
|
||||||
let reversed = str::raw::from_buf_len(cast::transmute(self), 4);
|
let reversed = str::raw::from_buf_len(cast::transmute(self), 4);
|
||||||
return str::from_chars([reversed.char_at(3),
|
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));
|
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
|
// fast path: already created a shaper
|
||||||
match self.shaper {
|
match self.shaper {
|
||||||
Some(shaper) => { return shaper; },
|
Some(shaper) => { return shaper; },
|
||||||
|
@ -332,7 +332,7 @@ impl Font {
|
||||||
// TODO: this should return a borrowed pointer, but I can't figure
|
// TODO: this should return a borrowed pointer, but I can't figure
|
||||||
// out why borrowck doesn't like my implementation.
|
// 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
|
// fast path: we've already created the azure font resource
|
||||||
match self.azure_font {
|
match self.azure_font {
|
||||||
Some(ref azfont) => return azfont.get_ref(),
|
Some(ref azfont) => return azfont.get_ref(),
|
||||||
|
@ -346,14 +346,14 @@ impl Font {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os="macos")]
|
#[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 cg_font = self.handle.get_CGFont();
|
||||||
let size = self.style.pt_size as AzFloat;
|
let size = self.style.pt_size as AzFloat;
|
||||||
ScaledFont::new(self.backend, &cg_font, size)
|
ScaledFont::new(self.backend, &cg_font, size)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os="linux")]
|
#[cfg(target_os="linux")]
|
||||||
priv fn create_azure_font(&self) -> ScaledFont {
|
fn create_azure_font(&self) -> ScaledFont {
|
||||||
let freetype_font = self.handle.face;
|
let freetype_font = self.handle.face;
|
||||||
let size = self.style.pt_size as AzFloat;
|
let size = self.style.pt_size as AzFloat;
|
||||||
ScaledFont::new(self.backend, freetype_font, size)
|
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 (glyphs, _offset, slice_range) in run.iter_slices_for_range(range) {
|
||||||
for (_i, glyph) in glyphs.iter_glyphs_for_char_range(&slice_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 glyph_offset = glyph.offset().unwrap_or_default(Au::zero_point());
|
||||||
|
|
||||||
let azglyph = struct__AzGlyph {
|
let azglyph = struct__AzGlyph {
|
||||||
|
@ -432,7 +432,7 @@ impl Font {
|
||||||
let mut advance = Au(0);
|
let mut advance = Au(0);
|
||||||
for (glyphs, _offset, slice_range) in run.iter_slices_for_range(range) {
|
for (glyphs, _offset, slice_range) in run.iter_slices_for_range(range) {
|
||||||
for (_i, glyph) in glyphs.iter_glyphs_for_char_range(&slice_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)
|
RunMetrics::new(advance, self.metrics.ascent, self.metrics.descent)
|
||||||
|
@ -444,7 +444,7 @@ impl Font {
|
||||||
-> RunMetrics {
|
-> RunMetrics {
|
||||||
let mut advance = Au(0);
|
let mut advance = Au(0);
|
||||||
for (_i, glyph) in glyphs.iter_glyphs_for_char_range(slice_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)
|
RunMetrics::new(advance, self.metrics.ascent, self.metrics.descent)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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()
|
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.
|
// FIXME: Need a find_like() in HashMap.
|
||||||
let family = family.to_str();
|
let family = family.to_str();
|
||||||
debug!("(transform family) searching for `%s`", family);
|
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 = ~[];
|
let mut fonts = ~[];
|
||||||
|
|
||||||
debug!("(create font group) --- starting ---");
|
debug!("(create font group) --- starting ---");
|
||||||
|
@ -182,7 +182,7 @@ impl<'self> FontContext {
|
||||||
@FontGroup::new(style.families.to_managed(), &used_style, fonts)
|
@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 {
|
return match &desc.selector {
|
||||||
// TODO(Issue #174): implement by-platform-name font selectors.
|
// TODO(Issue #174): implement by-platform-name font selectors.
|
||||||
&SelectorPlatformIdentifier(ref identifier) => {
|
&SelectorPlatformIdentifier(ref identifier) => {
|
||||||
|
|
|
@ -42,7 +42,7 @@ impl FontList {
|
||||||
list
|
list
|
||||||
}
|
}
|
||||||
|
|
||||||
priv fn refresh(&mut self, _: &FontContextHandle) {
|
fn refresh(&mut self, _: &FontContextHandle) {
|
||||||
// TODO(Issue #186): don't refresh unless something actually
|
// TODO(Issue #186): don't refresh unless something actually
|
||||||
// changed. Does OSX have a notification for this event?
|
// changed. Does OSX have a notification for this event?
|
||||||
//
|
//
|
||||||
|
@ -76,7 +76,7 @@ impl FontList {
|
||||||
result
|
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
|
// look up canonical name
|
||||||
let family = self.family_map.find_equiv(&family_name);
|
let family = self.family_map.find_equiv(&family_name);
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ pub use gfx_font_list = font_list;
|
||||||
pub use servo_gfx_font = font;
|
pub use servo_gfx_font = font;
|
||||||
pub use servo_gfx_font_list = font_list;
|
pub use servo_gfx_font_list = font_list;
|
||||||
|
|
||||||
priv mod render_context;
|
mod render_context;
|
||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
pub mod color;
|
pub mod color;
|
||||||
|
|
|
@ -73,7 +73,7 @@ impl Drop for FontHandle {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FontHandleMethods for FontHandle {
|
impl FontHandleMethods for FontHandle {
|
||||||
pub fn new_from_buffer(fctx: &FontContextHandle,
|
fn new_from_buffer(fctx: &FontContextHandle,
|
||||||
buf: ~[u8],
|
buf: ~[u8],
|
||||||
style: &SpecifiedFontStyle)
|
style: &SpecifiedFontStyle)
|
||||||
-> Result<FontHandle, ()> {
|
-> Result<FontHandle, ()> {
|
||||||
|
@ -178,7 +178,7 @@ impl FontHandleMethods for FontHandle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn glyph_index(&self,
|
fn glyph_index(&self,
|
||||||
codepoint: char) -> Option<GlyphIndex> {
|
codepoint: char) -> Option<GlyphIndex> {
|
||||||
assert!(self.face.is_not_null());
|
assert!(self.face.is_not_null());
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -192,7 +192,7 @@ impl FontHandleMethods for FontHandle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn glyph_h_advance(&self,
|
fn glyph_h_advance(&self,
|
||||||
glyph: GlyphIndex) -> Option<FractionalPixel> {
|
glyph: GlyphIndex) -> Option<FractionalPixel> {
|
||||||
assert!(self.face.is_not_null());
|
assert!(self.face.is_not_null());
|
||||||
unsafe {
|
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 */
|
/* TODO(Issue #76): complete me */
|
||||||
let face = self.get_face_rec();
|
let face = self.get_face_rec();
|
||||||
|
|
||||||
|
@ -242,7 +242,7 @@ impl FontHandleMethods for FontHandle {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'self> 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_width = float_to_fixed_ft(pt_size) as FT_F26Dot6;
|
||||||
let char_height = 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;
|
let h_dpi = 72;
|
||||||
|
@ -262,7 +262,7 @@ impl<'self> FontHandle {
|
||||||
|
|
||||||
let mut face: FT_Face = ptr::null();
|
let mut face: FT_Face = ptr::null();
|
||||||
let face_index = 0 as FT_Long;
|
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,
|
FT_New_Face(ft_ctx, file_str,
|
||||||
face_index, ptr::to_mut_unsafe_ptr(&mut face));
|
face_index, ptr::to_mut_unsafe_ptr(&mut face));
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,7 @@ impl<'self> FontHandle {
|
||||||
|
|
||||||
let mut face: FT_Face = ptr::null();
|
let mut face: FT_Face = ptr::null();
|
||||||
let face_index = 0 as FT_Long;
|
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,
|
FT_New_Face(ft_ctx, file_str,
|
||||||
face_index, ptr::to_mut_unsafe_ptr(&mut face));
|
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 {
|
unsafe {
|
||||||
&(*self.face)
|
&(*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();
|
let face = self.get_face_rec();
|
||||||
|
|
||||||
// face.size is a *c_void in the bindings, presumably to avoid
|
// face.size is a *c_void in the bindings, presumably to avoid
|
||||||
|
|
|
@ -26,7 +26,7 @@ use platform::font_context::FontContextHandle;
|
||||||
|
|
||||||
use std::hashmap::HashMap;
|
use std::hashmap::HashMap;
|
||||||
use std::libc;
|
use std::libc;
|
||||||
use std::libc::c_int;
|
use std::libc::{c_int, c_char};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::str;
|
use std::str;
|
||||||
|
|
||||||
|
@ -48,9 +48,9 @@ impl FontListHandle {
|
||||||
let font = (*fontSet).fonts.offset(i);
|
let font = (*fontSet).fonts.offset(i);
|
||||||
let family: *FcChar8 = ptr::null();
|
let family: *FcChar8 = ptr::null();
|
||||||
let mut v: c_int = 0;
|
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 {
|
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);
|
debug!("Creating new FontFamily for family: %s", family_name);
|
||||||
let new_family = @mut FontFamily::new(family_name);
|
let new_family = @mut FontFamily::new(family_name);
|
||||||
family_map.insert(family_name, new_family);
|
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 font_set_array_ptr = ptr::to_unsafe_ptr(&font_set);
|
||||||
let pattern = FcPatternCreate();
|
let pattern = FcPatternCreate();
|
||||||
assert!(pattern.is_not_null());
|
assert!(pattern.is_not_null());
|
||||||
do "family".as_c_str |FC_FAMILY| {
|
do "family".to_c_str().with_ref |FC_FAMILY| {
|
||||||
do family.family_name.as_c_str |family_name| {
|
do family.family_name.to_c_str().with_ref |family_name| {
|
||||||
let ok = FcPatternAddString(pattern, FC_FAMILY, family_name as *FcChar8);
|
let ok = FcPatternAddString(pattern, FC_FAMILY, family_name as *FcChar8);
|
||||||
assert!(ok != 0);
|
assert!(ok != 0);
|
||||||
}
|
}
|
||||||
|
@ -80,10 +80,10 @@ impl FontListHandle {
|
||||||
let object_set = FcObjectSetCreate();
|
let object_set = FcObjectSetCreate();
|
||||||
assert!(object_set.is_not_null());
|
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);
|
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);
|
FcObjectSetAdd(object_set, FC_INDEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ impl FontListHandle {
|
||||||
|
|
||||||
for i in range(0, (*matches).nfont as int) {
|
for i in range(0, (*matches).nfont as int) {
|
||||||
let font = (*matches).fonts.offset(i);
|
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();
|
let file: *FcChar8 = ptr::null();
|
||||||
if FcPatternGetString(*font, FC_FILE, 0, &file) == FcResultMatch {
|
if FcPatternGetString(*font, FC_FILE, 0, &file) == FcResultMatch {
|
||||||
str::raw::from_c_str(file as *libc::c_char)
|
str::raw::from_c_str(file as *libc::c_char)
|
||||||
|
@ -101,7 +101,7 @@ impl FontListHandle {
|
||||||
fail!();
|
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;
|
let index: libc::c_int = 0;
|
||||||
if FcPatternGetInteger(*font, FC_INDEX, 0, &index) == FcResultMatch {
|
if FcPatternGetInteger(*font, FC_INDEX, 0, &index) == FcResultMatch {
|
||||||
index
|
index
|
||||||
|
@ -150,8 +150,8 @@ pub fn path_from_identifier(name: ~str, style: &UsedFontStyle) -> Result<~str, (
|
||||||
let config = FcConfigGetCurrent();
|
let config = FcConfigGetCurrent();
|
||||||
let wrapper = AutoPattern { pattern: FcPatternCreate() };
|
let wrapper = AutoPattern { pattern: FcPatternCreate() };
|
||||||
let pattern = wrapper.pattern;
|
let pattern = wrapper.pattern;
|
||||||
let res = do "family".as_c_str |FC_FAMILY| {
|
let res = do "family".to_c_str().with_ref |FC_FAMILY| {
|
||||||
do name.as_c_str |family| {
|
do name.to_c_str().with_ref |family| {
|
||||||
FcPatternAddString(pattern, FC_FAMILY, family as *FcChar8)
|
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 {
|
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)
|
FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC)
|
||||||
};
|
};
|
||||||
if res != 1 {
|
if res != 1 {
|
||||||
|
@ -170,7 +170,7 @@ pub fn path_from_identifier(name: ~str, style: &UsedFontStyle) -> Result<~str, (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if style.weight.is_bold() {
|
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)
|
FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD)
|
||||||
};
|
};
|
||||||
if res != 1 {
|
if res != 1 {
|
||||||
|
@ -193,13 +193,13 @@ pub fn path_from_identifier(name: ~str, style: &UsedFontStyle) -> Result<~str, (
|
||||||
}
|
}
|
||||||
|
|
||||||
let file: *FcChar8 = ptr::null();
|
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)
|
FcPatternGetString(result_pattern, FC_FILE, 0, &file)
|
||||||
};
|
};
|
||||||
if res != FcResultMatch {
|
if res != FcResultMatch {
|
||||||
debug!("getting filename for font failed");
|
debug!("getting filename for font failed");
|
||||||
return Err(());
|
return Err(());
|
||||||
}
|
}
|
||||||
Ok(str::raw::from_buf(file as *u8))
|
Ok(str::raw::from_c_str(file as *c_char))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ impl RenderChan {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
priv struct RenderTask<C> {
|
struct RenderTask<C> {
|
||||||
id: PipelineId,
|
id: PipelineId,
|
||||||
port: Port<Msg>,
|
port: Port<Msg>,
|
||||||
compositor: C,
|
compositor: C,
|
||||||
|
|
|
@ -461,7 +461,7 @@ enum GlyphInfo<'self> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'self> GlyphInfo<'self> {
|
impl<'self> GlyphInfo<'self> {
|
||||||
fn index(self) -> GlyphIndex {
|
pub fn index(self) -> GlyphIndex {
|
||||||
match self {
|
match self {
|
||||||
SimpleGlyphInfo(store, entry_i) => store.entry_buffer[entry_i].index(),
|
SimpleGlyphInfo(store, entry_i) => store.entry_buffer[entry_i].index(),
|
||||||
DetailGlyphInfo(store, entry_i, detail_j) => {
|
DetailGlyphInfo(store, entry_i, detail_j) => {
|
||||||
|
@ -472,7 +472,7 @@ impl<'self> GlyphInfo<'self> {
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
// FIXME: Resolution conflicts with IteratorUtil trait so adding trailing _
|
// FIXME: Resolution conflicts with IteratorUtil trait so adding trailing _
|
||||||
fn advance_(self) -> Au {
|
pub fn advance(self) -> Au {
|
||||||
match self {
|
match self {
|
||||||
SimpleGlyphInfo(store, entry_i) => store.entry_buffer[entry_i].advance(),
|
SimpleGlyphInfo(store, entry_i) => store.entry_buffer[entry_i].advance(),
|
||||||
DetailGlyphInfo(store, entry_i, detail_j) => {
|
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 {
|
match self {
|
||||||
SimpleGlyphInfo(_, _) => None,
|
SimpleGlyphInfo(_, _) => None,
|
||||||
DetailGlyphInfo(store, entry_i, detail_j) => {
|
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 {
|
match self {
|
||||||
SimpleGlyphInfo(store, entry_i) => store.entry_buffer[entry_i].is_ligature_start(),
|
SimpleGlyphInfo(store, entry_i) => store.entry_buffer[entry_i].is_ligature_start(),
|
||||||
DetailGlyphInfo(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 {
|
match self {
|
||||||
SimpleGlyphInfo(store, entry_i) => store.entry_buffer[entry_i].is_cluster_start(),
|
SimpleGlyphInfo(store, entry_i) => store.entry_buffer[entry_i].is_cluster_start(),
|
||||||
DetailGlyphInfo(store, entry_i, _) => store.entry_buffer[entry_i].is_cluster_start()
|
DetailGlyphInfo(store, entry_i, _) => store.entry_buffer[entry_i].is_cluster_start()
|
||||||
|
|
|
@ -197,7 +197,7 @@ impl CompositorLayer {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
self.children.mut_iter().filter(|x| !x.child.hidden)
|
self.children.mut_iter().filter(|x| !x.child.hidden)
|
||||||
.transform(transform)
|
.map(transform)
|
||||||
.fold(false, |a, b| a || b) || redisplay
|
.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)
|
// 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;
|
return true;
|
||||||
}
|
}
|
||||||
// ID does not match ours, so recurse on descendents (including hidden children).
|
// 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.
|
// Deletes a specified sublayer, including hidden children. Returns false if the layer is not found.
|
||||||
|
@ -362,7 +362,7 @@ impl CompositorLayer {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
None => {
|
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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ struct QuadtreeNode<T> {
|
||||||
tile_mem: uint,
|
tile_mem: uint,
|
||||||
}
|
}
|
||||||
|
|
||||||
priv enum Quadrant {
|
enum Quadrant {
|
||||||
TL = 0,
|
TL = 0,
|
||||||
TR = 1,
|
TR = 1,
|
||||||
BL = 2,
|
BL = 2,
|
||||||
|
|
|
@ -49,7 +49,7 @@ struct FrameTree {
|
||||||
// Need to clone the FrameTrees, but _not_ the Pipelines
|
// Need to clone the FrameTrees, but _not_ the Pipelines
|
||||||
impl Clone for FrameTree {
|
impl Clone for FrameTree {
|
||||||
fn clone(&self) -> 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()
|
@mut (*frame_tree).clone()
|
||||||
};
|
};
|
||||||
FrameTree {
|
FrameTree {
|
||||||
|
@ -113,7 +113,7 @@ impl FrameTree {
|
||||||
fn to_sendable(&self) -> SendableFrameTree {
|
fn to_sendable(&self) -> SendableFrameTree {
|
||||||
let sendable_frame_tree = SendableFrameTree {
|
let sendable_frame_tree = SendableFrameTree {
|
||||||
pipeline: (*self.pipeline).clone(),
|
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
|
sendable_frame_tree
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ impl NavigationContext {
|
||||||
let from_prev = do self.previous.iter().filter_map |frame_tree| {
|
let from_prev = do self.previous.iter().filter_map |frame_tree| {
|
||||||
frame_tree.find_mut(pipeline_id)
|
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 {
|
pub fn contains(&mut self, pipeline_id: PipelineId) -> bool {
|
||||||
|
@ -210,7 +210,7 @@ impl NavigationContext {
|
||||||
let from_next = self.next.iter();
|
let from_next = self.next.iter();
|
||||||
let from_prev = self.previous.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| {
|
do all_contained.any |frame_tree| {
|
||||||
frame_tree.contains(pipeline_id)
|
frame_tree.contains(pipeline_id)
|
||||||
}
|
}
|
||||||
|
@ -337,7 +337,7 @@ impl Constellation {
|
||||||
let matching_pending_frames = do self.pending_frames.iter().filter_map |frame_change| {
|
let matching_pending_frames = do self.pending_frames.iter().filter_map |frame_change| {
|
||||||
frame_change.after.find_mut(source_pipeline_id)
|
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() {
|
if frame_trees.is_empty() {
|
||||||
|
|
|
@ -37,7 +37,7 @@ impl LayoutData {
|
||||||
/// Functionality useful for querying the layout-specific data on DOM nodes.
|
/// Functionality useful for querying the layout-specific data on DOM nodes.
|
||||||
pub trait LayoutAuxMethods {
|
pub trait LayoutAuxMethods {
|
||||||
fn layout_data(self) -> @mut LayoutData;
|
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 set_layout_data(self, data: @mut LayoutData);
|
||||||
|
|
||||||
fn initialize_layout_data(self) -> Option<@mut LayoutData>;
|
fn initialize_layout_data(self) -> Option<@mut LayoutData>;
|
||||||
|
@ -45,17 +45,17 @@ pub trait LayoutAuxMethods {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LayoutAuxMethods for AbstractNode<LayoutView> {
|
impl LayoutAuxMethods for AbstractNode<LayoutView> {
|
||||||
pub fn layout_data(self) -> @mut LayoutData {
|
fn layout_data(self) -> @mut LayoutData {
|
||||||
unsafe {
|
unsafe {
|
||||||
self.unsafe_layout_data()
|
self.unsafe_layout_data()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn has_layout_data(self) -> bool {
|
fn has_layout_data(self) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
self.unsafe_has_layout_data()
|
self.unsafe_has_layout_data()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn set_layout_data(self, data: @mut LayoutData) {
|
fn set_layout_data(self, data: @mut LayoutData) {
|
||||||
unsafe {
|
unsafe {
|
||||||
self.unsafe_set_layout_data(data)
|
self.unsafe_set_layout_data(data)
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ impl BlockFlowData {
|
||||||
|
|
||||||
/// Computes left and right margins and width based on CSS 2.1 secion 10.3.3.
|
/// Computes left and right margins and width based on CSS 2.1 secion 10.3.3.
|
||||||
/// Requires borders and padding to already be computed
|
/// Requires borders and padding to already be computed
|
||||||
priv fn compute_horiz( &self,
|
fn compute_horiz( &self,
|
||||||
width: MaybeAuto,
|
width: MaybeAuto,
|
||||||
left_margin: MaybeAuto,
|
left_margin: MaybeAuto,
|
||||||
right_margin: MaybeAuto,
|
right_margin: MaybeAuto,
|
||||||
|
|
|
@ -383,7 +383,7 @@ impl RenderBox {
|
||||||
//
|
//
|
||||||
// TODO(eatkinson): integrate with
|
// TODO(eatkinson): integrate with
|
||||||
// get_min_width and get_pref_width?
|
// get_min_width and get_pref_width?
|
||||||
priv fn guess_width (&self) -> Au {
|
fn guess_width (&self) -> Au {
|
||||||
do self.with_base |base| {
|
do self.with_base |base| {
|
||||||
if(!base.node.is_element()) {
|
if(!base.node.is_element()) {
|
||||||
Au(0)
|
Au(0)
|
||||||
|
@ -820,7 +820,7 @@ impl RenderBox {
|
||||||
self.nearest_ancestor_element().style().text_align()
|
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()
|
self.nearest_ancestor_element().style().line_height()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ enum InlineSpacerSide {
|
||||||
LogicalAfter,
|
LogicalAfter,
|
||||||
}
|
}
|
||||||
|
|
||||||
priv fn simulate_UA_display_rules(node: AbstractNode<LayoutView>) -> CSSDisplay {
|
fn simulate_UA_display_rules(node: AbstractNode<LayoutView>) -> CSSDisplay {
|
||||||
// FIXME
|
// FIXME
|
||||||
/*let resolved = do node.aux |nd| {
|
/*let resolved = do node.aux |nd| {
|
||||||
match nd.style.display_type {
|
match nd.style.display_type {
|
||||||
|
|
|
@ -83,7 +83,7 @@ impl FlowContext {
|
||||||
//
|
//
|
||||||
// FIXME: Unify this with traverse_preorder_prune, which takes a separate
|
// FIXME: Unify this with traverse_preorder_prune, which takes a separate
|
||||||
// 'prune' function.
|
// '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()) {
|
if !callback((*self).clone()) {
|
||||||
return;
|
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() {
|
for kid in self.children() {
|
||||||
// FIXME: Work around rust#2202. We should be able to pass the callback directly.
|
// FIXME: Work around rust#2202. We should be able to pass the callback directly.
|
||||||
kid.traverse_bu_sub_inorder(|a| callback(a));
|
kid.traverse_bu_sub_inorder(|a| callback(a));
|
||||||
|
|
|
@ -25,7 +25,7 @@ static THROBBER: [char, ..8] = [ '⣾', '⣽', '⣻', '⢿', '⡿', '⣟', '⣯'
|
||||||
pub struct Application;
|
pub struct Application;
|
||||||
|
|
||||||
impl ApplicationMethods for Application {
|
impl ApplicationMethods for Application {
|
||||||
pub fn new() -> Application {
|
fn new() -> Application {
|
||||||
glfw::init();
|
glfw::init();
|
||||||
Application
|
Application
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,8 +56,8 @@ pub mod compositing;
|
||||||
pub mod macros;
|
pub mod macros;
|
||||||
|
|
||||||
pub mod css {
|
pub mod css {
|
||||||
priv mod select_handler;
|
mod select_handler;
|
||||||
priv mod node_util;
|
mod node_util;
|
||||||
|
|
||||||
pub mod select;
|
pub mod select;
|
||||||
pub mod matching;
|
pub mod matching;
|
||||||
|
|
|
@ -51,21 +51,21 @@ pub trait ApplicationMethods {
|
||||||
|
|
||||||
pub trait WindowMethods<A> {
|
pub trait WindowMethods<A> {
|
||||||
/// Creates a new window.
|
/// Creates a new window.
|
||||||
pub fn new(app: &A) -> @mut Self;
|
fn new(app: &A) -> @mut Self;
|
||||||
/// Returns the size of the window.
|
/// 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).
|
/// 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.
|
/// 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.
|
/// 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.
|
/// 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.
|
/// Returns the hidpi factor of the monitor.
|
||||||
pub fn hidpi_factor(@mut self) -> f32;
|
fn hidpi_factor(@mut self) -> f32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
match self.state_map.find(&url) {
|
||||||
Some(state) => *state,
|
Some(state) => *state,
|
||||||
None => Init
|
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);
|
self.state_map.insert(url, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
priv fn prefetch(&self, url: Url) {
|
fn prefetch(&self, url: Url) {
|
||||||
match self.get_state(url.clone()) {
|
match self.get_state(url.clone()) {
|
||||||
Init => {
|
Init => {
|
||||||
let to_cache = self.chan.clone();
|
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()) {
|
match self.get_state(url.clone()) {
|
||||||
Prefetching(next_step) => {
|
Prefetching(next_step) => {
|
||||||
match data {
|
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()) {
|
match self.get_state(url.clone()) {
|
||||||
Init => fail!(~"decoding image before prefetch"),
|
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()) {
|
match self.get_state(url.clone()) {
|
||||||
Decoding => {
|
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) {
|
match self.wait_map.pop(&url) {
|
||||||
Some(waiters) => {
|
Some(waiters) => {
|
||||||
for response in waiters.iter() {
|
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()) {
|
match self.get_state(url.clone()) {
|
||||||
Init => fail!(~"request for image before prefetch"),
|
Init => fail!(~"request for image before prefetch"),
|
||||||
Prefetching(DoDecode) => response.send(ImageNotReady),
|
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()) {
|
match self.get_state(url.clone()) {
|
||||||
Init => fail!(~"request for image before prefetch"),
|
Init => fail!(~"request for image before prefetch"),
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ pub struct LocalImageCache {
|
||||||
priv state_map: UrlMap<@mut ImageState>
|
priv state_map: UrlMap<@mut ImageState>
|
||||||
}
|
}
|
||||||
|
|
||||||
priv struct ImageState {
|
struct ImageState {
|
||||||
prefetched: bool,
|
prefetched: bool,
|
||||||
decoded: bool,
|
decoded: bool,
|
||||||
last_request_round: uint,
|
last_request_round: uint,
|
||||||
|
@ -133,7 +133,7 @@ impl LocalImageCache {
|
||||||
return port;
|
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 state = do self.state_map.find_or_insert_with(url.clone()) |_| {
|
||||||
let new_state = @mut ImageState {
|
let new_state = @mut ImageState {
|
||||||
prefetched: false,
|
prefetched: false,
|
||||||
|
|
|
@ -3935,7 +3935,7 @@ class CGDOMJSProxyHandler_obj_toString(CGAbstractExternMethod):
|
||||||
JSString* jsresult;
|
JSString* jsresult;
|
||||||
return xpc_qsStringToJsstring(cx, result, &jsresult) ? jsresult : NULL;"""
|
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)
|
_obj_toString(cx, s)
|
||||||
}""" % self.descriptor.name
|
}""" % self.descriptor.name
|
||||||
|
|
||||||
|
@ -4461,9 +4461,9 @@ class CGDictionary(CGThing):
|
||||||
# NOTE: jsids are per-runtime, so don't use them in workers
|
# 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
|
if True or self.workers: #XXXjdm hack until 'static mut' exists for global jsids
|
||||||
propName = member.identifier.name
|
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)
|
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)
|
propName)
|
||||||
else:
|
else:
|
||||||
propId = self.makeIdName(member.identifier.name);
|
propId = self.makeIdName(member.identifier.name);
|
||||||
|
|
|
@ -54,7 +54,7 @@ pub extern fn trace(tracer: *mut JSTracer, obj: *JSObject) {
|
||||||
unsafe {
|
unsafe {
|
||||||
(*tracer).debugPrinter = ptr::null();
|
(*tracer).debugPrinter = ptr::null();
|
||||||
(*tracer).debugPrintIndex = -1;
|
(*tracer).debugPrintIndex = -1;
|
||||||
do name.as_c_str |name| {
|
do name.to_c_str().with_ref |name| {
|
||||||
(*tracer).debugPrintArg = name as *libc::c_void;
|
(*tracer).debugPrintArg = name as *libc::c_void;
|
||||||
JS_CallTracer(cast::transmute(tracer), wrapper, JSTRACE_OBJECT as u32);
|
JS_CallTracer(cast::transmute(tracer), wrapper, JSTRACE_OBJECT as u32);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
pub fn _obj_toString(cx: *JSContext, className: *libc::c_char) -> *JSString {
|
||||||
unsafe {
|
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 nchars = "[object ]".len() + name.len();
|
||||||
let chars: *mut jschar = cast::transmute(JS_malloc(cx, (nchars + 1) as u64 * (size_of::<jschar>() as u64)));
|
let chars: *mut jschar = cast::transmute(JS_malloc(cx, (nchars + 1) as u64 * (size_of::<jschar>() as u64)));
|
||||||
if chars.is_null() {
|
if chars.is_null() {
|
||||||
|
|
|
@ -202,7 +202,7 @@ pub fn jsval_to_str(cx: *JSContext, v: JSVal) -> Result<~str, ()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let strbuf = JS_EncodeString(cx, jsstr);
|
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);
|
JS_free(cx, strbuf as *libc::c_void);
|
||||||
Ok(buf)
|
Ok(buf)
|
||||||
}
|
}
|
||||||
|
@ -454,7 +454,7 @@ pub fn CreateInterfaceObjects2(cx: *JSContext, global: *JSObject, receiver: *JSO
|
||||||
|
|
||||||
let mut interface = ptr::null();
|
let mut interface = ptr::null();
|
||||||
if constructorClass.is_not_null() || constructor.is_not_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,
|
CreateInterfaceObject(cx, global, receiver, constructorClass,
|
||||||
constructor, ctorNargs, proto,
|
constructor, ctorNargs, proto,
|
||||||
staticMethods, constants, s)
|
staticMethods, constants, s)
|
||||||
|
@ -506,7 +506,7 @@ fn CreateInterfaceObject(cx: *JSContext, global: *JSObject, receiver: *JSObject,
|
||||||
}
|
}
|
||||||
|
|
||||||
if constructorClass.is_not_null() {
|
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,
|
DefineFunctionWithReserved(cx, constructor, s,
|
||||||
InterfaceObjectToString,
|
InterfaceObjectToString,
|
||||||
0, 0)
|
0, 0)
|
||||||
|
|
|
@ -115,7 +115,7 @@ impl Document {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WrappableDocument for 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
|
self.wrap_object_shared(cx, ptr::null()); //XXXjdm a proper scope would be nice
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ impl HTMLDocument {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WrappableDocument for 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
|
self.wrap_object_shared(cx, ptr::null()); //XXXjdm a proper scope would be nice
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -463,7 +463,7 @@ impl<'self, View> AbstractNode<View> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<View> Iterator<AbstractNode<View>> for AbstractNodeChildrenIterator<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;
|
let node = self.current_node;
|
||||||
self.current_node = self.current_node.chain(|node| node.next_sibling());
|
self.current_node = self.current_node.chain(|node| node.next_sibling());
|
||||||
node
|
node
|
||||||
|
|
|
@ -62,7 +62,7 @@ impl DocumentDamageLevel {
|
||||||
///
|
///
|
||||||
/// FIXME(pcwalton): This could be refactored to use `max` and the `Ord` trait, and this
|
/// FIXME(pcwalton): This could be refactored to use `max` and the `Ord` trait, and this
|
||||||
/// function removed.
|
/// function removed.
|
||||||
fn add(&mut self, new_damage: DocumentDamageLevel) {
|
pub fn add(&mut self, new_damage: DocumentDamageLevel) {
|
||||||
match (*self, new_damage) {
|
match (*self, new_damage) {
|
||||||
(ReflowDocumentDamage, new_damage) => *self = new_damage,
|
(ReflowDocumentDamage, new_damage) => *self = new_damage,
|
||||||
(MatchSelectorsDocumentDamage, _) => *self = MatchSelectorsDocumentDamage,
|
(MatchSelectorsDocumentDamage, _) => *self = MatchSelectorsDocumentDamage,
|
||||||
|
|
|
@ -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
|
// if the node's element is "a," load url from href attr
|
||||||
let attr = element.get_attr("href");
|
let attr = element.get_attr("href");
|
||||||
for href in attr.iter() {
|
for href in attr.iter() {
|
||||||
|
|
|
@ -70,7 +70,7 @@ impl ProfilerCategory {
|
||||||
|
|
||||||
// enumeration of all ProfilerCategory types
|
// enumeration of all ProfilerCategory types
|
||||||
// TODO(tkuehn): is there a better way to ensure proper order of categories?
|
// TODO(tkuehn): is there a better way to ensure proper order of categories?
|
||||||
priv fn empty_buckets() -> ProfilerBuckets {
|
fn empty_buckets() -> ProfilerBuckets {
|
||||||
let buckets = [
|
let buckets = [
|
||||||
(CompositingCategory, ~[]),
|
(CompositingCategory, ~[]),
|
||||||
(LayoutQueryCategory, ~[]),
|
(LayoutQueryCategory, ~[]),
|
||||||
|
@ -92,7 +92,7 @@ impl ProfilerCategory {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure that the order of the buckets matches the order of the enum categories
|
// 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() {
|
for &(category, _) in vec.iter() {
|
||||||
if category != vec[category as uint].first() {
|
if category != vec[category as uint].first() {
|
||||||
fail!("Enum category does not match bucket index. This is a bug.");
|
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 {
|
match msg {
|
||||||
TimeMsg(category, t) => match self.buckets[category as uint] {
|
TimeMsg(category, t) => match self.buckets[category as uint] {
|
||||||
//TODO(tkuehn): would be nice to have tuple.second_mut()
|
//TODO(tkuehn): would be nice to have tuple.second_mut()
|
||||||
|
@ -151,7 +151,7 @@ impl Profiler {
|
||||||
self.last_msg = Some(msg);
|
self.last_msg = Some(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
priv fn print_buckets(&mut self) {
|
fn print_buckets(&mut self) {
|
||||||
println(fmt!("%31s %15s %15s %15s %15s %15s",
|
println(fmt!("%31s %15s %15s %15s %15s %15s",
|
||||||
"_category_", "_mean (ms)_", "_median (ms)_",
|
"_category_", "_mean (ms)_", "_median (ms)_",
|
||||||
"_min (ms)_", "_max (ms)_", "_bucket size_"));
|
"_min (ms)_", "_max (ms)_", "_bucket size_"));
|
||||||
|
@ -163,7 +163,7 @@ impl Profiler {
|
||||||
let data_len = data.len();
|
let data_len = data.len();
|
||||||
if data_len > 0 {
|
if data_len > 0 {
|
||||||
let (mean, median, &min, &max) =
|
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[data_len / 2],
|
||||||
data.iter().min().unwrap(),
|
data.iter().min().unwrap(),
|
||||||
data.iter().max().unwrap());
|
data.iter().max().unwrap());
|
||||||
|
|
|
@ -7,13 +7,13 @@
|
||||||
// Macros to make add_child etc. less painful to write.
|
// Macros to make add_child etc. less painful to write.
|
||||||
// Code outside this module should instead implement TreeNode
|
// Code outside this module should instead implement TreeNode
|
||||||
// and use its default methods.
|
// and use its default methods.
|
||||||
priv macro_rules! get(
|
macro_rules! get(
|
||||||
($node:expr, $fun:ident) => (
|
($node:expr, $fun:ident) => (
|
||||||
TreeNodeRef::$fun::<Node,Self>($node)
|
TreeNodeRef::$fun::<Node,Self>($node)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
priv macro_rules! set(
|
macro_rules! set(
|
||||||
($node:expr, $fun:ident, $val:expr) => (
|
($node:expr, $fun:ident, $val:expr) => (
|
||||||
TreeNodeRef::$fun::<Node,Self>($node, $val)
|
TreeNodeRef::$fun::<Node,Self>($node, $val)
|
||||||
)
|
)
|
||||||
|
@ -44,7 +44,7 @@ pub struct TreeIterator<Ref> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Ref> TreeIterator<Ref> {
|
impl<Ref> TreeIterator<Ref> {
|
||||||
priv fn new(nodes: ~[Ref]) -> TreeIterator<Ref> {
|
fn new(nodes: ~[Ref]) -> TreeIterator<Ref> {
|
||||||
TreeIterator {
|
TreeIterator {
|
||||||
nodes: nodes,
|
nodes: nodes,
|
||||||
index: 0,
|
index: 0,
|
||||||
|
@ -220,7 +220,7 @@ pub trait TreeNodeRef<Node>: Clone {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
priv fn gather<Node, Ref: TreeNodeRef<Node>>(cur: &Ref, refs: &mut ~[Ref],
|
fn gather<Node, Ref: TreeNodeRef<Node>>(cur: &Ref, refs: &mut ~[Ref],
|
||||||
postorder: bool, prune: &fn(&Ref) -> bool) {
|
postorder: bool, prune: &fn(&Ref) -> bool) {
|
||||||
// prune shouldn't mutate, so don't clone
|
// prune shouldn't mutate, so don't clone
|
||||||
if prune(cur) {
|
if prune(cur) {
|
||||||
|
|
|
@ -43,7 +43,7 @@ pub fn make_url(str_url: ~str, current_url: Option<Url>) -> Url {
|
||||||
path.push(p.to_str());
|
path.push(p.to_str());
|
||||||
}
|
}
|
||||||
let path = path.init();
|
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);
|
path.push(str_url);
|
||||||
let path = path.connect("/");
|
let path = path.connect("/");
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 68875af396cb583e670dd5caad99431dac62f8db
|
Subproject commit 4e9340d2549d0f62468254809b59d833c2e82595
|
|
@ -1 +1 @@
|
||||||
Subproject commit 113e2c37ad772511c473010c4d944459689778a8
|
Subproject commit 4e883bc2754d9d3b1ba21baa0603dd43b093cffd
|
|
@ -1 +1 @@
|
||||||
Subproject commit 1c5e9e74b2857c254a8a0743747bffab6c059331
|
Subproject commit b66cc67a1fa0a5a85eefdb0073d29e410f34f1f2
|
|
@ -1 +1 @@
|
||||||
Subproject commit fc4a1cc0ff62aba5a32a66eee5dc087f11daa552
|
Subproject commit 3e2179942cb679a4f08c81674f4f8e4777f88cff
|
|
@ -1 +1 @@
|
||||||
Subproject commit 5b9a447946b736802a0791eb1c24687849ad3984
|
Subproject commit 690f9062746e1fed5e0f027acc1b095db6b50c6f
|
|
@ -1 +1 @@
|
||||||
Subproject commit 6d634549f24c87629cfa3401159b67a5766d5b67
|
Subproject commit 41e63b6856b21ee21549dcb98618404d088513bc
|
|
@ -1 +1 @@
|
||||||
Subproject commit 4c6a69ad0f074d4e03cd25d8cf753e8559712c3e
|
Subproject commit 065db559d51051bd786836e2aba9c0bef4031ad7
|
|
@ -1 +1 @@
|
||||||
Subproject commit cbd5e01469797b5f12df6679ff11365a3d4c34d5
|
Subproject commit e036183e152542cb2080e5b098b66efce1decf5a
|
|
@ -1 +1 @@
|
||||||
Subproject commit 93df6bd75c5ecd13855ea73be83d3c9a2d5d9d03
|
Subproject commit 9ea9b1411e0b98358c757e27eb026aac2c5948b2
|
|
@ -1 +1 @@
|
||||||
Subproject commit 795d0d6e5a9c8645f738d36111ef23021e646870
|
Subproject commit 69de03ef7e447d22593eb3e405257b07ff38aa71
|
|
@ -1 +1 @@
|
||||||
Subproject commit 8850fa10cdea9218be0fb470a6de3691766fa094
|
Subproject commit 73f46084428a37021e7d0d77daaa7b8a18fface3
|
|
@ -1 +1 @@
|
||||||
Subproject commit f634f6c5e6de7c3ef4ad62f28d36ea94e782b095
|
Subproject commit f19be6340c2d3fa9a12a53889ba5021a8f155073
|
|
@ -1 +1 @@
|
||||||
Subproject commit d9854ec23b9c6348c0b3fef38fe1890124391b8b
|
Subproject commit ae5fe3138298d276656715f5fdef021ce0a98c99
|
|
@ -1 +1 @@
|
||||||
Subproject commit 14a02310b547ee91126c0761b041be04edacd7da
|
Subproject commit caa31c98eee0334b5881f6ced37ccee4eba7d28c
|
Loading…
Add table
Add a link
Reference in a new issue