mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Eliminate warnings
This commit is contained in:
parent
2f46b9aede
commit
dc86e83654
57 changed files with 223 additions and 221 deletions
|
@ -317,7 +317,7 @@ impl IOCompositor {
|
||||||
}
|
}
|
||||||
|
|
||||||
(Ok(Paint(pipeline_id, epoch, replies)), NotShuttingDown) => {
|
(Ok(Paint(pipeline_id, epoch, replies)), NotShuttingDown) => {
|
||||||
for (layer_id, new_layer_buffer_set) in replies.move_iter() {
|
for (layer_id, new_layer_buffer_set) in replies.into_iter() {
|
||||||
self.paint(pipeline_id, layer_id, new_layer_buffer_set, epoch);
|
self.paint(pipeline_id, layer_id, new_layer_buffer_set, epoch);
|
||||||
}
|
}
|
||||||
self.remove_outstanding_render_msg();
|
self.remove_outstanding_render_msg();
|
||||||
|
@ -839,7 +839,7 @@ impl IOCompositor {
|
||||||
let mut results:
|
let mut results:
|
||||||
HashMap<PipelineId, (RenderChan, Vec<RenderRequest>)> = HashMap::new();
|
HashMap<PipelineId, (RenderChan, Vec<RenderRequest>)> = HashMap::new();
|
||||||
|
|
||||||
for (layer, mut layer_requests) in requests.move_iter() {
|
for (layer, mut layer_requests) in requests.into_iter() {
|
||||||
let pipeline_id = layer.extra_data.borrow().pipeline.id;
|
let pipeline_id = layer.extra_data.borrow().pipeline.id;
|
||||||
let &(_, ref mut vec) = results.find_or_insert_with(pipeline_id, |_| {
|
let &(_, ref mut vec) = results.find_or_insert_with(pipeline_id, |_| {
|
||||||
(layer.extra_data.borrow().pipeline.render_chan.clone(), Vec::new())
|
(layer.extra_data.borrow().pipeline.render_chan.clone(), Vec::new())
|
||||||
|
@ -847,7 +847,7 @@ impl IOCompositor {
|
||||||
|
|
||||||
// All the BufferRequests are in layer/device coordinates, but the render task
|
// All the BufferRequests are in layer/device coordinates, but the render task
|
||||||
// wants to know the page coordinates. We scale them before sending them.
|
// wants to know the page coordinates. We scale them before sending them.
|
||||||
for request in layer_requests.mut_iter() {
|
for request in layer_requests.iter_mut() {
|
||||||
request.page_rect = request.page_rect / scale.get();
|
request.page_rect = request.page_rect / scale.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -895,7 +895,7 @@ impl IOCompositor {
|
||||||
self.convert_buffer_requests_to_pipeline_requests_map(layers_and_requests);
|
self.convert_buffer_requests_to_pipeline_requests_map(layers_and_requests);
|
||||||
|
|
||||||
let mut num_render_msgs_sent = 0;
|
let mut num_render_msgs_sent = 0;
|
||||||
for (_pipeline_id, (chan, requests)) in pipeline_requests.move_iter() {
|
for (_pipeline_id, (chan, requests)) in pipeline_requests.into_iter() {
|
||||||
num_render_msgs_sent += 1;
|
num_render_msgs_sent += 1;
|
||||||
let _ = chan.send_opt(RenderMsg(requests));
|
let _ = chan.send_opt(RenderMsg(requests));
|
||||||
}
|
}
|
||||||
|
@ -949,7 +949,7 @@ impl IOCompositor {
|
||||||
// We must read from the back buffer (ie, before self.window.present()) as
|
// We must read from the back buffer (ie, before self.window.present()) as
|
||||||
// OpenGL ES 2 does not have glReadBuffer().
|
// OpenGL ES 2 does not have glReadBuffer().
|
||||||
let (width, height) = (self.window_size.width.get(), self.window_size.height.get());
|
let (width, height) = (self.window_size.width.get(), self.window_size.height.get());
|
||||||
let path = from_str::<Path>(self.opts.output_file.get_ref().as_slice()).unwrap();
|
let path = from_str::<Path>(self.opts.output_file.as_ref().unwrap().as_slice()).unwrap();
|
||||||
let mut pixels = gl2::read_pixels(0, 0,
|
let mut pixels = gl2::read_pixels(0, 0,
|
||||||
width as gl2::GLsizei,
|
width as gl2::GLsizei,
|
||||||
height as gl2::GLsizei,
|
height as gl2::GLsizei,
|
||||||
|
@ -962,7 +962,7 @@ impl IOCompositor {
|
||||||
let src_start = (height - y - 1) * stride;
|
let src_start = (height - y - 1) * stride;
|
||||||
unsafe {
|
unsafe {
|
||||||
let src_slice = orig_pixels.slice(src_start, src_start + stride);
|
let src_slice = orig_pixels.slice(src_start, src_start + stride);
|
||||||
pixels.mut_slice(dst_start, dst_start + stride)
|
pixels.slice_mut(dst_start, dst_start + stride)
|
||||||
.copy_memory(src_slice.slice_to(stride));
|
.copy_memory(src_slice.slice_to(stride));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ impl CompositorData {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
for buffer in new_buffers.buffers.move_iter().rev() {
|
for buffer in new_buffers.buffers.into_iter().rev() {
|
||||||
layer.add_buffer(buffer);
|
layer.add_buffer(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ impl CompositorData {
|
||||||
// We have no way of knowing without a race whether the render task is even up and
|
// We have no way of knowing without a race whether the render task is even up and
|
||||||
// running, but mark the buffers as not leaking. If the render task died, then the
|
// running, but mark the buffers as not leaking. If the render task died, then the
|
||||||
// buffers are going to be cleaned up.
|
// buffers are going to be cleaned up.
|
||||||
for buffer in buffers.mut_iter() {
|
for buffer in buffers.iter_mut() {
|
||||||
buffer.mark_wont_leak()
|
buffer.mark_wont_leak()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ impl CompositorData {
|
||||||
/// This is used during shutdown, when we know the render task is going away.
|
/// This is used during shutdown, when we know the render task is going away.
|
||||||
pub fn forget_all_tiles(layer: Rc<Layer<CompositorData>>) {
|
pub fn forget_all_tiles(layer: Rc<Layer<CompositorData>>) {
|
||||||
let tiles = layer.collect_buffers();
|
let tiles = layer.collect_buffers();
|
||||||
for tile in tiles.move_iter() {
|
for tile in tiles.into_iter() {
|
||||||
let mut tile = tile;
|
let mut tile = tile;
|
||||||
tile.mark_wont_leak()
|
tile.mark_wont_leak()
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,9 +116,9 @@ impl FrameTreeTraversal for Rc<FrameTree> {
|
||||||
fn replace_child(&self, id: PipelineId, new_child: Rc<FrameTree>) -> ReplaceResult {
|
fn replace_child(&self, id: PipelineId, new_child: Rc<FrameTree>) -> ReplaceResult {
|
||||||
for frame_tree in self.iter() {
|
for frame_tree in self.iter() {
|
||||||
let mut children = frame_tree.children.borrow_mut();
|
let mut children = frame_tree.children.borrow_mut();
|
||||||
let mut child = children.mut_iter()
|
let mut child = children.iter_mut()
|
||||||
.find(|child| child.frame_tree.pipeline.id == id);
|
.find(|child| child.frame_tree.pipeline.id == id);
|
||||||
for child in child.mut_iter() {
|
for child in child.iter_mut() {
|
||||||
*new_child.parent.borrow_mut() = child.frame_tree.parent.borrow().clone();
|
*new_child.parent.borrow_mut() = child.frame_tree.parent.borrow().clone();
|
||||||
return ReplacedNode(replace(&mut child.frame_tree, new_child));
|
return ReplacedNode(replace(&mut child.frame_tree, new_child));
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ impl Iterator<Rc<FrameTree>> for FrameTreeIterator {
|
||||||
fn next(&mut self) -> Option<Rc<FrameTree>> {
|
fn next(&mut self) -> Option<Rc<FrameTree>> {
|
||||||
if !self.stack.is_empty() {
|
if !self.stack.is_empty() {
|
||||||
let next = self.stack.pop();
|
let next = self.stack.pop();
|
||||||
for cft in next.get_ref().children.borrow().iter() {
|
for cft in next.as_ref().unwrap().children.borrow().iter() {
|
||||||
self.stack.push(cft.frame_tree.clone());
|
self.stack.push(cft.frame_tree.clone());
|
||||||
}
|
}
|
||||||
Some(next.unwrap())
|
Some(next.unwrap())
|
||||||
|
@ -190,14 +190,14 @@ impl NavigationContext {
|
||||||
* when it is known that there exists either a previous page or a next page. */
|
* when it is known that there exists either a previous page or a next page. */
|
||||||
|
|
||||||
fn back(&mut self) -> Rc<FrameTree> {
|
fn back(&mut self) -> Rc<FrameTree> {
|
||||||
self.next.push(self.current.take_unwrap());
|
self.next.push(self.current.take().unwrap());
|
||||||
let prev = self.previous.pop().unwrap();
|
let prev = self.previous.pop().unwrap();
|
||||||
self.current = Some(prev.clone());
|
self.current = Some(prev.clone());
|
||||||
prev
|
prev
|
||||||
}
|
}
|
||||||
|
|
||||||
fn forward(&mut self) -> Rc<FrameTree> {
|
fn forward(&mut self) -> Rc<FrameTree> {
|
||||||
self.previous.push(self.current.take_unwrap());
|
self.previous.push(self.current.take().unwrap());
|
||||||
let next = self.next.pop().unwrap();
|
let next = self.next.pop().unwrap();
|
||||||
self.current = Some(next.clone());
|
self.current = Some(next.clone());
|
||||||
next
|
next
|
||||||
|
@ -208,7 +208,7 @@ impl NavigationContext {
|
||||||
debug!("navigating to {:?}", frame_tree.pipeline.id);
|
debug!("navigating to {:?}", frame_tree.pipeline.id);
|
||||||
let evicted = replace(&mut self.next, vec!());
|
let evicted = replace(&mut self.next, vec!());
|
||||||
if self.current.is_some() {
|
if self.current.is_some() {
|
||||||
self.previous.push(self.current.take_unwrap());
|
self.previous.push(self.current.take().unwrap());
|
||||||
}
|
}
|
||||||
self.current = Some(frame_tree.clone());
|
self.current = Some(frame_tree.clone());
|
||||||
evicted
|
evicted
|
||||||
|
@ -333,7 +333,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
||||||
let matching_pending_frames = self.pending_frames.iter().filter_map(|frame_change| {
|
let matching_pending_frames = self.pending_frames.iter().filter_map(|frame_change| {
|
||||||
frame_change.after.find(pipeline_id)
|
frame_change.after.find(pipeline_id)
|
||||||
});
|
});
|
||||||
matching_navi_frames.move_iter().chain(matching_pending_frames).collect()
|
matching_navi_frames.into_iter().chain(matching_pending_frames).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handles loading pages, navigation, and granting access to the compositor
|
/// Handles loading pages, navigation, and granting access to the compositor
|
||||||
|
@ -527,7 +527,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
||||||
let source_frame = current_frame.find(pipeline_id);
|
let source_frame = current_frame.find(pipeline_id);
|
||||||
for source_frame in source_frame.iter() {
|
for source_frame in source_frame.iter() {
|
||||||
let mut children = source_frame.children.borrow_mut();
|
let mut children = source_frame.children.borrow_mut();
|
||||||
let found_child = children.mut_iter().find(|child| subpage_eq(child));
|
let found_child = children.iter_mut().find(|child| subpage_eq(child));
|
||||||
found_child.map(|child| update_child_rect(child, true));
|
found_child.map(|child| update_child_rect(child, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -535,7 +535,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
||||||
// Update all frames with matching pipeline- and subpage-ids
|
// Update all frames with matching pipeline- and subpage-ids
|
||||||
for frame_tree in frames.iter() {
|
for frame_tree in frames.iter() {
|
||||||
let mut children = frame_tree.children.borrow_mut();
|
let mut children = frame_tree.children.borrow_mut();
|
||||||
let found_child = children.mut_iter().find(|child| subpage_eq(child));
|
let found_child = children.iter_mut().find(|child| subpage_eq(child));
|
||||||
found_child.map(|child| update_child_rect(child, false));
|
found_child.map(|child| update_child_rect(child, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -612,7 +612,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
||||||
fn handle_load_url_msg(&mut self, source_id: PipelineId, url: Url) {
|
fn handle_load_url_msg(&mut self, source_id: PipelineId, url: Url) {
|
||||||
debug!("Constellation: received message to load {:s}", url.to_string());
|
debug!("Constellation: received message to load {:s}", url.to_string());
|
||||||
// Make sure no pending page would be overridden.
|
// Make sure no pending page would be overridden.
|
||||||
let source_frame = self.current_frame().get_ref().find(source_id).expect(
|
let source_frame = self.current_frame().as_ref().unwrap().find(source_id).expect(
|
||||||
"Constellation: received a LoadUrlMsg from a pipeline_id associated
|
"Constellation: received a LoadUrlMsg from a pipeline_id associated
|
||||||
with a pipeline not in the active frame tree. This should be
|
with a pipeline not in the active frame tree. This should be
|
||||||
impossible.");
|
impossible.");
|
||||||
|
@ -621,7 +621,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
||||||
let old_id = frame_change.before.expect("Constellation: Received load msg
|
let old_id = frame_change.before.expect("Constellation: Received load msg
|
||||||
from pipeline, but there is no currently active page. This should
|
from pipeline, but there is no currently active page. This should
|
||||||
be impossible.");
|
be impossible.");
|
||||||
let changing_frame = self.current_frame().get_ref().find(old_id).expect("Constellation:
|
let changing_frame = self.current_frame().as_ref().unwrap().find(old_id).expect("Constellation:
|
||||||
Pending change has non-active source pipeline. This should be
|
Pending change has non-active source pipeline. This should be
|
||||||
impossible.");
|
impossible.");
|
||||||
if changing_frame.contains(source_id) || source_frame.contains(old_id) {
|
if changing_frame.contains(source_id) || source_frame.contains(old_id) {
|
||||||
|
@ -663,7 +663,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
||||||
debug!("no next page to navigate to");
|
debug!("no next page to navigate to");
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
let old = self.current_frame().get_ref();
|
let old = self.current_frame().as_ref().unwrap();
|
||||||
for frame in old.iter() {
|
for frame in old.iter() {
|
||||||
frame.pipeline.revoke_paint_permission();
|
frame.pipeline.revoke_paint_permission();
|
||||||
}
|
}
|
||||||
|
@ -675,7 +675,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
||||||
debug!("no previous page to navigate to");
|
debug!("no previous page to navigate to");
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
let old = self.current_frame().get_ref();
|
let old = self.current_frame().as_ref().unwrap();
|
||||||
for frame in old.iter() {
|
for frame in old.iter() {
|
||||||
frame.pipeline.revoke_paint_permission();
|
frame.pipeline.revoke_paint_permission();
|
||||||
}
|
}
|
||||||
|
@ -721,7 +721,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
||||||
// Create the next frame tree that will be given to the compositor
|
// Create the next frame tree that will be given to the compositor
|
||||||
let next_frame_tree = if to_add.parent.borrow().is_some() {
|
let next_frame_tree = if to_add.parent.borrow().is_some() {
|
||||||
// NOTE: work around borrowchk issues
|
// NOTE: work around borrowchk issues
|
||||||
self.current_frame().get_ref().clone()
|
self.current_frame().as_ref().unwrap().clone()
|
||||||
} else {
|
} else {
|
||||||
to_add.clone()
|
to_add.clone()
|
||||||
};
|
};
|
||||||
|
@ -730,7 +730,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
||||||
match frame_change.before {
|
match frame_change.before {
|
||||||
Some(revoke_id) if self.current_frame().is_some() => {
|
Some(revoke_id) if self.current_frame().is_some() => {
|
||||||
debug!("Constellation: revoking permission from {:?}", revoke_id);
|
debug!("Constellation: revoking permission from {:?}", revoke_id);
|
||||||
let current_frame = self.current_frame().get_ref();
|
let current_frame = self.current_frame().as_ref().unwrap();
|
||||||
|
|
||||||
let to_revoke = current_frame.find(revoke_id).expect(
|
let to_revoke = current_frame.find(revoke_id).expect(
|
||||||
"Constellation: pending frame change refers to an old \
|
"Constellation: pending frame change refers to an old \
|
||||||
|
|
|
@ -103,7 +103,7 @@ impl BufferMap {
|
||||||
};
|
};
|
||||||
if {
|
if {
|
||||||
let list = &mut self.map.get_mut(&old_key).buffers;
|
let list = &mut self.map.get_mut(&old_key).buffers;
|
||||||
let condemned_buffer = list.pop().take_unwrap();
|
let condemned_buffer = list.pop().take().unwrap();
|
||||||
self.mem -= condemned_buffer.get_mem();
|
self.mem -= condemned_buffer.get_mem();
|
||||||
condemned_buffer.destroy(graphics_context);
|
condemned_buffer.destroy(graphics_context);
|
||||||
list.is_empty()
|
list.is_empty()
|
||||||
|
@ -126,7 +126,7 @@ impl BufferMap {
|
||||||
buffer_val.last_action = self.counter;
|
buffer_val.last_action = self.counter;
|
||||||
self.counter += 1;
|
self.counter += 1;
|
||||||
|
|
||||||
let buffer = buffer_val.buffers.pop().take_unwrap();
|
let buffer = buffer_val.buffers.pop().take().unwrap();
|
||||||
self.mem -= buffer.get_mem();
|
self.mem -= buffer.get_mem();
|
||||||
if buffer_val.buffers.is_empty() {
|
if buffer_val.buffers.is_empty() {
|
||||||
flag = true;
|
flag = true;
|
||||||
|
@ -146,8 +146,8 @@ impl BufferMap {
|
||||||
/// Destroys all buffers.
|
/// Destroys all buffers.
|
||||||
pub fn clear(&mut self, graphics_context: &NativePaintingGraphicsContext) {
|
pub fn clear(&mut self, graphics_context: &NativePaintingGraphicsContext) {
|
||||||
let map = mem::replace(&mut self.map, HashMap::new());
|
let map = mem::replace(&mut self.map, HashMap::new());
|
||||||
for (_, value) in map.move_iter() {
|
for (_, value) in map.into_iter() {
|
||||||
for tile in value.buffers.move_iter() {
|
for tile in value.buffers.into_iter() {
|
||||||
tile.destroy(graphics_context)
|
tile.destroy(graphics_context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,7 +198,7 @@ impl StackingContext {
|
||||||
positioned_descendants: Vec::new(),
|
positioned_descendants: Vec::new(),
|
||||||
};
|
};
|
||||||
|
|
||||||
for item in list.move_iter() {
|
for item in list.into_iter() {
|
||||||
match item {
|
match item {
|
||||||
ClipDisplayItemClass(box ClipDisplayItem {
|
ClipDisplayItemClass(box ClipDisplayItem {
|
||||||
base: base,
|
base: base,
|
||||||
|
@ -219,7 +219,7 @@ impl StackingContext {
|
||||||
ContentStackingLevel => stacking_context.content.push(item),
|
ContentStackingLevel => stacking_context.content.push(item),
|
||||||
PositionedDescendantStackingLevel(z_index) => {
|
PositionedDescendantStackingLevel(z_index) => {
|
||||||
match stacking_context.positioned_descendants
|
match stacking_context.positioned_descendants
|
||||||
.mut_iter()
|
.iter_mut()
|
||||||
.find(|& &(z, _)| z_index == z) {
|
.find(|& &(z, _)| z_index == z) {
|
||||||
Some(&(_, ref mut my_list)) => {
|
Some(&(_, ref mut my_list)) => {
|
||||||
my_list.push(item);
|
my_list.push(item);
|
||||||
|
@ -270,9 +270,9 @@ impl StackingContext {
|
||||||
push(&mut self.floats, floats, FloatStackingLevel);
|
push(&mut self.floats, floats, FloatStackingLevel);
|
||||||
push(&mut self.content, content, ContentStackingLevel);
|
push(&mut self.content, content, ContentStackingLevel);
|
||||||
|
|
||||||
for (z_index, list) in positioned_descendants.move_iter() {
|
for (z_index, list) in positioned_descendants.into_iter() {
|
||||||
match self.positioned_descendants
|
match self.positioned_descendants
|
||||||
.mut_iter()
|
.iter_mut()
|
||||||
.find(|& &(existing_z_index, _)| z_index == existing_z_index) {
|
.find(|& &(existing_z_index, _)| z_index == existing_z_index) {
|
||||||
Some(&(_, ref mut existing_list)) => {
|
Some(&(_, ref mut existing_list)) => {
|
||||||
push(existing_list, list, PositionedDescendantStackingLevel(z_index));
|
push(existing_list, list, PositionedDescendantStackingLevel(z_index));
|
||||||
|
@ -386,7 +386,7 @@ impl DisplayList {
|
||||||
// TODO(pcwalton): Sort positioned children according to z-index.
|
// TODO(pcwalton): Sort positioned children according to z-index.
|
||||||
|
|
||||||
// Step 3: Positioned descendants with negative z-indices.
|
// Step 3: Positioned descendants with negative z-indices.
|
||||||
for &(ref mut z_index, ref mut list) in positioned_descendants.mut_iter() {
|
for &(ref mut z_index, ref mut list) in positioned_descendants.iter_mut() {
|
||||||
if *z_index < 0 {
|
if *z_index < 0 {
|
||||||
result.push_all_move(mem::replace(list, DisplayList::new()))
|
result.push_all_move(mem::replace(list, DisplayList::new()))
|
||||||
}
|
}
|
||||||
|
@ -404,7 +404,7 @@ impl DisplayList {
|
||||||
result.push_all_move(content);
|
result.push_all_move(content);
|
||||||
|
|
||||||
// Steps 8 and 9: Positioned descendants with nonnegative z-indices.
|
// Steps 8 and 9: Positioned descendants with nonnegative z-indices.
|
||||||
for &(ref mut z_index, ref mut list) in positioned_descendants.mut_iter() {
|
for &(ref mut z_index, ref mut list) in positioned_descendants.iter_mut() {
|
||||||
if *z_index >= 0 {
|
if *z_index >= 0 {
|
||||||
result.push_all_move(mem::replace(list, DisplayList::new()))
|
result.push_all_move(mem::replace(list, DisplayList::new()))
|
||||||
}
|
}
|
||||||
|
@ -418,7 +418,7 @@ impl DisplayList {
|
||||||
|
|
||||||
/// Sets the stacking level for this display list and all its subitems.
|
/// Sets the stacking level for this display list and all its subitems.
|
||||||
fn set_stacking_level(&mut self, new_level: StackingLevel) {
|
fn set_stacking_level(&mut self, new_level: StackingLevel) {
|
||||||
for item in self.list.mut_iter() {
|
for item in self.list.iter_mut() {
|
||||||
item.mut_base().level = new_level;
|
item.mut_base().level = new_level;
|
||||||
match item.mut_sublist() {
|
match item.mut_sublist() {
|
||||||
None => {}
|
None => {}
|
||||||
|
|
|
@ -115,7 +115,7 @@ impl Font {
|
||||||
let shaper = &self.shaper;
|
let shaper = &self.shaper;
|
||||||
self.shape_cache.find_or_create(&text, |txt| {
|
self.shape_cache.find_or_create(&text, |txt| {
|
||||||
let mut glyphs = GlyphStore::new(text.as_slice().char_len() as int, is_whitespace);
|
let mut glyphs = GlyphStore::new(text.as_slice().char_len() as int, is_whitespace);
|
||||||
shaper.get_ref().shape_text(txt.as_slice(), &mut glyphs);
|
shaper.as_ref().unwrap().shape_text(txt.as_slice(), &mut glyphs);
|
||||||
Arc::new(glyphs)
|
Arc::new(glyphs)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ impl Font {
|
||||||
|
|
||||||
let shaper = Shaper::new(self);
|
let shaper = Shaper::new(self);
|
||||||
self.shaper = Some(shaper);
|
self.shaper = Some(shaper);
|
||||||
self.shaper.get_ref()
|
self.shaper.as_ref().unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_table_for_tag(&self, tag: FontTableTag) -> Option<FontTable> {
|
pub fn get_table_for_tag(&self, tag: FontTableTag) -> Option<FontTable> {
|
||||||
|
|
|
@ -36,7 +36,7 @@ impl FontFamily {
|
||||||
|
|
||||||
// TODO(Issue #190): if not in the fast path above, do
|
// TODO(Issue #190): if not in the fast path above, do
|
||||||
// expensive matching of weights, etc.
|
// expensive matching of weights, etc.
|
||||||
for template in self.templates.mut_iter() {
|
for template in self.templates.iter_mut() {
|
||||||
let maybe_template = template.get_if_matches(fctx, desc);
|
let maybe_template = template.get_if_matches(fctx, desc);
|
||||||
if maybe_template.is_some() {
|
if maybe_template.is_some() {
|
||||||
return maybe_template;
|
return maybe_template;
|
||||||
|
@ -46,7 +46,7 @@ impl FontFamily {
|
||||||
// If a request is made for a font family that exists,
|
// If a request is made for a font family that exists,
|
||||||
// pick the first valid font in the family if we failed
|
// pick the first valid font in the family if we failed
|
||||||
// to find an exact match for the descriptor.
|
// to find an exact match for the descriptor.
|
||||||
for template in self.templates.mut_iter() {
|
for template in self.templates.iter_mut() {
|
||||||
let maybe_template = template.get();
|
let maybe_template = template.get();
|
||||||
if maybe_template.is_some() {
|
if maybe_template.is_some() {
|
||||||
return maybe_template;
|
return maybe_template;
|
||||||
|
|
|
@ -34,7 +34,7 @@ fn create_scaled_font(backend: BackendType, template: &Arc<FontTemplateData>, pt
|
||||||
|
|
||||||
#[cfg(target_os="macos")]
|
#[cfg(target_os="macos")]
|
||||||
fn create_scaled_font(backend: BackendType, template: &Arc<FontTemplateData>, pt_size: f64) -> ScaledFont {
|
fn create_scaled_font(backend: BackendType, template: &Arc<FontTemplateData>, pt_size: f64) -> ScaledFont {
|
||||||
let cgfont = template.ctfont.get_ref().copy_to_CGFont();
|
let cgfont = template.ctfont.as_ref().unwrap().copy_to_CGFont();
|
||||||
ScaledFont::new(backend, &cgfont, pt_size as AzFloat)
|
ScaledFont::new(backend, &cgfont, pt_size as AzFloat)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#![allow(uppercase_variables)]
|
#![allow(non_snake_case)]
|
||||||
|
|
||||||
extern crate freetype;
|
extern crate freetype;
|
||||||
extern crate fontconfig;
|
extern crate fontconfig;
|
||||||
|
|
|
@ -237,7 +237,7 @@ impl<C:RenderListener + Send> RenderTask<C> {
|
||||||
let mut replies = Vec::new();
|
let mut replies = Vec::new();
|
||||||
self.compositor.set_render_state(self.id, RenderingRenderState);
|
self.compositor.set_render_state(self.id, RenderingRenderState);
|
||||||
for RenderRequest { buffer_requests, scale, layer_id, epoch }
|
for RenderRequest { buffer_requests, scale, layer_id, epoch }
|
||||||
in requests.move_iter() {
|
in requests.into_iter() {
|
||||||
if self.epoch == epoch {
|
if self.epoch == epoch {
|
||||||
self.render(&mut replies, buffer_requests, scale, layer_id);
|
self.render(&mut replies, buffer_requests, scale, layer_id);
|
||||||
} else {
|
} else {
|
||||||
|
@ -251,7 +251,7 @@ impl<C:RenderListener + Send> RenderTask<C> {
|
||||||
self.compositor.paint(self.id, self.epoch, replies);
|
self.compositor.paint(self.id, self.epoch, replies);
|
||||||
}
|
}
|
||||||
UnusedBufferMsg(unused_buffers) => {
|
UnusedBufferMsg(unused_buffers) => {
|
||||||
for buffer in unused_buffers.move_iter().rev() {
|
for buffer in unused_buffers.into_iter().rev() {
|
||||||
self.buffer_map.insert(native_graphics_context!(self), buffer);
|
self.buffer_map.insert(native_graphics_context!(self), buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,8 +156,8 @@ fn is_simple_glyph_id(id: GlyphId) -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_simple_advance(advance: Au) -> bool {
|
fn is_simple_advance(advance: Au) -> bool {
|
||||||
let unsignedAu = advance.to_u32().unwrap();
|
let unsigned_au = advance.to_u32().unwrap();
|
||||||
(unsignedAu & (GLYPH_ADVANCE_MASK >> GLYPH_ADVANCE_SHIFT as uint)) == unsignedAu
|
(unsigned_au & (GLYPH_ADVANCE_MASK >> GLYPH_ADVANCE_SHIFT as uint)) == unsigned_au
|
||||||
}
|
}
|
||||||
|
|
||||||
type DetailedGlyphCount = u16;
|
type DetailedGlyphCount = u16;
|
||||||
|
@ -700,7 +700,7 @@ impl<'a> GlyphIterator<'a> {
|
||||||
// Slow path when there is a glyph range.
|
// Slow path when there is a glyph range.
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
fn next_glyph_range(&mut self) -> Option<(CharIndex, GlyphInfo<'a>)> {
|
fn next_glyph_range(&mut self) -> Option<(CharIndex, GlyphInfo<'a>)> {
|
||||||
match self.glyph_range.get_mut_ref().next() {
|
match self.glyph_range.as_mut().unwrap().next() {
|
||||||
Some(j) => Some((self.char_index,
|
Some(j) => Some((self.char_index,
|
||||||
DetailGlyphInfo(self.store, self.char_index, j.get() as u16 /* ??? */))),
|
DetailGlyphInfo(self.store, self.char_index, j.get() as u16 /* ??? */))),
|
||||||
None => {
|
None => {
|
||||||
|
|
|
@ -241,15 +241,15 @@ impl Shaper {
|
||||||
}
|
}
|
||||||
|
|
||||||
// make map of what chars have glyphs
|
// make map of what chars have glyphs
|
||||||
let mut byteToGlyph: Vec<i32>;
|
let mut byte_to_glyph: 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 = Vec::from_elem(byte_max as uint, NO_GLYPH);
|
byte_to_glyph = Vec::from_elem(byte_max as uint, NO_GLYPH);
|
||||||
} else {
|
} else {
|
||||||
byteToGlyph = Vec::from_elem(byte_max as uint, CONTINUATION_BYTE);
|
byte_to_glyph = Vec::from_elem(byte_max as uint, CONTINUATION_BYTE);
|
||||||
for (i, _) in text.char_indices() {
|
for (i, _) in text.char_indices() {
|
||||||
*byteToGlyph.get_mut(i) = NO_GLYPH;
|
*byte_to_glyph.get_mut(i) = NO_GLYPH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,10 +258,10 @@ 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.get(loc as uint) != CONTINUATION_BYTE);
|
assert!(*byte_to_glyph.get(loc as uint) != CONTINUATION_BYTE);
|
||||||
*byteToGlyph.get_mut(loc as uint) = i as i32;
|
*byte_to_glyph.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 byte_to_glyph: idx={}, glyph idx={}",
|
||||||
loc,
|
loc,
|
||||||
i);
|
i);
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,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.get(i) as int);
|
debug!("{}: {} --> {:d}", i, ch, *byte_to_glyph.get(i) as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
// some helpers
|
// some helpers
|
||||||
|
@ -303,7 +303,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 {
|
byte_to_glyph[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);
|
||||||
|
@ -315,8 +315,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 byte_to_glyph[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(byte_to_glyph[i as uint] as int + 1, max_glyph_idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,7 +375,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 {
|
&& byte_to_glyph[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);
|
||||||
|
|
|
@ -104,7 +104,7 @@ impl<'a> Iterator<Range<CharIndex>> for LineIterator<'a> {
|
||||||
None => {
|
None => {
|
||||||
// flush any remaining chars as a line
|
// flush any remaining chars as a line
|
||||||
if self.clump.is_some() {
|
if self.clump.is_some() {
|
||||||
let mut c = self.clump.take_unwrap();
|
let mut c = self.clump.take().unwrap();
|
||||||
c.extend_to(self.range.end());
|
c.extend_to(self.range.end());
|
||||||
return Some(c);
|
return Some(c);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -753,7 +753,7 @@ impl BlockFlow {
|
||||||
// Avoid copying the offset vector.
|
// Avoid copying the offset vector.
|
||||||
let offsets = mem::replace(&mut kid_base.abs_descendants.static_b_offsets, Vec::new());
|
let offsets = mem::replace(&mut kid_base.abs_descendants.static_b_offsets, Vec::new());
|
||||||
// Consume all the static y-offsets bubbled up by kid.
|
// Consume all the static y-offsets bubbled up by kid.
|
||||||
for y_offset in offsets.move_iter() {
|
for y_offset in offsets.into_iter() {
|
||||||
// The offsets are wrt the kid flow box. Translate them to current flow.
|
// The offsets are wrt the kid flow box. Translate them to current flow.
|
||||||
abs_descendant_y_offsets.push(y_offset + kid_base.position.start.b);
|
abs_descendant_y_offsets.push(y_offset + kid_base.position.start.b);
|
||||||
}
|
}
|
||||||
|
@ -1046,15 +1046,15 @@ impl BlockFlow {
|
||||||
self.fragment.border_padding.inline_start_end(),
|
self.fragment.border_padding.inline_start_end(),
|
||||||
block_size + margin_block_size),
|
block_size + margin_block_size),
|
||||||
ceiling: clearance + self.base.position.start.b,
|
ceiling: clearance + self.base.position.start.b,
|
||||||
max_inline_size: self.float.get_ref().containing_inline_size,
|
max_inline_size: self.float.as_ref().unwrap().containing_inline_size,
|
||||||
kind: self.float.get_ref().float_kind,
|
kind: self.float.as_ref().unwrap().float_kind,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Place the float and return the `Floats` back to the parent flow.
|
// Place the float and return the `Floats` back to the parent flow.
|
||||||
// After, grab the position and use that to set our position.
|
// After, grab the position and use that to set our position.
|
||||||
self.base.floats.add_float(&info);
|
self.base.floats.add_float(&info);
|
||||||
|
|
||||||
self.float.get_mut_ref().rel_pos = self.base.floats.last_float_pos().unwrap();
|
self.float.as_mut().unwrap().rel_pos = self.base.floats.last_float_pos().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Assign block-size for current flow.
|
/// Assign block-size for current flow.
|
||||||
|
@ -1185,7 +1185,7 @@ impl BlockFlow {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_display_list_float(&mut self, layout_context: &LayoutContext) {
|
pub fn build_display_list_float(&mut self, layout_context: &LayoutContext) {
|
||||||
let float_offset = self.float.get_ref().rel_pos;
|
let float_offset = self.float.as_ref().unwrap().rel_pos;
|
||||||
self.build_display_list_block_common(layout_context,
|
self.build_display_list_block_common(layout_context,
|
||||||
float_offset,
|
float_offset,
|
||||||
RootOfStackingContextLevel);
|
RootOfStackingContextLevel);
|
||||||
|
@ -1599,7 +1599,7 @@ impl Flow for BlockFlow {
|
||||||
let containing_block_inline_size = self.base.position.size.inline;
|
let containing_block_inline_size = self.base.position.size.inline;
|
||||||
self.compute_used_inline_size(layout_context, containing_block_inline_size);
|
self.compute_used_inline_size(layout_context, containing_block_inline_size);
|
||||||
if self.is_float() {
|
if self.is_float() {
|
||||||
self.float.get_mut_ref().containing_inline_size = containing_block_inline_size;
|
self.float.as_mut().unwrap().containing_inline_size = containing_block_inline_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Formatting contexts are never impacted by floats.
|
// Formatting contexts are never impacted by floats.
|
||||||
|
@ -1720,7 +1720,7 @@ impl Flow for BlockFlow {
|
||||||
}
|
}
|
||||||
|
|
||||||
let float_offset = if self.is_float() {
|
let float_offset = if self.is_float() {
|
||||||
self.float.get_ref().rel_pos
|
self.float.as_ref().unwrap().rel_pos
|
||||||
} else {
|
} else {
|
||||||
LogicalPoint::zero(self.base.writing_mode)
|
LogicalPoint::zero(self.base.writing_mode)
|
||||||
};
|
};
|
||||||
|
|
|
@ -173,7 +173,7 @@ impl InlineFragmentsAccumulator {
|
||||||
|
|
||||||
match enclosing_style {
|
match enclosing_style {
|
||||||
Some(enclosing_style) => {
|
Some(enclosing_style) => {
|
||||||
for frag in fragments.fragments.mut_iter() {
|
for frag in fragments.fragments.iter_mut() {
|
||||||
frag.add_inline_context_style(enclosing_style.clone());
|
frag.add_inline_context_style(enclosing_style.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -372,7 +372,7 @@ impl<'a> FlowConstructor<'a> {
|
||||||
abs_descendants: kid_abs_descendants,
|
abs_descendants: kid_abs_descendants,
|
||||||
})) => {
|
})) => {
|
||||||
// Add any {ib} splits.
|
// Add any {ib} splits.
|
||||||
for split in splits.move_iter() {
|
for split in splits.into_iter() {
|
||||||
// Pull apart the {ib} split object and push its predecessor fragments
|
// Pull apart the {ib} split object and push its predecessor fragments
|
||||||
// onto the list.
|
// onto the list.
|
||||||
let InlineBlockSplit {
|
let InlineBlockSplit {
|
||||||
|
@ -556,7 +556,7 @@ impl<'a> FlowConstructor<'a> {
|
||||||
})) => {
|
})) => {
|
||||||
|
|
||||||
// Bubble up {ib} splits.
|
// Bubble up {ib} splits.
|
||||||
for split in splits.move_iter() {
|
for split in splits.into_iter() {
|
||||||
let InlineBlockSplit {
|
let InlineBlockSplit {
|
||||||
predecessors: predecessors,
|
predecessors: predecessors,
|
||||||
flow: kid_flow
|
flow: kid_flow
|
||||||
|
@ -709,7 +709,7 @@ impl<'a> FlowConstructor<'a> {
|
||||||
node: &ThreadSafeLayoutNode) {
|
node: &ThreadSafeLayoutNode) {
|
||||||
let mut anonymous_flow = flow.get().generate_missing_child_flow(node);
|
let mut anonymous_flow = flow.get().generate_missing_child_flow(node);
|
||||||
let mut consecutive_siblings = vec!();
|
let mut consecutive_siblings = vec!();
|
||||||
for kid_flow in child_flows.move_iter() {
|
for kid_flow in child_flows.into_iter() {
|
||||||
if anonymous_flow.get().need_anonymous_flow(kid_flow.get()) {
|
if anonymous_flow.get().need_anonymous_flow(kid_flow.get()) {
|
||||||
consecutive_siblings.push(kid_flow);
|
consecutive_siblings.push(kid_flow);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -464,7 +464,7 @@ impl<'ln> MatchMethods for LayoutNode<'ln> {
|
||||||
Some(shared_style) => {
|
Some(shared_style) => {
|
||||||
// Yay, cache hit. Share the style.
|
// Yay, cache hit. Share the style.
|
||||||
let mut layout_data_ref = self.mutate_layout_data();
|
let mut layout_data_ref = self.mutate_layout_data();
|
||||||
layout_data_ref.get_mut_ref().shared_data.style = Some(shared_style);
|
layout_data_ref.as_mut().unwrap().shared_data.style = Some(shared_style);
|
||||||
return StyleWasShared(i)
|
return StyleWasShared(i)
|
||||||
}
|
}
|
||||||
None => {}
|
None => {}
|
||||||
|
@ -622,14 +622,14 @@ impl<'ln> MatchMethods for LayoutNode<'ln> {
|
||||||
applicable_declarations_cache,
|
applicable_declarations_cache,
|
||||||
applicable_declarations.normal_shareable);
|
applicable_declarations.normal_shareable);
|
||||||
if applicable_declarations.before.len() > 0 {
|
if applicable_declarations.before.len() > 0 {
|
||||||
self.cascade_node_pseudo_element(Some(layout_data.shared_data.style.get_ref()),
|
self.cascade_node_pseudo_element(Some(layout_data.shared_data.style.as_ref().unwrap()),
|
||||||
applicable_declarations.before.as_slice(),
|
applicable_declarations.before.as_slice(),
|
||||||
&mut layout_data.data.before_style,
|
&mut layout_data.data.before_style,
|
||||||
applicable_declarations_cache,
|
applicable_declarations_cache,
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
if applicable_declarations.after.len() > 0 {
|
if applicable_declarations.after.len() > 0 {
|
||||||
self.cascade_node_pseudo_element(Some(layout_data.shared_data.style.get_ref()),
|
self.cascade_node_pseudo_element(Some(layout_data.shared_data.style.as_ref().unwrap()),
|
||||||
applicable_declarations.after.as_slice(),
|
applicable_declarations.after.as_slice(),
|
||||||
&mut layout_data.data.after_style,
|
&mut layout_data.data.after_style,
|
||||||
applicable_declarations_cache,
|
applicable_declarations_cache,
|
||||||
|
|
|
@ -57,7 +57,7 @@ impl<'ln> NodeUtil for ThreadSafeLayoutNode<'ln> {
|
||||||
/// Does this node have a computed style yet?
|
/// Does this node have a computed style yet?
|
||||||
fn have_css_select_results(&self) -> bool {
|
fn have_css_select_results(&self) -> bool {
|
||||||
let layout_data_ref = self.borrow_layout_data();
|
let layout_data_ref = self.borrow_layout_data();
|
||||||
layout_data_ref.get_ref().shared_data.style.is_some()
|
layout_data_ref.as_ref().unwrap().shared_data.style.is_some()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the description of how to account for recent style changes.
|
/// Get the description of how to account for recent style changes.
|
||||||
|
@ -73,7 +73,7 @@ impl<'ln> NodeUtil for ThreadSafeLayoutNode<'ln> {
|
||||||
|
|
||||||
let layout_data_ref = self.borrow_layout_data();
|
let layout_data_ref = self.borrow_layout_data();
|
||||||
layout_data_ref
|
layout_data_ref
|
||||||
.get_ref()
|
.as_ref().unwrap()
|
||||||
.data
|
.data
|
||||||
.restyle_damage
|
.restyle_damage
|
||||||
.unwrap_or(default)
|
.unwrap_or(default)
|
||||||
|
|
|
@ -355,7 +355,7 @@ pub fn mut_base<'a>(this: &'a mut Flow) -> &'a mut BaseFlow {
|
||||||
|
|
||||||
/// Iterates over the children of this flow.
|
/// Iterates over the children of this flow.
|
||||||
pub fn child_iter<'a>(flow: &'a mut Flow) -> MutFlowListIterator<'a> {
|
pub fn child_iter<'a>(flow: &'a mut Flow) -> MutFlowListIterator<'a> {
|
||||||
mut_base(flow).children.mut_iter()
|
mut_base(flow).children.iter_mut()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ImmutableFlowUtils {
|
pub trait ImmutableFlowUtils {
|
||||||
|
@ -610,7 +610,7 @@ impl Descendants {
|
||||||
///
|
///
|
||||||
/// Ignore any static y offsets, because they are None before layout.
|
/// Ignore any static y offsets, because they are None before layout.
|
||||||
pub fn push_descendants(&mut self, given_descendants: Descendants) {
|
pub fn push_descendants(&mut self, given_descendants: Descendants) {
|
||||||
for elem in given_descendants.descendant_links.move_iter() {
|
for elem in given_descendants.descendant_links.into_iter() {
|
||||||
self.descendant_links.push(elem);
|
self.descendant_links.push(elem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -618,16 +618,16 @@ impl Descendants {
|
||||||
/// Return an iterator over the descendant flows.
|
/// Return an iterator over the descendant flows.
|
||||||
pub fn iter<'a>(&'a mut self) -> DescendantIter<'a> {
|
pub fn iter<'a>(&'a mut self) -> DescendantIter<'a> {
|
||||||
DescendantIter {
|
DescendantIter {
|
||||||
iter: self.descendant_links.mut_slice_from(0).mut_iter(),
|
iter: self.descendant_links.slice_from_mut(0).iter_mut(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return an iterator over (descendant, static y offset).
|
/// Return an iterator over (descendant, static y offset).
|
||||||
pub fn iter_with_offset<'a>(&'a mut self) -> DescendantOffsetIter<'a> {
|
pub fn iter_with_offset<'a>(&'a mut self) -> DescendantOffsetIter<'a> {
|
||||||
let descendant_iter = DescendantIter {
|
let descendant_iter = DescendantIter {
|
||||||
iter: self.descendant_links.mut_slice_from(0).mut_iter(),
|
iter: self.descendant_links.slice_from_mut(0).iter_mut(),
|
||||||
};
|
};
|
||||||
descendant_iter.zip(self.static_b_offsets.mut_slice_from(0).mut_iter())
|
descendant_iter.zip(self.static_b_offsets.slice_from_mut(0).iter_mut())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -824,7 +824,7 @@ impl BaseFlow {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn child_iter<'a>(&'a mut self) -> MutFlowListIterator<'a> {
|
pub fn child_iter<'a>(&'a mut self) -> MutFlowListIterator<'a> {
|
||||||
self.children.mut_iter()
|
self.children.iter_mut()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn ref_count<'a>(&'a self) -> &'a AtomicUint {
|
pub unsafe fn ref_count<'a>(&'a self) -> &'a AtomicUint {
|
||||||
|
|
|
@ -63,7 +63,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: FlowRef) {
|
pub fn push_front(&mut self, new_head: FlowRef) {
|
||||||
self.flows.push_front(new_head);
|
self.flows.push_front(new_head);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ impl FlowList {
|
||||||
///
|
///
|
||||||
/// O(1)
|
/// O(1)
|
||||||
pub fn push_back(&mut self, new_tail: FlowRef) {
|
pub fn push_back(&mut self, new_tail: FlowRef) {
|
||||||
self.flows.push_back(new_tail);
|
self.flows.push(new_tail);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create an empty list
|
/// Create an empty list
|
||||||
|
@ -99,9 +99,9 @@ impl FlowList {
|
||||||
|
|
||||||
/// Provide a forward iterator with mutable references
|
/// Provide a forward iterator with mutable references
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn mut_iter<'a>(&'a mut self) -> MutFlowListIterator<'a> {
|
pub fn iter_mut<'a>(&'a mut self) -> MutFlowListIterator<'a> {
|
||||||
MutFlowListIterator {
|
MutFlowListIterator {
|
||||||
it: self.flows.mut_iter(),
|
it: self.flows.iter_mut(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -467,7 +467,7 @@ impl Fragment {
|
||||||
if self.inline_context.is_none() {
|
if self.inline_context.is_none() {
|
||||||
self.inline_context = Some(InlineFragmentContext::new());
|
self.inline_context = Some(InlineFragmentContext::new());
|
||||||
}
|
}
|
||||||
self.inline_context.get_mut_ref().styles.push(style.clone());
|
self.inline_context.as_mut().unwrap().styles.push(style.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Uses the style only to estimate the intrinsic inline-sizes. These may be modified for text or
|
/// Uses the style only to estimate the intrinsic inline-sizes. These may be modified for text or
|
||||||
|
|
|
@ -495,7 +495,7 @@ impl LineBreaker {
|
||||||
inline_start.new_line_pos = vec![];
|
inline_start.new_line_pos = vec![];
|
||||||
self.push_fragment_to_line(inline_start);
|
self.push_fragment_to_line(inline_start);
|
||||||
|
|
||||||
for inline_end in inline_end.move_iter() {
|
for inline_end in inline_end.into_iter() {
|
||||||
debug!("LineBreaker: Deferring the fragment to the inline_end of the new-line \
|
debug!("LineBreaker: Deferring the fragment to the inline_end of the new-line \
|
||||||
character to the line.");
|
character to the line.");
|
||||||
let mut inline_end = split_fragment(inline_end);
|
let mut inline_end = split_fragment(inline_end);
|
||||||
|
@ -680,7 +680,7 @@ impl InlineFragments {
|
||||||
|
|
||||||
// FIXME (rust#16151): This can be reverted back to using skip_while once
|
// FIXME (rust#16151): This can be reverted back to using skip_while once
|
||||||
// the upstream bug is fixed.
|
// the upstream bug is fixed.
|
||||||
let mut fragments = mem::replace(&mut self.fragments, vec![]).move_iter();
|
let mut fragments = mem::replace(&mut self.fragments, vec![]).into_iter();
|
||||||
let mut new_fragments = Vec::new();
|
let mut new_fragments = Vec::new();
|
||||||
let mut skipping = true;
|
let mut skipping = true;
|
||||||
for fragment in fragments {
|
for fragment in fragments {
|
||||||
|
@ -703,7 +703,7 @@ impl InlineFragments {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut new_fragments = self.fragments.clone();
|
let mut new_fragments = self.fragments.clone();
|
||||||
while new_fragments.len() > 0 && new_fragments.as_slice().last().get_ref().is_whitespace_only() {
|
while new_fragments.len() > 0 && new_fragments.as_slice().last().as_ref().unwrap().is_whitespace_only() {
|
||||||
debug!("stripping ignorable whitespace from end");
|
debug!("stripping ignorable whitespace from end");
|
||||||
drop(new_fragments.pop());
|
drop(new_fragments.pop());
|
||||||
}
|
}
|
||||||
|
@ -757,7 +757,7 @@ impl InlineFlow {
|
||||||
// not recurse on a line if nothing in it can intersect the dirty region.
|
// not recurse on a line if nothing in it can intersect the dirty region.
|
||||||
debug!("Flow: building display list for {:u} inline fragments", self.fragments.len());
|
debug!("Flow: building display list for {:u} inline fragments", self.fragments.len());
|
||||||
|
|
||||||
for fragment in self.fragments.fragments.mut_iter() {
|
for fragment in self.fragments.fragments.iter_mut() {
|
||||||
let rel_offset = fragment.relative_position(&self.base
|
let rel_offset = fragment.relative_position(&self.base
|
||||||
.absolute_position_info
|
.absolute_position_info
|
||||||
.relative_containing_block_size);
|
.relative_containing_block_size);
|
||||||
|
@ -923,7 +923,7 @@ impl Flow for InlineFlow {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut intrinsic_inline_sizes = IntrinsicISizes::new();
|
let mut intrinsic_inline_sizes = IntrinsicISizes::new();
|
||||||
for fragment in self.fragments.fragments.mut_iter() {
|
for fragment in self.fragments.fragments.iter_mut() {
|
||||||
debug!("Flow: measuring {}", *fragment);
|
debug!("Flow: measuring {}", *fragment);
|
||||||
|
|
||||||
let fragment_intrinsic_inline_sizes =
|
let fragment_intrinsic_inline_sizes =
|
||||||
|
@ -953,7 +953,7 @@ impl Flow for InlineFlow {
|
||||||
{
|
{
|
||||||
let inline_size = self.base.position.size.inline;
|
let inline_size = self.base.position.size.inline;
|
||||||
let this = &mut *self;
|
let this = &mut *self;
|
||||||
for fragment in this.fragments.fragments.mut_iter() {
|
for fragment in this.fragments.fragments.iter_mut() {
|
||||||
fragment.assign_replaced_inline_size_if_necessary(inline_size);
|
fragment.assign_replaced_inline_size_if_necessary(inline_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -982,7 +982,7 @@ impl Flow for InlineFlow {
|
||||||
debug!("assign_block_size_inline: floats in: {:?}", self.base.floats);
|
debug!("assign_block_size_inline: floats in: {:?}", self.base.floats);
|
||||||
|
|
||||||
// assign block-size for inline fragments
|
// assign block-size for inline fragments
|
||||||
for fragment in self.fragments.fragments.mut_iter() {
|
for fragment in self.fragments.fragments.iter_mut() {
|
||||||
fragment.assign_replaced_block_size_if_necessary();
|
fragment.assign_replaced_block_size_if_necessary();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -995,7 +995,7 @@ impl Flow for InlineFlow {
|
||||||
|
|
||||||
// Now, go through each line and lay out the fragments inside.
|
// Now, go through each line and lay out the fragments inside.
|
||||||
let mut line_distance_from_flow_block_start = Au(0);
|
let mut line_distance_from_flow_block_start = Au(0);
|
||||||
for line in self.lines.mut_iter() {
|
for line in self.lines.iter_mut() {
|
||||||
// Lay out fragments horizontally.
|
// Lay out fragments horizontally.
|
||||||
InlineFlow::set_horizontal_fragment_positions(&mut self.fragments, line, text_align);
|
InlineFlow::set_horizontal_fragment_positions(&mut self.fragments, line, text_align);
|
||||||
|
|
||||||
|
@ -1124,7 +1124,7 @@ impl Flow for InlineFlow {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn compute_absolute_position(&mut self) {
|
fn compute_absolute_position(&mut self) {
|
||||||
for f in self.fragments.fragments.mut_iter() {
|
for f in self.fragments.fragments.iter_mut() {
|
||||||
match f.specific {
|
match f.specific {
|
||||||
InlineBlockFragment(ref mut info) => {
|
InlineBlockFragment(ref mut info) => {
|
||||||
let block_flow = info.flow_ref.get_mut().as_block();
|
let block_flow = info.flow_ref.get_mut().as_block();
|
||||||
|
|
|
@ -81,7 +81,7 @@ impl Drop for Scope {
|
||||||
let mut state = refcell.borrow_mut();
|
let mut state = refcell.borrow_mut();
|
||||||
let mut current_scope = state.scope_stack.pop().unwrap();
|
let mut current_scope = state.scope_stack.pop().unwrap();
|
||||||
current_scope.post = json::encode(&state.flow_root.get());
|
current_scope.post = json::encode(&state.flow_root.get());
|
||||||
let previous_scope = state.scope_stack.mut_last().unwrap();
|
let previous_scope = state.scope_stack.last_mut().unwrap();
|
||||||
previous_scope.children.push(current_scope);
|
previous_scope.children.push(current_scope);
|
||||||
}
|
}
|
||||||
None => {}
|
None => {}
|
||||||
|
|
|
@ -909,7 +909,7 @@ impl LayoutTask {
|
||||||
let mut layers = SmallVec1::new();
|
let mut layers = SmallVec1::new();
|
||||||
layers.push(render_layer);
|
layers.push(render_layer);
|
||||||
for layer in mem::replace(&mut flow::mut_base(layout_root.get_mut()).layers,
|
for layer in mem::replace(&mut flow::mut_base(layout_root.get_mut()).layers,
|
||||||
DList::new()).move_iter() {
|
DList::new()).into_iter() {
|
||||||
layers.push(layer)
|
layers.push(layer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ impl TableFlow {
|
||||||
pub fn update_col_inline_sizes(self_inline_sizes: &mut Vec<Au>, kid_inline_sizes: &Vec<Au>) -> Au {
|
pub fn update_col_inline_sizes(self_inline_sizes: &mut Vec<Au>, kid_inline_sizes: &Vec<Au>) -> Au {
|
||||||
let mut sum_inline_sizes = Au(0);
|
let mut sum_inline_sizes = Au(0);
|
||||||
let mut kid_inline_sizes_it = kid_inline_sizes.iter();
|
let mut kid_inline_sizes_it = kid_inline_sizes.iter();
|
||||||
for self_inline_size in self_inline_sizes.mut_iter() {
|
for self_inline_size in self_inline_sizes.iter_mut() {
|
||||||
match kid_inline_sizes_it.next() {
|
match kid_inline_sizes_it.next() {
|
||||||
Some(kid_inline_size) => {
|
Some(kid_inline_size) => {
|
||||||
if *self_inline_size < *kid_inline_size {
|
if *self_inline_size < *kid_inline_size {
|
||||||
|
@ -197,7 +197,7 @@ impl Flow for TableFlow {
|
||||||
if !did_first_row {
|
if !did_first_row {
|
||||||
did_first_row = true;
|
did_first_row = true;
|
||||||
let mut child_inline_sizes = kid_col_inline_sizes.iter();
|
let mut child_inline_sizes = kid_col_inline_sizes.iter();
|
||||||
for col_inline_size in self.col_inline_sizes.mut_iter() {
|
for col_inline_size in self.col_inline_sizes.iter_mut() {
|
||||||
match child_inline_sizes.next() {
|
match child_inline_sizes.next() {
|
||||||
Some(child_inline_size) => {
|
Some(child_inline_size) => {
|
||||||
if *col_inline_size == Au::new(0) {
|
if *col_inline_size == Au::new(0) {
|
||||||
|
@ -280,12 +280,12 @@ impl Flow for TableFlow {
|
||||||
// any, or among all the columns if all are specified.
|
// any, or among all the columns if all are specified.
|
||||||
if (total_column_inline_size < content_inline_size) && (num_unspecified_inline_sizes == 0) {
|
if (total_column_inline_size < content_inline_size) && (num_unspecified_inline_sizes == 0) {
|
||||||
let ratio = content_inline_size.to_f64().unwrap() / total_column_inline_size.to_f64().unwrap();
|
let ratio = content_inline_size.to_f64().unwrap() / total_column_inline_size.to_f64().unwrap();
|
||||||
for col_inline_size in self.col_inline_sizes.mut_iter() {
|
for col_inline_size in self.col_inline_sizes.iter_mut() {
|
||||||
*col_inline_size = (*col_inline_size).scale_by(ratio);
|
*col_inline_size = (*col_inline_size).scale_by(ratio);
|
||||||
}
|
}
|
||||||
} else if num_unspecified_inline_sizes != 0 {
|
} else if num_unspecified_inline_sizes != 0 {
|
||||||
let extra_column_inline_size = (content_inline_size - total_column_inline_size) / num_unspecified_inline_sizes;
|
let extra_column_inline_size = (content_inline_size - total_column_inline_size) / num_unspecified_inline_sizes;
|
||||||
for col_inline_size in self.col_inline_sizes.mut_iter() {
|
for col_inline_size in self.col_inline_sizes.iter_mut() {
|
||||||
if *col_inline_size == Au(0) {
|
if *col_inline_size == Au(0) {
|
||||||
*col_inline_size = extra_column_inline_size;
|
*col_inline_size = extra_column_inline_size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,7 +231,7 @@ impl TextRunScanner {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
let new_text_fragment_info = ScannedTextFragmentInfo::new(run.get_ref().clone(), range);
|
let new_text_fragment_info = ScannedTextFragmentInfo::new(run.as_ref().unwrap().clone(), range);
|
||||||
let old_fragment = &in_fragments[i.to_uint()];
|
let old_fragment = &in_fragments[i.to_uint()];
|
||||||
let new_metrics = new_text_fragment_info.run.metrics_for_range(&range);
|
let new_metrics = new_text_fragment_info.run.metrics_for_range(&range);
|
||||||
let bounding_box_size = bounding_box_for_run_metrics(
|
let bounding_box_size = bounding_box_for_run_metrics(
|
||||||
|
|
|
@ -452,7 +452,7 @@ impl<'le> TElement for LayoutElement<'le> {
|
||||||
fn get_content(content_list: &content::T) -> String {
|
fn get_content(content_list: &content::T) -> String {
|
||||||
match *content_list {
|
match *content_list {
|
||||||
content::Content(ref value) => {
|
content::Content(ref value) => {
|
||||||
let iter = &mut value.clone().move_iter().peekable();
|
let iter = &mut value.clone().into_iter().peekable();
|
||||||
match iter.next() {
|
match iter.next() {
|
||||||
Some(content::StringContent(content)) => content,
|
Some(content::StringContent(content)) => content,
|
||||||
_ => "".to_string(),
|
_ => "".to_string(),
|
||||||
|
@ -533,13 +533,13 @@ impl<'ln> TLayoutNode for ThreadSafeLayoutNode<'ln> {
|
||||||
fn text(&self) -> String {
|
fn text(&self) -> String {
|
||||||
if self.pseudo != Normal {
|
if self.pseudo != Normal {
|
||||||
let layout_data_ref = self.borrow_layout_data();
|
let layout_data_ref = self.borrow_layout_data();
|
||||||
let node_layout_data_wrapper = layout_data_ref.get_ref();
|
let node_layout_data_wrapper = layout_data_ref.as_ref().unwrap();
|
||||||
|
|
||||||
if self.pseudo == Before || self.pseudo == BeforeBlock {
|
if self.pseudo == Before || self.pseudo == BeforeBlock {
|
||||||
let before_style = node_layout_data_wrapper.data.before_style.get_ref();
|
let before_style = node_layout_data_wrapper.data.before_style.as_ref().unwrap();
|
||||||
return get_content(&before_style.get_box().content)
|
return get_content(&before_style.get_box().content)
|
||||||
} else {
|
} else {
|
||||||
let after_style = node_layout_data_wrapper.data.after_style.get_ref();
|
let after_style = node_layout_data_wrapper.data.after_style.as_ref().unwrap();
|
||||||
return get_content(&after_style.get_box().content)
|
return get_content(&after_style.get_box().content)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -610,19 +610,19 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
||||||
|
|
||||||
pub fn is_block(&self, kind: PseudoElementType) -> bool {
|
pub fn is_block(&self, kind: PseudoElementType) -> bool {
|
||||||
let mut layout_data_ref = self.mutate_layout_data();
|
let mut layout_data_ref = self.mutate_layout_data();
|
||||||
let node_layout_data_wrapper = layout_data_ref.get_mut_ref();
|
let node_layout_data_wrapper = layout_data_ref.as_mut().unwrap();
|
||||||
|
|
||||||
let display = match kind {
|
let display = match kind {
|
||||||
Before | BeforeBlock => {
|
Before | BeforeBlock => {
|
||||||
let before_style = node_layout_data_wrapper.data.before_style.get_ref();
|
let before_style = node_layout_data_wrapper.data.before_style.as_ref().unwrap();
|
||||||
before_style.get_box().display
|
before_style.get_box().display
|
||||||
}
|
}
|
||||||
After | AfterBlock => {
|
After | AfterBlock => {
|
||||||
let after_style = node_layout_data_wrapper.data.after_style.get_ref();
|
let after_style = node_layout_data_wrapper.data.after_style.as_ref().unwrap();
|
||||||
after_style.get_box().display
|
after_style.get_box().display
|
||||||
}
|
}
|
||||||
Normal => {
|
Normal => {
|
||||||
let after_style = node_layout_data_wrapper.shared_data.style.get_ref();
|
let after_style = node_layout_data_wrapper.shared_data.style.as_ref().unwrap();
|
||||||
after_style.get_box().display
|
after_style.get_box().display
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -632,13 +632,13 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
||||||
|
|
||||||
pub fn has_before_pseudo(&self) -> bool {
|
pub fn has_before_pseudo(&self) -> bool {
|
||||||
let layout_data_wrapper = self.borrow_layout_data();
|
let layout_data_wrapper = self.borrow_layout_data();
|
||||||
let layout_data_wrapper_ref = layout_data_wrapper.get_ref();
|
let layout_data_wrapper_ref = layout_data_wrapper.as_ref().unwrap();
|
||||||
layout_data_wrapper_ref.data.before_style.is_some()
|
layout_data_wrapper_ref.data.before_style.is_some()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn has_after_pseudo(&self) -> bool {
|
pub fn has_after_pseudo(&self) -> bool {
|
||||||
let layout_data_wrapper = self.borrow_layout_data();
|
let layout_data_wrapper = self.borrow_layout_data();
|
||||||
let layout_data_wrapper_ref = layout_data_wrapper.get_ref();
|
let layout_data_wrapper_ref = layout_data_wrapper.as_ref().unwrap();
|
||||||
layout_data_wrapper_ref.data.after_style.is_some()
|
layout_data_wrapper_ref.data.after_style.is_some()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ fn load(load_data: LoadData, start_chan: Sender<LoadResponse>) {
|
||||||
if is_base64 {
|
if is_base64 {
|
||||||
// FIXME(#2909): It’s unclear what to do with non-alphabet characters,
|
// FIXME(#2909): It’s unclear what to do with non-alphabet characters,
|
||||||
// but Acid 3 apparently depends on spaces being ignored.
|
// but Acid 3 apparently depends on spaces being ignored.
|
||||||
let bytes = bytes.move_iter().filter(|&b| b != ' ' as u8).collect::<Vec<u8>>();
|
let bytes = bytes.into_iter().filter(|&b| b != ' ' as u8).collect::<Vec<u8>>();
|
||||||
match bytes.as_slice().from_base64() {
|
match bytes.as_slice().from_base64() {
|
||||||
Err(..) => {
|
Err(..) => {
|
||||||
progress_chan.send(Done(Err("non-base64 data uri".to_string())));
|
progress_chan.send(Done(Err("non-base64 data uri".to_string())));
|
||||||
|
|
|
@ -108,7 +108,7 @@ impl BasicCORSCache {
|
||||||
fn find_entry_by_header<'a>(&'a mut self, request: &CacheRequestDetails, header_name: &str) -> Option<&'a mut CORSCacheEntry> {
|
fn find_entry_by_header<'a>(&'a mut self, request: &CacheRequestDetails, header_name: &str) -> Option<&'a mut CORSCacheEntry> {
|
||||||
self.cleanup();
|
self.cleanup();
|
||||||
let BasicCORSCache(ref mut buf) = *self;
|
let BasicCORSCache(ref mut buf) = *self;
|
||||||
let entry = buf.mut_iter().find(|e| e.origin.scheme == request.origin.scheme &&
|
let entry = buf.iter_mut().find(|e| e.origin.scheme == request.origin.scheme &&
|
||||||
e.origin.host() == request.origin.host() &&
|
e.origin.host() == request.origin.host() &&
|
||||||
e.origin.port() == request.origin.port() &&
|
e.origin.port() == request.origin.port() &&
|
||||||
e.url == request.destination &&
|
e.url == request.destination &&
|
||||||
|
@ -121,7 +121,7 @@ impl BasicCORSCache {
|
||||||
// we can take the method from CORSRequest itself
|
// we can take the method from CORSRequest itself
|
||||||
self.cleanup();
|
self.cleanup();
|
||||||
let BasicCORSCache(ref mut buf) = *self;
|
let BasicCORSCache(ref mut buf) = *self;
|
||||||
let entry = buf.mut_iter().find(|e| e.origin.scheme == request.origin.scheme &&
|
let entry = buf.iter_mut().find(|e| e.origin.scheme == request.origin.scheme &&
|
||||||
e.origin.host() == request.origin.host() &&
|
e.origin.host() == request.origin.host() &&
|
||||||
e.origin.port() == request.origin.port() &&
|
e.origin.port() == request.origin.port() &&
|
||||||
e.url == request.destination &&
|
e.url == request.destination &&
|
||||||
|
@ -136,7 +136,7 @@ impl CORSCache for BasicCORSCache {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
fn clear (&mut self, request: CacheRequestDetails) {
|
fn clear (&mut self, request: CacheRequestDetails) {
|
||||||
let BasicCORSCache(buf) = self.clone();
|
let BasicCORSCache(buf) = self.clone();
|
||||||
let new_buf: Vec<CORSCacheEntry> = buf.move_iter().filter(|e| e.origin == request.origin && request.destination == e.url).collect();
|
let new_buf: Vec<CORSCacheEntry> = buf.into_iter().filter(|e| e.origin == request.origin && request.destination == e.url).collect();
|
||||||
*self = BasicCORSCache(new_buf);
|
*self = BasicCORSCache(new_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ impl CORSCache for BasicCORSCache {
|
||||||
fn cleanup(&mut self) {
|
fn cleanup(&mut self) {
|
||||||
let BasicCORSCache(buf) = self.clone();
|
let BasicCORSCache(buf) = self.clone();
|
||||||
let now = time::now().to_timespec();
|
let now = time::now().to_timespec();
|
||||||
let new_buf: Vec<CORSCacheEntry> = buf.move_iter().filter(|e| now.sec > e.created.sec + e.max_age as i64).collect();
|
let new_buf: Vec<CORSCacheEntry> = buf.into_iter().filter(|e| now.sec > e.created.sec + e.max_age as i64).collect();
|
||||||
*self = BasicCORSCache(new_buf);
|
*self = BasicCORSCache(new_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -464,7 +464,7 @@ fn load_image_data(url: Url, resource_task: ResourceTask) -> Result<Vec<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.move_iter().collect());
|
return Ok(image_data.into_iter().collect());
|
||||||
}
|
}
|
||||||
resource_task::Done(result::Err(..)) => {
|
resource_task::Done(result::Err(..)) => {
|
||||||
return Err(());
|
return Err(());
|
||||||
|
|
|
@ -315,7 +315,7 @@ impl CORSCache {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
fn clear (&mut self, request: &CORSRequest) {
|
fn clear (&mut self, request: &CORSRequest) {
|
||||||
let CORSCache(buf) = self.clone();
|
let CORSCache(buf) = self.clone();
|
||||||
let new_buf: Vec<CORSCacheEntry> = buf.move_iter().filter(|e| e.origin == request.origin && request.destination == e.url).collect();
|
let new_buf: Vec<CORSCacheEntry> = buf.into_iter().filter(|e| e.origin == request.origin && request.destination == e.url).collect();
|
||||||
*self = CORSCache(new_buf);
|
*self = CORSCache(new_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ impl CORSCache {
|
||||||
fn cleanup(&mut self) {
|
fn cleanup(&mut self) {
|
||||||
let CORSCache(buf) = self.clone();
|
let CORSCache(buf) = self.clone();
|
||||||
let now = time::now().to_timespec();
|
let now = time::now().to_timespec();
|
||||||
let new_buf: Vec<CORSCacheEntry> = buf.move_iter().filter(|e| now.sec > e.created.sec + e.max_age as i64).collect();
|
let new_buf: Vec<CORSCacheEntry> = buf.into_iter().filter(|e| now.sec > e.created.sec + e.max_age as i64).collect();
|
||||||
*self = CORSCache(new_buf);
|
*self = CORSCache(new_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ impl CORSCache {
|
||||||
self.cleanup();
|
self.cleanup();
|
||||||
let CORSCache(ref mut buf) = *self;
|
let CORSCache(ref mut buf) = *self;
|
||||||
// Credentials are not yet implemented here
|
// Credentials are not yet implemented here
|
||||||
let entry = buf.mut_iter().find(|e| e.origin.scheme == request.origin.scheme &&
|
let entry = buf.iter_mut().find(|e| e.origin.scheme == request.origin.scheme &&
|
||||||
e.origin.host() == request.origin.host() &&
|
e.origin.host() == request.origin.host() &&
|
||||||
e.origin.port() == request.origin.port() &&
|
e.origin.port() == request.origin.port() &&
|
||||||
e.url == request.destination &&
|
e.url == request.destination &&
|
||||||
|
@ -353,7 +353,7 @@ impl CORSCache {
|
||||||
self.cleanup();
|
self.cleanup();
|
||||||
let CORSCache(ref mut buf) = *self;
|
let CORSCache(ref mut buf) = *self;
|
||||||
// Credentials are not yet implemented here
|
// Credentials are not yet implemented here
|
||||||
let entry = buf.mut_iter().find(|e| e.origin.scheme == request.origin.scheme &&
|
let entry = buf.iter_mut().find(|e| e.origin.scheme == request.origin.scheme &&
|
||||||
e.origin.host() == request.origin.host() &&
|
e.origin.host() == request.origin.host() &&
|
||||||
e.origin.port() == request.origin.port() &&
|
e.origin.port() == request.origin.port() &&
|
||||||
e.url == request.destination &&
|
e.url == request.destination &&
|
||||||
|
|
|
@ -1798,7 +1798,7 @@ let obj = with_compartment(aCx, proto, || {
|
||||||
NewProxyObject(aCx, handler,
|
NewProxyObject(aCx, handler,
|
||||||
&private,
|
&private,
|
||||||
proto, %s,
|
proto, %s,
|
||||||
ptr::mut_null(), ptr::mut_null())
|
ptr::null_mut(), ptr::null_mut())
|
||||||
});
|
});
|
||||||
assert!(obj.is_not_null());
|
assert!(obj.is_not_null());
|
||||||
|
|
||||||
|
@ -3666,7 +3666,7 @@ if expando.is_not_null() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
""" + namedGet + """
|
""" + namedGet + """
|
||||||
(*desc).obj = ptr::mut_null();
|
(*desc).obj = ptr::null_mut();
|
||||||
return true;"""
|
return true;"""
|
||||||
|
|
||||||
def definition_body(self):
|
def definition_body(self):
|
||||||
|
@ -4303,11 +4303,11 @@ class CGDictionary(CGThing):
|
||||||
return string.Template(
|
return string.Template(
|
||||||
"impl<'a, 'b> ${selfName}<'a, 'b> {\n"
|
"impl<'a, 'b> ${selfName}<'a, 'b> {\n"
|
||||||
" pub fn empty() -> ${selfName}<'a, 'b> {\n"
|
" pub fn empty() -> ${selfName}<'a, 'b> {\n"
|
||||||
" ${selfName}::new(ptr::mut_null(), NullValue()).unwrap()\n"
|
" ${selfName}::new(ptr::null_mut(), NullValue()).unwrap()\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" pub fn new(cx: *mut JSContext, val: JSVal) -> Result<${selfName}<'a, 'b>, ()> {\n"
|
" pub fn new(cx: *mut JSContext, val: JSVal) -> Result<${selfName}<'a, 'b>, ()> {\n"
|
||||||
" let object = if val.is_null_or_undefined() {\n"
|
" let object = if val.is_null_or_undefined() {\n"
|
||||||
" ptr::mut_null()\n"
|
" ptr::null_mut()\n"
|
||||||
" } else if val.is_object() {\n"
|
" } else if val.is_object() {\n"
|
||||||
" val.to_object()\n"
|
" val.to_object()\n"
|
||||||
" } else {\n"
|
" } else {\n"
|
||||||
|
@ -4914,7 +4914,7 @@ class CGCallback(CGClass):
|
||||||
# the private method.
|
# the private method.
|
||||||
argnames = [arg.name for arg in args]
|
argnames = [arg.name for arg in args]
|
||||||
argnamesWithThis = ["s.GetContext()", "thisObjJS"] + argnames
|
argnamesWithThis = ["s.GetContext()", "thisObjJS"] + argnames
|
||||||
argnamesWithoutThis = ["s.GetContext()", "ptr::mut_null()"] + argnames
|
argnamesWithoutThis = ["s.GetContext()", "ptr::null_mut()"] + argnames
|
||||||
# Now that we've recorded the argnames for our call to our private
|
# Now that we've recorded the argnames for our call to our private
|
||||||
# method, insert our optional argument for deciding whether the
|
# method, insert our optional argument for deciding whether the
|
||||||
# CallSetup should re-throw exceptions on aRv.
|
# CallSetup should re-throw exceptions on aRv.
|
||||||
|
|
|
@ -660,7 +660,7 @@ pub extern fn outerize_global(_cx: *mut JSContext, obj: JSHandleObject) -> *mut
|
||||||
IDLInterface::get_prototype_depth(None::<window::Window>))
|
IDLInterface::get_prototype_depth(None::<window::Window>))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.root();
|
.root();
|
||||||
win.deref().browser_context.deref().borrow().get_ref().window_proxy()
|
win.deref().browser_context.deref().borrow().as_ref().unwrap().window_proxy()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,11 +53,11 @@ impl BrowserContext {
|
||||||
let page = win.deref().page();
|
let page = win.deref().page();
|
||||||
let js_info = page.js_info();
|
let js_info = page.js_info();
|
||||||
|
|
||||||
let handler = js_info.get_ref().dom_static.windowproxy_handler;
|
let handler = js_info.as_ref().unwrap().dom_static.windowproxy_handler;
|
||||||
assert!(handler.deref().is_not_null());
|
assert!(handler.deref().is_not_null());
|
||||||
|
|
||||||
let parent = win.deref().reflector().get_jsobject();
|
let parent = win.deref().reflector().get_jsobject();
|
||||||
let cx = js_info.get_ref().js_context.deref().deref().ptr;
|
let cx = js_info.as_ref().unwrap().js_context.deref().deref().ptr;
|
||||||
let wrapper = with_compartment(cx, parent, || unsafe {
|
let wrapper = with_compartment(cx, parent, || unsafe {
|
||||||
WrapperNew(cx, parent, *handler.deref())
|
WrapperNew(cx, parent, *handler.deref())
|
||||||
});
|
});
|
||||||
|
|
|
@ -356,12 +356,14 @@ impl<'a> PrivateDocumentHelpers for JSRef<'a, Document> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_html_element(self) -> Option<Temporary<HTMLHtmlElement>> {
|
fn get_html_element(self) -> Option<Temporary<HTMLHtmlElement>> {
|
||||||
self.GetDocumentElement().root().filtered(|root| {
|
match self.GetDocumentElement().root() {
|
||||||
let root: JSRef<Node> = NodeCast::from_ref(**root);
|
Some(ref root) if {
|
||||||
root.type_id() == ElementNodeTypeId(HTMLHtmlElementTypeId)
|
let root: JSRef<Node> = NodeCast::from_ref(**root);
|
||||||
}).map(|elem| {
|
root.type_id() == ElementNodeTypeId(HTMLHtmlElementTypeId)
|
||||||
Temporary::from_rooted(HTMLHtmlElementCast::to_ref(*elem).unwrap())
|
} => Some(Temporary::from_rooted(HTMLHtmlElementCast::to_ref(**root).unwrap())),
|
||||||
})
|
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,7 +373,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
if self.implementation.get().is_none() {
|
if self.implementation.get().is_none() {
|
||||||
self.implementation.assign(Some(DOMImplementation::new(self)));
|
self.implementation.assign(Some(DOMImplementation::new(self)));
|
||||||
}
|
}
|
||||||
Temporary::new(self.implementation.get().get_ref().clone())
|
Temporary::new(self.implementation.get().as_ref().unwrap().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-document-url
|
// http://dom.spec.whatwg.org/#dom-document-url
|
||||||
|
@ -751,7 +753,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
let filter = box ImagesFilter;
|
let filter = box ImagesFilter;
|
||||||
self.images.assign(Some(HTMLCollection::create(*window, root, filter)));
|
self.images.assign(Some(HTMLCollection::create(*window, root, filter)));
|
||||||
}
|
}
|
||||||
Temporary::new(self.images.get().get_ref().clone())
|
Temporary::new(self.images.get().as_ref().unwrap().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Embeds(self) -> Temporary<HTMLCollection> {
|
fn Embeds(self) -> Temporary<HTMLCollection> {
|
||||||
|
@ -761,7 +763,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
let filter = box EmbedsFilter;
|
let filter = box EmbedsFilter;
|
||||||
self.embeds.assign(Some(HTMLCollection::create(*window, root, filter)));
|
self.embeds.assign(Some(HTMLCollection::create(*window, root, filter)));
|
||||||
}
|
}
|
||||||
Temporary::new(self.embeds.get().get_ref().clone())
|
Temporary::new(self.embeds.get().as_ref().unwrap().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Plugins(self) -> Temporary<HTMLCollection> {
|
fn Plugins(self) -> Temporary<HTMLCollection> {
|
||||||
|
@ -775,7 +777,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
let filter = box LinksFilter;
|
let filter = box LinksFilter;
|
||||||
self.links.assign(Some(HTMLCollection::create(*window, root, filter)));
|
self.links.assign(Some(HTMLCollection::create(*window, root, filter)));
|
||||||
}
|
}
|
||||||
Temporary::new(self.links.get().get_ref().clone())
|
Temporary::new(self.links.get().as_ref().unwrap().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Forms(self) -> Temporary<HTMLCollection> {
|
fn Forms(self) -> Temporary<HTMLCollection> {
|
||||||
|
@ -785,7 +787,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
let filter = box FormsFilter;
|
let filter = box FormsFilter;
|
||||||
self.forms.assign(Some(HTMLCollection::create(*window, root, filter)));
|
self.forms.assign(Some(HTMLCollection::create(*window, root, filter)));
|
||||||
}
|
}
|
||||||
Temporary::new(self.forms.get().get_ref().clone())
|
Temporary::new(self.forms.get().as_ref().unwrap().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Scripts(self) -> Temporary<HTMLCollection> {
|
fn Scripts(self) -> Temporary<HTMLCollection> {
|
||||||
|
@ -795,7 +797,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
let filter = box ScriptsFilter;
|
let filter = box ScriptsFilter;
|
||||||
self.scripts.assign(Some(HTMLCollection::create(*window, root, filter)));
|
self.scripts.assign(Some(HTMLCollection::create(*window, root, filter)));
|
||||||
}
|
}
|
||||||
Temporary::new(self.scripts.get().get_ref().clone())
|
Temporary::new(self.scripts.get().as_ref().unwrap().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Anchors(self) -> Temporary<HTMLCollection> {
|
fn Anchors(self) -> Temporary<HTMLCollection> {
|
||||||
|
@ -805,7 +807,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
let filter = box AnchorsFilter;
|
let filter = box AnchorsFilter;
|
||||||
self.anchors.assign(Some(HTMLCollection::create(*window, root, filter)));
|
self.anchors.assign(Some(HTMLCollection::create(*window, root, filter)));
|
||||||
}
|
}
|
||||||
Temporary::new(self.anchors.get().get_ref().clone())
|
Temporary::new(self.anchors.get().as_ref().unwrap().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Applets(self) -> Temporary<HTMLCollection> {
|
fn Applets(self) -> Temporary<HTMLCollection> {
|
||||||
|
@ -816,7 +818,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
let filter = box AppletsFilter;
|
let filter = box AppletsFilter;
|
||||||
self.applets.assign(Some(HTMLCollection::create(*window, root, filter)));
|
self.applets.assign(Some(HTMLCollection::create(*window, root, filter)));
|
||||||
}
|
}
|
||||||
Temporary::new(self.applets.get().get_ref().clone())
|
Temporary::new(self.applets.get().as_ref().unwrap().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Location(self) -> Temporary<Location> {
|
fn Location(self) -> Temporary<Location> {
|
||||||
|
|
|
@ -581,7 +581,7 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
|
||||||
let window = doc.deref().window.root();
|
let window = doc.deref().window.root();
|
||||||
let list = NamedNodeMap::new(*window, self);
|
let list = NamedNodeMap::new(*window, self);
|
||||||
self.attr_list.assign(Some(list));
|
self.attr_list.assign(Some(list));
|
||||||
Temporary::new(self.attr_list.get().get_ref().clone())
|
Temporary::new(self.attr_list.get().as_ref().unwrap().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-element-getattribute
|
// http://dom.spec.whatwg.org/#dom-element-getattribute
|
||||||
|
|
|
@ -254,7 +254,7 @@ impl<'a> EventTargetMethods for JSRef<'a, EventTarget> {
|
||||||
Some(listener) => {
|
Some(listener) => {
|
||||||
let mut handlers = self.handlers.deref().borrow_mut();
|
let mut handlers = self.handlers.deref().borrow_mut();
|
||||||
let mut entry = handlers.find_mut(&ty);
|
let mut entry = handlers.find_mut(&ty);
|
||||||
for entry in entry.mut_iter() {
|
for entry in entry.iter_mut() {
|
||||||
let phase = if capture { Capturing } else { Bubbling };
|
let phase = if capture { Capturing } else { Bubbling };
|
||||||
let old_entry = EventListenerEntry {
|
let old_entry = EventListenerEntry {
|
||||||
phase: phase,
|
phase: phase,
|
||||||
|
|
|
@ -73,7 +73,7 @@ impl<'a> FormDataMethods for JSRef<'a, FormData> {
|
||||||
|
|
||||||
fn Get(self, name: DOMString) -> Option<FileOrString> {
|
fn Get(self, name: DOMString) -> Option<FileOrString> {
|
||||||
if self.data.deref().borrow().contains_key_equiv(&name) {
|
if self.data.deref().borrow().contains_key_equiv(&name) {
|
||||||
match self.data.deref().borrow().get(&name)[0].clone() {
|
match (*self.data.deref().borrow())[name][0].clone() {
|
||||||
StringData(ref s) => Some(eString(s.clone())),
|
StringData(ref s) => Some(eString(s.clone())),
|
||||||
FileData(ref f) => {
|
FileData(ref f) => {
|
||||||
Some(eFile(f.clone()))
|
Some(eFile(f.clone()))
|
||||||
|
|
|
@ -657,7 +657,7 @@ impl<'m, 'n> NodeHelpers<'m, 'n> for JSRef<'n, Node> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn owner_doc(&self) -> Temporary<Document> {
|
fn owner_doc(&self) -> Temporary<Document> {
|
||||||
Temporary::new(self.owner_doc.get().get_ref().clone())
|
Temporary::new(self.owner_doc.get().as_ref().unwrap().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_owner_doc(&self, document: JSRef<Document>) {
|
fn set_owner_doc(&self, document: JSRef<Document>) {
|
||||||
|
@ -869,7 +869,7 @@ impl<'a> Iterator<JSRef<'a, Node>> for AncestorIterator<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Do we need two clones here?
|
// FIXME: Do we need two clones here?
|
||||||
let x = self.current.get_ref().clone();
|
let x = self.current.as_ref().unwrap().clone();
|
||||||
self.current = x.parent_node().map(|node| (*node.root()).clone());
|
self.current = x.parent_node().map(|node| (*node.root()).clone());
|
||||||
Some(x)
|
Some(x)
|
||||||
}
|
}
|
||||||
|
@ -1236,7 +1236,7 @@ impl Node {
|
||||||
|
|
||||||
// Step 7: mutation records.
|
// Step 7: mutation records.
|
||||||
// Step 8.
|
// Step 8.
|
||||||
for node in nodes.mut_iter() {
|
for node in nodes.iter_mut() {
|
||||||
parent.add_child(*node, child);
|
parent.add_child(*node, child);
|
||||||
let is_in_doc = parent.is_in_doc();
|
let is_in_doc = parent.is_in_doc();
|
||||||
for kid in node.traverse_preorder() {
|
for kid in node.traverse_preorder() {
|
||||||
|
@ -1571,7 +1571,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
let window = doc.deref().window.root();
|
let window = doc.deref().window.root();
|
||||||
let child_list = NodeList::new_child_list(*window, self);
|
let child_list = NodeList::new_child_list(*window, self);
|
||||||
self.child_list.assign(Some(child_list));
|
self.child_list.assign(Some(child_list));
|
||||||
Temporary::new(self.child_list.get().get_ref().clone())
|
Temporary::new(self.child_list.get().as_ref().unwrap().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-firstchild
|
// http://dom.spec.whatwg.org/#dom-node-firstchild
|
||||||
|
|
|
@ -98,7 +98,7 @@ pub struct Window {
|
||||||
impl Window {
|
impl Window {
|
||||||
pub fn get_cx(&self) -> *mut JSContext {
|
pub fn get_cx(&self) -> *mut JSContext {
|
||||||
let js_info = self.page().js_info();
|
let js_info = self.page().js_info();
|
||||||
(**js_info.get_ref().js_context).ptr
|
(**js_info.as_ref().unwrap().js_context).ptr
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn page<'a>(&'a self) -> &'a Page {
|
pub fn page<'a>(&'a self) -> &'a Page {
|
||||||
|
@ -112,7 +112,7 @@ impl Window {
|
||||||
#[unsafe_destructor]
|
#[unsafe_destructor]
|
||||||
impl Drop for Window {
|
impl Drop for Window {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
for (_, timer_handle) in self.active_timers.borrow_mut().mut_iter() {
|
for (_, timer_handle) in self.active_timers.borrow_mut().iter_mut() {
|
||||||
timer_handle.cancel();
|
timer_handle.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
|
||||||
|
|
||||||
fn Document(self) -> Temporary<Document> {
|
fn Document(self) -> Temporary<Document> {
|
||||||
let frame = self.page().frame();
|
let frame = self.page().frame();
|
||||||
Temporary::new(frame.get_ref().document.clone())
|
Temporary::new(frame.as_ref().unwrap().document.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Location(self) -> Temporary<Location> {
|
fn Location(self) -> Temporary<Location> {
|
||||||
|
@ -224,7 +224,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
|
||||||
let location = Location::new(self, page);
|
let location = Location::new(self, page);
|
||||||
self.location.assign(Some(location));
|
self.location.assign(Some(location));
|
||||||
}
|
}
|
||||||
Temporary::new(self.location.get().get_ref().clone())
|
Temporary::new(self.location.get().as_ref().unwrap().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Console(self) -> Temporary<Console> {
|
fn Console(self) -> Temporary<Console> {
|
||||||
|
@ -232,7 +232,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
|
||||||
let console = Console::new(&global::Window(self));
|
let console = Console::new(&global::Window(self));
|
||||||
self.console.assign(Some(console));
|
self.console.assign(Some(console));
|
||||||
}
|
}
|
||||||
Temporary::new(self.console.get().get_ref().clone())
|
Temporary::new(self.console.get().as_ref().unwrap().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Navigator(self) -> Temporary<Navigator> {
|
fn Navigator(self) -> Temporary<Navigator> {
|
||||||
|
@ -240,7 +240,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
|
||||||
let navigator = Navigator::new(self);
|
let navigator = Navigator::new(self);
|
||||||
self.navigator.assign(Some(navigator));
|
self.navigator.assign(Some(navigator));
|
||||||
}
|
}
|
||||||
Temporary::new(self.navigator.get().get_ref().clone())
|
Temporary::new(self.navigator.get().as_ref().unwrap().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetTimeout(self, _cx: *mut JSContext, callback: JSVal, timeout: i32) -> i32 {
|
fn SetTimeout(self, _cx: *mut JSContext, callback: JSVal, timeout: i32) -> i32 {
|
||||||
|
@ -288,7 +288,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
|
||||||
let performance = Performance::new(self);
|
let performance = Performance::new(self);
|
||||||
self.performance.assign(Some(performance));
|
self.performance.assign(Some(performance));
|
||||||
}
|
}
|
||||||
Temporary::new(self.performance.get().get_ref().clone())
|
Temporary::new(self.performance.get().as_ref().unwrap().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetOnclick(self) -> Option<EventHandlerNonNull> {
|
fn GetOnclick(self) -> Option<EventHandlerNonNull> {
|
||||||
|
@ -336,7 +336,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
|
||||||
let screen = Screen::new(self);
|
let screen = Screen::new(self);
|
||||||
self.screen.assign(Some(screen));
|
self.screen.assign(Some(screen));
|
||||||
}
|
}
|
||||||
Temporary::new(self.screen.get().get_ref().clone())
|
Temporary::new(self.screen.get().as_ref().unwrap().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Debug(self, message: DOMString) {
|
fn Debug(self, message: DOMString) {
|
||||||
|
|
|
@ -88,12 +88,12 @@ impl<'a> WorkerGlobalScopeMethods for JSRef<'a, WorkerGlobalScope> {
|
||||||
let location = WorkerLocation::new(self, self.worker_url.deref().clone());
|
let location = WorkerLocation::new(self, self.worker_url.deref().clone());
|
||||||
self.location.assign(Some(location));
|
self.location.assign(Some(location));
|
||||||
}
|
}
|
||||||
Temporary::new(self.location.get().get_ref().clone())
|
Temporary::new(self.location.get().as_ref().unwrap().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ImportScripts(self, url_strings: Vec<DOMString>) -> ErrorResult {
|
fn ImportScripts(self, url_strings: Vec<DOMString>) -> ErrorResult {
|
||||||
let mut urls = Vec::with_capacity(url_strings.len());
|
let mut urls = Vec::with_capacity(url_strings.len());
|
||||||
for url in url_strings.move_iter() {
|
for url in url_strings.into_iter() {
|
||||||
let url = UrlParser::new().base_url(&*self.worker_url)
|
let url = UrlParser::new().base_url(&*self.worker_url)
|
||||||
.parse(url.as_slice());
|
.parse(url.as_slice());
|
||||||
match url {
|
match url {
|
||||||
|
@ -102,7 +102,7 @@ impl<'a> WorkerGlobalScopeMethods for JSRef<'a, WorkerGlobalScope> {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
for url in urls.move_iter() {
|
for url in urls.into_iter() {
|
||||||
let (url, source) = match load_whole_resource(&*self.resource_task, url) {
|
let (url, source) = match load_whole_resource(&*self.resource_task, url) {
|
||||||
Err(_) => return Err(Network),
|
Err(_) => return Err(Network),
|
||||||
Ok((metadata, bytes)) => {
|
Ok((metadata, bytes)) => {
|
||||||
|
@ -128,7 +128,7 @@ impl<'a> WorkerGlobalScopeMethods for JSRef<'a, WorkerGlobalScope> {
|
||||||
let navigator = WorkerNavigator::new(self);
|
let navigator = WorkerNavigator::new(self);
|
||||||
self.navigator.assign(Some(navigator));
|
self.navigator.assign(Some(navigator));
|
||||||
}
|
}
|
||||||
Temporary::new(self.navigator.get().get_ref().clone())
|
Temporary::new(self.navigator.get().as_ref().unwrap().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Console(self) -> Temporary<Console> {
|
fn Console(self) -> Temporary<Console> {
|
||||||
|
@ -136,7 +136,7 @@ impl<'a> WorkerGlobalScopeMethods for JSRef<'a, WorkerGlobalScope> {
|
||||||
let console = Console::new(&global::Worker(self));
|
let console = Console::new(&global::Worker(self));
|
||||||
self.console.assign(Some(console));
|
self.console.assign(Some(console));
|
||||||
}
|
}
|
||||||
Temporary::new(self.console.get().get_ref().clone())
|
Temporary::new(self.console.get().as_ref().unwrap().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Btoa(self, btoa: DOMString) -> Fallible<DOMString> {
|
fn Btoa(self, btoa: DOMString) -> Fallible<DOMString> {
|
||||||
|
|
|
@ -519,7 +519,7 @@ pub fn parse_html(page: &Page,
|
||||||
let load_response = load_response.unwrap();
|
let load_response = load_response.unwrap();
|
||||||
match load_response.metadata.content_type {
|
match load_response.metadata.content_type {
|
||||||
Some((ref t, _)) if t.as_slice().eq_ignore_ascii_case("image") => {
|
Some((ref t, _)) if t.as_slice().eq_ignore_ascii_case("image") => {
|
||||||
let page = format!("<html><body><img src='{:s}' /></body></html>", base_url.get_ref().serialize());
|
let page = format!("<html><body><img src='{:s}' /></body></html>", base_url.as_ref().unwrap().serialize());
|
||||||
parser.parse_chunk(page.into_bytes().as_slice());
|
parser.parse_chunk(page.into_bytes().as_slice());
|
||||||
},
|
},
|
||||||
_ => loop {
|
_ => loop {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#![feature(globs, macro_rules, struct_variant, phase, unsafe_destructor)]
|
#![feature(globs, macro_rules, struct_variant, phase, unsafe_destructor)]
|
||||||
|
|
||||||
#![deny(unused_imports, unused_variable)]
|
#![deny(unused_imports, unused_variable)]
|
||||||
#![allow(non_snake_case_functions)]
|
#![allow(non_snake_case)]
|
||||||
|
|
||||||
#![doc="The script crate contains all matters DOM."]
|
#![doc="The script crate contains all matters DOM."]
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,7 @@ impl Page {
|
||||||
let damaged = self.damage.borrow().is_some();
|
let damaged = self.damage.borrow().is_some();
|
||||||
if damaged {
|
if damaged {
|
||||||
let frame = self.frame();
|
let frame = self.frame();
|
||||||
let window = frame.get_ref().window.root();
|
let window = frame.as_ref().unwrap().window.root();
|
||||||
self.reflow(goal, window.control_chan.clone(), &**window.compositor);
|
self.reflow(goal, window.control_chan.clone(), &**window.compositor);
|
||||||
} else {
|
} else {
|
||||||
self.avoided_reflows.set(self.avoided_reflows.get() + 1);
|
self.avoided_reflows.set(self.avoided_reflows.get() + 1);
|
||||||
|
@ -192,7 +192,7 @@ impl Page {
|
||||||
self.children
|
self.children
|
||||||
.deref()
|
.deref()
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
.mut_iter()
|
.iter_mut()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.find(|&(_idx, ref page_tree)| {
|
.find(|&(_idx, ref page_tree)| {
|
||||||
// FIXME: page_tree has a lifetime such that it's unusable for anything.
|
// FIXME: page_tree has a lifetime such that it's unusable for anything.
|
||||||
|
@ -204,7 +204,7 @@ impl Page {
|
||||||
match remove_idx {
|
match remove_idx {
|
||||||
Some(idx) => return Some(self.children.deref().borrow_mut().remove(idx).unwrap()),
|
Some(idx) => return Some(self.children.deref().borrow_mut().remove(idx).unwrap()),
|
||||||
None => {
|
None => {
|
||||||
for page_tree in self.children.deref().borrow_mut().mut_iter() {
|
for page_tree in self.children.deref().borrow_mut().iter_mut() {
|
||||||
match page_tree.remove(id) {
|
match page_tree.remove(id) {
|
||||||
found @ Some(_) => return found,
|
found @ Some(_) => return found,
|
||||||
None => (), // keep going...
|
None => (), // keep going...
|
||||||
|
@ -292,7 +292,7 @@ impl Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_url(&self) -> Url {
|
pub fn get_url(&self) -> Url {
|
||||||
self.url().get_ref().ref0().clone()
|
self.url().as_ref().unwrap().ref0().clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME(cgaebel): join_layout is racey. What if the compositor triggers a
|
// FIXME(cgaebel): join_layout is racey. What if the compositor triggers a
|
||||||
|
@ -393,7 +393,7 @@ impl Page {
|
||||||
|
|
||||||
/// Attempt to find a named element in this page's document.
|
/// Attempt to find a named element in this page's document.
|
||||||
pub fn find_fragment_node(&self, fragid: DOMString) -> Option<Temporary<Element>> {
|
pub fn find_fragment_node(&self, fragid: DOMString) -> Option<Temporary<Element>> {
|
||||||
let document = self.frame().get_ref().document.root();
|
let document = self.frame().as_ref().unwrap().document.root();
|
||||||
match document.deref().GetElementById(fragid.to_string()) {
|
match document.deref().GetElementById(fragid.to_string()) {
|
||||||
Some(node) => Some(node),
|
Some(node) => Some(node),
|
||||||
None => {
|
None => {
|
||||||
|
@ -412,7 +412,7 @@ impl Page {
|
||||||
|
|
||||||
pub fn hit_test(&self, point: &Point2D<f32>) -> Option<UntrustedNodeAddress> {
|
pub fn hit_test(&self, point: &Point2D<f32>) -> Option<UntrustedNodeAddress> {
|
||||||
let frame = self.frame();
|
let frame = self.frame();
|
||||||
let document = frame.get_ref().document.root();
|
let document = frame.as_ref().unwrap().document.root();
|
||||||
let root = document.deref().GetDocumentElement().root();
|
let root = document.deref().GetDocumentElement().root();
|
||||||
if root.is_none() {
|
if root.is_none() {
|
||||||
return None;
|
return None;
|
||||||
|
@ -433,7 +433,7 @@ impl Page {
|
||||||
|
|
||||||
pub fn get_nodes_under_mouse(&self, point: &Point2D<f32>) -> Option<Vec<UntrustedNodeAddress>> {
|
pub fn get_nodes_under_mouse(&self, point: &Point2D<f32>) -> Option<Vec<UntrustedNodeAddress>> {
|
||||||
let frame = self.frame();
|
let frame = self.frame();
|
||||||
let document = frame.get_ref().document.root();
|
let document = frame.as_ref().unwrap().document.root();
|
||||||
let root = document.deref().GetDocumentElement().root();
|
let root = document.deref().GetDocumentElement().root();
|
||||||
if root.is_none() {
|
if root.is_none() {
|
||||||
return None;
|
return None;
|
||||||
|
|
|
@ -376,7 +376,7 @@ impl ScriptTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_cx(&self) -> *mut JSContext {
|
pub fn get_cx(&self) -> *mut JSContext {
|
||||||
(**self.js_context.borrow().get_ref()).ptr
|
(**self.js_context.borrow().as_ref().unwrap()).ptr
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Starts the script task. After calling this method, the script task will loop receiving
|
/// Starts the script task. After calling this method, the script task will loop receiving
|
||||||
|
@ -412,7 +412,7 @@ impl ScriptTask {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (id, size) in resizes.move_iter() {
|
for (id, size) in resizes.into_iter() {
|
||||||
self.handle_event(id, ResizeEvent(size));
|
self.handle_event(id, ResizeEvent(size));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -485,7 +485,7 @@ impl ScriptTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process the gathered events.
|
// Process the gathered events.
|
||||||
for msg in sequential.move_iter() {
|
for msg in sequential.into_iter() {
|
||||||
match msg {
|
match msg {
|
||||||
// TODO(tkuehn) need to handle auxiliary layouts for iframes
|
// TODO(tkuehn) need to handle auxiliary layouts for iframes
|
||||||
FromConstellation(AttachLayoutMsg(_)) => fail!("should have handled AttachLayoutMsg already"),
|
FromConstellation(AttachLayoutMsg(_)) => fail!("should have handled AttachLayoutMsg already"),
|
||||||
|
@ -605,7 +605,7 @@ impl ScriptTask {
|
||||||
window_size,
|
window_size,
|
||||||
parent_page.resource_task.deref().clone(),
|
parent_page.resource_task.deref().clone(),
|
||||||
self.constellation_chan.clone(),
|
self.constellation_chan.clone(),
|
||||||
self.js_context.borrow().get_ref().clone())
|
self.js_context.borrow().as_ref().unwrap().clone())
|
||||||
};
|
};
|
||||||
parent_page.children.deref().borrow_mut().push(Rc::new(new_page));
|
parent_page.children.deref().borrow_mut().push(Rc::new(new_page));
|
||||||
}
|
}
|
||||||
|
@ -616,7 +616,7 @@ impl ScriptTask {
|
||||||
let page = page.find(id).expect("ScriptTask: received fire timer msg for a
|
let page = page.find(id).expect("ScriptTask: received fire timer msg for a
|
||||||
pipeline ID not associated with this script task. This is a bug.");
|
pipeline ID not associated with this script task. This is a bug.");
|
||||||
let frame = page.frame();
|
let frame = page.frame();
|
||||||
let window = frame.get_ref().window.root();
|
let window = frame.as_ref().unwrap().window.root();
|
||||||
window.handle_fire_timer(timer_id, self.get_cx());
|
window.handle_fire_timer(timer_id, self.get_cx());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -729,7 +729,7 @@ impl ScriptTask {
|
||||||
let last_url = last_loaded_url.map(|(ref loaded, _)| loaded.clone());
|
let last_url = last_loaded_url.map(|(ref loaded, _)| loaded.clone());
|
||||||
|
|
||||||
let cx = self.js_context.borrow();
|
let cx = self.js_context.borrow();
|
||||||
let cx = cx.get_ref();
|
let cx = cx.as_ref().unwrap();
|
||||||
// Create the window and document objects.
|
// Create the window and document objects.
|
||||||
let window = Window::new(cx.deref().ptr,
|
let window = Window::new(cx.deref().ptr,
|
||||||
page.clone(),
|
page.clone(),
|
||||||
|
@ -742,7 +742,7 @@ impl ScriptTask {
|
||||||
Some(url) => Some(url.clone()),
|
Some(url) => Some(url.clone()),
|
||||||
None => Url::parse("about:blank").ok(),
|
None => Url::parse("about:blank").ok(),
|
||||||
};
|
};
|
||||||
*page.mut_url() = Some((doc_url.get_ref().clone(), true));
|
*page.mut_url() = Some((doc_url.as_ref().unwrap().clone(), true));
|
||||||
doc_url
|
doc_url
|
||||||
} else {
|
} else {
|
||||||
Some(url.clone())
|
Some(url.clone())
|
||||||
|
@ -974,7 +974,7 @@ impl ScriptTask {
|
||||||
let mouse_over_targets = &mut *self.mouse_over_targets.borrow_mut();
|
let mouse_over_targets = &mut *self.mouse_over_targets.borrow_mut();
|
||||||
match *mouse_over_targets {
|
match *mouse_over_targets {
|
||||||
Some(ref mut mouse_over_targets) => {
|
Some(ref mut mouse_over_targets) => {
|
||||||
for node in mouse_over_targets.mut_iter() {
|
for node in mouse_over_targets.iter_mut() {
|
||||||
let node = node.root();
|
let node = node.root();
|
||||||
node.deref().set_hover_state(false);
|
node.deref().set_hover_state(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ pub fn parse_font_face_rule(rule: AtRule, parent_rules: &mut Vec<CSSRule>, base_
|
||||||
let mut maybe_family = None;
|
let mut maybe_family = None;
|
||||||
let mut maybe_sources = None;
|
let mut maybe_sources = None;
|
||||||
|
|
||||||
for item in ErrorLoggerIterator(parse_declaration_list(block.move_iter())) {
|
for item in ErrorLoggerIterator(parse_declaration_list(block.into_iter())) {
|
||||||
match item {
|
match item {
|
||||||
DeclAtRule(rule) => log_css_error(
|
DeclAtRule(rule) => log_css_error(
|
||||||
rule.location, format!("Unsupported at-rule in declaration list: @{:s}", rule.name).as_slice()),
|
rule.location, format!("Unsupported at-rule in declaration list: @{:s}", rule.name).as_slice()),
|
||||||
|
|
|
@ -59,7 +59,7 @@ pub fn parse_media_rule(rule: AtRule, parent_rules: &mut Vec<CSSRule>,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let mut rules = vec!();
|
let mut rules = vec!();
|
||||||
for rule in ErrorLoggerIterator(parse_rule_list(block.move_iter())) {
|
for rule in ErrorLoggerIterator(parse_rule_list(block.into_iter())) {
|
||||||
match rule {
|
match rule {
|
||||||
QualifiedRule(rule) => parse_style_rule(rule, &mut rules, namespaces, base_url),
|
QualifiedRule(rule) => parse_style_rule(rule, &mut rules, namespaces, base_url),
|
||||||
AtRule(rule) => parse_nested_at_rule(
|
AtRule(rule) => parse_nested_at_rule(
|
||||||
|
@ -94,13 +94,13 @@ pub fn parse_media_query_list(input: &[ComponentValue]) -> MediaQueryList {
|
||||||
};
|
};
|
||||||
match iter.next() {
|
match iter.next() {
|
||||||
None => {
|
None => {
|
||||||
for mq in mq.move_iter() {
|
for mq in mq.into_iter() {
|
||||||
queries.push(mq);
|
queries.push(mq);
|
||||||
}
|
}
|
||||||
return MediaQueryList{ media_queries: queries }
|
return MediaQueryList{ media_queries: queries }
|
||||||
},
|
},
|
||||||
Some(&Comma) => {
|
Some(&Comma) => {
|
||||||
for mq in mq.move_iter() {
|
for mq in mq.into_iter() {
|
||||||
queries.push(mq);
|
queries.push(mq);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -229,14 +229,14 @@ pub mod computed {
|
||||||
// TODO, as needed: root font size, viewport size, etc.
|
// TODO, as needed: root font size, viewport size, etc.
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case_functions)]
|
#[allow(non_snake_case)]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn compute_Au(value: specified::Length, context: &Context) -> Au {
|
pub fn compute_Au(value: specified::Length, context: &Context) -> Au {
|
||||||
compute_Au_with_font_size(value, context.font_size)
|
compute_Au_with_font_size(value, context.font_size)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A special version of `compute_Au` used for `font-size`.
|
/// A special version of `compute_Au` used for `font-size`.
|
||||||
#[allow(non_snake_case_functions)]
|
#[allow(non_snake_case)]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn compute_Au_with_font_size(value: specified::Length, reference_font_size: Au) -> Au {
|
pub fn compute_Au_with_font_size(value: specified::Length, reference_font_size: Au) -> Au {
|
||||||
match value {
|
match value {
|
||||||
|
@ -254,7 +254,7 @@ pub mod computed {
|
||||||
LP_Length(Au),
|
LP_Length(Au),
|
||||||
LP_Percentage(CSSFloat),
|
LP_Percentage(CSSFloat),
|
||||||
}
|
}
|
||||||
#[allow(non_snake_case_functions)]
|
#[allow(non_snake_case)]
|
||||||
pub fn compute_LengthOrPercentage(value: specified::LengthOrPercentage, context: &Context)
|
pub fn compute_LengthOrPercentage(value: specified::LengthOrPercentage, context: &Context)
|
||||||
-> LengthOrPercentage {
|
-> LengthOrPercentage {
|
||||||
match value {
|
match value {
|
||||||
|
@ -269,7 +269,7 @@ pub mod computed {
|
||||||
LPA_Percentage(CSSFloat),
|
LPA_Percentage(CSSFloat),
|
||||||
LPA_Auto,
|
LPA_Auto,
|
||||||
}
|
}
|
||||||
#[allow(non_snake_case_functions)]
|
#[allow(non_snake_case)]
|
||||||
pub fn compute_LengthOrPercentageOrAuto(value: specified::LengthOrPercentageOrAuto,
|
pub fn compute_LengthOrPercentageOrAuto(value: specified::LengthOrPercentageOrAuto,
|
||||||
context: &Context) -> LengthOrPercentageOrAuto {
|
context: &Context) -> LengthOrPercentageOrAuto {
|
||||||
match value {
|
match value {
|
||||||
|
@ -285,7 +285,7 @@ pub mod computed {
|
||||||
LPN_Percentage(CSSFloat),
|
LPN_Percentage(CSSFloat),
|
||||||
LPN_None,
|
LPN_None,
|
||||||
}
|
}
|
||||||
#[allow(non_snake_case_functions)]
|
#[allow(non_snake_case)]
|
||||||
pub fn compute_LengthOrPercentageOrNone(value: specified::LengthOrPercentageOrNone,
|
pub fn compute_LengthOrPercentageOrNone(value: specified::LengthOrPercentageOrNone,
|
||||||
context: &Context) -> LengthOrPercentageOrNone {
|
context: &Context) -> LengthOrPercentageOrNone {
|
||||||
match value {
|
match value {
|
||||||
|
|
|
@ -1438,17 +1438,17 @@ mod property_bit_field {
|
||||||
self.storage[bit / uint::BITS] &= !(1 << (bit % uint::BITS))
|
self.storage[bit / uint::BITS] &= !(1 << (bit % uint::BITS))
|
||||||
}
|
}
|
||||||
% for i, property in enumerate(LONGHANDS):
|
% for i, property in enumerate(LONGHANDS):
|
||||||
#[allow(non_snake_case_functions)]
|
#[allow(non_snake_case)]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn get_${property.ident}(&self) -> bool {
|
pub fn get_${property.ident}(&self) -> bool {
|
||||||
self.get(${i})
|
self.get(${i})
|
||||||
}
|
}
|
||||||
#[allow(non_snake_case_functions)]
|
#[allow(non_snake_case)]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn set_${property.ident}(&mut self) {
|
pub fn set_${property.ident}(&mut self) {
|
||||||
self.set(${i})
|
self.set(${i})
|
||||||
}
|
}
|
||||||
#[allow(non_snake_case_functions)]
|
#[allow(non_snake_case)]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn clear_${property.ident}(&mut self) {
|
pub fn clear_${property.ident}(&mut self) {
|
||||||
self.clear(${i})
|
self.clear(${i})
|
||||||
|
@ -1484,7 +1484,7 @@ pub fn parse_property_declaration_list<I: Iterator<Node>>(input: I, base_url: &U
|
||||||
let mut normal_seen = PropertyBitField::new();
|
let mut normal_seen = PropertyBitField::new();
|
||||||
let items: Vec<DeclarationListItem> =
|
let items: Vec<DeclarationListItem> =
|
||||||
ErrorLoggerIterator(parse_declaration_list(input)).collect();
|
ErrorLoggerIterator(parse_declaration_list(input)).collect();
|
||||||
for item in items.move_iter().rev() {
|
for item in items.into_iter().rev() {
|
||||||
match item {
|
match item {
|
||||||
DeclAtRule(rule) => log_css_error(
|
DeclAtRule(rule) => log_css_error(
|
||||||
rule.location, format!("Unsupported at-rule in declaration list: @{:s}", rule.name).as_slice()),
|
rule.location, format!("Unsupported at-rule in declaration list: @{:s}", rule.name).as_slice()),
|
||||||
|
|
|
@ -140,7 +140,7 @@ impl SelectorMap {
|
||||||
shareable);
|
shareable);
|
||||||
|
|
||||||
// Sort only the rules we just added.
|
// Sort only the rules we just added.
|
||||||
sort::quicksort_by(matching_rules_list.vec_mut_slice_from(init_len), compare);
|
sort::quicksort_by(matching_rules_list.vec_slice_from_mut(init_len), compare);
|
||||||
|
|
||||||
fn compare(a: &DeclarationBlock, b: &DeclarationBlock) -> Ordering {
|
fn compare(a: &DeclarationBlock, b: &DeclarationBlock) -> Ordering {
|
||||||
(a.specificity, a.source_order).cmp(&(b.specificity, b.source_order))
|
(a.specificity, a.source_order).cmp(&(b.specificity, b.source_order))
|
||||||
|
@ -1006,7 +1006,7 @@ mod tests {
|
||||||
let namespaces = NamespaceMap::new();
|
let namespaces = NamespaceMap::new();
|
||||||
css_selectors.iter().enumerate().map(|(i, selectors)| {
|
css_selectors.iter().enumerate().map(|(i, selectors)| {
|
||||||
parse_selector_list(tokenize(*selectors).map(|(c, _)| c), &namespaces)
|
parse_selector_list(tokenize(*selectors).map(|(c, _)| c), &namespaces)
|
||||||
.unwrap().move_iter().map(|s| {
|
.unwrap().into_iter().map(|s| {
|
||||||
Rule {
|
Rule {
|
||||||
selector: s.compound_selectors.clone(),
|
selector: s.compound_selectors.clone(),
|
||||||
declarations: DeclarationBlock {
|
declarations: DeclarationBlock {
|
||||||
|
|
|
@ -436,7 +436,7 @@ fn parse_qualified_name<I: Iterator<ComponentValue>>(
|
||||||
|
|
||||||
fn parse_attribute_selector(content: Vec<ComponentValue>, namespaces: &NamespaceMap)
|
fn parse_attribute_selector(content: Vec<ComponentValue>, namespaces: &NamespaceMap)
|
||||||
-> Result<SimpleSelector, ()> {
|
-> Result<SimpleSelector, ()> {
|
||||||
let iter = &mut content.move_iter().peekable();
|
let iter = &mut content.into_iter().peekable();
|
||||||
let attr = match try!(parse_qualified_name(iter, /* in_attr_selector = */ true, namespaces)) {
|
let attr = match try!(parse_qualified_name(iter, /* in_attr_selector = */ true, namespaces)) {
|
||||||
None => return Err(()),
|
None => return Err(()),
|
||||||
Some((_, None)) => fail!("Implementation error, this should not happen."),
|
Some((_, None)) => fail!("Implementation error, this should not happen."),
|
||||||
|
@ -537,7 +537,7 @@ fn parse_pseudo_element(name: String) -> Result<PseudoElement, ()> {
|
||||||
/// Level 3: Parse **one** simple_selector
|
/// Level 3: Parse **one** simple_selector
|
||||||
fn parse_negation(arguments: Vec<ComponentValue>, namespaces: &NamespaceMap)
|
fn parse_negation(arguments: Vec<ComponentValue>, namespaces: &NamespaceMap)
|
||||||
-> Result<SimpleSelector, ()> {
|
-> Result<SimpleSelector, ()> {
|
||||||
let iter = &mut arguments.move_iter().peekable();
|
let iter = &mut arguments.into_iter().peekable();
|
||||||
match try!(parse_type_selector(iter, namespaces)) {
|
match try!(parse_type_selector(iter, namespaces)) {
|
||||||
Some(type_selector) => Ok(Negation(type_selector)),
|
Some(type_selector) => Ok(Negation(type_selector)),
|
||||||
None => {
|
None => {
|
||||||
|
|
|
@ -129,10 +129,10 @@ pub fn parse_style_rule(rule: QualifiedRule, parent_rules: &mut Vec<CSSRule>,
|
||||||
let QualifiedRule{location: location, prelude: prelude, block: block} = rule;
|
let QualifiedRule{location: location, prelude: prelude, block: block} = rule;
|
||||||
// FIXME: avoid doing this for valid selectors
|
// FIXME: avoid doing this for valid selectors
|
||||||
let serialized = prelude.iter().to_css();
|
let serialized = prelude.iter().to_css();
|
||||||
match selectors::parse_selector_list(prelude.move_iter(), namespaces) {
|
match selectors::parse_selector_list(prelude.into_iter(), namespaces) {
|
||||||
Ok(selectors) => parent_rules.push(CSSStyleRule(StyleRule{
|
Ok(selectors) => parent_rules.push(CSSStyleRule(StyleRule{
|
||||||
selectors: selectors,
|
selectors: selectors,
|
||||||
declarations: properties::parse_property_declaration_list(block.move_iter(), base_url)
|
declarations: properties::parse_property_declaration_list(block.into_iter(), base_url)
|
||||||
})),
|
})),
|
||||||
Err(()) => log_css_error(location, format!(
|
Err(()) => log_css_error(location, format!(
|
||||||
"Invalid/unsupported selector: {}", serialized).as_slice()),
|
"Invalid/unsupported selector: {}", serialized).as_slice()),
|
||||||
|
|
|
@ -262,7 +262,7 @@ impl BloomFilter {
|
||||||
/// on every element.
|
/// on every element.
|
||||||
pub fn clear(&mut self) {
|
pub fn clear(&mut self) {
|
||||||
self.number_of_insertions = 0;
|
self.number_of_insertions = 0;
|
||||||
for x in self.buf.as_mut_slice().mut_iter() {
|
for x in self.buf.as_mut_slice().iter_mut() {
|
||||||
*x = 0u;
|
*x = 0u;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,7 +238,7 @@ impl<K:Clone+PartialEq+Hash,V:Clone> Cache<K,V> for SimpleHashCache<K,V> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn evict_all(&mut self) {
|
fn evict_all(&mut self) {
|
||||||
for slot in self.entries.mut_iter() {
|
for slot in self.entries.iter_mut() {
|
||||||
*slot = None
|
*slot = None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,12 +21,12 @@ pub trait VecLike<T> {
|
||||||
fn vec_len(&self) -> uint;
|
fn vec_len(&self) -> uint;
|
||||||
fn vec_push(&mut self, value: T);
|
fn vec_push(&mut self, value: T);
|
||||||
|
|
||||||
fn vec_mut_slice<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T];
|
fn vec_slice_mut<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T];
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn vec_mut_slice_from<'a>(&'a mut self, start: uint) -> &'a mut [T] {
|
fn vec_slice_from_mut<'a>(&'a mut self, start: uint) -> &'a mut [T] {
|
||||||
let len = self.vec_len();
|
let len = self.vec_len();
|
||||||
self.vec_mut_slice(start, len)
|
self.vec_slice_mut(start, len)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,8 +42,8 @@ impl<T> VecLike<T> for Vec<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn vec_mut_slice<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] {
|
fn vec_slice_mut<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] {
|
||||||
self.mut_slice(start, end)
|
self.slice_mut(start, end)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ pub trait SmallVec<T> : SmallVecPrivate<T> where T: 'static {
|
||||||
|
|
||||||
/// NB: For efficiency reasons (avoiding making a second copy of the inline elements), this
|
/// NB: For efficiency reasons (avoiding making a second copy of the inline elements), this
|
||||||
/// actually clears out the original array instead of moving it.
|
/// actually clears out the original array instead of moving it.
|
||||||
fn move_iter<'a>(&'a mut self) -> SmallVecMoveIterator<'a,T> {
|
fn into_iter<'a>(&'a mut self) -> SmallVecMoveIterator<'a,T> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let iter = mem::transmute(self.iter());
|
let iter = mem::transmute(self.iter());
|
||||||
let ptr_opt = if self.spilled() {
|
let ptr_opt = if self.spilled() {
|
||||||
|
@ -136,7 +136,7 @@ pub trait SmallVec<T> : SmallVecPrivate<T> where T: 'static {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn push_all_move<V:SmallVec<T>>(&mut self, mut other: V) {
|
fn push_all_move<V:SmallVec<T>>(&mut self, mut other: V) {
|
||||||
for value in other.move_iter() {
|
for value in other.into_iter() {
|
||||||
self.push(value)
|
self.push(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,12 +219,12 @@ pub trait SmallVec<T> : SmallVecPrivate<T> where T: 'static {
|
||||||
self.slice(0, self.len())
|
self.slice(0, self.len())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T] {
|
fn as_slice_mut<'a>(&'a mut self) -> &'a mut [T] {
|
||||||
let len = self.len();
|
let len = self.len();
|
||||||
self.mut_slice(0, len)
|
self.slice_mut(0, len)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mut_slice<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] {
|
fn slice_mut<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] {
|
||||||
assert!(start <= end);
|
assert!(start <= end);
|
||||||
assert!(end <= self.len());
|
assert!(end <= self.len());
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -235,9 +235,9 @@ pub trait SmallVec<T> : SmallVecPrivate<T> where T: 'static {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mut_slice_from<'a>(&'a mut self, start: uint) -> &'a mut [T] {
|
fn slice_from_mut<'a>(&'a mut self, start: uint) -> &'a mut [T] {
|
||||||
let len = self.len();
|
let len = self.len();
|
||||||
self.mut_slice(start, len)
|
self.slice_mut(start, len)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fail_bounds_check(&self, index: uint) {
|
fn fail_bounds_check(&self, index: uint) {
|
||||||
|
@ -400,8 +400,8 @@ macro_rules! def_small_vector(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn vec_mut_slice<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] {
|
fn vec_slice_mut<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] {
|
||||||
self.mut_slice(start, end)
|
self.slice_mut(start, end)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ pub mod test {
|
||||||
let len: uint = rng.gen();
|
let len: uint = rng.gen();
|
||||||
let mut v: Vec<int> = rng.gen_iter::<int>().take((len % 32) + 1).collect();
|
let mut v: Vec<int> = rng.gen_iter::<int>().take((len % 32) + 1).collect();
|
||||||
fn compare_ints(a: &int, b: &int) -> Ordering { a.cmp(b) }
|
fn compare_ints(a: &int, b: &int) -> Ordering { a.cmp(b) }
|
||||||
sort::quicksort_by(v.as_mut_slice(), compare_ints);
|
sort::quicksort_by(v.as_slice_mut(), compare_ints);
|
||||||
for i in range(0, v.len() - 1) {
|
for i in range(0, v.len() - 1) {
|
||||||
assert!(v.get(i) <= v.get(i + 1))
|
assert!(v.get(i) <= v.get(i + 1))
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,7 +210,7 @@ impl TimeProfiler {
|
||||||
"_category_", "_incremental?_", "_iframe?_",
|
"_category_", "_incremental?_", "_iframe?_",
|
||||||
" _url_", " _mean (ms)_", " _median (ms)_",
|
" _url_", " _mean (ms)_", " _median (ms)_",
|
||||||
" _min (ms)_", " _max (ms)_", " _events_");
|
" _min (ms)_", " _max (ms)_", " _events_");
|
||||||
for (&(ref category, ref meta), ref mut data) in self.buckets.mut_iter() {
|
for (&(ref category, ref meta), ref mut data) in self.buckets.iter_mut() {
|
||||||
data.sort_by(|a, b| {
|
data.sort_by(|a, b| {
|
||||||
if a < b {
|
if a < b {
|
||||||
Less
|
Less
|
||||||
|
|
|
@ -229,7 +229,7 @@ impl<QueueData: Send, WorkData: Send> WorkQueue<QueueData, WorkData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spawn threads.
|
// Spawn threads.
|
||||||
for thread in threads.move_iter() {
|
for thread in threads.into_iter() {
|
||||||
TaskBuilder::new().named(task_name).native().spawn(proc() {
|
TaskBuilder::new().named(task_name).native().spawn(proc() {
|
||||||
let mut thread = thread;
|
let mut thread = thread;
|
||||||
thread.start()
|
thread.start()
|
||||||
|
@ -260,8 +260,8 @@ impl<QueueData: Send, WorkData: Send> WorkQueue<QueueData, WorkData> {
|
||||||
pub fn run(&mut self) {
|
pub fn run(&mut self) {
|
||||||
// Tell the workers to start.
|
// Tell the workers to start.
|
||||||
let mut work_count = AtomicUint::new(self.work_count);
|
let mut work_count = AtomicUint::new(self.work_count);
|
||||||
for worker in self.workers.mut_iter() {
|
for worker in self.workers.iter_mut() {
|
||||||
worker.chan.send(StartMsg(worker.deque.take_unwrap(), &mut work_count, &self.data))
|
worker.chan.send(StartMsg(worker.deque.take().unwrap(), &mut work_count, &self.data))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for the work to finish.
|
// Wait for the work to finish.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue