mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Update Rust.
This commit is contained in:
parent
3644d0272c
commit
eaedeb07cb
184 changed files with 643 additions and 657 deletions
|
@ -1,8 +1,9 @@
|
||||||
config = {
|
config = {
|
||||||
'mock_target': 'mozilla-centos6-x86_64',
|
'mock_target': 'mozilla-centos6-x86_64',
|
||||||
'mock_packages': ['freetype-devel', 'fontconfig-devel', 'glib2-devel', 'autoconf213', 'git', 'make', 'libX11-devel', 'mesa-libGL-devel', 'freeglut-devel',
|
'mock_packages': ['freetype-devel', 'fontconfig-devel', 'glib2-devel', 'autoconf213', 'git', 'make', 'libX11-devel', 'mesa-libGL-devel', 'freeglut-devel',
|
||||||
'xorg-x11-server-devel', 'libXrandr-devel', 'libXi-devel', 'libpng-devel', 'expat-devel', 'gperf'],
|
'xorg-x11-server-devel', 'libXrandr-devel', 'libXi-devel', 'libpng-devel', 'expat-devel', 'gperf', 'gcc473_0moz1'],
|
||||||
'mock_files': [('/home/servobld/.ssh', '/home/mock_mozilla/.ssh')],
|
'mock_files': [('/home/servobld/.ssh', '/home/mock_mozilla/.ssh')],
|
||||||
'concurrency': 6,
|
'concurrency': 6,
|
||||||
'add_actions': ['setup-mock'],
|
'add_actions': ['setup-mock'],
|
||||||
|
'env': {'PATH': '/tools/gcc-4.7.3-0moz1/bin:%(PATH)s'},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 5099b8c863150675450631347436b7d220f4efd3
|
Subproject commit aa6725407ae0a2cb88458e147e76adf8bcae0961
|
|
@ -1,4 +1,4 @@
|
||||||
# If this file is modified, then rust will be forcibly cleaned and then rebuilt.
|
# If this file is modified, then rust will be forcibly cleaned and then rebuilt.
|
||||||
# The actual contents of this file do not matter, but to trigger a change on the
|
# The actual contents of this file do not matter, but to trigger a change on the
|
||||||
# build bots then the contents should be changed so git updates the mtime.
|
# build bots then the contents should be changed so git updates the mtime.
|
||||||
2014-04-10b
|
2014-05-08
|
||||||
|
|
|
@ -111,7 +111,7 @@ impl StackingContext {
|
||||||
|
|
||||||
for item in list.move_iter() {
|
for item in list.move_iter() {
|
||||||
match item {
|
match item {
|
||||||
ClipDisplayItemClass(~ClipDisplayItem {
|
ClipDisplayItemClass(box ClipDisplayItem {
|
||||||
base: base,
|
base: base,
|
||||||
children: sublist
|
children: sublist
|
||||||
}) => {
|
}) => {
|
||||||
|
@ -168,7 +168,7 @@ impl StackingContext {
|
||||||
let push = |destination: &mut DisplayList, source: DisplayList, level| {
|
let push = |destination: &mut DisplayList, source: DisplayList, level| {
|
||||||
if !source.is_empty() {
|
if !source.is_empty() {
|
||||||
let base = BaseDisplayItem::new(*clip_rect, clipping_dom_node, level);
|
let base = BaseDisplayItem::new(*clip_rect, clipping_dom_node, level);
|
||||||
destination.push(ClipDisplayItemClass(~ClipDisplayItem::new(base, source)))
|
destination.push(ClipDisplayItemClass(box ClipDisplayItem::new(base, source)))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -332,19 +332,19 @@ impl DisplayList {
|
||||||
|
|
||||||
/// One drawing command in the list.
|
/// One drawing command in the list.
|
||||||
pub enum DisplayItem {
|
pub enum DisplayItem {
|
||||||
SolidColorDisplayItemClass(~SolidColorDisplayItem),
|
SolidColorDisplayItemClass(Box<SolidColorDisplayItem>),
|
||||||
TextDisplayItemClass(~TextDisplayItem),
|
TextDisplayItemClass(Box<TextDisplayItem>),
|
||||||
ImageDisplayItemClass(~ImageDisplayItem),
|
ImageDisplayItemClass(Box<ImageDisplayItem>),
|
||||||
BorderDisplayItemClass(~BorderDisplayItem),
|
BorderDisplayItemClass(Box<BorderDisplayItem>),
|
||||||
LineDisplayItemClass(~LineDisplayItem),
|
LineDisplayItemClass(Box<LineDisplayItem>),
|
||||||
ClipDisplayItemClass(~ClipDisplayItem),
|
ClipDisplayItemClass(Box<ClipDisplayItem>),
|
||||||
|
|
||||||
/// A pseudo-display item that exists only so that queries like `ContentBoxQuery` and
|
/// A pseudo-display item that exists only so that queries like `ContentBoxQuery` and
|
||||||
/// `ContentBoxesQuery` can be answered.
|
/// `ContentBoxesQuery` can be answered.
|
||||||
///
|
///
|
||||||
/// FIXME(pcwalton): This is really bogus. Those queries should not consult the display list
|
/// FIXME(pcwalton): This is really bogus. Those queries should not consult the display list
|
||||||
/// but should instead consult the flow/box tree.
|
/// but should instead consult the flow/box tree.
|
||||||
PseudoDisplayItemClass(~BaseDisplayItem),
|
PseudoDisplayItemClass(Box<BaseDisplayItem>),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Information common to all display items.
|
/// Information common to all display items.
|
||||||
|
@ -393,7 +393,7 @@ pub struct TextDisplayItem {
|
||||||
pub base: BaseDisplayItem,
|
pub base: BaseDisplayItem,
|
||||||
|
|
||||||
/// The text run.
|
/// The text run.
|
||||||
pub text_run: Arc<~TextRun>,
|
pub text_run: Arc<Box<TextRun>>,
|
||||||
|
|
||||||
/// The range of text within the text run.
|
/// The range of text within the text run.
|
||||||
pub range: Range<CharIndex>,
|
pub range: Range<CharIndex>,
|
||||||
|
@ -408,7 +408,7 @@ pub struct TextDisplayItem {
|
||||||
/// Renders an image.
|
/// Renders an image.
|
||||||
pub struct ImageDisplayItem {
|
pub struct ImageDisplayItem {
|
||||||
pub base: BaseDisplayItem,
|
pub base: BaseDisplayItem,
|
||||||
pub image: Arc<~Image>,
|
pub image: Arc<Box<Image>>,
|
||||||
|
|
||||||
/// The dimensions to which the image display item should be stretched. If this is smaller than
|
/// The dimensions to which the image display item should be stretched. If this is smaller than
|
||||||
/// the bounds of this display item, then the image will be repeated in the appropriate
|
/// the bounds of this display item, then the image will be repeated in the appropriate
|
||||||
|
@ -631,7 +631,7 @@ impl DisplayItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn debug_with_level(&self, level: uint) {
|
pub fn debug_with_level(&self, level: uint) {
|
||||||
let mut indent = "".to_owned();
|
let mut indent = StrBuf::new();
|
||||||
for _ in range(0, level) {
|
for _ in range(0, level) {
|
||||||
indent.push_str("| ")
|
indent.push_str("| ")
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,10 +217,9 @@ impl<'a> Font {
|
||||||
backend: BackendType)
|
backend: BackendType)
|
||||||
-> Result<Rc<RefCell<Font>>, ()> {
|
-> Result<Rc<RefCell<Font>>, ()> {
|
||||||
let handle = FontHandleMethods::new_from_buffer(&ctx.handle, buffer, style);
|
let handle = FontHandleMethods::new_from_buffer(&ctx.handle, buffer, style);
|
||||||
let handle: FontHandle = if handle.is_ok() {
|
let handle: FontHandle = match handle {
|
||||||
handle.unwrap()
|
Ok(handle) => handle,
|
||||||
} else {
|
Err(()) => return Err(()),
|
||||||
return Err(handle.unwrap_err());
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let metrics = handle.get_metrics();
|
let metrics = handle.get_metrics();
|
||||||
|
@ -329,7 +328,7 @@ impl<'a> Font {
|
||||||
impl Font {
|
impl Font {
|
||||||
pub fn draw_text_into_context(&mut self,
|
pub fn draw_text_into_context(&mut self,
|
||||||
rctx: &RenderContext,
|
rctx: &RenderContext,
|
||||||
run: &~TextRun,
|
run: &Box<TextRun>,
|
||||||
range: &Range<CharIndex>,
|
range: &Range<CharIndex>,
|
||||||
baseline_origin: Point2D<Au>,
|
baseline_origin: Point2D<Au>,
|
||||||
color: Color) {
|
color: Color) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ use sync::Arc;
|
||||||
|
|
||||||
pub struct RenderContext<'a> {
|
pub struct RenderContext<'a> {
|
||||||
pub draw_target: &'a DrawTarget,
|
pub draw_target: &'a DrawTarget,
|
||||||
pub font_ctx: &'a mut ~FontContext,
|
pub font_ctx: &'a mut Box<FontContext>,
|
||||||
pub opts: &'a Opts,
|
pub opts: &'a Opts,
|
||||||
/// The rectangle that this context encompasses in page coordinates.
|
/// The rectangle that this context encompasses in page coordinates.
|
||||||
pub page_rect: Rect<f32>,
|
pub page_rect: Rect<f32>,
|
||||||
|
@ -98,7 +98,7 @@ impl<'a> RenderContext<'a> {
|
||||||
self.draw_target.pop_clip();
|
self.draw_target.pop_clip();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn draw_image(&self, bounds: Rect<Au>, image: Arc<~Image>) {
|
pub fn draw_image(&self, bounds: Rect<Au>, image: Arc<Box<Image>>) {
|
||||||
let size = Size2D(image.width as i32, image.height as i32);
|
let size = Size2D(image.width as i32, image.height as i32);
|
||||||
let pixel_width = match image.color_type {
|
let pixel_width = match image.color_type {
|
||||||
RGBA8 => 4,
|
RGBA8 => 4,
|
||||||
|
|
|
@ -30,7 +30,7 @@ use servo_util::time;
|
||||||
use servo_util::task::send_on_failure;
|
use servo_util::task::send_on_failure;
|
||||||
|
|
||||||
use std::comm::{channel, Receiver, Sender};
|
use std::comm::{channel, Receiver, Sender};
|
||||||
use std::task;
|
use std::task::TaskBuilder;
|
||||||
use sync::Arc;
|
use sync::Arc;
|
||||||
|
|
||||||
/// Information about a layer that layout sends to the painting task.
|
/// Information about a layer that layout sends to the painting task.
|
||||||
|
@ -50,7 +50,7 @@ pub struct RenderLayer {
|
||||||
pub enum Msg {
|
pub enum Msg {
|
||||||
RenderMsg(SmallVec1<RenderLayer>),
|
RenderMsg(SmallVec1<RenderLayer>),
|
||||||
ReRenderMsg(Vec<BufferRequest>, f32, LayerId, Epoch),
|
ReRenderMsg(Vec<BufferRequest>, f32, LayerId, Epoch),
|
||||||
UnusedBufferMsg(Vec<~LayerBuffer>),
|
UnusedBufferMsg(Vec<Box<LayerBuffer>>),
|
||||||
PaintPermissionGranted,
|
PaintPermissionGranted,
|
||||||
PaintPermissionRevoked,
|
PaintPermissionRevoked,
|
||||||
ExitMsg(Option<Sender<()>>),
|
ExitMsg(Option<Sender<()>>),
|
||||||
|
@ -96,11 +96,11 @@ impl RenderChan {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send(&self, msg: Msg) {
|
pub fn send(&self, msg: Msg) {
|
||||||
assert!(self.try_send(msg), "RenderChan.send: render port closed")
|
assert!(self.send_opt(msg).is_ok(), "RenderChan.send: render port closed")
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn try_send(&self, msg: Msg) -> bool {
|
pub fn send_opt(&self, msg: Msg) -> Result<(), Msg> {
|
||||||
self.chan.try_send(msg)
|
self.chan.send_opt(msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ pub struct RenderTask<C> {
|
||||||
port: Receiver<Msg>,
|
port: Receiver<Msg>,
|
||||||
compositor: C,
|
compositor: C,
|
||||||
constellation_chan: ConstellationChan,
|
constellation_chan: ConstellationChan,
|
||||||
font_ctx: ~FontContext,
|
font_ctx: Box<FontContext>,
|
||||||
opts: Opts,
|
opts: Opts,
|
||||||
|
|
||||||
/// A channel to the profiler.
|
/// A channel to the profiler.
|
||||||
|
@ -138,7 +138,7 @@ pub struct RenderTask<C> {
|
||||||
epoch: Epoch,
|
epoch: Epoch,
|
||||||
|
|
||||||
/// A data structure to store unused LayerBuffers
|
/// A data structure to store unused LayerBuffers
|
||||||
buffer_map: BufferMap<~LayerBuffer>,
|
buffer_map: BufferMap<Box<LayerBuffer>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we implement this as a function, we get borrowck errors from borrowing
|
// If we implement this as a function, we get borrowck errors from borrowing
|
||||||
|
@ -174,7 +174,7 @@ impl<C: RenderListener + Send> RenderTask<C> {
|
||||||
opts: Opts,
|
opts: Opts,
|
||||||
profiler_chan: ProfilerChan,
|
profiler_chan: ProfilerChan,
|
||||||
shutdown_chan: Sender<()>) {
|
shutdown_chan: Sender<()>) {
|
||||||
let mut builder = task::task().named("RenderTask");
|
let mut builder = TaskBuilder::new().named("RenderTask");
|
||||||
let ConstellationChan(c) = constellation_chan.clone();
|
let ConstellationChan(c) = constellation_chan.clone();
|
||||||
send_on_failure(&mut builder, FailureMsg(failure_msg), c);
|
send_on_failure(&mut builder, FailureMsg(failure_msg), c);
|
||||||
builder.spawn(proc() {
|
builder.spawn(proc() {
|
||||||
|
@ -190,7 +190,7 @@ impl<C: RenderListener + Send> RenderTask<C> {
|
||||||
port: port,
|
port: port,
|
||||||
compositor: compositor,
|
compositor: compositor,
|
||||||
constellation_chan: constellation_chan,
|
constellation_chan: constellation_chan,
|
||||||
font_ctx: ~FontContext::new(FontContextInfo {
|
font_ctx: box FontContext::new(FontContextInfo {
|
||||||
backend: opts.render_backend.clone(),
|
backend: opts.render_backend.clone(),
|
||||||
needs_font_list: false,
|
needs_font_list: false,
|
||||||
profiler_chan: profiler_chan.clone(),
|
profiler_chan: profiler_chan.clone(),
|
||||||
|
@ -382,7 +382,7 @@ impl<C: RenderListener + Send> RenderTask<C> {
|
||||||
width as i32 * 4);
|
width as i32 * 4);
|
||||||
native_surface.mark_wont_leak();
|
native_surface.mark_wont_leak();
|
||||||
|
|
||||||
~LayerBuffer {
|
box LayerBuffer {
|
||||||
native_surface: native_surface,
|
native_surface: native_surface,
|
||||||
rect: tile.page_rect,
|
rect: tile.page_rect,
|
||||||
screen_pos: tile.screen_rect,
|
screen_pos: tile.screen_rect,
|
||||||
|
@ -412,7 +412,7 @@ impl<C: RenderListener + Send> RenderTask<C> {
|
||||||
NativeSurfaceAzureMethods::from_azure_surface(native_surface);
|
NativeSurfaceAzureMethods::from_azure_surface(native_surface);
|
||||||
native_surface.mark_wont_leak();
|
native_surface.mark_wont_leak();
|
||||||
|
|
||||||
~LayerBuffer {
|
box LayerBuffer {
|
||||||
native_surface: native_surface,
|
native_surface: native_surface,
|
||||||
rect: tile.page_rect,
|
rect: tile.page_rect,
|
||||||
screen_pos: tile.screen_rect,
|
screen_pos: tile.screen_rect,
|
||||||
|
@ -425,7 +425,7 @@ impl<C: RenderListener + Send> RenderTask<C> {
|
||||||
new_buffers.push(buffer);
|
new_buffers.push(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
let layer_buffer_set = ~LayerBufferSet {
|
let layer_buffer_set = box LayerBufferSet {
|
||||||
buffers: new_buffers,
|
buffers: new_buffers,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ use std::cmp::{Ord, Eq};
|
||||||
use std::num::{NumCast, Zero};
|
use std::num::{NumCast, Zero};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::u16;
|
use std::u16;
|
||||||
use std::slice;
|
use std::vec::Vec;
|
||||||
use geom::point::Point2D;
|
use geom::point::Point2D;
|
||||||
|
|
||||||
/// GlyphEntry is a port of Gecko's CompressedGlyph scheme for storing glyph data compactly.
|
/// GlyphEntry is a port of Gecko's CompressedGlyph scheme for storing glyph data compactly.
|
||||||
|
@ -587,13 +587,13 @@ impl<'a> GlyphStore {
|
||||||
let entry = match first_glyph_data.is_missing {
|
let entry = match first_glyph_data.is_missing {
|
||||||
true => GlyphEntry::missing(glyph_count),
|
true => GlyphEntry::missing(glyph_count),
|
||||||
false => {
|
false => {
|
||||||
let glyphs_vec = slice::from_fn(glyph_count as uint, |i| {
|
let glyphs_vec = Vec::from_fn(glyph_count as uint, |i| {
|
||||||
DetailedGlyph::new(data_for_glyphs[i].id,
|
DetailedGlyph::new(data_for_glyphs[i].id,
|
||||||
data_for_glyphs[i].advance,
|
data_for_glyphs[i].advance,
|
||||||
data_for_glyphs[i].offset)
|
data_for_glyphs[i].offset)
|
||||||
});
|
});
|
||||||
|
|
||||||
self.detail_store.add_detailed_glyphs_for_entry(i, glyphs_vec);
|
self.detail_store.add_detailed_glyphs_for_entry(i, glyphs_vec.as_slice());
|
||||||
GlyphEntry::complex(first_glyph_data.cluster_start,
|
GlyphEntry::complex(first_glyph_data.cluster_start,
|
||||||
first_glyph_data.ligature_start,
|
first_glyph_data.ligature_start,
|
||||||
glyph_count)
|
glyph_count)
|
||||||
|
|
|
@ -42,7 +42,6 @@ use std::cast::transmute;
|
||||||
use std::char;
|
use std::char;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::ptr::null;
|
use std::ptr::null;
|
||||||
use std::slice;
|
|
||||||
|
|
||||||
static NO_GLYPH: i32 = -1;
|
static NO_GLYPH: i32 = -1;
|
||||||
static CONTINUATION_BYTE: i32 = -2;
|
static CONTINUATION_BYTE: i32 = -2;
|
||||||
|
@ -243,15 +242,15 @@ impl Shaper {
|
||||||
}
|
}
|
||||||
|
|
||||||
// make map of what chars have glyphs
|
// make map of what chars have glyphs
|
||||||
let mut byteToGlyph: ~[i32];
|
let mut byteToGlyph: Vec<i32>;
|
||||||
|
|
||||||
// fast path: all chars are single-byte.
|
// fast path: all chars are single-byte.
|
||||||
if byte_max == char_max {
|
if byte_max == char_max {
|
||||||
byteToGlyph = slice::from_elem(byte_max as uint, NO_GLYPH);
|
byteToGlyph = Vec::from_elem(byte_max as uint, NO_GLYPH);
|
||||||
} else {
|
} else {
|
||||||
byteToGlyph = slice::from_elem(byte_max as uint, CONTINUATION_BYTE);
|
byteToGlyph = Vec::from_elem(byte_max as uint, CONTINUATION_BYTE);
|
||||||
for (i, _) in text.char_indices() {
|
for (i, _) in text.char_indices() {
|
||||||
byteToGlyph[i] = NO_GLYPH;
|
*byteToGlyph.get_mut(i) = NO_GLYPH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,8 +259,8 @@ impl Shaper {
|
||||||
// loc refers to a *byte* offset within the utf8 string.
|
// loc refers to a *byte* offset within the utf8 string.
|
||||||
let loc = glyph_data.byte_offset_of_glyph(i);
|
let loc = glyph_data.byte_offset_of_glyph(i);
|
||||||
if loc < byte_max {
|
if loc < byte_max {
|
||||||
assert!(byteToGlyph[loc as uint] != CONTINUATION_BYTE);
|
assert!(*byteToGlyph.get(loc as uint) != CONTINUATION_BYTE);
|
||||||
byteToGlyph[loc as uint] = i as i32;
|
*byteToGlyph.get_mut(loc as uint) = i as i32;
|
||||||
} else {
|
} else {
|
||||||
debug!("ERROR: tried to set out of range byteToGlyph: idx={}, glyph idx={}",
|
debug!("ERROR: tried to set out of range byteToGlyph: idx={}, glyph idx={}",
|
||||||
loc,
|
loc,
|
||||||
|
@ -273,7 +272,7 @@ impl Shaper {
|
||||||
debug!("text: {:s}", text);
|
debug!("text: {:s}", text);
|
||||||
debug!("(char idx): char->(glyph index):");
|
debug!("(char idx): char->(glyph index):");
|
||||||
for (i, ch) in text.char_indices() {
|
for (i, ch) in text.char_indices() {
|
||||||
debug!("{}: {} --> {:d}", i, ch, byteToGlyph[i] as int);
|
debug!("{}: {} --> {:d}", i, ch, *byteToGlyph.get(i) as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
// some helpers
|
// some helpers
|
||||||
|
@ -305,7 +304,7 @@ impl Shaper {
|
||||||
char_byte_span.begin(), char_byte_span.length(), glyph_span.begin());
|
char_byte_span.begin(), char_byte_span.length(), glyph_span.begin());
|
||||||
|
|
||||||
while char_byte_span.end() != byte_max &&
|
while char_byte_span.end() != byte_max &&
|
||||||
byteToGlyph[char_byte_span.end() as uint] == NO_GLYPH {
|
*byteToGlyph.get(char_byte_span.end() as uint) == NO_GLYPH {
|
||||||
debug!("Extending char byte span to include byte offset={} with no associated \
|
debug!("Extending char byte span to include byte offset={} with no associated \
|
||||||
glyph", char_byte_span.end());
|
glyph", char_byte_span.end());
|
||||||
let range = text.char_range_at(char_byte_span.end() as uint);
|
let range = text.char_range_at(char_byte_span.end() as uint);
|
||||||
|
@ -317,8 +316,8 @@ impl Shaper {
|
||||||
// in cases where one char made several glyphs and left some unassociated chars.
|
// in cases where one char made several glyphs and left some unassociated chars.
|
||||||
let mut max_glyph_idx = glyph_span.end();
|
let mut max_glyph_idx = glyph_span.end();
|
||||||
for i in char_byte_span.each_index() {
|
for i in char_byte_span.each_index() {
|
||||||
if byteToGlyph[i as uint] > NO_GLYPH {
|
if *byteToGlyph.get(i as uint) > NO_GLYPH {
|
||||||
max_glyph_idx = cmp::max(byteToGlyph[i as uint] as int + 1, max_glyph_idx);
|
max_glyph_idx = cmp::max(*byteToGlyph.get(i as uint) as int + 1, max_glyph_idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,7 +376,7 @@ impl Shaper {
|
||||||
let mut covered_byte_span = char_byte_span.clone();
|
let mut covered_byte_span = char_byte_span.clone();
|
||||||
// extend, clipping at end of text range.
|
// extend, clipping at end of text range.
|
||||||
while covered_byte_span.end() < byte_max
|
while covered_byte_span.end() < byte_max
|
||||||
&& byteToGlyph[covered_byte_span.end() as uint] == NO_GLYPH {
|
&& *byteToGlyph.get(covered_byte_span.end() as uint) == NO_GLYPH {
|
||||||
let range = text.char_range_at(covered_byte_span.end() as uint);
|
let range = text.char_range_at(covered_byte_span.end() as uint);
|
||||||
drop(range.ch);
|
drop(range.ch);
|
||||||
covered_byte_span.extend_to(range.next as int);
|
covered_byte_span.extend_to(range.next as int);
|
||||||
|
|
|
@ -25,7 +25,7 @@ pub enum CompressionMode {
|
||||||
pub fn transform_text(text: &str, mode: CompressionMode,
|
pub fn transform_text(text: &str, mode: CompressionMode,
|
||||||
incoming_whitespace: bool,
|
incoming_whitespace: bool,
|
||||||
new_line_pos: &mut Vec<CharIndex>) -> (~str, bool) {
|
new_line_pos: &mut Vec<CharIndex>) -> (~str, bool) {
|
||||||
let mut out_str: ~str = "".to_owned();
|
let mut out_str = StrBuf::new();
|
||||||
let out_whitespace = match mode {
|
let out_whitespace = match mode {
|
||||||
CompressNone | DiscardNewline => {
|
CompressNone | DiscardNewline => {
|
||||||
let mut new_line_index = CharIndex(0);
|
let mut new_line_index = CharIndex(0);
|
||||||
|
@ -82,7 +82,7 @@ pub fn transform_text(text: &str, mode: CompressionMode,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (out_str, out_whitespace);
|
return (out_str.into_owned(), out_whitespace);
|
||||||
|
|
||||||
fn is_in_whitespace(ch: char, mode: CompressionMode) -> bool {
|
fn is_in_whitespace(ch: char, mode: CompressionMode) -> bool {
|
||||||
match (ch, mode) {
|
match (ch, mode) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ macro_rules! lazy_init(
|
||||||
static mut s: *$T = 0 as *$T;
|
static mut s: *$T = 0 as *$T;
|
||||||
static mut ONCE: ::sync::one::Once = ::sync::one::ONCE_INIT;
|
static mut ONCE: ::sync::one::Once = ::sync::one::ONCE_INIT;
|
||||||
ONCE.doit(|| {
|
ONCE.doit(|| {
|
||||||
s = ::std::cast::transmute::<~$T, *$T>(~($e));
|
s = ::std::cast::transmute::<Box<$T>, *$T>(box () ($e));
|
||||||
});
|
});
|
||||||
&*s
|
&*s
|
||||||
}
|
}
|
||||||
|
@ -65,8 +65,8 @@ mod tests {
|
||||||
|
|
||||||
lazy_init! {
|
lazy_init! {
|
||||||
static ref NUMBER: uint = times_two(3);
|
static ref NUMBER: uint = times_two(3);
|
||||||
static ref VEC: [~uint, ..3] = [~1, ~2, ~3];
|
static ref VEC: [Box<uint>, ..3] = [box 1, box 2, box 3];
|
||||||
static ref OWNED_STRING: ~str = ~"hello";
|
static ref OWNED_STRING: ~str = "hello".to_owned();
|
||||||
static ref HASHMAP: collections::HashMap<uint, &'static str> = {
|
static ref HASHMAP: collections::HashMap<uint, &'static str> = {
|
||||||
let mut m = collections::HashMap::new();
|
let mut m = collections::HashMap::new();
|
||||||
m.insert(0u, "abc");
|
m.insert(0u, "abc");
|
||||||
|
@ -82,11 +82,11 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_basic() {
|
fn test_basic() {
|
||||||
assert_eq!(*OWNED_STRING, ~"hello");
|
assert_eq!(*OWNED_STRING, "hello".to_owned());
|
||||||
assert_eq!(*NUMBER, 6);
|
assert_eq!(*NUMBER, 6);
|
||||||
assert!(HASHMAP.find(&1).is_some());
|
assert!(HASHMAP.find(&1).is_some());
|
||||||
assert!(HASHMAP.find(&3).is_none());
|
assert!(HASHMAP.find(&3).is_none());
|
||||||
assert_eq!(VEC.as_slice(), &[~1, ~2, ~3]);
|
assert_eq!(VEC.as_slice(), &[box 1, box 2, box 3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -34,7 +34,6 @@ use servo_msg::constellation_msg;
|
||||||
use servo_util::opts::Opts;
|
use servo_util::opts::Opts;
|
||||||
use servo_util::time::{profile, ProfilerChan};
|
use servo_util::time::{profile, ProfilerChan};
|
||||||
use servo_util::{time, url};
|
use servo_util::{time, url};
|
||||||
use std::comm::{Empty, Disconnected, Data, Sender, Receiver};
|
|
||||||
use std::io::timer::sleep;
|
use std::io::timer::sleep;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
@ -219,8 +218,8 @@ impl IOCompositor {
|
||||||
// another task from finishing (i.e. SetIds)
|
// another task from finishing (i.e. SetIds)
|
||||||
loop {
|
loop {
|
||||||
match self.port.try_recv() {
|
match self.port.try_recv() {
|
||||||
Empty | Disconnected => break,
|
Err(_) => break,
|
||||||
Data(_) => {},
|
Ok(_) => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,11 +231,9 @@ impl IOCompositor {
|
||||||
fn handle_message(&mut self) {
|
fn handle_message(&mut self) {
|
||||||
loop {
|
loop {
|
||||||
match (self.port.try_recv(), self.shutting_down) {
|
match (self.port.try_recv(), self.shutting_down) {
|
||||||
(Empty, _) => break,
|
(Err(_), _) => break,
|
||||||
|
|
||||||
(Disconnected, _) => break,
|
(Ok(Exit(chan)), _) => {
|
||||||
|
|
||||||
(Data(Exit(chan)), _) => {
|
|
||||||
debug!("shutting down the constellation");
|
debug!("shutting down the constellation");
|
||||||
let ConstellationChan(ref con_chan) = self.constellation_chan;
|
let ConstellationChan(ref con_chan) = self.constellation_chan;
|
||||||
con_chan.send(ExitMsg);
|
con_chan.send(ExitMsg);
|
||||||
|
@ -244,38 +241,38 @@ impl IOCompositor {
|
||||||
self.shutting_down = true;
|
self.shutting_down = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
(Data(ShutdownComplete), _) => {
|
(Ok(ShutdownComplete), _) => {
|
||||||
debug!("constellation completed shutdown");
|
debug!("constellation completed shutdown");
|
||||||
self.done = true;
|
self.done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
(Data(ChangeReadyState(ready_state)), false) => {
|
(Ok(ChangeReadyState(ready_state)), false) => {
|
||||||
self.window.set_ready_state(ready_state);
|
self.window.set_ready_state(ready_state);
|
||||||
self.ready_state = ready_state;
|
self.ready_state = ready_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
(Data(ChangeRenderState(render_state)), false) => {
|
(Ok(ChangeRenderState(render_state)), false) => {
|
||||||
self.change_render_state(render_state);
|
self.change_render_state(render_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
(Data(SetUnRenderedColor(pipeline_id, layer_id, color)), false) => {
|
(Ok(SetUnRenderedColor(pipeline_id, layer_id, color)), false) => {
|
||||||
self.set_unrendered_color(pipeline_id, layer_id, color);
|
self.set_unrendered_color(pipeline_id, layer_id, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
(Data(SetIds(frame_tree, response_chan, new_constellation_chan)), _) => {
|
(Ok(SetIds(frame_tree, response_chan, new_constellation_chan)), _) => {
|
||||||
self.set_ids(frame_tree, response_chan, new_constellation_chan);
|
self.set_ids(frame_tree, response_chan, new_constellation_chan);
|
||||||
}
|
}
|
||||||
|
|
||||||
(Data(GetGraphicsMetadata(chan)), false) => {
|
(Ok(GetGraphicsMetadata(chan)), false) => {
|
||||||
chan.send(Some(azure_hl::current_graphics_metadata()));
|
chan.send(Some(azure_hl::current_graphics_metadata()));
|
||||||
}
|
}
|
||||||
|
|
||||||
(Data(CreateRootCompositorLayerIfNecessary(pipeline_id, layer_id, size)),
|
(Ok(CreateRootCompositorLayerIfNecessary(pipeline_id, layer_id, size)),
|
||||||
false) => {
|
false) => {
|
||||||
self.create_root_compositor_layer_if_necessary(pipeline_id, layer_id, size);
|
self.create_root_compositor_layer_if_necessary(pipeline_id, layer_id, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
(Data(CreateDescendantCompositorLayerIfNecessary(pipeline_id,
|
(Ok(CreateDescendantCompositorLayerIfNecessary(pipeline_id,
|
||||||
layer_id,
|
layer_id,
|
||||||
rect,
|
rect,
|
||||||
scroll_behavior)),
|
scroll_behavior)),
|
||||||
|
@ -286,27 +283,27 @@ impl IOCompositor {
|
||||||
scroll_behavior);
|
scroll_behavior);
|
||||||
}
|
}
|
||||||
|
|
||||||
(Data(SetLayerPageSize(pipeline_id, layer_id, new_size, epoch)), false) => {
|
(Ok(SetLayerPageSize(pipeline_id, layer_id, new_size, epoch)), false) => {
|
||||||
self.set_layer_page_size(pipeline_id, layer_id, new_size, epoch);
|
self.set_layer_page_size(pipeline_id, layer_id, new_size, epoch);
|
||||||
}
|
}
|
||||||
|
|
||||||
(Data(SetLayerClipRect(pipeline_id, layer_id, new_rect)), false) => {
|
(Ok(SetLayerClipRect(pipeline_id, layer_id, new_rect)), false) => {
|
||||||
self.set_layer_clip_rect(pipeline_id, layer_id, new_rect);
|
self.set_layer_clip_rect(pipeline_id, layer_id, new_rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
(Data(DeleteLayerGroup(id)), _) => {
|
(Ok(DeleteLayerGroup(id)), _) => {
|
||||||
self.delete_layer(id);
|
self.delete_layer(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
(Data(Paint(pipeline_id, layer_id, new_layer_buffer_set, epoch)), false) => {
|
(Ok(Paint(pipeline_id, layer_id, new_layer_buffer_set, epoch)), false) => {
|
||||||
self.paint(pipeline_id, layer_id, new_layer_buffer_set, epoch);
|
self.paint(pipeline_id, layer_id, new_layer_buffer_set, epoch);
|
||||||
}
|
}
|
||||||
|
|
||||||
(Data(ScrollFragmentPoint(pipeline_id, layer_id, point)), false) => {
|
(Ok(ScrollFragmentPoint(pipeline_id, layer_id, point)), false) => {
|
||||||
self.scroll_fragment_to_point(pipeline_id, layer_id, point);
|
self.scroll_fragment_to_point(pipeline_id, layer_id, point);
|
||||||
}
|
}
|
||||||
|
|
||||||
(Data(LoadComplete(..)), false) => {
|
(Ok(LoadComplete(..)), false) => {
|
||||||
self.load_complete = true;
|
self.load_complete = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -492,7 +489,7 @@ impl IOCompositor {
|
||||||
fn paint(&mut self,
|
fn paint(&mut self,
|
||||||
pipeline_id: PipelineId,
|
pipeline_id: PipelineId,
|
||||||
layer_id: LayerId,
|
layer_id: LayerId,
|
||||||
new_layer_buffer_set: ~LayerBufferSet,
|
new_layer_buffer_set: Box<LayerBufferSet>,
|
||||||
epoch: Epoch) {
|
epoch: Epoch) {
|
||||||
debug!("compositor received new frame");
|
debug!("compositor received new frame");
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ pub struct CompositorLayer {
|
||||||
/// Helper struct for keeping CompositorLayer children organized.
|
/// Helper struct for keeping CompositorLayer children organized.
|
||||||
pub struct CompositorLayerChild {
|
pub struct CompositorLayerChild {
|
||||||
/// The child itself.
|
/// The child itself.
|
||||||
pub child: ~CompositorLayer,
|
pub child: Box<CompositorLayer>,
|
||||||
/// A ContainerLayer managed by the parent node. This deals with clipping and
|
/// A ContainerLayer managed by the parent node. This deals with clipping and
|
||||||
/// positioning, and is added above the child's layer tree.
|
/// positioning, and is added above the child's layer tree.
|
||||||
pub container: Rc<ContainerLayer>,
|
pub container: Rc<ContainerLayer>,
|
||||||
|
@ -107,7 +107,7 @@ pub struct CompositorLayerChild {
|
||||||
/// Helper enum for storing quadtrees. Either contains a quadtree, or contains
|
/// Helper enum for storing quadtrees. Either contains a quadtree, or contains
|
||||||
/// information from which a quadtree can be built.
|
/// information from which a quadtree can be built.
|
||||||
enum MaybeQuadtree {
|
enum MaybeQuadtree {
|
||||||
Tree(Quadtree<~LayerBuffer>),
|
Tree(Quadtree<Box<LayerBuffer>>),
|
||||||
NoTree(uint, Option<uint>),
|
NoTree(uint, Option<uint>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,14 +253,14 @@ impl CompositorLayer {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut kid = ~CompositorLayer::new(self.pipeline.clone(),
|
let mut kid = box CompositorLayer::new(self.pipeline.clone(),
|
||||||
child_layer_id,
|
child_layer_id,
|
||||||
rect,
|
rect,
|
||||||
Some(page_size),
|
Some(page_size),
|
||||||
self.quadtree.tile_size(),
|
self.quadtree.tile_size(),
|
||||||
self.cpu_painting,
|
self.cpu_painting,
|
||||||
DoesntWantScrollEvents,
|
DoesntWantScrollEvents,
|
||||||
scroll_policy);
|
scroll_policy);
|
||||||
|
|
||||||
kid.hidden = false;
|
kid.hidden = false;
|
||||||
|
|
||||||
|
@ -406,13 +406,13 @@ impl CompositorLayer {
|
||||||
MouseWindowMouseUpEvent(button, _) => MouseUpEvent(button, cursor),
|
MouseWindowMouseUpEvent(button, _) => MouseUpEvent(button, cursor),
|
||||||
};
|
};
|
||||||
let ScriptChan(ref chan) = self.pipeline.script_chan;
|
let ScriptChan(ref chan) = self.pipeline.script_chan;
|
||||||
chan.try_send(SendEventMsg(self.pipeline.id.clone(), message));
|
chan.send_opt(SendEventMsg(self.pipeline.id.clone(), message));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send_mouse_move_event(&self, cursor: Point2D<f32>) {
|
pub fn send_mouse_move_event(&self, cursor: Point2D<f32>) {
|
||||||
let message = MouseMoveEvent(cursor);
|
let message = MouseMoveEvent(cursor);
|
||||||
let ScriptChan(ref chan) = self.pipeline.script_chan;
|
let ScriptChan(ref chan) = self.pipeline.script_chan;
|
||||||
chan.try_send(SendEventMsg(self.pipeline.id.clone(), message));
|
chan.send_opt(SendEventMsg(self.pipeline.id.clone(), message));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Given the current window size, determine which tiles need to be (re-)rendered and sends them
|
// Given the current window size, determine which tiles need to be (re-)rendered and sends them
|
||||||
|
@ -432,7 +432,7 @@ impl CompositorLayer {
|
||||||
redisplay = !unused.is_empty();
|
redisplay = !unused.is_empty();
|
||||||
if redisplay {
|
if redisplay {
|
||||||
// Send back unused tiles.
|
// Send back unused tiles.
|
||||||
self.pipeline.render_chan.try_send(UnusedBufferMsg(unused));
|
self.pipeline.render_chan.send_opt(UnusedBufferMsg(unused));
|
||||||
}
|
}
|
||||||
if !request.is_empty() {
|
if !request.is_empty() {
|
||||||
// Ask for tiles.
|
// Ask for tiles.
|
||||||
|
@ -440,7 +440,7 @@ impl CompositorLayer {
|
||||||
// FIXME(#2003, pcwalton): We may want to batch these up in the case in which
|
// FIXME(#2003, pcwalton): We may want to batch these up in the case in which
|
||||||
// one page has multiple layers, to avoid the user seeing inconsistent states.
|
// one page has multiple layers, to avoid the user seeing inconsistent states.
|
||||||
let msg = ReRenderMsg(request, scale, self.id, self.epoch);
|
let msg = ReRenderMsg(request, scale, self.id, self.epoch);
|
||||||
self.pipeline.render_chan.try_send(msg);
|
self.pipeline.render_chan.send_opt(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -550,7 +550,7 @@ impl CompositorLayer {
|
||||||
Tree(ref mut quadtree) => {
|
Tree(ref mut quadtree) => {
|
||||||
self.pipeline
|
self.pipeline
|
||||||
.render_chan
|
.render_chan
|
||||||
.try_send(UnusedBufferMsg(quadtree.resize(new_size.width as uint,
|
.send_opt(UnusedBufferMsg(quadtree.resize(new_size.width as uint,
|
||||||
new_size.height as uint)));
|
new_size.height as uint)));
|
||||||
}
|
}
|
||||||
NoTree(tile_size, max_mem) => {
|
NoTree(tile_size, max_mem) => {
|
||||||
|
@ -655,7 +655,7 @@ impl CompositorLayer {
|
||||||
child.page_size = Some(new_size);
|
child.page_size = Some(new_size);
|
||||||
match child.quadtree {
|
match child.quadtree {
|
||||||
Tree(ref mut quadtree) => {
|
Tree(ref mut quadtree) => {
|
||||||
child.pipeline.render_chan.try_send(UnusedBufferMsg(quadtree.resize(new_size.width as uint,
|
child.pipeline.render_chan.send_opt(UnusedBufferMsg(quadtree.resize(new_size.width as uint,
|
||||||
new_size.height as uint)));
|
new_size.height as uint)));
|
||||||
}
|
}
|
||||||
NoTree(tile_size, max_mem) => {
|
NoTree(tile_size, max_mem) => {
|
||||||
|
@ -801,9 +801,9 @@ impl CompositorLayer {
|
||||||
graphics_context: &NativeCompositingGraphicsContext,
|
graphics_context: &NativeCompositingGraphicsContext,
|
||||||
pipeline_id: PipelineId,
|
pipeline_id: PipelineId,
|
||||||
layer_id: LayerId,
|
layer_id: LayerId,
|
||||||
mut new_buffers: ~LayerBufferSet,
|
mut new_buffers: Box<LayerBufferSet>,
|
||||||
epoch: Epoch)
|
epoch: Epoch)
|
||||||
-> Option<~LayerBufferSet> {
|
-> Option<Box<LayerBufferSet>> {
|
||||||
debug!("compositor_layer: starting add_buffers()");
|
debug!("compositor_layer: starting add_buffers()");
|
||||||
if self.pipeline.id != pipeline_id || self.id != layer_id {
|
if self.pipeline.id != pipeline_id || self.id != layer_id {
|
||||||
// ID does not match ours, so recurse on descendents (including hidden children).
|
// ID does not match ours, so recurse on descendents (including hidden children).
|
||||||
|
@ -829,7 +829,7 @@ impl CompositorLayer {
|
||||||
self.epoch,
|
self.epoch,
|
||||||
epoch,
|
epoch,
|
||||||
self.pipeline.id);
|
self.pipeline.id);
|
||||||
self.pipeline.render_chan.try_send(UnusedBufferMsg(new_buffers.buffers));
|
self.pipeline.render_chan.send_opt(UnusedBufferMsg(new_buffers.buffers));
|
||||||
return None
|
return None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -849,7 +849,7 @@ impl CompositorLayer {
|
||||||
buffer));
|
buffer));
|
||||||
}
|
}
|
||||||
if !unused_tiles.is_empty() { // send back unused buffers
|
if !unused_tiles.is_empty() { // send back unused buffers
|
||||||
self.pipeline.render_chan.try_send(UnusedBufferMsg(unused_tiles));
|
self.pipeline.render_chan.send_opt(UnusedBufferMsg(unused_tiles));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -926,7 +926,7 @@ impl CompositorLayer {
|
||||||
tile.mark_wont_leak()
|
tile.mark_wont_leak()
|
||||||
}
|
}
|
||||||
|
|
||||||
self.pipeline.render_chan.try_send(UnusedBufferMsg(tiles));
|
self.pipeline.render_chan.send_opt(UnusedBufferMsg(tiles));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,8 +58,8 @@ impl ScriptListener for CompositorChan {
|
||||||
port.recv();
|
port.recv();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dup(&self) -> ~ScriptListener {
|
fn dup(&self) -> Box<ScriptListener> {
|
||||||
~self.clone() as ~ScriptListener
|
box self.clone() as Box<ScriptListener>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ impl RenderListener for CompositorChan {
|
||||||
fn paint(&self,
|
fn paint(&self,
|
||||||
pipeline_id: PipelineId,
|
pipeline_id: PipelineId,
|
||||||
layer_id: LayerId,
|
layer_id: LayerId,
|
||||||
layer_buffer_set: ~LayerBufferSet,
|
layer_buffer_set: Box<LayerBufferSet>,
|
||||||
epoch: Epoch) {
|
epoch: Epoch) {
|
||||||
self.chan.send(Paint(pipeline_id, layer_id, layer_buffer_set, epoch))
|
self.chan.send(Paint(pipeline_id, layer_id, layer_buffer_set, epoch))
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ pub enum Msg {
|
||||||
/// Scroll a page in a window
|
/// Scroll a page in a window
|
||||||
ScrollFragmentPoint(PipelineId, LayerId, Point2D<f32>),
|
ScrollFragmentPoint(PipelineId, LayerId, Point2D<f32>),
|
||||||
/// Requests that the compositor paint the given layer buffer set for the given page size.
|
/// Requests that the compositor paint the given layer buffer set for the given page size.
|
||||||
Paint(PipelineId, LayerId, ~LayerBufferSet, Epoch),
|
Paint(PipelineId, LayerId, Box<LayerBufferSet>, Epoch),
|
||||||
/// Alerts the compositor to the current status of page loading.
|
/// Alerts the compositor to the current status of page loading.
|
||||||
ChangeReadyState(ReadyState),
|
ChangeReadyState(ReadyState),
|
||||||
/// Alerts the compositor to the current status of rendering.
|
/// Alerts the compositor to the current status of rendering.
|
||||||
|
|
|
@ -6,7 +6,6 @@ use compositing::*;
|
||||||
|
|
||||||
use geom::size::Size2D;
|
use geom::size::Size2D;
|
||||||
use servo_msg::constellation_msg::{ConstellationChan, ExitMsg, ResizedWindowMsg};
|
use servo_msg::constellation_msg::{ConstellationChan, ExitMsg, ResizedWindowMsg};
|
||||||
use std::comm::{Empty, Disconnected, Data, Receiver};
|
|
||||||
use servo_util::time::ProfilerChan;
|
use servo_util::time::ProfilerChan;
|
||||||
use servo_util::time;
|
use servo_util::time;
|
||||||
|
|
||||||
|
@ -42,8 +41,8 @@ impl NullCompositor {
|
||||||
// another task from finishing (i.e. SetIds)
|
// another task from finishing (i.e. SetIds)
|
||||||
loop {
|
loop {
|
||||||
match compositor.port.try_recv() {
|
match compositor.port.try_recv() {
|
||||||
Empty | Disconnected => break,
|
Err(_) => break,
|
||||||
Data(_) => {},
|
Ok(_) => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,6 @@ use gfx::render_task::BufferRequest;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::mem::replace;
|
use std::mem::replace;
|
||||||
use std::num::next_power_of_two;
|
use std::num::next_power_of_two;
|
||||||
use std::slice;
|
|
||||||
use std::slice::build;
|
|
||||||
use servo_msg::compositor_msg::Tile;
|
use servo_msg::compositor_msg::Tile;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
@ -23,7 +21,7 @@ use layers::platform::surface::NativePaintingGraphicsContext;
|
||||||
/// at this level are in pixel coordinates.
|
/// at this level are in pixel coordinates.
|
||||||
pub struct Quadtree<T> {
|
pub struct Quadtree<T> {
|
||||||
// The root node of the quadtree
|
// The root node of the quadtree
|
||||||
pub root: ~QuadtreeNode<T>,
|
pub root: Box<QuadtreeNode<T>>,
|
||||||
// The size of the layer in pixels. Tiles will be clipped to this size.
|
// The size of the layer in pixels. Tiles will be clipped to this size.
|
||||||
// Note that the underlying quadtree has a potentailly larger size, since it is rounded
|
// Note that the underlying quadtree has a potentailly larger size, since it is rounded
|
||||||
// to the next highest power of two.
|
// to the next highest power of two.
|
||||||
|
@ -45,7 +43,7 @@ struct QuadtreeNode<T> {
|
||||||
/// The width and height of the node in page coordinates.
|
/// The width and height of the node in page coordinates.
|
||||||
pub size: f32,
|
pub size: f32,
|
||||||
/// The node's children.
|
/// The node's children.
|
||||||
pub quadrants: [Option<~QuadtreeNode<T>>, ..4],
|
pub quadrants: [Option<Box<QuadtreeNode<T>>>, ..4],
|
||||||
/// Combined size of self.tile and tiles of all descendants
|
/// Combined size of self.tile and tiles of all descendants
|
||||||
pub tile_mem: uint,
|
pub tile_mem: uint,
|
||||||
/// The current status of this node. See below for details.
|
/// The current status of this node. See below for details.
|
||||||
|
@ -92,7 +90,7 @@ impl<T: Tile> Quadtree<T> {
|
||||||
let size = power_of_two * tile_size;
|
let size = power_of_two * tile_size;
|
||||||
|
|
||||||
Quadtree {
|
Quadtree {
|
||||||
root: ~QuadtreeNode {
|
root: box QuadtreeNode {
|
||||||
tile: None,
|
tile: None,
|
||||||
origin: Point2D(0f32, 0f32),
|
origin: Point2D(0f32, 0f32),
|
||||||
size: size as f32,
|
size: size as f32,
|
||||||
|
@ -165,7 +163,7 @@ impl<T: Tile> Quadtree<T> {
|
||||||
let power_of_two = next_power_of_two(num_tiles);
|
let power_of_two = next_power_of_two(num_tiles);
|
||||||
let size = power_of_two * self.max_tile_size;
|
let size = power_of_two * self.max_tile_size;
|
||||||
let ret = self.root.collect_tiles();
|
let ret = self.root.collect_tiles();
|
||||||
self.root = ~QuadtreeNode {
|
self.root = box QuadtreeNode {
|
||||||
tile: None,
|
tile: None,
|
||||||
origin: Point2D(0f32, 0f32),
|
origin: Point2D(0f32, 0f32),
|
||||||
size: size as f32,
|
size: size as f32,
|
||||||
|
@ -193,7 +191,7 @@ impl<T: Tile> Quadtree<T> {
|
||||||
if difference > 0 { // doubling
|
if difference > 0 { // doubling
|
||||||
let difference = difference as uint;
|
let difference = difference as uint;
|
||||||
for i in range(0, difference) {
|
for i in range(0, difference) {
|
||||||
let new_root = ~QuadtreeNode {
|
let new_root = box QuadtreeNode {
|
||||||
tile: None,
|
tile: None,
|
||||||
origin: Point2D(0f32, 0f32),
|
origin: Point2D(0f32, 0f32),
|
||||||
size: new_size as f32 / ((difference - i - 1) as f32).exp2(),
|
size: new_size as f32 / ((difference - i - 1) as f32).exp2(),
|
||||||
|
@ -210,7 +208,7 @@ impl<T: Tile> Quadtree<T> {
|
||||||
match remove {
|
match remove {
|
||||||
Some(child) => self.root = child,
|
Some(child) => self.root = child,
|
||||||
None => {
|
None => {
|
||||||
self.root = ~QuadtreeNode {
|
self.root = box QuadtreeNode {
|
||||||
tile: None,
|
tile: None,
|
||||||
origin: Point2D(0f32, 0f32),
|
origin: Point2D(0f32, 0f32),
|
||||||
size: new_size as f32,
|
size: new_size as f32,
|
||||||
|
@ -334,7 +332,7 @@ impl<T: Tile> QuadtreeNode<T> {
|
||||||
TL | TR => self.origin.y,
|
TL | TR => self.origin.y,
|
||||||
BL | BR => self.origin.y + new_size,
|
BL | BR => self.origin.y + new_size,
|
||||||
};
|
};
|
||||||
let mut c = ~QuadtreeNode::new_child(new_x, new_y, new_size);
|
let mut c = box QuadtreeNode::new_child(new_x, new_y, new_size);
|
||||||
let (delta, unused) = c.add_tile(x, y, tile, tile_size);
|
let (delta, unused) = c.add_tile(x, y, tile, tile_size);
|
||||||
self.tile_mem = (self.tile_mem as int + delta) as uint;
|
self.tile_mem = (self.tile_mem as int + delta) as uint;
|
||||||
self.quadrants[quad as uint] = Some(c);
|
self.quadrants[quad as uint] = Some(c);
|
||||||
|
@ -376,7 +374,7 @@ impl<T: Tile> QuadtreeNode<T> {
|
||||||
TL | TR => self.origin.y,
|
TL | TR => self.origin.y,
|
||||||
BL | BR => self.origin.y + new_size,
|
BL | BR => self.origin.y + new_size,
|
||||||
};
|
};
|
||||||
let mut c = ~QuadtreeNode::new_child(new_x, new_y, new_size);
|
let mut c = box QuadtreeNode::new_child(new_x, new_y, new_size);
|
||||||
let result = c.get_tile_rect(x, y, clip_x, clip_y, scale, tile_size);
|
let result = c.get_tile_rect(x, y, clip_x, clip_y, scale, tile_size);
|
||||||
self.quadrants[quad as uint] = Some(c);
|
self.quadrants[quad as uint] = Some(c);
|
||||||
result
|
result
|
||||||
|
@ -523,30 +521,27 @@ impl<T: Tile> QuadtreeNode<T> {
|
||||||
let w_br_quad = self.get_quadrant(w_x + w_width, w_y + w_height);
|
let w_br_quad = self.get_quadrant(w_x + w_width, w_y + w_height);
|
||||||
|
|
||||||
// Figure out which quadrants the window is in
|
// Figure out which quadrants the window is in
|
||||||
let builder = |push: |Quadrant|| {
|
let mut quads_to_check = Vec::with_capacity(4);
|
||||||
match (w_tl_quad, w_br_quad) {
|
match (w_tl_quad, w_br_quad) {
|
||||||
(tl, br) if tl as int == br as int => {
|
(tl, br) if tl as int == br as int => {
|
||||||
push(tl);
|
quads_to_check.push(tl);
|
||||||
}
|
}
|
||||||
(TL, br) => {
|
(TL, br) => {
|
||||||
push(TL);
|
quads_to_check.push(TL);
|
||||||
push(br);
|
quads_to_check.push(br);
|
||||||
match br {
|
match br {
|
||||||
BR => {
|
BR => {
|
||||||
push(TR);
|
quads_to_check.push(TR);
|
||||||
push(BL);
|
quads_to_check.push(BL);
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
_ => {}
|
||||||
(tl, br) => {
|
|
||||||
push(tl);
|
|
||||||
push(br);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
(tl, br) => {
|
||||||
|
quads_to_check.push(tl);
|
||||||
let quads_to_check = slice::build(Some(4), builder);
|
quads_to_check.push(br);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let mut request = vec!();
|
let mut request = vec!();
|
||||||
let mut unused = vec!();
|
let mut unused = vec!();
|
||||||
|
@ -588,7 +583,7 @@ impl<T: Tile> QuadtreeNode<T> {
|
||||||
TL | TR => self.origin.y,
|
TL | TR => self.origin.y,
|
||||||
BL | BR => self.origin.y + new_size,
|
BL | BR => self.origin.y + new_size,
|
||||||
};
|
};
|
||||||
let mut child = ~QuadtreeNode::new_child(new_x, new_y, new_size);
|
let mut child = box QuadtreeNode::new_child(new_x, new_y, new_size);
|
||||||
let ret = child.get_tile_rects(new_window, clip, scale, tile_size, override);
|
let ret = child.get_tile_rects(new_window, clip, scale, tile_size, override);
|
||||||
self.quadrants[*quad as uint] = Some(child);
|
self.quadrants[*quad as uint] = Some(child);
|
||||||
ret
|
ret
|
||||||
|
|
|
@ -396,10 +396,10 @@ impl Constellation {
|
||||||
|
|
||||||
fn force_pipeline_exit(old_pipeline: &Rc<Pipeline>) {
|
fn force_pipeline_exit(old_pipeline: &Rc<Pipeline>) {
|
||||||
let ScriptChan(ref old_script) = old_pipeline.script_chan;
|
let ScriptChan(ref old_script) = old_pipeline.script_chan;
|
||||||
old_script.try_send(ExitPipelineMsg(old_pipeline.id));
|
old_script.send_opt(ExitPipelineMsg(old_pipeline.id));
|
||||||
old_pipeline.render_chan.chan.try_send(render_task::ExitMsg(None));
|
old_pipeline.render_chan.chan.send_opt(render_task::ExitMsg(None));
|
||||||
let LayoutChan(ref old_layout) = old_pipeline.layout_chan;
|
let LayoutChan(ref old_layout) = old_pipeline.layout_chan;
|
||||||
old_layout.try_send(layout_interface::ExitNowMsg);
|
old_layout.send_opt(layout_interface::ExitNowMsg);
|
||||||
}
|
}
|
||||||
force_pipeline_exit(&old_pipeline);
|
force_pipeline_exit(&old_pipeline);
|
||||||
self.pipelines.remove(&pipeline_id);
|
self.pipelines.remove(&pipeline_id);
|
||||||
|
@ -804,7 +804,7 @@ impl Constellation {
|
||||||
debug!("constellation sending resize message to active frame");
|
debug!("constellation sending resize message to active frame");
|
||||||
let pipeline = &frame_tree.pipeline;
|
let pipeline = &frame_tree.pipeline;
|
||||||
let ScriptChan(ref chan) = pipeline.script_chan;
|
let ScriptChan(ref chan) = pipeline.script_chan;
|
||||||
chan.try_send(ResizeMsg(pipeline.id, new_size));
|
chan.send_opt(ResizeMsg(pipeline.id, new_size));
|
||||||
already_seen.insert(pipeline.id);
|
already_seen.insert(pipeline.id);
|
||||||
}
|
}
|
||||||
for frame_tree in self.navigation_context.previous.iter()
|
for frame_tree in self.navigation_context.previous.iter()
|
||||||
|
@ -813,7 +813,7 @@ impl Constellation {
|
||||||
if !already_seen.contains(&pipeline.id) {
|
if !already_seen.contains(&pipeline.id) {
|
||||||
debug!("constellation sending resize message to inactive frame");
|
debug!("constellation sending resize message to inactive frame");
|
||||||
let ScriptChan(ref chan) = pipeline.script_chan;
|
let ScriptChan(ref chan) = pipeline.script_chan;
|
||||||
chan.try_send(ResizeInactiveMsg(pipeline.id, new_size));
|
chan.send_opt(ResizeInactiveMsg(pipeline.id, new_size));
|
||||||
already_seen.insert(pipeline.id);
|
already_seen.insert(pipeline.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -826,7 +826,7 @@ impl Constellation {
|
||||||
debug!("constellation sending resize message to pending outer frame ({:?})",
|
debug!("constellation sending resize message to pending outer frame ({:?})",
|
||||||
frame_tree.pipeline.id);
|
frame_tree.pipeline.id);
|
||||||
let ScriptChan(ref chan) = frame_tree.pipeline.script_chan;
|
let ScriptChan(ref chan) = frame_tree.pipeline.script_chan;
|
||||||
chan.try_send(ResizeMsg(frame_tree.pipeline.id, new_size));
|
chan.send_opt(ResizeMsg(frame_tree.pipeline.id, new_size));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -879,13 +879,13 @@ impl Constellation {
|
||||||
debug!("Constellation sending SetIds");
|
debug!("Constellation sending SetIds");
|
||||||
self.compositor_chan.send(SetIds(frame_tree.to_sendable(), chan, self.chan.clone()));
|
self.compositor_chan.send(SetIds(frame_tree.to_sendable(), chan, self.chan.clone()));
|
||||||
match port.recv_opt() {
|
match port.recv_opt() {
|
||||||
Some(()) => {
|
Ok(()) => {
|
||||||
let mut iter = frame_tree.iter();
|
let mut iter = frame_tree.iter();
|
||||||
for frame in iter {
|
for frame in iter {
|
||||||
frame.pipeline.grant_paint_permission();
|
frame.pipeline.grant_paint_permission();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => {} // message has been discarded, probably shutting down
|
Err(()) => {} // message has been discarded, probably shutting down
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -286,12 +286,12 @@ pub trait MatchMethods {
|
||||||
fn recalc_style_for_subtree(&self,
|
fn recalc_style_for_subtree(&self,
|
||||||
stylist: &Stylist,
|
stylist: &Stylist,
|
||||||
layout_context: &mut LayoutContext,
|
layout_context: &mut LayoutContext,
|
||||||
mut font_context: ~FontContext,
|
mut font_context: Box<FontContext>,
|
||||||
applicable_declarations: &mut ApplicableDeclarations,
|
applicable_declarations: &mut ApplicableDeclarations,
|
||||||
applicable_declarations_cache: &mut ApplicableDeclarationsCache,
|
applicable_declarations_cache: &mut ApplicableDeclarationsCache,
|
||||||
style_sharing_candidate_cache: &mut StyleSharingCandidateCache,
|
style_sharing_candidate_cache: &mut StyleSharingCandidateCache,
|
||||||
parent: Option<LayoutNode>)
|
parent: Option<LayoutNode>)
|
||||||
-> ~FontContext;
|
-> Box<FontContext>;
|
||||||
|
|
||||||
fn match_node(&self,
|
fn match_node(&self,
|
||||||
stylist: &Stylist,
|
stylist: &Stylist,
|
||||||
|
@ -466,12 +466,12 @@ impl<'ln> MatchMethods for LayoutNode<'ln> {
|
||||||
fn recalc_style_for_subtree(&self,
|
fn recalc_style_for_subtree(&self,
|
||||||
stylist: &Stylist,
|
stylist: &Stylist,
|
||||||
layout_context: &mut LayoutContext,
|
layout_context: &mut LayoutContext,
|
||||||
mut font_context: ~FontContext,
|
mut font_context: Box<FontContext>,
|
||||||
applicable_declarations: &mut ApplicableDeclarations,
|
applicable_declarations: &mut ApplicableDeclarations,
|
||||||
applicable_declarations_cache: &mut ApplicableDeclarationsCache,
|
applicable_declarations_cache: &mut ApplicableDeclarationsCache,
|
||||||
style_sharing_candidate_cache: &mut StyleSharingCandidateCache,
|
style_sharing_candidate_cache: &mut StyleSharingCandidateCache,
|
||||||
parent: Option<LayoutNode>)
|
parent: Option<LayoutNode>)
|
||||||
-> ~FontContext {
|
-> Box<FontContext> {
|
||||||
self.initialize_layout_data(layout_context.layout_chan.clone());
|
self.initialize_layout_data(layout_context.layout_chan.clone());
|
||||||
|
|
||||||
// First, check to see whether we can share a style with someone.
|
// First, check to see whether we can share a style with someone.
|
||||||
|
|
|
@ -27,23 +27,23 @@ impl<'ln> NodeUtil for ThreadSafeLayoutNode<'ln> {
|
||||||
let layout_data_ref = self.borrow_layout_data();
|
let layout_data_ref = self.borrow_layout_data();
|
||||||
match self.get_pseudo_element_type() {
|
match self.get_pseudo_element_type() {
|
||||||
Before | BeforeBlock => {
|
Before | BeforeBlock => {
|
||||||
cast::transmute_region(layout_data_ref.as_ref()
|
cast::transmute_lifetime(layout_data_ref.as_ref()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.data
|
.data
|
||||||
.before_style
|
.before_style
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.unwrap())
|
.unwrap())
|
||||||
}
|
}
|
||||||
After | AfterBlock => {
|
After | AfterBlock => {
|
||||||
cast::transmute_region(layout_data_ref.as_ref()
|
cast::transmute_lifetime(layout_data_ref.as_ref()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.data
|
.data
|
||||||
.after_style
|
.after_style
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.unwrap())
|
.unwrap())
|
||||||
}
|
}
|
||||||
Normal => {
|
Normal => {
|
||||||
cast::transmute_region(layout_data_ref.as_ref()
|
cast::transmute_lifetime(layout_data_ref.as_ref()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.shared_data
|
.shared_data
|
||||||
.style
|
.style
|
||||||
|
|
|
@ -41,6 +41,7 @@ use servo_util::geometry;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::num::Zero;
|
use std::num::Zero;
|
||||||
|
use std::owned;
|
||||||
use style::computed_values::{LPA_Auto, LPA_Length, LPA_Percentage, LPN_Length, LPN_None};
|
use style::computed_values::{LPA_Auto, LPA_Length, LPA_Percentage, LPN_Length, LPN_None};
|
||||||
use style::computed_values::{LPN_Percentage, LP_Length, LP_Percentage, display, float, overflow};
|
use style::computed_values::{LPN_Percentage, LP_Length, LP_Percentage, display, float, overflow};
|
||||||
use sync::Arc;
|
use sync::Arc;
|
||||||
|
@ -503,7 +504,7 @@ pub struct BlockFlow {
|
||||||
previous_float_width: Option<Au>,
|
previous_float_width: Option<Au>,
|
||||||
|
|
||||||
/// Additional floating flow members.
|
/// Additional floating flow members.
|
||||||
pub float: Option<~FloatedBlockInfo>
|
pub float: Option<owned::Box<FloatedBlockInfo>>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BlockFlow {
|
impl BlockFlow {
|
||||||
|
@ -539,7 +540,7 @@ impl BlockFlow {
|
||||||
is_root: false,
|
is_root: false,
|
||||||
static_y_offset: Au::new(0),
|
static_y_offset: Au::new(0),
|
||||||
previous_float_width: None,
|
previous_float_width: None,
|
||||||
float: Some(~FloatedBlockInfo::new(float_kind))
|
float: Some(box FloatedBlockInfo::new(float_kind))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ use std::from_str::FromStr;
|
||||||
use std::iter::AdditiveIterator;
|
use std::iter::AdditiveIterator;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::num::Zero;
|
use std::num::Zero;
|
||||||
|
use std::owned;
|
||||||
use style::{ComputedValues, TElement, TNode, cascade_anonymous};
|
use style::{ComputedValues, TElement, TNode, cascade_anonymous};
|
||||||
use style::computed_values::{LengthOrPercentageOrAuto, overflow, LPA_Auto, background_attachment};
|
use style::computed_values::{LengthOrPercentageOrAuto, overflow, LPA_Auto, background_attachment};
|
||||||
use style::computed_values::{background_repeat, border_style, clear, position, text_align};
|
use style::computed_values::{background_repeat, border_style, clear, position, text_align};
|
||||||
|
@ -224,7 +225,7 @@ impl IframeBoxInfo {
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct ScannedTextBoxInfo {
|
pub struct ScannedTextBoxInfo {
|
||||||
/// The text run that this represents.
|
/// The text run that this represents.
|
||||||
pub run: Arc<~TextRun>,
|
pub run: Arc<owned::Box<TextRun>>,
|
||||||
|
|
||||||
/// The range within the above text run that this represents.
|
/// The range within the above text run that this represents.
|
||||||
pub range: Range<CharIndex>,
|
pub range: Range<CharIndex>,
|
||||||
|
@ -232,7 +233,7 @@ pub struct ScannedTextBoxInfo {
|
||||||
|
|
||||||
impl ScannedTextBoxInfo {
|
impl ScannedTextBoxInfo {
|
||||||
/// Creates the information specific to a scanned text box from a range and a text run.
|
/// Creates the information specific to a scanned text box from a range and a text run.
|
||||||
pub fn new(run: Arc<~TextRun>, range: Range<CharIndex>) -> ScannedTextBoxInfo {
|
pub fn new(run: Arc<owned::Box<TextRun>>, range: Range<CharIndex>) -> ScannedTextBoxInfo {
|
||||||
ScannedTextBoxInfo {
|
ScannedTextBoxInfo {
|
||||||
run: run,
|
run: run,
|
||||||
range: range,
|
range: range,
|
||||||
|
@ -642,7 +643,7 @@ impl Box {
|
||||||
let style = self.style();
|
let style = self.style();
|
||||||
let background_color = style.resolve_color(style.Background.get().background_color);
|
let background_color = style.resolve_color(style.Background.get().background_color);
|
||||||
if !background_color.alpha.approx_eq(&0.0) {
|
if !background_color.alpha.approx_eq(&0.0) {
|
||||||
let display_item = ~SolidColorDisplayItem {
|
let display_item = box SolidColorDisplayItem {
|
||||||
base: BaseDisplayItem::new(*absolute_bounds, self.node, level),
|
base: BaseDisplayItem::new(*absolute_bounds, self.node, level),
|
||||||
color: background_color.to_gfx_color(),
|
color: background_color.to_gfx_color(),
|
||||||
};
|
};
|
||||||
|
@ -689,7 +690,7 @@ impl Box {
|
||||||
bounds.size.height = bounds.size.height - vertical_position;
|
bounds.size.height = bounds.size.height - vertical_position;
|
||||||
}
|
}
|
||||||
background_attachment::fixed => {
|
background_attachment::fixed => {
|
||||||
clip_display_item = Some(~ClipDisplayItem {
|
clip_display_item = Some(box ClipDisplayItem {
|
||||||
base: BaseDisplayItem::new(bounds, self.node, level),
|
base: BaseDisplayItem::new(bounds, self.node, level),
|
||||||
children: DisplayList::new(),
|
children: DisplayList::new(),
|
||||||
});
|
});
|
||||||
|
@ -718,7 +719,7 @@ impl Box {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create the image display item.
|
// Create the image display item.
|
||||||
let image_display_item = ImageDisplayItemClass(~ImageDisplayItem {
|
let image_display_item = ImageDisplayItemClass(box ImageDisplayItem {
|
||||||
base: BaseDisplayItem::new(bounds, self.node, level),
|
base: BaseDisplayItem::new(bounds, self.node, level),
|
||||||
image: image.clone(),
|
image: image.clone(),
|
||||||
stretch_size: Size2D(Au::from_px(image.width as int),
|
stretch_size: Size2D(Au::from_px(image.width as int),
|
||||||
|
@ -755,7 +756,7 @@ impl Box {
|
||||||
let left_color = style.resolve_color(style.Border.get().border_left_color);
|
let left_color = style.resolve_color(style.Border.get().border_left_color);
|
||||||
|
|
||||||
// Append the border to the display list.
|
// Append the border to the display list.
|
||||||
let border_display_item = ~BorderDisplayItem {
|
let border_display_item = box BorderDisplayItem {
|
||||||
base: BaseDisplayItem::new(*abs_bounds, self.node, level),
|
base: BaseDisplayItem::new(*abs_bounds, self.node, level),
|
||||||
border: border,
|
border: border,
|
||||||
color: SideOffsets2D::new(top_color.to_gfx_color(),
|
color: SideOffsets2D::new(top_color.to_gfx_color(),
|
||||||
|
@ -781,7 +782,7 @@ impl Box {
|
||||||
// Compute the text box bounds and draw a border surrounding them.
|
// Compute the text box bounds and draw a border surrounding them.
|
||||||
let debug_border = SideOffsets2D::new_all_same(Au::from_px(1));
|
let debug_border = SideOffsets2D::new_all_same(Au::from_px(1));
|
||||||
|
|
||||||
let border_display_item = ~BorderDisplayItem {
|
let border_display_item = box BorderDisplayItem {
|
||||||
base: BaseDisplayItem::new(absolute_box_bounds, self.node, ContentStackingLevel),
|
base: BaseDisplayItem::new(absolute_box_bounds, self.node, ContentStackingLevel),
|
||||||
border: debug_border,
|
border: debug_border,
|
||||||
color: SideOffsets2D::new_all_same(rgb(0, 0, 200)),
|
color: SideOffsets2D::new_all_same(rgb(0, 0, 200)),
|
||||||
|
@ -794,7 +795,7 @@ impl Box {
|
||||||
let baseline = Rect(absolute_box_bounds.origin + Point2D(Au(0), ascent),
|
let baseline = Rect(absolute_box_bounds.origin + Point2D(Au(0), ascent),
|
||||||
Size2D(absolute_box_bounds.size.width, Au(0)));
|
Size2D(absolute_box_bounds.size.width, Au(0)));
|
||||||
|
|
||||||
let line_display_item = ~LineDisplayItem {
|
let line_display_item = box LineDisplayItem {
|
||||||
base: BaseDisplayItem::new(baseline, self.node, ContentStackingLevel),
|
base: BaseDisplayItem::new(baseline, self.node, ContentStackingLevel),
|
||||||
color: rgb(0, 200, 0),
|
color: rgb(0, 200, 0),
|
||||||
style: border_style::dashed,
|
style: border_style::dashed,
|
||||||
|
@ -811,7 +812,7 @@ impl Box {
|
||||||
// This prints a debug border around the border of this box.
|
// This prints a debug border around the border of this box.
|
||||||
let debug_border = SideOffsets2D::new_all_same(Au::from_px(1));
|
let debug_border = SideOffsets2D::new_all_same(Au::from_px(1));
|
||||||
|
|
||||||
let border_display_item = ~BorderDisplayItem {
|
let border_display_item = box BorderDisplayItem {
|
||||||
base: BaseDisplayItem::new(absolute_box_bounds, self.node, ContentStackingLevel),
|
base: BaseDisplayItem::new(absolute_box_bounds, self.node, ContentStackingLevel),
|
||||||
border: debug_border,
|
border: debug_border,
|
||||||
color: SideOffsets2D::new_all_same(rgb(0, 0, 200)),
|
color: SideOffsets2D::new_all_same(rgb(0, 0, 200)),
|
||||||
|
@ -867,7 +868,7 @@ impl Box {
|
||||||
StackingLevel::from_background_and_border_level(background_and_border_level);
|
StackingLevel::from_background_and_border_level(background_and_border_level);
|
||||||
|
|
||||||
// Add a pseudo-display item for content box queries. This is a very bogus thing to do.
|
// Add a pseudo-display item for content box queries. This is a very bogus thing to do.
|
||||||
let base_display_item = ~BaseDisplayItem::new(absolute_box_bounds, self.node, level);
|
let base_display_item = box BaseDisplayItem::new(absolute_box_bounds, self.node, level);
|
||||||
display_list.push(PseudoDisplayItemClass(base_display_item));
|
display_list.push(PseudoDisplayItemClass(base_display_item));
|
||||||
|
|
||||||
// Add the background to the list, if applicable.
|
// Add the background to the list, if applicable.
|
||||||
|
@ -910,7 +911,7 @@ impl Box {
|
||||||
bounds.size.width = bounds.size.width - self.border_padding.horizontal();
|
bounds.size.width = bounds.size.width - self.border_padding.horizontal();
|
||||||
|
|
||||||
// Create the text box.
|
// Create the text box.
|
||||||
let text_display_item = ~TextDisplayItem {
|
let text_display_item = box TextDisplayItem {
|
||||||
base: BaseDisplayItem::new(bounds, self.node, ContentStackingLevel),
|
base: BaseDisplayItem::new(bounds, self.node, ContentStackingLevel),
|
||||||
text_run: text_box.run.clone(),
|
text_run: text_box.run.clone(),
|
||||||
range: text_box.range,
|
range: text_box.range,
|
||||||
|
@ -948,7 +949,7 @@ impl Box {
|
||||||
debug!("(building display list) building image box");
|
debug!("(building display list) building image box");
|
||||||
|
|
||||||
// Place the image into the display list.
|
// Place the image into the display list.
|
||||||
let image_display_item = ~ImageDisplayItem {
|
let image_display_item = box ImageDisplayItem {
|
||||||
base: BaseDisplayItem::new(bounds,
|
base: BaseDisplayItem::new(bounds,
|
||||||
self.node,
|
self.node,
|
||||||
ContentStackingLevel),
|
ContentStackingLevel),
|
||||||
|
@ -1463,7 +1464,7 @@ impl fmt::Show for Box {
|
||||||
|
|
||||||
/// An object that accumulates display lists of child flows, applying a clipping rect if necessary.
|
/// An object that accumulates display lists of child flows, applying a clipping rect if necessary.
|
||||||
pub struct ChildDisplayListAccumulator {
|
pub struct ChildDisplayListAccumulator {
|
||||||
clip_display_item: Option<~ClipDisplayItem>,
|
clip_display_item: Option<owned::Box<ClipDisplayItem>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ChildDisplayListAccumulator {
|
impl ChildDisplayListAccumulator {
|
||||||
|
@ -1473,7 +1474,7 @@ impl ChildDisplayListAccumulator {
|
||||||
ChildDisplayListAccumulator {
|
ChildDisplayListAccumulator {
|
||||||
clip_display_item: match style.Box.get().overflow {
|
clip_display_item: match style.Box.get().overflow {
|
||||||
overflow::hidden => {
|
overflow::hidden => {
|
||||||
Some(~ClipDisplayItem {
|
Some(box ClipDisplayItem {
|
||||||
base: BaseDisplayItem::new(bounds, node, level),
|
base: BaseDisplayItem::new(bounds, node, level),
|
||||||
children: DisplayList::new(),
|
children: DisplayList::new(),
|
||||||
})
|
})
|
||||||
|
|
|
@ -60,6 +60,7 @@ use servo_util::range::Range;
|
||||||
use servo_util::str::is_whitespace;
|
use servo_util::str::is_whitespace;
|
||||||
use servo_util::url::{is_image_data, parse_url};
|
use servo_util::url::{is_image_data, parse_url};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
use std::owned;
|
||||||
use style::ComputedValues;
|
use style::ComputedValues;
|
||||||
use style::computed_values::{display, position, float, white_space};
|
use style::computed_values::{display, position, float, white_space};
|
||||||
use sync::Arc;
|
use sync::Arc;
|
||||||
|
@ -74,7 +75,7 @@ pub enum ConstructionResult {
|
||||||
/// This node contributed a flow at the proper position in the tree.
|
/// This node contributed a flow at the proper position in the tree.
|
||||||
/// Nothing more needs to be done for this node. It has bubbled up fixed
|
/// Nothing more needs to be done for this node. It has bubbled up fixed
|
||||||
/// and absolute descendant flows that have a CB above it.
|
/// and absolute descendant flows that have a CB above it.
|
||||||
FlowConstructionResult(~Flow:Share, AbsDescendants),
|
FlowConstructionResult(owned::Box<Flow:Share>, AbsDescendants),
|
||||||
|
|
||||||
/// This node contributed some object or objects that will be needed to construct a proper flow
|
/// This node contributed some object or objects that will be needed to construct a proper flow
|
||||||
/// later up the tree, but these objects have not yet found their home.
|
/// later up the tree, but these objects have not yet found their home.
|
||||||
|
@ -156,7 +157,7 @@ pub struct InlineBlockSplit {
|
||||||
pub predecessors: InlineBoxes,
|
pub predecessors: InlineBoxes,
|
||||||
|
|
||||||
/// The flow that caused this {ib} split.
|
/// The flow that caused this {ib} split.
|
||||||
pub flow: ~Flow:Share,
|
pub flow: owned::Box<Flow:Share>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InlineBlockSplit {
|
impl InlineBlockSplit {
|
||||||
|
@ -222,12 +223,12 @@ pub struct FlowConstructor<'a> {
|
||||||
///
|
///
|
||||||
/// FIXME(pcwalton): This is pretty bogus and is basically just a workaround for libgreen
|
/// FIXME(pcwalton): This is pretty bogus and is basically just a workaround for libgreen
|
||||||
/// having slow TLS.
|
/// having slow TLS.
|
||||||
pub font_context: Option<~FontContext>,
|
pub font_context: Option<owned::Box<FontContext>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> FlowConstructor<'a> {
|
impl<'a> FlowConstructor<'a> {
|
||||||
/// Creates a new flow constructor.
|
/// Creates a new flow constructor.
|
||||||
pub fn new(layout_context: &'a mut LayoutContext, font_context: Option<~FontContext>)
|
pub fn new(layout_context: &'a mut LayoutContext, font_context: Option<owned::Box<FontContext>>)
|
||||||
-> FlowConstructor<'a> {
|
-> FlowConstructor<'a> {
|
||||||
FlowConstructor {
|
FlowConstructor {
|
||||||
layout_context: layout_context,
|
layout_context: layout_context,
|
||||||
|
@ -246,7 +247,7 @@ impl<'a> FlowConstructor<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Destroys this flow constructor and retrieves the font context.
|
/// Destroys this flow constructor and retrieves the font context.
|
||||||
pub fn unwrap_font_context(self) -> Option<~FontContext> {
|
pub fn unwrap_font_context(self) -> Option<owned::Box<FontContext>> {
|
||||||
let FlowConstructor {
|
let FlowConstructor {
|
||||||
font_context,
|
font_context,
|
||||||
..
|
..
|
||||||
|
@ -302,8 +303,8 @@ impl<'a> FlowConstructor<'a> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn flush_inline_boxes_to_flow_or_list(&mut self,
|
fn flush_inline_boxes_to_flow_or_list(&mut self,
|
||||||
box_accumulator: InlineBoxAccumulator,
|
box_accumulator: InlineBoxAccumulator,
|
||||||
flow: &mut ~Flow:Share,
|
flow: &mut owned::Box<Flow:Share>,
|
||||||
flow_list: &mut Vec<~Flow:Share>,
|
flow_list: &mut Vec<owned::Box<Flow:Share>>,
|
||||||
whitespace_stripping: WhitespaceStrippingMode,
|
whitespace_stripping: WhitespaceStrippingMode,
|
||||||
node: &ThreadSafeLayoutNode) {
|
node: &ThreadSafeLayoutNode) {
|
||||||
let mut boxes = box_accumulator.finish();
|
let mut boxes = box_accumulator.finish();
|
||||||
|
@ -327,9 +328,9 @@ impl<'a> FlowConstructor<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut inline_flow = ~InlineFlow::from_boxes((*node).clone(), boxes);
|
let mut inline_flow = box InlineFlow::from_boxes((*node).clone(), boxes);
|
||||||
inline_flow.compute_minimum_ascent_and_descent(self.font_context(), &**node.style());
|
inline_flow.compute_minimum_ascent_and_descent(self.font_context(), &**node.style());
|
||||||
let mut inline_flow = inline_flow as ~Flow:Share;
|
let mut inline_flow = inline_flow as owned::Box<Flow:Share>;
|
||||||
TextRunScanner::new().scan_for_runs(self.font_context(), inline_flow);
|
TextRunScanner::new().scan_for_runs(self.font_context(), inline_flow);
|
||||||
inline_flow.finish(self.layout_context);
|
inline_flow.finish(self.layout_context);
|
||||||
|
|
||||||
|
@ -341,9 +342,9 @@ impl<'a> FlowConstructor<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_block_flow_using_children_construction_result(&mut self,
|
fn build_block_flow_using_children_construction_result(&mut self,
|
||||||
flow: &mut ~Flow:Share,
|
flow: &mut owned::Box<Flow:Share>,
|
||||||
consecutive_siblings:
|
consecutive_siblings:
|
||||||
&mut Vec<~Flow:Share>,
|
&mut Vec<owned::Box<Flow:Share>>,
|
||||||
node: &ThreadSafeLayoutNode,
|
node: &ThreadSafeLayoutNode,
|
||||||
kid: ThreadSafeLayoutNode,
|
kid: ThreadSafeLayoutNode,
|
||||||
inline_box_accumulator:
|
inline_box_accumulator:
|
||||||
|
@ -458,7 +459,7 @@ impl<'a> FlowConstructor<'a> {
|
||||||
/// Also, deal with the absolute and fixed descendants bubbled up by
|
/// Also, deal with the absolute and fixed descendants bubbled up by
|
||||||
/// children nodes.
|
/// children nodes.
|
||||||
fn build_flow_using_children(&mut self,
|
fn build_flow_using_children(&mut self,
|
||||||
mut flow: ~Flow:Share,
|
mut flow: owned::Box<Flow:Share>,
|
||||||
node: &ThreadSafeLayoutNode)
|
node: &ThreadSafeLayoutNode)
|
||||||
-> ConstructionResult {
|
-> ConstructionResult {
|
||||||
// Gather up boxes for the inline flows we might need to create.
|
// Gather up boxes for the inline flows we might need to create.
|
||||||
|
@ -516,7 +517,7 @@ impl<'a> FlowConstructor<'a> {
|
||||||
/// other `BlockFlow`s or `InlineFlow`s underneath it, depending on whether {ib} splits needed
|
/// other `BlockFlow`s or `InlineFlow`s underneath it, depending on whether {ib} splits needed
|
||||||
/// to happen.
|
/// to happen.
|
||||||
fn build_flow_for_block(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult {
|
fn build_flow_for_block(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult {
|
||||||
let flow = ~BlockFlow::from_node(self, node) as ~Flow:Share;
|
let flow = box BlockFlow::from_node(self, node) as owned::Box<Flow:Share>;
|
||||||
self.build_flow_using_children(flow, node)
|
self.build_flow_using_children(flow, node)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -524,7 +525,7 @@ impl<'a> FlowConstructor<'a> {
|
||||||
/// a `BlockFlow` underneath it.
|
/// a `BlockFlow` underneath it.
|
||||||
fn build_flow_for_floated_block(&mut self, node: &ThreadSafeLayoutNode, float_kind: FloatKind)
|
fn build_flow_for_floated_block(&mut self, node: &ThreadSafeLayoutNode, float_kind: FloatKind)
|
||||||
-> ConstructionResult {
|
-> ConstructionResult {
|
||||||
let flow = ~BlockFlow::float_from_node(self, node, float_kind) as ~Flow:Share;
|
let flow = box BlockFlow::float_from_node(self, node, float_kind) as owned::Box<Flow:Share>;
|
||||||
self.build_flow_using_children(flow, node)
|
self.build_flow_using_children(flow, node)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -660,7 +661,7 @@ impl<'a> FlowConstructor<'a> {
|
||||||
|
|
||||||
/// TableCaptionFlow is populated underneath TableWrapperFlow
|
/// TableCaptionFlow is populated underneath TableWrapperFlow
|
||||||
fn place_table_caption_under_table_wrapper(&mut self,
|
fn place_table_caption_under_table_wrapper(&mut self,
|
||||||
table_wrapper_flow: &mut ~Flow:Share,
|
table_wrapper_flow: &mut owned::Box<Flow:Share>,
|
||||||
node: &ThreadSafeLayoutNode) {
|
node: &ThreadSafeLayoutNode) {
|
||||||
for kid in node.children() {
|
for kid in node.children() {
|
||||||
match kid.swap_out_construction_result() {
|
match kid.swap_out_construction_result() {
|
||||||
|
@ -677,8 +678,8 @@ impl<'a> FlowConstructor<'a> {
|
||||||
/// Generates an anonymous table flow according to CSS 2.1 § 17.2.1, step 2.
|
/// Generates an anonymous table flow according to CSS 2.1 § 17.2.1, step 2.
|
||||||
/// If necessary, generate recursively another anonymous table flow.
|
/// If necessary, generate recursively another anonymous table flow.
|
||||||
fn generate_anonymous_missing_child(&mut self,
|
fn generate_anonymous_missing_child(&mut self,
|
||||||
child_flows: Vec<~Flow:Share>,
|
child_flows: Vec<owned::Box<Flow:Share>>,
|
||||||
flow: &mut ~Flow:Share,
|
flow: &mut owned::Box<Flow:Share>,
|
||||||
node: &ThreadSafeLayoutNode) {
|
node: &ThreadSafeLayoutNode) {
|
||||||
let mut anonymous_flow = flow.generate_missing_child_flow(node);
|
let mut anonymous_flow = flow.generate_missing_child_flow(node);
|
||||||
let mut consecutive_siblings = vec!();
|
let mut consecutive_siblings = vec!();
|
||||||
|
@ -705,10 +706,10 @@ impl<'a> FlowConstructor<'a> {
|
||||||
/// other `TableCaptionFlow`s or `TableFlow`s underneath it.
|
/// other `TableCaptionFlow`s or `TableFlow`s underneath it.
|
||||||
fn build_flow_for_table_wrapper(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult {
|
fn build_flow_for_table_wrapper(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult {
|
||||||
let box_ = Box::new_from_specific_info(node, TableWrapperBox);
|
let box_ = Box::new_from_specific_info(node, TableWrapperBox);
|
||||||
let mut wrapper_flow = ~TableWrapperFlow::from_node_and_box(node, box_) as ~Flow:Share;
|
let mut wrapper_flow = box TableWrapperFlow::from_node_and_box(node, box_) as owned::Box<Flow:Share>;
|
||||||
|
|
||||||
let table_box_ = Box::new_from_specific_info(node, TableBox);
|
let table_box_ = Box::new_from_specific_info(node, TableBox);
|
||||||
let table_flow = ~TableFlow::from_node_and_box(node, table_box_) as ~Flow:Share;
|
let table_flow = box TableFlow::from_node_and_box(node, table_box_) as owned::Box<Flow:Share>;
|
||||||
|
|
||||||
// We first populate the TableFlow with other flows than TableCaptionFlow.
|
// We first populate the TableFlow with other flows than TableCaptionFlow.
|
||||||
// We then populate the TableWrapperFlow with TableCaptionFlow, and attach
|
// We then populate the TableWrapperFlow with TableCaptionFlow, and attach
|
||||||
|
@ -754,7 +755,7 @@ impl<'a> FlowConstructor<'a> {
|
||||||
/// Builds a flow for a node with `display: table-caption`. This yields a `TableCaptionFlow`
|
/// Builds a flow for a node with `display: table-caption`. This yields a `TableCaptionFlow`
|
||||||
/// with possibly other `BlockFlow`s or `InlineFlow`s underneath it.
|
/// with possibly other `BlockFlow`s or `InlineFlow`s underneath it.
|
||||||
fn build_flow_for_table_caption(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult {
|
fn build_flow_for_table_caption(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult {
|
||||||
let flow = ~TableCaptionFlow::from_node(self, node) as ~Flow:Share;
|
let flow = box TableCaptionFlow::from_node(self, node) as owned::Box<Flow:Share>;
|
||||||
self.build_flow_using_children(flow, node)
|
self.build_flow_using_children(flow, node)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -762,7 +763,7 @@ impl<'a> FlowConstructor<'a> {
|
||||||
/// with possibly other `TableRowFlow`s underneath it.
|
/// with possibly other `TableRowFlow`s underneath it.
|
||||||
fn build_flow_for_table_rowgroup(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult {
|
fn build_flow_for_table_rowgroup(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult {
|
||||||
let box_ = Box::new_from_specific_info(node, TableRowBox);
|
let box_ = Box::new_from_specific_info(node, TableRowBox);
|
||||||
let flow = ~TableRowGroupFlow::from_node_and_box(node, box_) as ~Flow:Share;
|
let flow = box TableRowGroupFlow::from_node_and_box(node, box_) as owned::Box<Flow:Share>;
|
||||||
self.build_flow_using_children(flow, node)
|
self.build_flow_using_children(flow, node)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -770,7 +771,7 @@ impl<'a> FlowConstructor<'a> {
|
||||||
/// possibly other `TableCellFlow`s underneath it.
|
/// possibly other `TableCellFlow`s underneath it.
|
||||||
fn build_flow_for_table_row(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult {
|
fn build_flow_for_table_row(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult {
|
||||||
let box_ = Box::new_from_specific_info(node, TableRowBox);
|
let box_ = Box::new_from_specific_info(node, TableRowBox);
|
||||||
let flow = ~TableRowFlow::from_node_and_box(node, box_) as ~Flow:Share;
|
let flow = box TableRowFlow::from_node_and_box(node, box_) as owned::Box<Flow:Share>;
|
||||||
self.build_flow_using_children(flow, node)
|
self.build_flow_using_children(flow, node)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -778,7 +779,7 @@ impl<'a> FlowConstructor<'a> {
|
||||||
/// possibly other `BlockFlow`s or `InlineFlow`s underneath it.
|
/// possibly other `BlockFlow`s or `InlineFlow`s underneath it.
|
||||||
fn build_flow_for_table_cell(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult {
|
fn build_flow_for_table_cell(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult {
|
||||||
let box_ = Box::new_from_specific_info(node, TableCellBox);
|
let box_ = Box::new_from_specific_info(node, TableCellBox);
|
||||||
let flow = ~TableCellFlow::from_node_and_box(node, box_) as ~Flow:Share;
|
let flow = box TableCellFlow::from_node_and_box(node, box_) as owned::Box<Flow:Share>;
|
||||||
self.build_flow_using_children(flow, node)
|
self.build_flow_using_children(flow, node)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -817,8 +818,8 @@ impl<'a> FlowConstructor<'a> {
|
||||||
let specific = TableColumnBox(TableColumnBoxInfo::new(node));
|
let specific = TableColumnBox(TableColumnBoxInfo::new(node));
|
||||||
col_boxes.push( Box::new_from_specific_info(node, specific) );
|
col_boxes.push( Box::new_from_specific_info(node, specific) );
|
||||||
}
|
}
|
||||||
let mut flow = ~TableColGroupFlow::from_node_and_boxes(node, box_, col_boxes) as
|
let mut flow = box TableColGroupFlow::from_node_and_boxes(node, box_, col_boxes) as
|
||||||
~Flow:Share;
|
owned::Box<Flow:Share>;
|
||||||
flow.finish(self.layout_context);
|
flow.finish(self.layout_context);
|
||||||
|
|
||||||
FlowConstructionResult(flow, Descendants::new())
|
FlowConstructionResult(flow, Descendants::new())
|
||||||
|
|
|
@ -27,9 +27,6 @@ use std::rt::task::Task;
|
||||||
use style::Stylist;
|
use style::Stylist;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
#[cfg(target_os="android")]
|
|
||||||
use std::local_data;
|
|
||||||
|
|
||||||
#[cfg(not(target_os="android"))]
|
#[cfg(not(target_os="android"))]
|
||||||
#[thread_local]
|
#[thread_local]
|
||||||
static mut FONT_CONTEXT: *mut FontContext = 0 as *mut FontContext;
|
static mut FONT_CONTEXT: *mut FontContext = 0 as *mut FontContext;
|
||||||
|
@ -95,9 +92,9 @@ impl LayoutContext {
|
||||||
// Sanity check.
|
// Sanity check.
|
||||||
{
|
{
|
||||||
let mut task = Local::borrow(None::<Task>);
|
let mut task = Local::borrow(None::<Task>);
|
||||||
match task.get().maybe_take_runtime::<GreenTask>() {
|
match task.maybe_take_runtime::<GreenTask>() {
|
||||||
Some(green) => {
|
Some(green) => {
|
||||||
task.get().put_runtime(green);
|
task.put_runtime(green);
|
||||||
fail!("can't call this on a green task!")
|
fail!("can't call this on a green task!")
|
||||||
}
|
}
|
||||||
None => {}
|
None => {}
|
||||||
|
@ -106,7 +103,7 @@ impl LayoutContext {
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
if FONT_CONTEXT == ptr::mut_null() {
|
if FONT_CONTEXT == ptr::mut_null() {
|
||||||
let context = ~FontContext::new(self.font_context_info.clone());
|
let context = box FontContext::new(self.font_context_info.clone());
|
||||||
FONT_CONTEXT = cast::transmute(context)
|
FONT_CONTEXT = cast::transmute(context)
|
||||||
}
|
}
|
||||||
cast::transmute(FONT_CONTEXT)
|
cast::transmute(FONT_CONTEXT)
|
||||||
|
@ -117,9 +114,9 @@ impl LayoutContext {
|
||||||
// Sanity check.
|
// Sanity check.
|
||||||
{
|
{
|
||||||
let mut task = Local::borrow(None::<Task>);
|
let mut task = Local::borrow(None::<Task>);
|
||||||
match task.get().maybe_take_runtime::<GreenTask>() {
|
match task.maybe_take_runtime::<GreenTask>() {
|
||||||
Some(green) => {
|
Some(green) => {
|
||||||
task.get().put_runtime(green);
|
task.put_runtime(green);
|
||||||
fail!("can't call this on a green task!")
|
fail!("can't call this on a green task!")
|
||||||
}
|
}
|
||||||
None => {}
|
None => {}
|
||||||
|
@ -128,7 +125,7 @@ impl LayoutContext {
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
if APPLICABLE_DECLARATIONS_CACHE == ptr::mut_null() {
|
if APPLICABLE_DECLARATIONS_CACHE == ptr::mut_null() {
|
||||||
let cache = ~ApplicableDeclarationsCache::new();
|
let cache = box ApplicableDeclarationsCache::new();
|
||||||
APPLICABLE_DECLARATIONS_CACHE = cast::transmute(cache)
|
APPLICABLE_DECLARATIONS_CACHE = cast::transmute(cache)
|
||||||
}
|
}
|
||||||
cast::transmute(APPLICABLE_DECLARATIONS_CACHE)
|
cast::transmute(APPLICABLE_DECLARATIONS_CACHE)
|
||||||
|
@ -139,9 +136,9 @@ impl LayoutContext {
|
||||||
// Sanity check.
|
// Sanity check.
|
||||||
{
|
{
|
||||||
let mut task = Local::borrow(None::<Task>);
|
let mut task = Local::borrow(None::<Task>);
|
||||||
match task.get().maybe_take_runtime::<GreenTask>() {
|
match task.maybe_take_runtime::<GreenTask>() {
|
||||||
Some(green) => {
|
Some(green) => {
|
||||||
task.get().put_runtime(green);
|
task.put_runtime(green);
|
||||||
fail!("can't call this on a green task!")
|
fail!("can't call this on a green task!")
|
||||||
}
|
}
|
||||||
None => {}
|
None => {}
|
||||||
|
@ -150,7 +147,7 @@ impl LayoutContext {
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
if STYLE_SHARING_CANDIDATE_CACHE == ptr::mut_null() {
|
if STYLE_SHARING_CANDIDATE_CACHE == ptr::mut_null() {
|
||||||
let cache = ~StyleSharingCandidateCache::new();
|
let cache = box StyleSharingCandidateCache::new();
|
||||||
STYLE_SHARING_CANDIDATE_CACHE = cast::transmute(cache)
|
STYLE_SHARING_CANDIDATE_CACHE = cast::transmute(cache)
|
||||||
}
|
}
|
||||||
cast::transmute(STYLE_SHARING_CANDIDATE_CACHE)
|
cast::transmute(STYLE_SHARING_CANDIDATE_CACHE)
|
||||||
|
@ -168,45 +165,45 @@ impl LayoutContext {
|
||||||
impl LayoutContext {
|
impl LayoutContext {
|
||||||
pub fn font_context<'a>(&'a mut self) -> &'a mut FontContext {
|
pub fn font_context<'a>(&'a mut self) -> &'a mut FontContext {
|
||||||
unsafe {
|
unsafe {
|
||||||
let opt = local_data::pop(font_context);
|
let opt = font_context.replace(None);
|
||||||
let mut context;
|
let mut context;
|
||||||
match opt {
|
match opt {
|
||||||
Some(c) => context = cast::transmute(c),
|
Some(c) => context = cast::transmute(c),
|
||||||
None => {
|
None => {
|
||||||
context = cast::transmute(~FontContext::new(self.font_context_info.clone()))
|
context = cast::transmute(box FontContext::new(self.font_context_info.clone()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
local_data::set(font_context, context);
|
font_context.replace(Some(context));
|
||||||
cast::transmute(context)
|
cast::transmute(context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn applicable_declarations_cache<'a>(&'a self) -> &'a mut ApplicableDeclarationsCache {
|
pub fn applicable_declarations_cache<'a>(&'a self) -> &'a mut ApplicableDeclarationsCache {
|
||||||
unsafe {
|
unsafe {
|
||||||
let opt = local_data::pop(applicable_declarations_cache);
|
let opt = applicable_declarations_cache.replace(None);
|
||||||
let mut cache;
|
let mut cache;
|
||||||
match opt {
|
match opt {
|
||||||
Some(c) => cache = cast::transmute(c),
|
Some(c) => cache = cast::transmute(c),
|
||||||
None => {
|
None => {
|
||||||
cache = cast::transmute(~ApplicableDeclarationsCache::new());
|
cache = cast::transmute(box ApplicableDeclarationsCache::new());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
local_data::set(applicable_declarations_cache, cache);
|
applicable_declarations_cache.replace(Some(cache));
|
||||||
cast::transmute(cache)
|
cast::transmute(cache)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn style_sharing_candidate_cache<'a>(&'a self) -> &'a mut StyleSharingCandidateCache {
|
pub fn style_sharing_candidate_cache<'a>(&'a self) -> &'a mut StyleSharingCandidateCache {
|
||||||
unsafe {
|
unsafe {
|
||||||
let opt = local_data::pop(style_sharing_candidate_cache);
|
let opt = style_sharing_candidate_cache.replace(None);
|
||||||
let mut cache;
|
let mut cache;
|
||||||
match opt {
|
match opt {
|
||||||
Some(c) => cache = cast::transmute(c),
|
Some(c) => cache = cast::transmute(c),
|
||||||
None => {
|
None => {
|
||||||
cache = cast::transmute(~StyleSharingCandidateCache::new());
|
cache = cast::transmute(box StyleSharingCandidateCache::new());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
local_data::set(style_sharing_candidate_cache, cache);
|
style_sharing_candidate_cache.replace(Some(cache));
|
||||||
cast::transmute(cache)
|
cast::transmute(cache)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ impl<'ln> LayoutAuxMethods for LayoutNode<'ln> {
|
||||||
*layout_data_ref = Some(LayoutDataWrapper {
|
*layout_data_ref = Some(LayoutDataWrapper {
|
||||||
chan: Some(chan),
|
chan: Some(chan),
|
||||||
shared_data: SharedLayoutData { style: None },
|
shared_data: SharedLayoutData { style: None },
|
||||||
data: ~PrivateLayoutData::new(),
|
data: box PrivateLayoutData::new(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Some(_) => {}
|
Some(_) => {}
|
||||||
|
|
|
@ -58,6 +58,7 @@ use std::cast;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::iter::Zip;
|
use std::iter::Zip;
|
||||||
use std::num::Zero;
|
use std::num::Zero;
|
||||||
|
use std::owned;
|
||||||
use std::sync::atomics::Relaxed;
|
use std::sync::atomics::Relaxed;
|
||||||
use std::slice::MutItems;
|
use std::slice::MutItems;
|
||||||
use style::computed_values::{clear, position, text_align};
|
use style::computed_values::{clear, position, text_align};
|
||||||
|
@ -171,7 +172,7 @@ pub trait Flow: fmt::Show + ToStr {
|
||||||
/// this child was impacted by floats or false otherwise.
|
/// this child was impacted by floats or false otherwise.
|
||||||
fn assign_height_for_inorder_child_if_necessary(&mut self, layout_context: &mut LayoutContext)
|
fn assign_height_for_inorder_child_if_necessary(&mut self, layout_context: &mut LayoutContext)
|
||||||
-> bool {
|
-> bool {
|
||||||
let impacted = base(self).flags.impacted_by_floats();
|
let impacted = base(&*self).flags.impacted_by_floats();
|
||||||
if impacted {
|
if impacted {
|
||||||
self.assign_height(layout_context);
|
self.assign_height(layout_context);
|
||||||
}
|
}
|
||||||
|
@ -337,7 +338,7 @@ pub trait ImmutableFlowUtils {
|
||||||
fn need_anonymous_flow(self, child: &Flow) -> bool;
|
fn need_anonymous_flow(self, child: &Flow) -> bool;
|
||||||
|
|
||||||
/// Generates missing child flow of this flow.
|
/// Generates missing child flow of this flow.
|
||||||
fn generate_missing_child_flow(self, node: &ThreadSafeLayoutNode) -> ~Flow:Share;
|
fn generate_missing_child_flow(self, node: &ThreadSafeLayoutNode) -> owned::Box<Flow:Share>;
|
||||||
|
|
||||||
/// Returns true if this flow has no children.
|
/// Returns true if this flow has no children.
|
||||||
fn is_leaf(self) -> bool;
|
fn is_leaf(self) -> bool;
|
||||||
|
@ -391,7 +392,7 @@ pub trait MutableFlowUtils {
|
||||||
pub trait MutableOwnedFlowUtils {
|
pub trait MutableOwnedFlowUtils {
|
||||||
/// Adds a new flow as a child of this flow. Removes the flow from the given leaf set if
|
/// Adds a new flow as a child of this flow. Removes the flow from the given leaf set if
|
||||||
/// it's present.
|
/// it's present.
|
||||||
fn add_new_child(&mut self, new_child: ~Flow:Share);
|
fn add_new_child(&mut self, new_child: owned::Box<Flow:Share>);
|
||||||
|
|
||||||
/// Finishes a flow. Once a flow is finished, no more child flows or boxes may be added to it.
|
/// Finishes a flow. Once a flow is finished, no more child flows or boxes may be added to it.
|
||||||
/// This will normally run the bubble-widths (minimum and preferred -- i.e. intrinsic -- width)
|
/// This will normally run the bubble-widths (minimum and preferred -- i.e. intrinsic -- width)
|
||||||
|
@ -841,15 +842,15 @@ impl<'a> ImmutableFlowUtils for &'a Flow {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generates missing child flow of this flow.
|
/// Generates missing child flow of this flow.
|
||||||
fn generate_missing_child_flow(self, node: &ThreadSafeLayoutNode) -> ~Flow:Share {
|
fn generate_missing_child_flow(self, node: &ThreadSafeLayoutNode) -> owned::Box<Flow:Share> {
|
||||||
match self.class() {
|
match self.class() {
|
||||||
TableFlowClass | TableRowGroupFlowClass => {
|
TableFlowClass | TableRowGroupFlowClass => {
|
||||||
let box_ = Box::new_anonymous_table_box(node, TableRowBox);
|
let box_ = Box::new_anonymous_table_box(node, TableRowBox);
|
||||||
~TableRowFlow::from_node_and_box(node, box_) as ~Flow:Share
|
box TableRowFlow::from_node_and_box(node, box_) as owned::Box<Flow:Share>
|
||||||
},
|
},
|
||||||
TableRowFlowClass => {
|
TableRowFlowClass => {
|
||||||
let box_ = Box::new_anonymous_table_box(node, TableCellBox);
|
let box_ = Box::new_anonymous_table_box(node, TableCellBox);
|
||||||
~TableCellFlow::from_node_and_box(node, box_) as ~Flow:Share
|
box TableCellFlow::from_node_and_box(node, box_) as owned::Box<Flow:Share>
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
fail!("no need to generate a missing child")
|
fail!("no need to generate a missing child")
|
||||||
|
@ -907,7 +908,7 @@ impl<'a> ImmutableFlowUtils for &'a Flow {
|
||||||
|
|
||||||
/// Dumps the flow tree for debugging, with a prefix to indicate that we're at the given level.
|
/// Dumps the flow tree for debugging, with a prefix to indicate that we're at the given level.
|
||||||
fn dump_with_level(self, level: uint) {
|
fn dump_with_level(self, level: uint) {
|
||||||
let mut indent = "".to_owned();
|
let mut indent = StrBuf::new();
|
||||||
for _ in range(0, level) {
|
for _ in range(0, level) {
|
||||||
indent.push_str("| ")
|
indent.push_str("| ")
|
||||||
}
|
}
|
||||||
|
@ -1051,9 +1052,9 @@ impl<'a> MutableFlowUtils for &'a mut Flow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MutableOwnedFlowUtils for ~Flow:Share {
|
impl MutableOwnedFlowUtils for owned::Box<Flow:Share> {
|
||||||
/// Adds a new flow as a child of this flow. Fails if this flow is marked as a leaf.
|
/// Adds a new flow as a child of this flow. Fails if this flow is marked as a leaf.
|
||||||
fn add_new_child(&mut self, mut new_child: ~Flow:Share) {
|
fn add_new_child(&mut self, mut new_child: owned::Box<Flow:Share>) {
|
||||||
{
|
{
|
||||||
let kid_base = mut_base(new_child);
|
let kid_base = mut_base(new_child);
|
||||||
kid_base.parallel.parent = parallel::mut_owned_flow_to_unsafe_flow(self);
|
kid_base.parallel.parent = parallel::mut_owned_flow_to_unsafe_flow(self);
|
||||||
|
|
|
@ -11,7 +11,7 @@ use std::ptr;
|
||||||
|
|
||||||
use layout::flow::{Flow, base, mut_base};
|
use layout::flow::{Flow, base, mut_base};
|
||||||
|
|
||||||
pub type Link = Option<~Flow:Share>;
|
pub type Link = Option<Box<Flow:Share>>;
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct Rawlink {
|
pub struct Rawlink {
|
||||||
|
@ -88,7 +88,7 @@ impl Rawlink {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the .prev field on `next`, then return `Some(next)`
|
/// Set the .prev field on `next`, then return `Some(next)`
|
||||||
fn link_with_prev(mut next: ~Flow:Share, prev: Rawlink) -> Link {
|
fn link_with_prev(mut next: Box<Flow:Share>, prev: Rawlink) -> Link {
|
||||||
mut_base(next).prev_sibling = prev;
|
mut_base(next).prev_sibling = prev;
|
||||||
Some(next)
|
Some(next)
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ impl FlowList {
|
||||||
/// Add an element first in the list
|
/// Add an element first in the list
|
||||||
///
|
///
|
||||||
/// O(1)
|
/// O(1)
|
||||||
pub fn push_front(&mut self, mut new_head: ~Flow:Share) {
|
pub fn push_front(&mut self, mut new_head: Box<Flow:Share>) {
|
||||||
match self.list_head {
|
match self.list_head {
|
||||||
None => {
|
None => {
|
||||||
self.list_tail = Rawlink::some(new_head);
|
self.list_tail = Rawlink::some(new_head);
|
||||||
|
@ -165,7 +165,7 @@ impl FlowList {
|
||||||
/// Remove the first element and return it, or None if the list is empty
|
/// Remove the first element and return it, or None if the list is empty
|
||||||
///
|
///
|
||||||
/// O(1)
|
/// O(1)
|
||||||
pub fn pop_front(&mut self) -> Option<~Flow:Share> {
|
pub fn pop_front(&mut self) -> Option<Box<Flow:Share>> {
|
||||||
self.list_head.take().map(|mut front_node| {
|
self.list_head.take().map(|mut front_node| {
|
||||||
self.length -= 1;
|
self.length -= 1;
|
||||||
match mut_base(front_node).next_sibling.take() {
|
match mut_base(front_node).next_sibling.take() {
|
||||||
|
@ -179,7 +179,7 @@ impl FlowList {
|
||||||
/// Add an element last in the list
|
/// Add an element last in the list
|
||||||
///
|
///
|
||||||
/// O(1)
|
/// O(1)
|
||||||
pub fn push_back(&mut self, mut new_tail: ~Flow:Share) {
|
pub fn push_back(&mut self, mut new_tail: Box<Flow:Share>) {
|
||||||
if self.list_tail.is_none() {
|
if self.list_tail.is_none() {
|
||||||
return self.push_front(new_tail);
|
return self.push_front(new_tail);
|
||||||
} else {
|
} else {
|
||||||
|
@ -194,7 +194,7 @@ impl FlowList {
|
||||||
/// Remove the last element and return it, or None if the list is empty
|
/// Remove the last element and return it, or None if the list is empty
|
||||||
///
|
///
|
||||||
/// O(1)
|
/// O(1)
|
||||||
pub fn pop_back(&mut self) -> Option<~Flow:Share> {
|
pub fn pop_back(&mut self) -> Option<Box<Flow:Share>> {
|
||||||
if self.list_tail.is_none() {
|
if self.list_tail.is_none() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -58,7 +58,7 @@ use std::cast;
|
||||||
use std::comm::{channel, Sender, Receiver};
|
use std::comm::{channel, Sender, Receiver};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::task;
|
use std::task::TaskBuilder;
|
||||||
use style::{AuthorOrigin, Stylesheet, Stylist};
|
use style::{AuthorOrigin, Stylesheet, Stylist};
|
||||||
use sync::{Arc, Mutex};
|
use sync::{Arc, Mutex};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
@ -95,7 +95,7 @@ pub struct LayoutTask {
|
||||||
/// A cached display list.
|
/// A cached display list.
|
||||||
pub display_list: Option<Arc<DisplayList>>,
|
pub display_list: Option<Arc<DisplayList>>,
|
||||||
|
|
||||||
pub stylist: ~Stylist,
|
pub stylist: Box<Stylist>,
|
||||||
|
|
||||||
/// The workers that we use for parallel operation.
|
/// The workers that we use for parallel operation.
|
||||||
pub parallel_traversal: Option<WorkQueue<*mut LayoutContext,PaddedUnsafeFlow>>,
|
pub parallel_traversal: Option<WorkQueue<*mut LayoutContext,PaddedUnsafeFlow>>,
|
||||||
|
@ -264,7 +264,7 @@ impl ImageResponder for LayoutImageResponder {
|
||||||
let script_chan = self.script_chan.clone();
|
let script_chan = self.script_chan.clone();
|
||||||
let f: proc(ImageResponseMsg):Send = proc(_) {
|
let f: proc(ImageResponseMsg):Send = proc(_) {
|
||||||
let ScriptChan(chan) = script_chan;
|
let ScriptChan(chan) = script_chan;
|
||||||
drop(chan.try_send(SendEventMsg(id.clone(), ReflowEvent)))
|
drop(chan.send_opt(SendEventMsg(id.clone(), ReflowEvent)))
|
||||||
};
|
};
|
||||||
f
|
f
|
||||||
}
|
}
|
||||||
|
@ -283,7 +283,7 @@ impl LayoutTask {
|
||||||
opts: Opts,
|
opts: Opts,
|
||||||
profiler_chan: ProfilerChan,
|
profiler_chan: ProfilerChan,
|
||||||
shutdown_chan: Sender<()>) {
|
shutdown_chan: Sender<()>) {
|
||||||
let mut builder = task::task().named("LayoutTask");
|
let mut builder = TaskBuilder::new().named("LayoutTask");
|
||||||
let ConstellationChan(con_chan) = constellation_chan.clone();
|
let ConstellationChan(con_chan) = constellation_chan.clone();
|
||||||
send_on_failure(&mut builder, FailureMsg(failure_msg), con_chan);
|
send_on_failure(&mut builder, FailureMsg(failure_msg), con_chan);
|
||||||
builder.spawn(proc() {
|
builder.spawn(proc() {
|
||||||
|
@ -314,10 +314,10 @@ impl LayoutTask {
|
||||||
opts: &Opts,
|
opts: &Opts,
|
||||||
profiler_chan: ProfilerChan)
|
profiler_chan: ProfilerChan)
|
||||||
-> LayoutTask {
|
-> LayoutTask {
|
||||||
let local_image_cache = ~LocalImageCache(image_cache_task.clone());
|
let local_image_cache = box LocalImageCache(image_cache_task.clone());
|
||||||
let local_image_cache = unsafe {
|
let local_image_cache = unsafe {
|
||||||
let cache = Arc::new(Mutex::new(cast::transmute::<~LocalImageCache,
|
let cache = Arc::new(Mutex::new(
|
||||||
*()>(local_image_cache)));
|
cast::transmute::<Box<LocalImageCache>, *()>(local_image_cache)));
|
||||||
LocalImageCacheHandle::new(cast::transmute::<Arc<Mutex<*()>>,Arc<*()>>(cache))
|
LocalImageCacheHandle::new(cast::transmute::<Arc<Mutex<*()>>,Arc<*()>>(cache))
|
||||||
};
|
};
|
||||||
let screen_size = Size2D(Au(0), Au(0));
|
let screen_size = Size2D(Au(0), Au(0));
|
||||||
|
@ -339,7 +339,7 @@ impl LayoutTask {
|
||||||
screen_size: screen_size,
|
screen_size: screen_size,
|
||||||
|
|
||||||
display_list: None,
|
display_list: None,
|
||||||
stylist: ~new_stylist(),
|
stylist: box new_stylist(),
|
||||||
parallel_traversal: parallel_traversal,
|
parallel_traversal: parallel_traversal,
|
||||||
profiler_chan: profiler_chan,
|
profiler_chan: profiler_chan,
|
||||||
opts: opts.clone(),
|
opts: opts.clone(),
|
||||||
|
@ -455,7 +455,7 @@ impl LayoutTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves the flow tree root from the root node.
|
/// Retrieves the flow tree root from the root node.
|
||||||
fn get_layout_root(&self, node: LayoutNode) -> ~Flow:Share {
|
fn get_layout_root(&self, node: LayoutNode) -> Box<Flow:Share> {
|
||||||
let mut layout_data_ref = node.mutate_layout_data();
|
let mut layout_data_ref = node.mutate_layout_data();
|
||||||
let result = match &mut *layout_data_ref {
|
let result = match &mut *layout_data_ref {
|
||||||
&Some(ref mut layout_data) => {
|
&Some(ref mut layout_data) => {
|
||||||
|
@ -521,7 +521,7 @@ impl LayoutTask {
|
||||||
/// benchmarked against those two. It is marked `#[inline(never)]` to aid profiling.
|
/// benchmarked against those two. It is marked `#[inline(never)]` to aid profiling.
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
fn solve_constraints_parallel(&mut self,
|
fn solve_constraints_parallel(&mut self,
|
||||||
layout_root: &mut ~Flow:Share,
|
layout_root: &mut Box<Flow:Share>,
|
||||||
layout_context: &mut LayoutContext) {
|
layout_context: &mut LayoutContext) {
|
||||||
if layout_context.opts.bubble_widths_separately {
|
if layout_context.opts.bubble_widths_separately {
|
||||||
let mut traversal = BubbleWidthsTraversal {
|
let mut traversal = BubbleWidthsTraversal {
|
||||||
|
@ -547,13 +547,13 @@ impl LayoutTask {
|
||||||
/// This is only on in debug builds.
|
/// This is only on in debug builds.
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
#[cfg(debug)]
|
#[cfg(debug)]
|
||||||
fn verify_flow_tree(&mut self, layout_root: &mut ~Flow:Share) {
|
fn verify_flow_tree(&mut self, layout_root: &mut Box<Flow:Share>) {
|
||||||
let mut traversal = FlowTreeVerificationTraversal;
|
let mut traversal = FlowTreeVerificationTraversal;
|
||||||
layout_root.traverse_preorder(&mut traversal);
|
layout_root.traverse_preorder(&mut traversal);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(debug))]
|
#[cfg(not(debug))]
|
||||||
fn verify_flow_tree(&mut self, _: &mut ~Flow:Share) {
|
fn verify_flow_tree(&mut self, _: &mut Box<Flow:Share>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The high-level routine that performs layout tasks.
|
/// The high-level routine that performs layout tasks.
|
||||||
|
@ -597,7 +597,7 @@ impl LayoutTask {
|
||||||
// FIXME(pcwalton): This is a pretty bogus thing to do. Essentially this is a workaround
|
// FIXME(pcwalton): This is a pretty bogus thing to do. Essentially this is a workaround
|
||||||
// for libgreen having slow TLS.
|
// for libgreen having slow TLS.
|
||||||
let mut font_context_opt = if self.parallel_traversal.is_none() {
|
let mut font_context_opt = if self.parallel_traversal.is_none() {
|
||||||
Some(~FontContext::new(layout_ctx.font_context_info.clone()))
|
Some(box FontContext::new(layout_ctx.font_context_info.clone()))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
@ -805,7 +805,7 @@ impl LayoutTask {
|
||||||
match *item {
|
match *item {
|
||||||
ClipDisplayItemClass(ref cc) => {
|
ClipDisplayItemClass(ref cc) => {
|
||||||
if geometry::rect_contains_point(cc.base.bounds, Point2D(x, y)) {
|
if geometry::rect_contains_point(cc.base.bounds, Point2D(x, y)) {
|
||||||
let ret = hit_test(x, y, cc.children.list.rev_iter());
|
let ret = hit_test(x, y, cc.children.list.iter().rev());
|
||||||
if !ret.is_none() {
|
if !ret.is_none() {
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
@ -835,7 +835,7 @@ impl LayoutTask {
|
||||||
Au::from_frac_px(point.y as f64));
|
Au::from_frac_px(point.y as f64));
|
||||||
let resp = match self.display_list {
|
let resp = match self.display_list {
|
||||||
None => fail!("no display list!"),
|
None => fail!("no display list!"),
|
||||||
Some(ref display_list) => hit_test(x, y, display_list.list.rev_iter()),
|
Some(ref display_list) => hit_test(x, y, display_list.list.iter().rev()),
|
||||||
};
|
};
|
||||||
if resp.is_some() {
|
if resp.is_some() {
|
||||||
reply_chan.send(Ok(resp.unwrap()));
|
reply_chan.send(Ok(resp.unwrap()));
|
||||||
|
@ -900,15 +900,15 @@ impl LayoutTask {
|
||||||
// to the script task, and ultimately cause the image to be
|
// to the script task, and ultimately cause the image to be
|
||||||
// re-requested. We probably don't need to go all the way back to
|
// re-requested. We probably don't need to go all the way back to
|
||||||
// the script task for this.
|
// the script task for this.
|
||||||
fn make_on_image_available_cb(&self) -> ~ImageResponder:Send {
|
fn make_on_image_available_cb(&self) -> Box<ImageResponder:Send> {
|
||||||
// This has a crazy signature because the image cache needs to
|
// This has a crazy signature because the image cache needs to
|
||||||
// make multiple copies of the callback, and the dom event
|
// make multiple copies of the callback, and the dom event
|
||||||
// channel is not a copyable type, so this is actually a
|
// channel is not a copyable type, so this is actually a
|
||||||
// little factory to produce callbacks
|
// little factory to produce callbacks
|
||||||
~LayoutImageResponder {
|
box LayoutImageResponder {
|
||||||
id: self.id.clone(),
|
id: self.id.clone(),
|
||||||
script_chan: self.script_chan.clone(),
|
script_chan: self.script_chan.clone(),
|
||||||
} as ~ImageResponder:Send
|
} as Box<ImageResponder:Send>
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handles a message to destroy layout data. Layout data must be destroyed on *this* task
|
/// Handles a message to destroy layout data. Layout data must be destroyed on *this* task
|
||||||
|
|
|
@ -63,13 +63,13 @@ fn null_unsafe_flow() -> UnsafeFlow {
|
||||||
(0, 0)
|
(0, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn owned_flow_to_unsafe_flow(flow: *~Flow:Share) -> UnsafeFlow {
|
pub fn owned_flow_to_unsafe_flow(flow: *Box<Flow:Share>) -> UnsafeFlow {
|
||||||
unsafe {
|
unsafe {
|
||||||
cast::transmute_copy(&*flow)
|
cast::transmute_copy(&*flow)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mut_owned_flow_to_unsafe_flow(flow: *mut ~Flow:Share) -> UnsafeFlow {
|
pub fn mut_owned_flow_to_unsafe_flow(flow: *mut Box<Flow:Share>) -> UnsafeFlow {
|
||||||
unsafe {
|
unsafe {
|
||||||
cast::transmute_copy(&*flow)
|
cast::transmute_copy(&*flow)
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ trait ParallelPostorderFlowTraversal : PostorderFlowTraversal {
|
||||||
loop {
|
loop {
|
||||||
unsafe {
|
unsafe {
|
||||||
// Get a real flow.
|
// Get a real flow.
|
||||||
let flow: &mut ~Flow:Share = cast::transmute(&unsafe_flow);
|
let flow: &mut Box<Flow:Share> = cast::transmute(&unsafe_flow);
|
||||||
|
|
||||||
// Perform the appropriate traversal.
|
// Perform the appropriate traversal.
|
||||||
if self.should_process(*flow) {
|
if self.should_process(*flow) {
|
||||||
|
@ -163,7 +163,7 @@ trait ParallelPostorderFlowTraversal : PostorderFlowTraversal {
|
||||||
// No, we're not at the root yet. Then are we the last child
|
// No, we're not at the root yet. Then are we the last child
|
||||||
// of our parent to finish processing? If so, we can continue
|
// of our parent to finish processing? If so, we can continue
|
||||||
// on with our parent; otherwise, we've gotta wait.
|
// on with our parent; otherwise, we've gotta wait.
|
||||||
let parent: &mut ~Flow:Share = cast::transmute(&unsafe_parent);
|
let parent: &mut Box<Flow:Share> = cast::transmute(&unsafe_parent);
|
||||||
let parent_base = flow::mut_base(*parent);
|
let parent_base = flow::mut_base(*parent);
|
||||||
if parent_base.parallel.children_count.fetch_sub(1, SeqCst) == 1 {
|
if parent_base.parallel.children_count.fetch_sub(1, SeqCst) == 1 {
|
||||||
// We were the last child of our parent. Reflow our parent.
|
// We were the last child of our parent. Reflow our parent.
|
||||||
|
@ -196,7 +196,7 @@ trait ParallelPreorderFlowTraversal : PreorderFlowTraversal {
|
||||||
let mut had_children = false;
|
let mut had_children = false;
|
||||||
unsafe {
|
unsafe {
|
||||||
// Get a real flow.
|
// Get a real flow.
|
||||||
let flow: &mut ~Flow:Share = cast::transmute(&unsafe_flow);
|
let flow: &mut Box<Flow:Share> = cast::transmute(&unsafe_flow);
|
||||||
|
|
||||||
// Perform the appropriate traversal.
|
// Perform the appropriate traversal.
|
||||||
self.process(*flow);
|
self.process(*flow);
|
||||||
|
@ -421,7 +421,7 @@ fn compute_absolute_position(unsafe_flow: PaddedUnsafeFlow,
|
||||||
let mut had_descendants = false;
|
let mut had_descendants = false;
|
||||||
unsafe {
|
unsafe {
|
||||||
// Get a real flow.
|
// Get a real flow.
|
||||||
let flow: &mut ~Flow:Share = cast::transmute(&unsafe_flow);
|
let flow: &mut Box<Flow:Share> = cast::transmute(&unsafe_flow);
|
||||||
|
|
||||||
// Compute the absolute position for the flow.
|
// Compute the absolute position for the flow.
|
||||||
flow.compute_absolute_position();
|
flow.compute_absolute_position();
|
||||||
|
@ -479,7 +479,7 @@ fn build_display_list(mut unsafe_flow: PaddedUnsafeFlow,
|
||||||
loop {
|
loop {
|
||||||
unsafe {
|
unsafe {
|
||||||
// Get a real flow.
|
// Get a real flow.
|
||||||
let flow: &mut ~Flow:Share = cast::transmute(&unsafe_flow);
|
let flow: &mut Box<Flow:Share> = cast::transmute(&unsafe_flow);
|
||||||
|
|
||||||
// Build display lists.
|
// Build display lists.
|
||||||
flow.build_display_list(layout_context);
|
flow.build_display_list(layout_context);
|
||||||
|
@ -512,7 +512,7 @@ fn build_display_list(mut unsafe_flow: PaddedUnsafeFlow,
|
||||||
// No, we're not at the root yet. Then are we the last child
|
// No, we're not at the root yet. Then are we the last child
|
||||||
// of our parent to finish processing? If so, we can continue
|
// of our parent to finish processing? If so, we can continue
|
||||||
// on with our parent; otherwise, we've gotta wait.
|
// on with our parent; otherwise, we've gotta wait.
|
||||||
let parent: &mut ~Flow:Share = cast::transmute(&unsafe_parent);
|
let parent: &mut Box<Flow:Share> = cast::transmute(&unsafe_parent);
|
||||||
let parent_base = flow::mut_base(*parent);
|
let parent_base = flow::mut_base(*parent);
|
||||||
if parent_base.parallel
|
if parent_base.parallel
|
||||||
.children_and_absolute_descendant_count
|
.children_and_absolute_descendant_count
|
||||||
|
@ -545,7 +545,7 @@ pub fn recalc_style_for_subtree(root_node: &LayoutNode,
|
||||||
queue.data = ptr::mut_null()
|
queue.data = ptr::mut_null()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn traverse_flow_tree_preorder(root: &mut ~Flow:Share,
|
pub fn traverse_flow_tree_preorder(root: &mut Box<Flow:Share>,
|
||||||
profiler_chan: ProfilerChan,
|
profiler_chan: ProfilerChan,
|
||||||
layout_context: &mut LayoutContext,
|
layout_context: &mut LayoutContext,
|
||||||
queue: &mut WorkQueue<*mut LayoutContext,PaddedUnsafeFlow>) {
|
queue: &mut WorkQueue<*mut LayoutContext,PaddedUnsafeFlow>) {
|
||||||
|
@ -565,7 +565,7 @@ pub fn traverse_flow_tree_preorder(root: &mut ~Flow:Share,
|
||||||
queue.data = ptr::mut_null()
|
queue.data = ptr::mut_null()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_display_list_for_subtree(root: &mut ~Flow:Share,
|
pub fn build_display_list_for_subtree(root: &mut Box<Flow:Share>,
|
||||||
profiler_chan: ProfilerChan,
|
profiler_chan: ProfilerChan,
|
||||||
layout_context: &mut LayoutContext,
|
layout_context: &mut LayoutContext,
|
||||||
queue: &mut WorkQueue<*mut LayoutContext,PaddedUnsafeFlow>) {
|
queue: &mut WorkQueue<*mut LayoutContext,PaddedUnsafeFlow>) {
|
||||||
|
|
|
@ -151,8 +151,8 @@ impl TextRunScanner {
|
||||||
// font group fonts. This is probably achieved by creating the font group above
|
// font group fonts. This is probably achieved by creating the font group above
|
||||||
// and then letting `FontGroup` decide which `Font` to stick into the text run.
|
// and then letting `FontGroup` decide which `Font` to stick into the text run.
|
||||||
let fontgroup = font_context.get_resolved_font_for_style(&font_style);
|
let fontgroup = font_context.get_resolved_font_for_style(&font_style);
|
||||||
let run = ~fontgroup.borrow().create_textrun(transformed_text.clone(),
|
let run = box fontgroup.borrow().create_textrun(
|
||||||
decoration);
|
transformed_text.clone(), decoration);
|
||||||
|
|
||||||
debug!("TextRunScanner: pushing single text box in range: {} ({})",
|
debug!("TextRunScanner: pushing single text box in range: {} ({})",
|
||||||
self.clump,
|
self.clump,
|
||||||
|
@ -210,7 +210,7 @@ impl TextRunScanner {
|
||||||
|
|
||||||
// Next, concatenate all of the transformed strings together, saving the new
|
// Next, concatenate all of the transformed strings together, saving the new
|
||||||
// character indices.
|
// character indices.
|
||||||
let mut run_str: ~str = "".to_owned();
|
let mut run_str = StrBuf::new();
|
||||||
let mut new_ranges: Vec<Range<CharIndex>> = vec![];
|
let mut new_ranges: Vec<Range<CharIndex>> = vec![];
|
||||||
let mut char_total = CharIndex(0);
|
let mut char_total = CharIndex(0);
|
||||||
for i in range(0, transformed_strs.len() as int) {
|
for i in range(0, transformed_strs.len() as int) {
|
||||||
|
@ -225,8 +225,9 @@ impl TextRunScanner {
|
||||||
// sequence. If no clump takes ownership, however, it will leak.
|
// sequence. If no clump takes ownership, however, it will leak.
|
||||||
let clump = self.clump;
|
let clump = self.clump;
|
||||||
let run = if clump.length() != CharIndex(0) && run_str.len() > 0 {
|
let run = if clump.length() != CharIndex(0) && run_str.len() > 0 {
|
||||||
Some(Arc::new(~TextRun::new(&mut *fontgroup.borrow().fonts.get(0).borrow_mut(),
|
Some(Arc::new(box TextRun::new(
|
||||||
run_str.clone(), decoration)))
|
&mut *fontgroup.borrow().fonts.get(0).borrow_mut(),
|
||||||
|
run_str.into_owned(), decoration)))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
|
@ -60,7 +60,7 @@ impl PrivateLayoutData {
|
||||||
pub struct LayoutDataWrapper {
|
pub struct LayoutDataWrapper {
|
||||||
pub chan: Option<LayoutChan>,
|
pub chan: Option<LayoutChan>,
|
||||||
pub shared_data: SharedLayoutData,
|
pub shared_data: SharedLayoutData,
|
||||||
pub data: ~PrivateLayoutData,
|
pub data: Box<PrivateLayoutData>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A trait that allows access to the layout data of a DOM node.
|
/// A trait that allows access to the layout data of a DOM node.
|
||||||
|
|
|
@ -247,7 +247,7 @@ impl<'ln> TNode<LayoutElement<'ln>> for LayoutNode<'ln> {
|
||||||
let elem: JS<Element> = self.node.transmute_copy();
|
let elem: JS<Element> = self.node.transmute_copy();
|
||||||
let element = &*elem.unsafe_get();
|
let element = &*elem.unsafe_get();
|
||||||
LayoutElement {
|
LayoutElement {
|
||||||
element: cast::transmute_region(element),
|
element: cast::transmute_lifetime(element),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,7 +136,7 @@ impl Pipeline {
|
||||||
};
|
};
|
||||||
|
|
||||||
ScriptTask::create(id,
|
ScriptTask::create(id,
|
||||||
~compositor_chan.clone(),
|
box compositor_chan.clone(),
|
||||||
layout_chan.clone(),
|
layout_chan.clone(),
|
||||||
script_port,
|
script_port,
|
||||||
script_chan.clone(),
|
script_chan.clone(),
|
||||||
|
@ -197,12 +197,12 @@ impl Pipeline {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn grant_paint_permission(&self) {
|
pub fn grant_paint_permission(&self) {
|
||||||
self.render_chan.chan.try_send(PaintPermissionGranted);
|
self.render_chan.chan.send_opt(PaintPermissionGranted);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn revoke_paint_permission(&self) {
|
pub fn revoke_paint_permission(&self) {
|
||||||
debug!("pipeline revoking render channel paint permission");
|
debug!("pipeline revoking render channel paint permission");
|
||||||
self.render_chan.chan.try_send(PaintPermissionRevoked);
|
self.render_chan.chan.send_opt(PaintPermissionRevoked);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn exit(&self) {
|
pub fn exit(&self) {
|
||||||
|
@ -211,7 +211,7 @@ impl Pipeline {
|
||||||
// Script task handles shutting down layout, and layout handles shutting down the renderer.
|
// Script task handles shutting down layout, and layout handles shutting down the renderer.
|
||||||
// For now, if the script task has failed, we give up on clean shutdown.
|
// For now, if the script task has failed, we give up on clean shutdown.
|
||||||
let ScriptChan(ref chan) = self.script_chan;
|
let ScriptChan(ref chan) = self.script_chan;
|
||||||
if chan.try_send(script_task::ExitPipelineMsg(self.id)) {
|
if chan.send_opt(script_task::ExitPipelineMsg(self.id)).is_ok() {
|
||||||
// Wait until all slave tasks have terminated and run destructors
|
// Wait until all slave tasks have terminated and run destructors
|
||||||
// NOTE: We don't wait for script task as we don't always own it
|
// NOTE: We don't wait for script task as we don't always own it
|
||||||
self.render_shutdown_port.recv_opt();
|
self.render_shutdown_port.recv_opt();
|
||||||
|
|
|
@ -13,7 +13,6 @@ use windowing::{Forward, Back};
|
||||||
use alert::{Alert, AlertMethods};
|
use alert::{Alert, AlertMethods};
|
||||||
use libc::{c_int, c_uchar};
|
use libc::{c_int, c_uchar};
|
||||||
use std::cell::{Cell, RefCell};
|
use std::cell::{Cell, RefCell};
|
||||||
use std::local_data;
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use geom::point::Point2D;
|
use geom::point::Point2D;
|
||||||
use geom::size::Size2D;
|
use geom::size::Size2D;
|
||||||
|
@ -92,7 +91,7 @@ impl WindowMethods<Application> for Window {
|
||||||
debug!("GLUT display func registgered");
|
debug!("GLUT display func registgered");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glut::display_func(~DisplayCallbackState);
|
glut::display_func(box DisplayCallbackState);
|
||||||
struct ReshapeCallbackState;
|
struct ReshapeCallbackState;
|
||||||
impl glut::ReshapeCallback for ReshapeCallbackState {
|
impl glut::ReshapeCallback for ReshapeCallbackState {
|
||||||
fn call(&self, width: c_int, height: c_int) {
|
fn call(&self, width: c_int, height: c_int) {
|
||||||
|
@ -100,7 +99,7 @@ impl WindowMethods<Application> for Window {
|
||||||
tmp.event_queue.borrow_mut().push(ResizeWindowEvent(width as uint, height as uint))
|
tmp.event_queue.borrow_mut().push(ResizeWindowEvent(width as uint, height as uint))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glut::reshape_func(glut_window, ~ReshapeCallbackState);
|
glut::reshape_func(glut_window, box ReshapeCallbackState);
|
||||||
struct KeyboardCallbackState;
|
struct KeyboardCallbackState;
|
||||||
impl glut::KeyboardCallback for KeyboardCallbackState {
|
impl glut::KeyboardCallback for KeyboardCallbackState {
|
||||||
fn call(&self, key: c_uchar, _x: c_int, _y: c_int) {
|
fn call(&self, key: c_uchar, _x: c_int, _y: c_int) {
|
||||||
|
@ -108,7 +107,7 @@ impl WindowMethods<Application> for Window {
|
||||||
tmp.handle_key(key)
|
tmp.handle_key(key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glut::keyboard_func(~KeyboardCallbackState);
|
glut::keyboard_func(box KeyboardCallbackState);
|
||||||
struct MouseCallbackState;
|
struct MouseCallbackState;
|
||||||
impl glut::MouseCallback for MouseCallbackState {
|
impl glut::MouseCallback for MouseCallbackState {
|
||||||
fn call(&self, button: c_int, state: c_int, x: c_int, y: c_int) {
|
fn call(&self, button: c_int, state: c_int, x: c_int, y: c_int) {
|
||||||
|
@ -130,7 +129,7 @@ impl WindowMethods<Application> for Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glut::mouse_func(~MouseCallbackState);
|
glut::mouse_func(box MouseCallbackState);
|
||||||
|
|
||||||
let wrapped_window = Rc::new(window);
|
let wrapped_window = Rc::new(window);
|
||||||
|
|
||||||
|
@ -275,16 +274,16 @@ impl Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static TLS_KEY: local_data::Key<Rc<Window>> = &local_data::Key;
|
local_data_key!(TLS_KEY: Rc<Window>)
|
||||||
|
|
||||||
fn install_local_window(window: Rc<Window>) {
|
fn install_local_window(window: Rc<Window>) {
|
||||||
local_data::set(TLS_KEY, window);
|
TLS_KEY.replace(Some(window));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn drop_local_window() {
|
fn drop_local_window() {
|
||||||
local_data::pop(TLS_KEY);
|
TLS_KEY.replace(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn local_window() -> Rc<Window> {
|
fn local_window() -> Rc<Window> {
|
||||||
local_data::get(TLS_KEY, |v| v.unwrap().clone())
|
TLS_KEY.get().unwrap().clone()
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ pub struct LayerBuffer {
|
||||||
/// A set of layer buffers. This is an atomic unit used to switch between the front and back
|
/// A set of layer buffers. This is an atomic unit used to switch between the front and back
|
||||||
/// buffers.
|
/// buffers.
|
||||||
pub struct LayerBufferSet {
|
pub struct LayerBufferSet {
|
||||||
pub buffers: Vec<~LayerBuffer>
|
pub buffers: Vec<Box<LayerBuffer>>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LayerBufferSet {
|
impl LayerBufferSet {
|
||||||
|
@ -140,7 +140,7 @@ pub trait RenderListener {
|
||||||
fn paint(&self,
|
fn paint(&self,
|
||||||
pipeline_id: PipelineId,
|
pipeline_id: PipelineId,
|
||||||
layer_id: LayerId,
|
layer_id: LayerId,
|
||||||
layer_buffer_set: ~LayerBufferSet,
|
layer_buffer_set: Box<LayerBufferSet>,
|
||||||
epoch: Epoch);
|
epoch: Epoch);
|
||||||
|
|
||||||
fn set_render_state(&self, render_state: RenderState);
|
fn set_render_state(&self, render_state: RenderState);
|
||||||
|
@ -155,10 +155,10 @@ pub trait ScriptListener : Clone {
|
||||||
layer_id: LayerId,
|
layer_id: LayerId,
|
||||||
point: Point2D<f32>);
|
point: Point2D<f32>);
|
||||||
fn close(&self);
|
fn close(&self);
|
||||||
fn dup(&self) -> ~ScriptListener;
|
fn dup(&self) -> Box<ScriptListener>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<E, S: Encoder<E>> Encodable<S, E> for ~ScriptListener {
|
impl<E, S: Encoder<E>> Encodable<S, E> for Box<ScriptListener> {
|
||||||
fn encode(&self, _s: &mut S) -> Result<(), E> {
|
fn encode(&self, _s: &mut S) -> Result<(), E> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ pub trait Tile {
|
||||||
fn destroy(self, graphics_context: &NativePaintingGraphicsContext);
|
fn destroy(self, graphics_context: &NativePaintingGraphicsContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Tile for ~LayerBuffer {
|
impl Tile for Box<LayerBuffer> {
|
||||||
fn get_mem(&self) -> uint {
|
fn get_mem(&self) -> uint {
|
||||||
// This works for now, but in the future we may want a better heuristic
|
// This works for now, but in the future we may want a better heuristic
|
||||||
self.screen_pos.size.width * self.screen_pos.size.height
|
self.screen_pos.size.width * self.screen_pos.size.height
|
||||||
|
|
|
@ -58,7 +58,7 @@ fn load(mut url: Url, start_chan: Sender<LoadResponse>) {
|
||||||
|
|
||||||
let request = RequestWriter::<NetworkStream>::new(Get, url.clone());
|
let request = RequestWriter::<NetworkStream>::new(Get, url.clone());
|
||||||
let writer = match request {
|
let writer = match request {
|
||||||
Ok(w) => ~w,
|
Ok(w) => box w,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
send_error(url, e.desc.to_owned(), start_chan);
|
send_error(url, e.desc.to_owned(), start_chan);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -25,7 +25,7 @@ pub struct LocalImageCacheHandle {
|
||||||
impl Drop for LocalImageCacheHandle {
|
impl Drop for LocalImageCacheHandle {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let _: ~Arc<Mutex<~LocalImageCache>> =
|
let _: Box<Arc<Mutex<Box<LocalImageCache>>>> =
|
||||||
cast::transmute(mem::replace(&mut self.data, ptr::null()));
|
cast::transmute(mem::replace(&mut self.data, ptr::null()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ impl Drop for LocalImageCacheHandle {
|
||||||
impl Clone for LocalImageCacheHandle {
|
impl Clone for LocalImageCacheHandle {
|
||||||
fn clone(&self) -> LocalImageCacheHandle {
|
fn clone(&self) -> LocalImageCacheHandle {
|
||||||
unsafe {
|
unsafe {
|
||||||
let handle = cast::transmute::<&Arc<Mutex<~LocalImageCache>>,&Arc<*()>>(self.get());
|
let handle = cast::transmute::<&Arc<Mutex<Box<LocalImageCache>>>,&Arc<*()>>(self.get());
|
||||||
let new_handle = (*handle).clone();
|
let new_handle = (*handle).clone();
|
||||||
LocalImageCacheHandle::new(new_handle)
|
LocalImageCacheHandle::new(new_handle)
|
||||||
}
|
}
|
||||||
|
@ -44,13 +44,13 @@ impl Clone for LocalImageCacheHandle {
|
||||||
impl LocalImageCacheHandle {
|
impl LocalImageCacheHandle {
|
||||||
pub unsafe fn new(cache: Arc<*()>) -> LocalImageCacheHandle {
|
pub unsafe fn new(cache: Arc<*()>) -> LocalImageCacheHandle {
|
||||||
LocalImageCacheHandle {
|
LocalImageCacheHandle {
|
||||||
data: cast::transmute(~cache),
|
data: cast::transmute(box cache),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get<'a>(&'a self) -> &'a Arc<Mutex<~LocalImageCache>> {
|
pub fn get<'a>(&'a self) -> &'a Arc<Mutex<Box<LocalImageCache>>> {
|
||||||
unsafe {
|
unsafe {
|
||||||
cast::transmute::<*uint,&'a Arc<Mutex<~LocalImageCache>>>(self.data)
|
cast::transmute::<*uint,&'a Arc<Mutex<Box<LocalImageCache>>>>(self.data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ impl LocalImageCacheHandle {
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct ImageHolder {
|
pub struct ImageHolder {
|
||||||
url: Url,
|
url: Url,
|
||||||
image: Option<Arc<~Image>>,
|
image: Option<Arc<Box<Image>>>,
|
||||||
cached_size: Size2D<int>,
|
cached_size: Size2D<int>,
|
||||||
local_image_cache: LocalImageCacheHandle,
|
local_image_cache: LocalImageCacheHandle,
|
||||||
}
|
}
|
||||||
|
@ -109,12 +109,12 @@ impl ImageHolder {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_image_if_present(&self) -> Option<Arc<~Image>> {
|
pub fn get_image_if_present(&self) -> Option<Arc<Box<Image>>> {
|
||||||
debug!("get_image_if_present() {}", self.url.to_str());
|
debug!("get_image_if_present() {}", self.url.to_str());
|
||||||
self.image.clone()
|
self.image.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_image(&mut self) -> Option<Arc<~Image>> {
|
pub fn get_image(&mut self) -> Option<Arc<Box<Image>>> {
|
||||||
debug!("get_image() {}", self.url.to_str());
|
debug!("get_image() {}", self.url.to_str());
|
||||||
|
|
||||||
// If this is the first time we've called this function, load
|
// If this is the first time we've called this function, load
|
||||||
|
|
|
@ -37,21 +37,21 @@ pub enum Msg {
|
||||||
|
|
||||||
// FIXME: We can probably get rid of this Cell now
|
// FIXME: We can probably get rid of this Cell now
|
||||||
/// Used be the prefetch tasks to post back image binaries
|
/// Used be the prefetch tasks to post back image binaries
|
||||||
priv StorePrefetchedImageData(Url, Result<~[u8], ()>),
|
StorePrefetchedImageData(Url, Result<~[u8], ()>),
|
||||||
|
|
||||||
/// Used by the decoder tasks to post decoded images back to the cache
|
/// Used by the decoder tasks to post decoded images back to the cache
|
||||||
priv StoreImage(Url, Option<Arc<~Image>>),
|
StoreImage(Url, Option<Arc<Box<Image>>>),
|
||||||
|
|
||||||
/// For testing
|
/// For testing
|
||||||
priv WaitForStore(Sender<()>),
|
WaitForStore(Sender<()>),
|
||||||
|
|
||||||
/// For testing
|
/// For testing
|
||||||
priv WaitForStorePrefetched(Sender<()>),
|
WaitForStorePrefetched(Sender<()>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub enum ImageResponseMsg {
|
pub enum ImageResponseMsg {
|
||||||
ImageReady(Arc<~Image>),
|
ImageReady(Arc<Box<Image>>),
|
||||||
ImageNotReady,
|
ImageNotReady,
|
||||||
ImageFailed
|
ImageFailed
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ enum ImageState {
|
||||||
Prefetching(AfterPrefetch),
|
Prefetching(AfterPrefetch),
|
||||||
Prefetched(~[u8]),
|
Prefetched(~[u8]),
|
||||||
Decoding,
|
Decoding,
|
||||||
Decoded(Arc<~Image>),
|
Decoded(Arc<Box<Image>>),
|
||||||
Failed
|
Failed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ impl ImageCache {
|
||||||
debug!("image_cache_task: started image decode for {:s}", url.to_str());
|
debug!("image_cache_task: started image decode for {:s}", url.to_str());
|
||||||
let image = load_from_memory(data);
|
let image = load_from_memory(data);
|
||||||
let image = if image.is_some() {
|
let image = if image.is_some() {
|
||||||
Some(Arc::new(~image.unwrap()))
|
Some(Arc::new(box image.unwrap()))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
@ -344,7 +344,7 @@ impl ImageCache {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn store_image(&mut self, url: Url, image: Option<Arc<~Image>>) {
|
fn store_image(&mut self, url: Url, image: Option<Arc<Box<Image>>>) {
|
||||||
|
|
||||||
match self.get_state(url.clone()) {
|
match self.get_state(url.clone()) {
|
||||||
Decoding => {
|
Decoding => {
|
||||||
|
@ -376,14 +376,14 @@ impl ImageCache {
|
||||||
Some(waiters) => {
|
Some(waiters) => {
|
||||||
let val = waiters.lock();
|
let val = waiters.lock();
|
||||||
let items = unsafe {
|
let items = unsafe {
|
||||||
cast::transmute::<*(), ~[Sender<ImageResponseMsg>]>(*val)
|
cast::transmute::<*(), Box<Vec<Sender<ImageResponseMsg>>>>(*val)
|
||||||
};
|
};
|
||||||
for response in items.iter() {
|
for response in items.iter() {
|
||||||
response.send(f());
|
response.send(f());
|
||||||
}
|
}
|
||||||
let _ = unsafe {
|
let _ = unsafe {
|
||||||
// Cast back to avoid the drop at the end.
|
// Cast back to avoid the drop at the end.
|
||||||
cast::transmute::<~[Sender<ImageResponseMsg>], *()>(items)
|
cast::transmute::<Box<Vec<Sender<ImageResponseMsg>>>, *()>(items)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
None => ()
|
None => ()
|
||||||
|
@ -414,18 +414,18 @@ impl ImageCache {
|
||||||
let mut response = Some(response);
|
let mut response = Some(response);
|
||||||
let val = waiters.lock();
|
let val = waiters.lock();
|
||||||
let mut items = unsafe {
|
let mut items = unsafe {
|
||||||
cast::transmute::<*(), ~[Sender<ImageResponseMsg>]>(*val)
|
cast::transmute::<*(), Box<Vec<Sender<ImageResponseMsg>>>>(*val)
|
||||||
};
|
};
|
||||||
items.push(response.take().unwrap());
|
items.push(response.take().unwrap());
|
||||||
let _ = unsafe {
|
let _ = unsafe {
|
||||||
// Cast back to avoid the drop at the end.
|
// Cast back to avoid the drop at the end.
|
||||||
cast::transmute::<~[Sender<ImageResponseMsg>], *()>(items)
|
cast::transmute::<Box<Vec<Sender<ImageResponseMsg>>>, *()>(items)
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
let response = ~[response];
|
let response = box vec!(response);
|
||||||
let wrapped = unsafe {
|
let wrapped = unsafe {
|
||||||
Arc::new(Mutex::new(
|
Arc::new(Mutex::new(
|
||||||
cast::transmute::<~[Sender<ImageResponseMsg>], *()>(response)))
|
cast::transmute::<Box<Vec<Sender<ImageResponseMsg>>>, *()>(response)))
|
||||||
};
|
};
|
||||||
|
|
||||||
self.wait_map.insert(url, wrapped);
|
self.wait_map.insert(url, wrapped);
|
||||||
|
@ -481,7 +481,7 @@ fn load_image_data(url: Url, resource_task: ResourceTask) -> Result<~[u8], ()> {
|
||||||
let (response_chan, response_port) = channel();
|
let (response_chan, response_port) = channel();
|
||||||
resource_task.send(resource_task::Load(url, response_chan));
|
resource_task.send(resource_task::Load(url, response_chan));
|
||||||
|
|
||||||
let mut image_data = ~[];
|
let mut image_data = vec!();
|
||||||
|
|
||||||
let progress_port = response_port.recv().progress_port;
|
let progress_port = response_port.recv().progress_port;
|
||||||
loop {
|
loop {
|
||||||
|
@ -490,7 +490,7 @@ fn load_image_data(url: Url, resource_task: ResourceTask) -> Result<~[u8], ()> {
|
||||||
image_data.push_all(data.as_slice());
|
image_data.push_all(data.as_slice());
|
||||||
}
|
}
|
||||||
resource_task::Done(result::Ok(..)) => {
|
resource_task::Done(result::Ok(..)) => {
|
||||||
return Ok(image_data);
|
return Ok(image_data.move_iter().collect());
|
||||||
}
|
}
|
||||||
resource_task::Done(result::Err(..)) => {
|
resource_task::Done(result::Err(..)) => {
|
||||||
return Err(());
|
return Err(());
|
||||||
|
@ -521,7 +521,6 @@ mod tests {
|
||||||
use image::base::test_image_bin;
|
use image::base::test_image_bin;
|
||||||
use servo_util::url::parse_url;
|
use servo_util::url::parse_url;
|
||||||
use std::comm;
|
use std::comm;
|
||||||
use std::comm::{Empty, Data, Disconnected};
|
|
||||||
|
|
||||||
trait Closure {
|
trait Closure {
|
||||||
fn invoke(&self, _response: Sender<resource_task::ProgressMsg>) { }
|
fn invoke(&self, _response: Sender<resource_task::ProgressMsg>) { }
|
||||||
|
@ -589,7 +588,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mock_resource_task<T: Closure+Send>(on_load: ~T) -> ResourceTask {
|
fn mock_resource_task<T: Closure+Send>(on_load: Box<T>) -> ResourceTask {
|
||||||
spawn_listener(proc(port: Receiver<resource_task::ControlMsg>) {
|
spawn_listener(proc(port: Receiver<resource_task::ControlMsg>) {
|
||||||
loop {
|
loop {
|
||||||
match port.recv() {
|
match port.recv() {
|
||||||
|
@ -605,7 +604,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn should_exit_on_request() {
|
fn should_exit_on_request() {
|
||||||
let mock_resource_task = mock_resource_task(~DoesNothing);
|
let mock_resource_task = mock_resource_task(box DoesNothing);
|
||||||
|
|
||||||
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
||||||
let _url = parse_url("file", None);
|
let _url = parse_url("file", None);
|
||||||
|
@ -617,7 +616,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
#[should_fail]
|
#[should_fail]
|
||||||
fn should_fail_if_unprefetched_image_is_requested() {
|
fn should_fail_if_unprefetched_image_is_requested() {
|
||||||
let mock_resource_task = mock_resource_task(~DoesNothing);
|
let mock_resource_task = mock_resource_task(box DoesNothing);
|
||||||
|
|
||||||
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
||||||
let url = parse_url("file", None);
|
let url = parse_url("file", None);
|
||||||
|
@ -631,7 +630,7 @@ mod tests {
|
||||||
fn should_request_url_from_resource_task_on_prefetch() {
|
fn should_request_url_from_resource_task_on_prefetch() {
|
||||||
let (url_requested_chan, url_requested) = channel();
|
let (url_requested_chan, url_requested) = channel();
|
||||||
|
|
||||||
let mock_resource_task = mock_resource_task(~JustSendOK { url_requested_chan: url_requested_chan});
|
let mock_resource_task = mock_resource_task(box JustSendOK { url_requested_chan: url_requested_chan});
|
||||||
|
|
||||||
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
||||||
let url = parse_url("file", None);
|
let url = parse_url("file", None);
|
||||||
|
@ -646,7 +645,7 @@ mod tests {
|
||||||
fn should_not_request_url_from_resource_task_on_multiple_prefetches() {
|
fn should_not_request_url_from_resource_task_on_multiple_prefetches() {
|
||||||
let (url_requested_chan, url_requested) = comm::channel();
|
let (url_requested_chan, url_requested) = comm::channel();
|
||||||
|
|
||||||
let mock_resource_task = mock_resource_task(~JustSendOK { url_requested_chan: url_requested_chan});
|
let mock_resource_task = mock_resource_task(box JustSendOK { url_requested_chan: url_requested_chan});
|
||||||
|
|
||||||
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
||||||
let url = parse_url("file", None);
|
let url = parse_url("file", None);
|
||||||
|
@ -657,8 +656,8 @@ mod tests {
|
||||||
image_cache_task.exit();
|
image_cache_task.exit();
|
||||||
mock_resource_task.send(resource_task::Exit);
|
mock_resource_task.send(resource_task::Exit);
|
||||||
match url_requested.try_recv() {
|
match url_requested.try_recv() {
|
||||||
Empty | Disconnected => (),
|
Err(_) => (),
|
||||||
Data(_) => assert!(false),
|
Ok(_) => fail!(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -666,7 +665,7 @@ mod tests {
|
||||||
fn should_return_image_not_ready_if_data_has_not_arrived() {
|
fn should_return_image_not_ready_if_data_has_not_arrived() {
|
||||||
let (wait_chan, wait_port) = comm::channel();
|
let (wait_chan, wait_port) = comm::channel();
|
||||||
|
|
||||||
let mock_resource_task = mock_resource_task(~WaitSendTestImage{wait_port: wait_port});
|
let mock_resource_task = mock_resource_task(box WaitSendTestImage{wait_port: wait_port});
|
||||||
|
|
||||||
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
||||||
let url = parse_url("file", None);
|
let url = parse_url("file", None);
|
||||||
|
@ -683,7 +682,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn should_return_decoded_image_data_if_data_has_arrived() {
|
fn should_return_decoded_image_data_if_data_has_arrived() {
|
||||||
let mock_resource_task = mock_resource_task(~SendTestImage);
|
let mock_resource_task = mock_resource_task(box SendTestImage);
|
||||||
|
|
||||||
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
||||||
let url = parse_url("file", None);
|
let url = parse_url("file", None);
|
||||||
|
@ -709,7 +708,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn should_return_decoded_image_data_for_multiple_requests() {
|
fn should_return_decoded_image_data_for_multiple_requests() {
|
||||||
let mock_resource_task = mock_resource_task(~SendTestImage);
|
let mock_resource_task = mock_resource_task(box SendTestImage);
|
||||||
|
|
||||||
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
||||||
let url = parse_url("file", None);
|
let url = parse_url("file", None);
|
||||||
|
@ -776,8 +775,8 @@ mod tests {
|
||||||
// Our resource task should not have received another request for the image
|
// Our resource task should not have received another request for the image
|
||||||
// because it's already cached
|
// because it's already cached
|
||||||
match image_bin_sent.try_recv() {
|
match image_bin_sent.try_recv() {
|
||||||
Empty | Disconnected => (),
|
Err(_) => (),
|
||||||
Data(_) => assert!(false),
|
Ok(_) => fail!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -824,14 +823,14 @@ mod tests {
|
||||||
// Our resource task should not have received another request for the image
|
// Our resource task should not have received another request for the image
|
||||||
// because it's already cached
|
// because it's already cached
|
||||||
match image_bin_sent.try_recv() {
|
match image_bin_sent.try_recv() {
|
||||||
Empty | Disconnected => (),
|
Err(_) => (),
|
||||||
Data(_) => assert!(false),
|
Ok(_) => fail!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn should_return_failed_if_image_bin_cannot_be_fetched() {
|
fn should_return_failed_if_image_bin_cannot_be_fetched() {
|
||||||
let mock_resource_task = mock_resource_task(~SendTestImageErr);
|
let mock_resource_task = mock_resource_task(box SendTestImageErr);
|
||||||
|
|
||||||
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
||||||
let url = parse_url("file", None);
|
let url = parse_url("file", None);
|
||||||
|
@ -857,7 +856,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn should_return_failed_for_multiple_get_image_requests_if_image_bin_cannot_be_fetched() {
|
fn should_return_failed_for_multiple_get_image_requests_if_image_bin_cannot_be_fetched() {
|
||||||
let mock_resource_task = mock_resource_task(~SendTestImageErr);
|
let mock_resource_task = mock_resource_task(box SendTestImageErr);
|
||||||
|
|
||||||
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
||||||
let url = parse_url("file", None);
|
let url = parse_url("file", None);
|
||||||
|
@ -891,7 +890,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn should_return_failed_if_image_decode_fails() {
|
fn should_return_failed_if_image_decode_fails() {
|
||||||
let mock_resource_task = mock_resource_task(~SendBogusImage);
|
let mock_resource_task = mock_resource_task(box SendBogusImage);
|
||||||
|
|
||||||
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
||||||
let url = parse_url("file", None);
|
let url = parse_url("file", None);
|
||||||
|
@ -919,7 +918,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn should_return_image_on_wait_if_image_is_already_loaded() {
|
fn should_return_image_on_wait_if_image_is_already_loaded() {
|
||||||
let mock_resource_task = mock_resource_task(~SendTestImage);
|
let mock_resource_task = mock_resource_task(box SendTestImage);
|
||||||
|
|
||||||
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
||||||
let url = parse_url("file", None);
|
let url = parse_url("file", None);
|
||||||
|
@ -947,7 +946,7 @@ mod tests {
|
||||||
fn should_return_image_on_wait_if_image_is_not_yet_loaded() {
|
fn should_return_image_on_wait_if_image_is_not_yet_loaded() {
|
||||||
let (wait_chan, wait_port) = comm::channel();
|
let (wait_chan, wait_port) = comm::channel();
|
||||||
|
|
||||||
let mock_resource_task = mock_resource_task(~WaitSendTestImage {wait_port: wait_port});
|
let mock_resource_task = mock_resource_task(box WaitSendTestImage {wait_port: wait_port});
|
||||||
|
|
||||||
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
||||||
let url = parse_url("file", None);
|
let url = parse_url("file", None);
|
||||||
|
@ -973,7 +972,7 @@ mod tests {
|
||||||
fn should_return_image_failed_on_wait_if_image_fails_to_load() {
|
fn should_return_image_failed_on_wait_if_image_fails_to_load() {
|
||||||
let (wait_chan, wait_port) = comm::channel();
|
let (wait_chan, wait_port) = comm::channel();
|
||||||
|
|
||||||
let mock_resource_task = mock_resource_task(~WaitSendTestImageErr{wait_port: wait_port});
|
let mock_resource_task = mock_resource_task(box WaitSendTestImageErr{wait_port: wait_port});
|
||||||
|
|
||||||
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
let image_cache_task = ImageCacheTask(mock_resource_task.clone());
|
||||||
let url = parse_url("file", None);
|
let url = parse_url("file", None);
|
||||||
|
@ -997,7 +996,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn sync_cache_should_wait_for_images() {
|
fn sync_cache_should_wait_for_images() {
|
||||||
let mock_resource_task = mock_resource_task(~SendTestImage);
|
let mock_resource_task = mock_resource_task(box SendTestImage);
|
||||||
|
|
||||||
let image_cache_task = SyncImageCacheTask(mock_resource_task.clone());
|
let image_cache_task = SyncImageCacheTask(mock_resource_task.clone());
|
||||||
let url = parse_url("file", None);
|
let url = parse_url("file", None);
|
||||||
|
|
|
@ -32,7 +32,7 @@ pub fn LocalImageCache(image_cache_task: ImageCacheTask) -> LocalImageCache {
|
||||||
pub struct LocalImageCache {
|
pub struct LocalImageCache {
|
||||||
image_cache_task: ImageCacheTask,
|
image_cache_task: ImageCacheTask,
|
||||||
round_number: uint,
|
round_number: uint,
|
||||||
on_image_available: Option<~ImageResponder:Send>,
|
on_image_available: Option<Box<ImageResponder:Send>>,
|
||||||
state_map: UrlMap<ImageState>
|
state_map: UrlMap<ImageState>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ struct ImageState {
|
||||||
impl LocalImageCache {
|
impl LocalImageCache {
|
||||||
/// The local cache will only do a single remote request for a given
|
/// The local cache will only do a single remote request for a given
|
||||||
/// URL in each 'round'. Layout should call this each time it begins
|
/// URL in each 'round'. Layout should call this each time it begins
|
||||||
pub fn next_round(&mut self, on_image_available: ~ImageResponder:Send) {
|
pub fn next_round(&mut self, on_image_available: Box<ImageResponder:Send>) {
|
||||||
self.round_number += 1;
|
self.round_number += 1;
|
||||||
self.on_image_available = Some(on_image_available);
|
self.on_image_available = Some(on_image_available);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ use http_loader;
|
||||||
use data_loader;
|
use data_loader;
|
||||||
|
|
||||||
use std::comm::{channel, Receiver, Sender};
|
use std::comm::{channel, Receiver, Sender};
|
||||||
use std::task;
|
use std::task::TaskBuilder;
|
||||||
use http::headers::content_type::MediaType;
|
use http::headers::content_type::MediaType;
|
||||||
use http::headers::response::HeaderCollection;
|
use http::headers::response::HeaderCollection;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
@ -56,10 +56,10 @@ impl Metadata {
|
||||||
Some(MediaType { type_: ref type_,
|
Some(MediaType { type_: ref type_,
|
||||||
subtype: ref subtype,
|
subtype: ref subtype,
|
||||||
parameters: ref parameters }) => {
|
parameters: ref parameters }) => {
|
||||||
self.content_type = Some((type_.clone(), subtype.clone()));
|
self.content_type = Some((type_.as_slice().to_owned(), subtype.as_slice().to_owned()));
|
||||||
for &(ref k, ref v) in parameters.iter() {
|
for &(ref k, ref v) in parameters.iter() {
|
||||||
if "charset" == k.as_slice() {
|
if "charset" == k.as_slice() {
|
||||||
self.charset = Some(v.clone());
|
self.charset = Some(v.as_slice().to_owned());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ pub fn ResourceTask() -> ResourceTask {
|
||||||
|
|
||||||
fn create_resource_task_with_loaders(loaders: Vec<(~str, LoaderTaskFactory)>) -> ResourceTask {
|
fn create_resource_task_with_loaders(loaders: Vec<(~str, LoaderTaskFactory)>) -> ResourceTask {
|
||||||
let (setup_chan, setup_port) = channel();
|
let (setup_chan, setup_port) = channel();
|
||||||
let builder = task::task().named("ResourceManager");
|
let builder = TaskBuilder::new().named("ResourceManager");
|
||||||
builder.spawn(proc() {
|
builder.spawn(proc() {
|
||||||
let (chan, port) = channel();
|
let (chan, port) = channel();
|
||||||
setup_chan.send(chan);
|
setup_chan.send(chan);
|
||||||
|
|
|
@ -61,7 +61,7 @@ impl Attr {
|
||||||
name: DOMString, namespace: Namespace,
|
name: DOMString, namespace: Namespace,
|
||||||
prefix: Option<DOMString>, owner: &JSRef<Element>) -> Temporary<Attr> {
|
prefix: Option<DOMString>, owner: &JSRef<Element>) -> Temporary<Attr> {
|
||||||
let attr = Attr::new_inherited(local_name, value, name, namespace, prefix, owner);
|
let attr = Attr::new_inherited(local_name, value, name, namespace, prefix, owner);
|
||||||
reflect_dom_object(~attr, window, AttrBinding::Wrap)
|
reflect_dom_object(box attr, window, AttrBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_value(&mut self, set_type: AttrSettingType, value: DOMString) {
|
pub fn set_value(&mut self, set_type: AttrSettingType, value: DOMString) {
|
||||||
|
|
|
@ -26,7 +26,7 @@ impl AttrList {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(window: &JSRef<Window>, elem: &JSRef<Element>) -> Temporary<AttrList> {
|
pub fn new(window: &JSRef<Window>, elem: &JSRef<Element>) -> Temporary<AttrList> {
|
||||||
reflect_dom_object(~AttrList::new_inherited(window, elem),
|
reflect_dom_object(box AttrList::new_inherited(window, elem),
|
||||||
window, AttrListBinding::Wrap)
|
window, AttrListBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ pub fn GetJSObjectFromCallback<T: CallbackContainer>(callback: &T) -> *JSObject
|
||||||
|
|
||||||
pub fn WrapCallThisObject<T: 'static + CallbackContainer + Reflectable>(cx: *JSContext,
|
pub fn WrapCallThisObject<T: 'static + CallbackContainer + Reflectable>(cx: *JSContext,
|
||||||
_scope: *JSObject,
|
_scope: *JSObject,
|
||||||
p: ~T) -> *JSObject {
|
p: Box<T>) -> *JSObject {
|
||||||
let obj = GetJSObjectFromCallback(p);
|
let obj = GetJSObjectFromCallback(p);
|
||||||
assert!(obj.is_not_null());
|
assert!(obj.is_not_null());
|
||||||
|
|
||||||
|
|
|
@ -1755,10 +1755,10 @@ class CGWrapMethod(CGAbstractMethod):
|
||||||
assert descriptor.interface.hasInterfacePrototypeObject()
|
assert descriptor.interface.hasInterfacePrototypeObject()
|
||||||
if not descriptor.createGlobal:
|
if not descriptor.createGlobal:
|
||||||
args = [Argument('*JSContext', 'aCx'), Argument('&JSRef<Window>', 'aScope'),
|
args = [Argument('*JSContext', 'aCx'), Argument('&JSRef<Window>', 'aScope'),
|
||||||
Argument("~" + descriptor.concreteType, 'aObject', mutable=True)]
|
Argument("Box<%s>" % descriptor.concreteType, 'aObject', mutable=True)]
|
||||||
else:
|
else:
|
||||||
args = [Argument('*JSContext', 'aCx'),
|
args = [Argument('*JSContext', 'aCx'),
|
||||||
Argument("~" + descriptor.concreteType, 'aObject', mutable=True)]
|
Argument("Box<%s>" % descriptor.concreteType, 'aObject', mutable=True)]
|
||||||
retval = 'JS<%s>' % descriptor.concreteType
|
retval = 'JS<%s>' % descriptor.concreteType
|
||||||
CGAbstractMethod.__init__(self, descriptor, 'Wrap', retval, args, pub=True)
|
CGAbstractMethod.__init__(self, descriptor, 'Wrap', retval, args, pub=True)
|
||||||
|
|
||||||
|
@ -2609,7 +2609,7 @@ impl ToJSValConvertible for valuelist {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
""" % (",\n ".join(map(getEnumValueName, enum.values())),
|
""" % (",\n ".join(map(getEnumValueName, enum.values())),
|
||||||
",\n ".join(['&"%s"' % val for val in enum.values()]))
|
",\n ".join(['"%s"' % val for val in enum.values()]))
|
||||||
|
|
||||||
self.cgRoot = CGList([
|
self.cgRoot = CGList([
|
||||||
CGNamespace.build([enum.identifier.name + "Values"],
|
CGNamespace.build([enum.identifier.name + "Values"],
|
||||||
|
@ -3740,7 +3740,7 @@ class CGAbstractClassHook(CGAbstractExternMethod):
|
||||||
|
|
||||||
def finalizeHook(descriptor, hookName, context):
|
def finalizeHook(descriptor, hookName, context):
|
||||||
release = """let val = JS_GetReservedSlot(obj, dom_object_slot(obj));
|
release = """let val = JS_GetReservedSlot(obj, dom_object_slot(obj));
|
||||||
let _: ~%s = cast::transmute(val.to_private());
|
let _: Box<%s> = cast::transmute(val.to_private());
|
||||||
debug!("%s finalize: {:p}", this);
|
debug!("%s finalize: {:p}", this);
|
||||||
""" % (descriptor.concreteType, descriptor.concreteType)
|
""" % (descriptor.concreteType, descriptor.concreteType)
|
||||||
return release
|
return release
|
||||||
|
@ -4221,7 +4221,7 @@ class CGBindingRoot(CGThing):
|
||||||
'dom::bindings::js::{OptionalRootable, OptionalRootedRootable, ResultRootable}',
|
'dom::bindings::js::{OptionalRootable, OptionalRootedRootable, ResultRootable}',
|
||||||
'dom::bindings::js::{OptionalRootedReference, OptionalOptionalRootedRootable}',
|
'dom::bindings::js::{OptionalRootedReference, OptionalOptionalRootedRootable}',
|
||||||
'dom::bindings::utils::{CreateDOMGlobal, CreateInterfaceObjects2}',
|
'dom::bindings::utils::{CreateDOMGlobal, CreateInterfaceObjects2}',
|
||||||
'dom::bindings::utils::{ConstantSpec, cx_for_dom_object, Default}',
|
'dom::bindings::utils::{ConstantSpec, cx_for_dom_object}',
|
||||||
'dom::bindings::utils::{dom_object_slot, DOM_OBJECT_SLOT, DOMClass}',
|
'dom::bindings::utils::{dom_object_slot, DOM_OBJECT_SLOT, DOMClass}',
|
||||||
'dom::bindings::utils::{DOMJSClass, JSCLASS_DOM_GLOBAL}',
|
'dom::bindings::utils::{DOMJSClass, JSCLASS_DOM_GLOBAL}',
|
||||||
'dom::bindings::utils::{FindEnumStringIndex, GetArrayIndexFromId}',
|
'dom::bindings::utils::{FindEnumStringIndex, GetArrayIndexFromId}',
|
||||||
|
@ -4258,7 +4258,6 @@ class CGBindingRoot(CGThing):
|
||||||
'std::cast',
|
'std::cast',
|
||||||
'std::cmp',
|
'std::cmp',
|
||||||
'std::ptr',
|
'std::ptr',
|
||||||
'std::slice',
|
|
||||||
'std::str',
|
'std::str',
|
||||||
'std::num',
|
'std::num',
|
||||||
])
|
])
|
||||||
|
@ -4649,7 +4648,7 @@ class CGCallback(CGClass):
|
||||||
|
|
||||||
# And now insert our template argument.
|
# And now insert our template argument.
|
||||||
argsWithoutThis = list(args)
|
argsWithoutThis = list(args)
|
||||||
args.insert(0, Argument("~T", "thisObj"))
|
args.insert(0, Argument("Box<T>", "thisObj"))
|
||||||
|
|
||||||
# And the self argument
|
# And the self argument
|
||||||
method.args.insert(0, Argument(None, "&self"))
|
method.args.insert(0, Argument(None, "&self"))
|
||||||
|
@ -4799,7 +4798,7 @@ class CallbackMember(CGNativeMember):
|
||||||
if self.argCount > 0:
|
if self.argCount > 0:
|
||||||
replacements["argCount"] = self.argCountStr
|
replacements["argCount"] = self.argCountStr
|
||||||
replacements["argvDecl"] = string.Template(
|
replacements["argvDecl"] = string.Template(
|
||||||
"let mut argv = slice::from_elem(${argCount}, UndefinedValue());\n"
|
"let mut argv = Vec::from_elem(${argCount}, UndefinedValue());\n"
|
||||||
).substitute(replacements)
|
).substitute(replacements)
|
||||||
else:
|
else:
|
||||||
# Avoid weird 0-sized arrays
|
# Avoid weird 0-sized arrays
|
||||||
|
@ -4886,7 +4885,7 @@ class CallbackMember(CGNativeMember):
|
||||||
result = argval
|
result = argval
|
||||||
prepend = ""
|
prepend = ""
|
||||||
|
|
||||||
conversion = prepend + wrapForType("argv[%s]" % jsvalIndex,
|
conversion = prepend + wrapForType("*argv.get_mut(%s)" % jsvalIndex,
|
||||||
result=result,
|
result=result,
|
||||||
successCode="continue;" if arg.variadic else "break;")
|
successCode="continue;" if arg.variadic else "break;")
|
||||||
if arg.variadic:
|
if arg.variadic:
|
||||||
|
@ -4975,7 +4974,7 @@ class CallbackMethod(CallbackMember):
|
||||||
"getCallable": self.getCallableDecl()
|
"getCallable": self.getCallableDecl()
|
||||||
}
|
}
|
||||||
if self.argCount > 0:
|
if self.argCount > 0:
|
||||||
replacements["argv"] = "&argv[0]"
|
replacements["argv"] = "argv.as_ptr()"
|
||||||
replacements["argc"] = "argc"
|
replacements["argc"] = "argc"
|
||||||
else:
|
else:
|
||||||
replacements["argv"] = "nullptr"
|
replacements["argv"] = "nullptr"
|
||||||
|
|
|
@ -49,7 +49,6 @@ use script_task::StackRoots;
|
||||||
use std::cast;
|
use std::cast;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::kinds::marker::ContravariantLifetime;
|
use std::kinds::marker::ContravariantLifetime;
|
||||||
use std::local_data;
|
|
||||||
|
|
||||||
/// A type that represents a JS-owned value that is rooted for the lifetime of this value.
|
/// A type that represents a JS-owned value that is rooted for the lifetime of this value.
|
||||||
/// Importantly, it requires explicit rooting in order to interact with the inner value.
|
/// Importantly, it requires explicit rooting in order to interact with the inner value.
|
||||||
|
@ -94,12 +93,10 @@ impl<T: Reflectable> Temporary<T> {
|
||||||
|
|
||||||
/// Create a stack-bounded root for this value.
|
/// Create a stack-bounded root for this value.
|
||||||
pub fn root<'a, 'b>(self) -> Root<'a, 'b, T> {
|
pub fn root<'a, 'b>(self) -> Root<'a, 'b, T> {
|
||||||
local_data::get(StackRoots, |opt| {
|
let collection = StackRoots.get().unwrap();
|
||||||
let collection = opt.unwrap();
|
unsafe {
|
||||||
unsafe {
|
(**collection).new_root(&self.inner)
|
||||||
(**collection).new_root(&self.inner)
|
}
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn inner(&self) -> JS<T> {
|
unsafe fn inner(&self) -> JS<T> {
|
||||||
|
@ -162,12 +159,10 @@ impl<T: Reflectable> JS<T> {
|
||||||
|
|
||||||
/// Root this JS-owned value to prevent its collection as garbage.
|
/// Root this JS-owned value to prevent its collection as garbage.
|
||||||
pub fn root<'a, 'b>(&self) -> Root<'a, 'b, T> {
|
pub fn root<'a, 'b>(&self) -> Root<'a, 'b, T> {
|
||||||
local_data::get(StackRoots, |opt| {
|
let collection = StackRoots.get().unwrap();
|
||||||
let collection = opt.unwrap();
|
unsafe {
|
||||||
unsafe {
|
(**collection).new_root(self)
|
||||||
(**collection).new_root(self)
|
}
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ pub fn unwrap_jsmanaged<T: Reflectable>(mut obj: *JSObject,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn squirrel_away_unique<T>(x: ~T) -> *T {
|
pub unsafe fn squirrel_away_unique<T>(x: Box<T>) -> *T {
|
||||||
cast::transmute(x)
|
cast::transmute(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,7 +375,7 @@ pub extern fn ThrowingConstructor(_cx: *JSContext, _argc: c_uint, _vp: *mut JSVa
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn initialize_global(global: *JSObject) {
|
pub fn initialize_global(global: *JSObject) {
|
||||||
let protoArray = ~([0 as *JSObject, ..PrototypeList::id::IDCount as uint]);
|
let protoArray = box () ([0 as *JSObject, ..PrototypeList::id::IDCount as uint]);
|
||||||
unsafe {
|
unsafe {
|
||||||
let box_ = squirrel_away_unique(protoArray);
|
let box_ = squirrel_away_unique(protoArray);
|
||||||
JS_SetReservedSlot(global,
|
JS_SetReservedSlot(global,
|
||||||
|
@ -390,9 +390,9 @@ pub trait Reflectable {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reflect_dom_object<T: Reflectable>
|
pub fn reflect_dom_object<T: Reflectable>
|
||||||
(obj: ~T,
|
(obj: Box<T>,
|
||||||
window: &JSRef<window::Window>,
|
window: &JSRef<window::Window>,
|
||||||
wrap_fn: extern "Rust" fn(*JSContext, &JSRef<window::Window>, ~T) -> JS<T>)
|
wrap_fn: extern "Rust" fn(*JSContext, &JSRef<window::Window>, Box<T>) -> JS<T>)
|
||||||
-> Temporary<T> {
|
-> Temporary<T> {
|
||||||
Temporary::new(wrap_fn(window.deref().get_cx(), window, obj))
|
Temporary::new(wrap_fn(window.deref().get_cx(), window, obj))
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ impl Blob {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(window: &JSRef<Window>) -> Temporary<Blob> {
|
pub fn new(window: &JSRef<Window>) -> Temporary<Blob> {
|
||||||
reflect_dom_object(~Blob::new_inherited(window),
|
reflect_dom_object(box Blob::new_inherited(window),
|
||||||
window,
|
window,
|
||||||
BlobBinding::Wrap)
|
BlobBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn AppendData(&mut self, arg: DOMString) -> ErrorResult {
|
fn AppendData(&mut self, arg: DOMString) -> ErrorResult {
|
||||||
self.data.push_str(arg);
|
self.data = self.data + arg;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,10 +92,10 @@ impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> {
|
||||||
} else {
|
} else {
|
||||||
count
|
count
|
||||||
};
|
};
|
||||||
let mut data = self.data.slice(0, offset as uint).to_owned();
|
let mut data = self.data.slice(0, offset as uint).to_strbuf();
|
||||||
data.push_str(arg);
|
data.push_str(arg);
|
||||||
data.push_str(self.data.slice((offset + count) as uint, length as uint));
|
data.push_str(self.data.slice((offset + count) as uint, length as uint));
|
||||||
self.data = data;
|
self.data = data.into_owned();
|
||||||
// FIXME: Once we have `Range`, we should implement step7 to step11
|
// FIXME: Once we have `Range`, we should implement step7 to step11
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ impl ClientRect {
|
||||||
top: Au, bottom: Au,
|
top: Au, bottom: Au,
|
||||||
left: Au, right: Au) -> Temporary<ClientRect> {
|
left: Au, right: Au) -> Temporary<ClientRect> {
|
||||||
let rect = ClientRect::new_inherited(window, top, bottom, left, right);
|
let rect = ClientRect::new_inherited(window, top, bottom, left, right);
|
||||||
reflect_dom_object(~rect, window, ClientRectBinding::Wrap)
|
reflect_dom_object(box rect, window, ClientRectBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ impl ClientRectList {
|
||||||
|
|
||||||
pub fn new(window: &JSRef<Window>,
|
pub fn new(window: &JSRef<Window>,
|
||||||
rects: Vec<JSRef<ClientRect>>) -> Temporary<ClientRectList> {
|
rects: Vec<JSRef<ClientRect>>) -> Temporary<ClientRectList> {
|
||||||
reflect_dom_object(~ClientRectList::new_inherited(window, rects),
|
reflect_dom_object(box ClientRectList::new_inherited(window, rects),
|
||||||
window, ClientRectListBinding::Wrap)
|
window, ClientRectListBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ impl Comment {
|
||||||
|
|
||||||
pub fn new(text: DOMString, document: &JSRef<Document>) -> Temporary<Comment> {
|
pub fn new(text: DOMString, document: &JSRef<Document>) -> Temporary<Comment> {
|
||||||
let node = Comment::new_inherited(text, document);
|
let node = Comment::new_inherited(text, document);
|
||||||
Node::reflect_node(~node, document, CommentBinding::Wrap)
|
Node::reflect_node(box node, document, CommentBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn Constructor(owner: &JSRef<Window>, data: DOMString) -> Fallible<Temporary<Comment>> {
|
pub fn Constructor(owner: &JSRef<Window>, data: DOMString) -> Fallible<Temporary<Comment>> {
|
||||||
|
|
|
@ -21,7 +21,7 @@ impl Console {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(window: &JSRef<Window>) -> Temporary<Console> {
|
pub fn new(window: &JSRef<Window>) -> Temporary<Console> {
|
||||||
reflect_dom_object(~Console::new_inherited(), window, ConsoleBinding::Wrap)
|
reflect_dom_object(box Console::new_inherited(), window, ConsoleBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -179,9 +179,9 @@ impl<'a> DocumentHelpers for JSRef<'a, Document> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Document {
|
impl Document {
|
||||||
pub fn reflect_document(document: ~Document,
|
pub fn reflect_document(document: Box<Document>,
|
||||||
window: &JSRef<Window>,
|
window: &JSRef<Window>,
|
||||||
wrap_fn: extern "Rust" fn(*JSContext, &JSRef<Window>, ~Document) -> JS<Document>)
|
wrap_fn: extern "Rust" fn(*JSContext, &JSRef<Window>, Box<Document>) -> JS<Document>)
|
||||||
-> Temporary<Document> {
|
-> Temporary<Document> {
|
||||||
assert!(document.reflector().get_jsobject().is_null());
|
assert!(document.reflector().get_jsobject().is_null());
|
||||||
let mut raw_doc = reflect_dom_object(document, window, wrap_fn).root();
|
let mut raw_doc = reflect_dom_object(document, window, wrap_fn).root();
|
||||||
|
@ -230,7 +230,7 @@ impl Document {
|
||||||
|
|
||||||
pub fn new(window: &JSRef<Window>, url: Option<Url>, doctype: IsHTMLDocument, content_type: Option<DOMString>) -> Temporary<Document> {
|
pub fn new(window: &JSRef<Window>, url: Option<Url>, doctype: IsHTMLDocument, content_type: Option<DOMString>) -> Temporary<Document> {
|
||||||
let document = Document::new_inherited(window, url, doctype, content_type);
|
let document = Document::new_inherited(window, url, doctype, content_type);
|
||||||
Document::reflect_document(~document, window, DocumentBinding::Wrap)
|
Document::reflect_document(box document, window, DocumentBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -541,7 +541,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
|
|
||||||
// http://www.whatwg.org/specs/web-apps/current-work/#document.title
|
// http://www.whatwg.org/specs/web-apps/current-work/#document.title
|
||||||
fn Title(&self) -> DOMString {
|
fn Title(&self) -> DOMString {
|
||||||
let mut title = "".to_owned();
|
let mut title = StrBuf::new();
|
||||||
self.GetDocumentElement().root().map(|root| {
|
self.GetDocumentElement().root().map(|root| {
|
||||||
let root: &JSRef<Node> = NodeCast::from_ref(&*root);
|
let root: &JSRef<Node> = NodeCast::from_ref(&*root);
|
||||||
root.traverse_preorder()
|
root.traverse_preorder()
|
||||||
|
@ -555,7 +555,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
let v: Vec<&str> = title.words().collect();
|
let v: Vec<&str> = title.as_slice().words().collect();
|
||||||
let title = v.connect(" ");
|
let title = v.connect(" ");
|
||||||
title.trim().to_owned()
|
title.trim().to_owned()
|
||||||
}
|
}
|
||||||
|
@ -693,7 +693,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
"img" == elem.deref().local_name
|
"img" == elem.deref().local_name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let filter = ~ImagesFilter;
|
let filter = box ImagesFilter;
|
||||||
HTMLCollection::create(&*window, NodeCast::from_ref(self), filter)
|
HTMLCollection::create(&*window, NodeCast::from_ref(self), filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -707,7 +707,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
"embed" == elem.deref().local_name
|
"embed" == elem.deref().local_name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let filter = ~EmbedsFilter;
|
let filter = box EmbedsFilter;
|
||||||
HTMLCollection::create(&*window, NodeCast::from_ref(self), filter)
|
HTMLCollection::create(&*window, NodeCast::from_ref(self), filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -727,7 +727,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
elem.get_attribute(Null, "href").is_some()
|
elem.get_attribute(Null, "href").is_some()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let filter = ~LinksFilter;
|
let filter = box LinksFilter;
|
||||||
HTMLCollection::create(&*window, NodeCast::from_ref(self), filter)
|
HTMLCollection::create(&*window, NodeCast::from_ref(self), filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -741,7 +741,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
"form" == elem.deref().local_name
|
"form" == elem.deref().local_name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let filter = ~FormsFilter;
|
let filter = box FormsFilter;
|
||||||
HTMLCollection::create(&*window, NodeCast::from_ref(self), filter)
|
HTMLCollection::create(&*window, NodeCast::from_ref(self), filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -755,7 +755,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
"script" == elem.deref().local_name
|
"script" == elem.deref().local_name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let filter = ~ScriptsFilter;
|
let filter = box ScriptsFilter;
|
||||||
HTMLCollection::create(&*window, NodeCast::from_ref(self), filter)
|
HTMLCollection::create(&*window, NodeCast::from_ref(self), filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -769,7 +769,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
"a" == elem.deref().local_name && elem.get_attribute(Null, "name").is_some()
|
"a" == elem.deref().local_name && elem.get_attribute(Null, "name").is_some()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let filter = ~AnchorsFilter;
|
let filter = box AnchorsFilter;
|
||||||
HTMLCollection::create(&*window, NodeCast::from_ref(self), filter)
|
HTMLCollection::create(&*window, NodeCast::from_ref(self), filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -783,7 +783,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
"applet" == elem.deref().local_name
|
"applet" == elem.deref().local_name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let filter = ~AppletsFilter;
|
let filter = box AppletsFilter;
|
||||||
HTMLCollection::create(&*window, NodeCast::from_ref(self), filter)
|
HTMLCollection::create(&*window, NodeCast::from_ref(self), filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl DocumentFragment {
|
||||||
|
|
||||||
pub fn new(document: &JSRef<Document>) -> Temporary<DocumentFragment> {
|
pub fn new(document: &JSRef<Document>) -> Temporary<DocumentFragment> {
|
||||||
let node = DocumentFragment::new_inherited(document);
|
let node = DocumentFragment::new_inherited(document);
|
||||||
Node::reflect_node(~node, document, DocumentFragmentBinding::Wrap)
|
Node::reflect_node(box node, document, DocumentFragmentBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn Constructor(owner: &JSRef<Window>) -> Fallible<Temporary<DocumentFragment>> {
|
pub fn Constructor(owner: &JSRef<Window>) -> Fallible<Temporary<DocumentFragment>> {
|
||||||
|
|
|
@ -48,7 +48,7 @@ impl DocumentType {
|
||||||
public_id,
|
public_id,
|
||||||
system_id,
|
system_id,
|
||||||
document);
|
document);
|
||||||
Node::reflect_node(~documenttype, document, DocumentTypeBinding::Wrap)
|
Node::reflect_node(box documenttype, document, DocumentTypeBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ impl DOMException {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(window: &JSRef<Window>, code: DOMErrorName) -> Temporary<DOMException> {
|
pub fn new(window: &JSRef<Window>, code: DOMErrorName) -> Temporary<DOMException> {
|
||||||
reflect_dom_object(~DOMException::new_inherited(code), window, DOMExceptionBinding::Wrap)
|
reflect_dom_object(box DOMException::new_inherited(code), window, DOMExceptionBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ impl DOMImplementation {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(owner: &JSRef<Window>) -> Temporary<DOMImplementation> {
|
pub fn new(owner: &JSRef<Window>) -> Temporary<DOMImplementation> {
|
||||||
reflect_dom_object(~DOMImplementation::new_inherited(owner), owner,
|
reflect_dom_object(box DOMImplementation::new_inherited(owner), owner,
|
||||||
DOMImplementationBinding::Wrap)
|
DOMImplementationBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ impl DOMParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(owner: &JSRef<Window>) -> Temporary<DOMParser> {
|
pub fn new(owner: &JSRef<Window>) -> Temporary<DOMParser> {
|
||||||
reflect_dom_object(~DOMParser::new_inherited(owner), owner,
|
reflect_dom_object(box DOMParser::new_inherited(owner), owner,
|
||||||
DOMParserBinding::Wrap)
|
DOMParserBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,7 @@ impl Element {
|
||||||
|
|
||||||
pub fn new(local_name: DOMString, namespace: Namespace, prefix: Option<DOMString>, document: &JSRef<Document>) -> Temporary<Element> {
|
pub fn new(local_name: DOMString, namespace: Namespace, prefix: Option<DOMString>, document: &JSRef<Document>) -> Temporary<Element> {
|
||||||
let element = Element::new_inherited(ElementTypeId, local_name, namespace, prefix, document);
|
let element = Element::new_inherited(ElementTypeId, local_name, namespace, prefix, document);
|
||||||
Node::reflect_node(~element, document, ElementBinding::Wrap)
|
Node::reflect_node(box element, document, ElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ impl Event {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(window: &JSRef<Window>) -> Temporary<Event> {
|
pub fn new(window: &JSRef<Window>) -> Temporary<Event> {
|
||||||
reflect_dom_object(~Event::new_inherited(HTMLEventTypeId),
|
reflect_dom_object(box Event::new_inherited(HTMLEventTypeId),
|
||||||
window,
|
window,
|
||||||
EventBinding::Wrap)
|
EventBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,7 @@
|
||||||
use dom::bindings::js::JSRef;
|
use dom::bindings::js::JSRef;
|
||||||
use dom::bindings::utils::{Reflectable, Reflector};
|
use dom::bindings::utils::{Reflectable, Reflector};
|
||||||
use dom::bindings::error::{Fallible, InvalidState};
|
use dom::bindings::error::{Fallible, InvalidState};
|
||||||
use dom::bindings::codegen::BindingDeclarations::EventListenerBinding;
|
use dom::bindings::codegen::BindingDeclarations::EventListenerBinding::EventListener;
|
||||||
use self::EventListenerBinding::EventListener;
|
|
||||||
use dom::event::Event;
|
use dom::event::Event;
|
||||||
use dom::eventdispatcher::dispatch_event;
|
use dom::eventdispatcher::dispatch_event;
|
||||||
use dom::node::NodeTypeId;
|
use dom::node::NodeTypeId;
|
||||||
|
|
|
@ -38,7 +38,7 @@ impl FormData {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(form: Option<JSRef<HTMLFormElement>>, window: &JSRef<Window>) -> Temporary<FormData> {
|
pub fn new(form: Option<JSRef<HTMLFormElement>>, window: &JSRef<Window>) -> Temporary<FormData> {
|
||||||
reflect_dom_object(~FormData::new_inherited(form, window), window, FormDataBinding::Wrap)
|
reflect_dom_object(box FormData::new_inherited(form, window), window, FormDataBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn Constructor(window: &JSRef<Window>, form: Option<JSRef<HTMLFormElement>>) -> Fallible<Temporary<FormData>> {
|
pub fn Constructor(window: &JSRef<Window>, form: Option<JSRef<HTMLFormElement>>) -> Fallible<Temporary<FormData>> {
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl HTMLAnchorElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLAnchorElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLAnchorElement> {
|
||||||
let element = HTMLAnchorElement::new_inherited(localName, document);
|
let element = HTMLAnchorElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLAnchorElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLAnchorElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl HTMLAppletElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLAppletElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLAppletElement> {
|
||||||
let element = HTMLAppletElement::new_inherited(localName, document);
|
let element = HTMLAppletElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLAppletElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLAppletElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl HTMLAreaElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLAreaElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLAreaElement> {
|
||||||
let element = HTMLAreaElement::new_inherited(localName, document);
|
let element = HTMLAreaElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLAreaElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLAreaElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ impl HTMLAudioElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLAudioElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLAudioElement> {
|
||||||
let element = HTMLAudioElement::new_inherited(localName, document);
|
let element = HTMLAudioElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLAudioElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLAudioElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl HTMLBaseElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLBaseElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLBaseElement> {
|
||||||
let element = HTMLBaseElement::new_inherited(localName, document);
|
let element = HTMLBaseElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLBaseElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLBaseElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl HTMLBodyElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLBodyElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLBodyElement> {
|
||||||
let element = HTMLBodyElement::new_inherited(localName, document);
|
let element = HTMLBodyElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLBodyElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLBodyElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl HTMLBRElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLBRElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLBRElement> {
|
||||||
let element = HTMLBRElement::new_inherited(localName, document);
|
let element = HTMLBRElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLBRElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLBRElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ impl HTMLButtonElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLButtonElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLButtonElement> {
|
||||||
let element = HTMLButtonElement::new_inherited(localName, document);
|
let element = HTMLButtonElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLButtonElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLButtonElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl HTMLCanvasElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLCanvasElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLCanvasElement> {
|
||||||
let element = HTMLCanvasElement::new_inherited(localName, document);
|
let element = HTMLCanvasElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLCanvasElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLCanvasElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ pub trait CollectionFilter {
|
||||||
fn filter(&self, elem: &JSRef<Element>, root: &JSRef<Node>) -> bool;
|
fn filter(&self, elem: &JSRef<Element>, root: &JSRef<Node>) -> bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S: Encoder<E>, E> Encodable<S, E> for ~CollectionFilter {
|
impl<S: Encoder<E>, E> Encodable<S, E> for Box<CollectionFilter> {
|
||||||
fn encode(&self, _s: &mut S) -> Result<(), E> {
|
fn encode(&self, _s: &mut S) -> Result<(), E> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ impl<S: Encoder<E>, E> Encodable<S, E> for ~CollectionFilter {
|
||||||
#[deriving(Encodable)]
|
#[deriving(Encodable)]
|
||||||
pub enum CollectionTypeId {
|
pub enum CollectionTypeId {
|
||||||
Static(Vec<JS<Element>>),
|
Static(Vec<JS<Element>>),
|
||||||
Live(JS<Node>, ~CollectionFilter)
|
Live(JS<Node>, Box<CollectionFilter>)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Encodable)]
|
#[deriving(Encodable)]
|
||||||
|
@ -47,13 +47,14 @@ impl HTMLCollection {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(window: &JSRef<Window>, collection: CollectionTypeId) -> Temporary<HTMLCollection> {
|
pub fn new(window: &JSRef<Window>, collection: CollectionTypeId) -> Temporary<HTMLCollection> {
|
||||||
reflect_dom_object(~HTMLCollection::new_inherited(window, collection),
|
reflect_dom_object(box HTMLCollection::new_inherited(window, collection),
|
||||||
window, HTMLCollectionBinding::Wrap)
|
window, HTMLCollectionBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLCollection {
|
impl HTMLCollection {
|
||||||
pub fn create(window: &JSRef<Window>, root: &JSRef<Node>, filter: ~CollectionFilter) -> Temporary<HTMLCollection> {
|
pub fn create(window: &JSRef<Window>, root: &JSRef<Node>,
|
||||||
|
filter: Box<CollectionFilter>) -> Temporary<HTMLCollection> {
|
||||||
HTMLCollection::new(window, Live(root.unrooted(), filter))
|
HTMLCollection::new(window, Live(root.unrooted(), filter))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +71,7 @@ impl HTMLCollection {
|
||||||
let filter = TagNameFilter {
|
let filter = TagNameFilter {
|
||||||
tag: tag
|
tag: tag
|
||||||
};
|
};
|
||||||
HTMLCollection::create(window, root, ~filter)
|
HTMLCollection::create(window, root, box filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn by_tag_name_ns(window: &JSRef<Window>, root: &JSRef<Node>, tag: DOMString,
|
pub fn by_tag_name_ns(window: &JSRef<Window>, root: &JSRef<Node>, tag: DOMString,
|
||||||
|
@ -88,7 +89,7 @@ impl HTMLCollection {
|
||||||
tag: tag,
|
tag: tag,
|
||||||
namespace: namespace
|
namespace: namespace
|
||||||
};
|
};
|
||||||
HTMLCollection::create(window, root, ~filter)
|
HTMLCollection::create(window, root, box filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn by_class_name(window: &JSRef<Window>, root: &JSRef<Node>, classes: DOMString)
|
pub fn by_class_name(window: &JSRef<Window>, root: &JSRef<Node>, classes: DOMString)
|
||||||
|
@ -104,7 +105,7 @@ impl HTMLCollection {
|
||||||
let filter = ClassNameFilter {
|
let filter = ClassNameFilter {
|
||||||
classes: split_html_space_chars(classes).map(|class| class.into_owned()).collect()
|
classes: split_html_space_chars(classes).map(|class| class.into_owned()).collect()
|
||||||
};
|
};
|
||||||
HTMLCollection::create(window, root, ~filter)
|
HTMLCollection::create(window, root, box filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn children(window: &JSRef<Window>, root: &JSRef<Node>) -> Temporary<HTMLCollection> {
|
pub fn children(window: &JSRef<Window>, root: &JSRef<Node>) -> Temporary<HTMLCollection> {
|
||||||
|
@ -114,7 +115,7 @@ impl HTMLCollection {
|
||||||
root.is_parent_of(NodeCast::from_ref(elem))
|
root.is_parent_of(NodeCast::from_ref(elem))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HTMLCollection::create(window, root, ~ElementChildFilter)
|
HTMLCollection::create(window, root, box ElementChildFilter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl HTMLDataElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLDataElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLDataElement> {
|
||||||
let element = HTMLDataElement::new_inherited(localName, document);
|
let element = HTMLDataElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLDataElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLDataElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl HTMLDataListElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLDataListElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLDataListElement> {
|
||||||
let element = HTMLDataListElement::new_inherited(localName, document);
|
let element = HTMLDataListElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLDataListElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLDataListElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ impl<'a> HTMLDataListElementMethods for JSRef<'a, HTMLDataListElement> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let node: &JSRef<Node> = NodeCast::from_ref(self);
|
let node: &JSRef<Node> = NodeCast::from_ref(self);
|
||||||
let filter = ~HTMLDataListOptionsFilter;
|
let filter = box HTMLDataListOptionsFilter;
|
||||||
let window = window_from_node(node).root();
|
let window = window_from_node(node).root();
|
||||||
HTMLCollection::create(&*window, node, filter)
|
HTMLCollection::create(&*window, node, filter)
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl HTMLDirectoryElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLDirectoryElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLDirectoryElement> {
|
||||||
let element = HTMLDirectoryElement::new_inherited(localName, document);
|
let element = HTMLDirectoryElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLDirectoryElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLDirectoryElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl HTMLDivElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLDivElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLDivElement> {
|
||||||
let element = HTMLDivElement::new_inherited(localName, document);
|
let element = HTMLDivElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLDivElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLDivElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl HTMLDListElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLDListElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLDListElement> {
|
||||||
let element = HTMLDListElement::new_inherited(localName, document);
|
let element = HTMLDListElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLDListElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLDListElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ impl HTMLElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLElement> {
|
||||||
let element = HTMLElement::new_inherited(HTMLElementTypeId, localName, document);
|
let element = HTMLElement::new_inherited(HTMLElementTypeId, localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl HTMLEmbedElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLEmbedElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLEmbedElement> {
|
||||||
let element = HTMLEmbedElement::new_inherited(localName, document);
|
let element = HTMLEmbedElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLEmbedElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLEmbedElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ impl HTMLFieldSetElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLFieldSetElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLFieldSetElement> {
|
||||||
let element = HTMLFieldSetElement::new_inherited(localName, document);
|
let element = HTMLFieldSetElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLFieldSetElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLFieldSetElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ impl<'a> HTMLFieldSetElementMethods for JSRef<'a, HTMLFieldSetElement> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let node: &JSRef<Node> = NodeCast::from_ref(self);
|
let node: &JSRef<Node> = NodeCast::from_ref(self);
|
||||||
let filter = ~ElementsFilter;
|
let filter = box ElementsFilter;
|
||||||
let window = window_from_node(node).root();
|
let window = window_from_node(node).root();
|
||||||
HTMLCollection::create(&*window, node, filter)
|
HTMLCollection::create(&*window, node, filter)
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl HTMLFontElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLFontElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLFontElement> {
|
||||||
let element = HTMLFontElement::new_inherited(localName, document);
|
let element = HTMLFontElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLFontElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLFontElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ impl HTMLFormElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLFormElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLFormElement> {
|
||||||
let element = HTMLFormElement::new_inherited(localName, document);
|
let element = HTMLFormElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLFormElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLFormElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ impl HTMLFrameElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLFrameElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLFrameElement> {
|
||||||
let element = HTMLFrameElement::new_inherited(localName, document);
|
let element = HTMLFrameElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLFrameElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLFrameElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl HTMLFrameSetElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLFrameSetElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLFrameSetElement> {
|
||||||
let element = HTMLFrameSetElement::new_inherited(localName, document);
|
let element = HTMLFrameSetElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLFrameSetElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLFrameSetElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ impl HTMLHeadElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLHeadElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLHeadElement> {
|
||||||
let element = HTMLHeadElement::new_inherited(localName, document);
|
let element = HTMLHeadElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLHeadElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLHeadElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ impl HTMLHeadingElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>, level: HeadingLevel) -> Temporary<HTMLHeadingElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>, level: HeadingLevel) -> Temporary<HTMLHeadingElement> {
|
||||||
let element = HTMLHeadingElement::new_inherited(localName, document, level);
|
let element = HTMLHeadingElement::new_inherited(localName, document, level);
|
||||||
Node::reflect_node(~element, document, HTMLHeadingElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLHeadingElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl HTMLHRElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLHRElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLHRElement> {
|
||||||
let element = HTMLHRElement::new_inherited(localName, document);
|
let element = HTMLHRElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLHRElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLHRElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl HTMLHtmlElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLHtmlElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLHtmlElement> {
|
||||||
let element = HTMLHtmlElement::new_inherited(localName, document);
|
let element = HTMLHtmlElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLHtmlElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLHtmlElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ impl HTMLIFrameElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLIFrameElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLIFrameElement> {
|
||||||
let element = HTMLIFrameElement::new_inherited(localName, document);
|
let element = HTMLIFrameElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLIFrameElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLIFrameElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ impl HTMLImageElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLImageElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLImageElement> {
|
||||||
let element = HTMLImageElement::new_inherited(localName, document);
|
let element = HTMLImageElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLImageElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLImageElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl HTMLInputElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLInputElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLInputElement> {
|
||||||
let element = HTMLInputElement::new_inherited(localName, document);
|
let element = HTMLInputElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLInputElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLInputElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ impl HTMLLabelElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLLabelElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLLabelElement> {
|
||||||
let element = HTMLLabelElement::new_inherited(localName, document);
|
let element = HTMLLabelElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLLabelElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLLabelElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl HTMLLegendElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLLegendElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLLegendElement> {
|
||||||
let element = HTMLLegendElement::new_inherited(localName, document);
|
let element = HTMLLegendElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLLegendElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLLegendElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl HTMLLIElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLLIElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLLIElement> {
|
||||||
let element = HTMLLIElement::new_inherited(localName, document);
|
let element = HTMLLIElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLLIElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLLIElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl HTMLLinkElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLLinkElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLLinkElement> {
|
||||||
let element = HTMLLinkElement::new_inherited(localName, document);
|
let element = HTMLLinkElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLLinkElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLLinkElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ impl HTMLMainElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLMainElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLMainElement> {
|
||||||
let element = HTMLMainElement::new_inherited(localName, document);
|
let element = HTMLMainElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLMainElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLMainElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ impl HTMLMapElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLMapElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLMapElement> {
|
||||||
let element = HTMLMapElement::new_inherited(localName, document);
|
let element = HTMLMapElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLMapElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLMapElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl HTMLMetaElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLMetaElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLMetaElement> {
|
||||||
let element = HTMLMetaElement::new_inherited(localName, document);
|
let element = HTMLMetaElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLMetaElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLMetaElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl HTMLMeterElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLMeterElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLMeterElement> {
|
||||||
let element = HTMLMeterElement::new_inherited(localName, document);
|
let element = HTMLMeterElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLMeterElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLMeterElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl HTMLModElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLModElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLModElement> {
|
||||||
let element = HTMLModElement::new_inherited(localName, document);
|
let element = HTMLModElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLModElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLModElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ impl HTMLObjectElement {
|
||||||
|
|
||||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLObjectElement> {
|
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLObjectElement> {
|
||||||
let element = HTMLObjectElement::new_inherited(localName, document);
|
let element = HTMLObjectElement::new_inherited(localName, document);
|
||||||
Node::reflect_node(~element, document, HTMLObjectElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLObjectElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue