auto merge of #4542 : servo/servo/pre-rustup_20141221, r=saneyuki

In particular, this contains changes to qualify enums where rust will require it, and to stop using some features that will be removed.
This commit is contained in:
bors-servo 2015-01-04 12:39:47 -07:00
commit ba8cf6b0e6
63 changed files with 445 additions and 439 deletions

View file

@ -2,8 +2,8 @@
* 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/. */
use azure::azure_hl::{DrawTarget, Color, B8G8R8A8, SkiaBackend, StrokeOptions, DrawOptions}; use azure::azure_hl::{DrawTarget, Color, SurfaceFormat, BackendType, StrokeOptions, DrawOptions};
use azure::azure_hl::{ColorPattern, ColorPatternRef}; use azure::azure_hl::{ColorPattern, PatternRef};
use geom::rect::Rect; use geom::rect::Rect;
use geom::size::Size2D; use geom::size::Size2D;
use servo_util::task::spawn_named; use servo_util::task::spawn_named;
@ -55,7 +55,8 @@ impl CanvasPaintTask {
fn fill_rect(&self, rect: &Rect<f32>) { fn fill_rect(&self, rect: &Rect<f32>) {
let drawopts = DrawOptions::new(1.0, 0); let drawopts = DrawOptions::new(1.0, 0);
self.drawtarget.fill_rect(rect, ColorPatternRef(&self.fill_color), Some(&drawopts)); self.drawtarget.fill_rect(rect, PatternRef::ColorPatternRef(&self.fill_color),
Some(&drawopts));
} }
fn clear_rect(&self, rect: &Rect<f32>) { fn clear_rect(&self, rect: &Rect<f32>) {
@ -68,7 +69,7 @@ impl CanvasPaintTask {
} }
fn create(size: Size2D<i32>) -> DrawTarget { fn create(size: Size2D<i32>) -> DrawTarget {
DrawTarget::new(SkiaBackend, size, B8G8R8A8) DrawTarget::new(BackendType::SkiaBackend, size, SurfaceFormat::B8G8R8A8)
} }
fn recreate(&mut self, size: Size2D<i32>) { fn recreate(&mut self, size: Size2D<i32>) {

View file

@ -18,7 +18,8 @@ use geom::point::{Point2D, TypedPoint2D};
use geom::rect::{Rect, TypedRect}; use geom::rect::{Rect, TypedRect};
use geom::size::TypedSize2D; use geom::size::TypedSize2D;
use geom::scale_factor::ScaleFactor; use geom::scale_factor::ScaleFactor;
use gfx::paint_task::{PaintChan, PaintMsg, PaintRequest, UnusedBufferMsg}; use gfx::paint_task::Msg as PaintMsg;
use gfx::paint_task::{PaintChan, PaintRequest};
use layers::geometry::{DevicePixel, LayerPixel}; use layers::geometry::{DevicePixel, LayerPixel};
use layers::layers::{BufferRequest, Layer, LayerBufferSet}; use layers::layers::{BufferRequest, Layer, LayerBufferSet};
use layers::rendergl; use layers::rendergl;
@ -27,17 +28,17 @@ use layers::scene::Scene;
use png; use png;
use gleam::gl::types::{GLint, GLsizei}; use gleam::gl::types::{GLint, GLsizei};
use gleam::gl; use gleam::gl;
use script_traits::{ViewportMsg, ScriptControlChan}; use script_traits::{ConstellationControlMsg, ScriptControlChan};
use servo_msg::compositor_msg::{Blank, Epoch, FinishedLoading, IdlePaintState, LayerId}; use servo_msg::compositor_msg::{Blank, Epoch, FinishedLoading, LayerId};
use servo_msg::compositor_msg::{ReadyState, PaintState, PaintingPaintState, Scrollable}; use servo_msg::compositor_msg::{ReadyState, PaintState, Scrollable};
use servo_msg::constellation_msg::{mod, ConstellationChan, ExitMsg}; use servo_msg::constellation_msg::{mod, ConstellationChan};
use servo_msg::constellation_msg::{GetPipelineTitleMsg, Key, KeyModifiers, KeyState, LoadData}; use servo_msg::constellation_msg::Msg as ConstellationMsg;
use servo_msg::constellation_msg::{LoadUrlMsg, NavigateMsg, PipelineId, ResizedWindowMsg}; use servo_msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
use servo_msg::constellation_msg::{WindowSizeData}; use servo_msg::constellation_msg::{PipelineId, WindowSizeData};
use servo_util::geometry::{PagePx, ScreenPx, ViewportPx}; use servo_util::geometry::{PagePx, ScreenPx, ViewportPx};
use servo_util::memory::MemoryProfilerChan; use servo_util::memory::MemoryProfilerChan;
use servo_util::opts; use servo_util::opts;
use servo_util::time::{profile, TimeProfilerChan}; use servo_util::time::{TimeProfilerCategory, profile, TimeProfilerChan};
use servo_util::{memory, time}; use servo_util::{memory, time};
use std::collections::HashMap; use std::collections::HashMap;
use std::collections::hash_map::{Occupied, Vacant}; use std::collections::hash_map::{Occupied, Vacant};
@ -236,7 +237,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
(Msg::Exit(chan), _) => { (Msg::Exit(chan), _) => {
debug!("shutting down the constellation"); debug!("shutting down the constellation");
let ConstellationChan(ref con_chan) = self.constellation_chan; let ConstellationChan(ref con_chan) = self.constellation_chan;
con_chan.send(ExitMsg); con_chan.send(ConstellationMsg::Exit);
chan.send(()); chan.send(());
self.shutdown_state = ShutdownState::ShuttingDown; self.shutdown_state = ShutdownState::ShuttingDown;
} }
@ -410,7 +411,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
if self.ready_states.len() == 0 { if self.ready_states.len() == 0 {
return false; return false;
} }
return self.paint_states.values().all(|&value| value == IdlePaintState); return self.paint_states.values().all(|&value| value == PaintState::Idle);
} }
fn has_paint_msg_tracking(&self) -> bool { fn has_paint_msg_tracking(&self) -> bool {
@ -504,7 +505,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
-> Rc<Layer<CompositorData>> { -> Rc<Layer<CompositorData>> {
// Initialize the ReadyState and PaintState for this pipeline. // Initialize the ReadyState and PaintState for this pipeline.
self.ready_states.insert(frame_tree.pipeline.id, Blank); self.ready_states.insert(frame_tree.pipeline.id, Blank);
self.paint_states.insert(frame_tree.pipeline.id, PaintingPaintState); self.paint_states.insert(frame_tree.pipeline.id, PaintState::Painting);
let root_layer = self.create_root_layer_for_pipeline_and_rect(&frame_tree.pipeline, let root_layer = self.create_root_layer_for_pipeline_and_rect(&frame_tree.pipeline,
frame_rect); frame_rect);
@ -588,7 +589,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
let visible_viewport = initial_viewport / self.viewport_zoom; let visible_viewport = initial_viewport / self.viewport_zoom;
let ConstellationChan(ref chan) = self.constellation_chan; let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(ResizedWindowMsg(WindowSizeData { chan.send(ConstellationMsg::ResizedWindow(WindowSizeData {
device_pixel_ratio: dppx, device_pixel_ratio: dppx,
initial_viewport: initial_viewport, initial_viewport: initial_viewport,
visible_viewport: visible_viewport, visible_viewport: visible_viewport,
@ -662,7 +663,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
None => { None => {
match self.paint_channels.entry(pipeline_id) { match self.paint_channels.entry(pipeline_id) {
Occupied(entry) => { Occupied(entry) => {
let message = UnusedBufferMsg(new_layer_buffer_set.buffers); let message = PaintMsg::UnusedBuffer(new_layer_buffer_set.buffers);
let _ = entry.get().send_opt(message); let _ = entry.get().send_opt(message);
}, },
Vacant(_) => panic!("Received a buffer from an unknown pipeline!"), Vacant(_) => panic!("Received a buffer from an unknown pipeline!"),
@ -753,7 +754,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
WindowEvent::Quit => { WindowEvent::Quit => {
debug!("shutting down the constellation for WindowEvent::Quit"); debug!("shutting down the constellation for WindowEvent::Quit");
let ConstellationChan(ref chan) = self.constellation_chan; let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(ExitMsg); chan.send(ConstellationMsg::Exit);
self.shutdown_state = ShutdownState::ShuttingDown; self.shutdown_state = ShutdownState::ShuttingDown;
} }
} }
@ -788,8 +789,8 @@ impl<Window: WindowMethods> IOCompositor<Window> {
layers"), layers"),
}; };
let msg = LoadUrlMsg(root_pipeline_id, let msg = ConstellationMsg::LoadUrl(root_pipeline_id,
LoadData::new(Url::parse(url_string.as_slice()).unwrap())); LoadData::new(Url::parse(url_string.as_slice()).unwrap()));
let ConstellationChan(ref chan) = self.constellation_chan; let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(msg); chan.send(msg);
} }
@ -910,7 +911,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
windowing::WindowNavigateMsg::Back => constellation_msg::Back, windowing::WindowNavigateMsg::Back => constellation_msg::Back,
}; };
let ConstellationChan(ref chan) = self.constellation_chan; let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(NavigateMsg(direction)) chan.send(ConstellationMsg::Navigate(direction))
} }
fn on_key_event(&self, key: Key, state: KeyState, modifiers: KeyModifiers) { fn on_key_event(&self, key: Key, state: KeyState, modifiers: KeyModifiers) {
@ -962,7 +963,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
Some(ref pipeline) => { Some(ref pipeline) => {
let unused_buffers = self.scene.collect_unused_buffers(); let unused_buffers = self.scene.collect_unused_buffers();
if unused_buffers.len() != 0 { if unused_buffers.len() != 0 {
let message = UnusedBufferMsg(unused_buffers); let message = PaintMsg::UnusedBuffer(unused_buffers);
let _ = pipeline.paint_chan.send_opt(message); let _ = pipeline.paint_chan.send_opt(message);
} }
}, },
@ -976,7 +977,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
layer.bounds.borrow().size.to_untyped()); layer.bounds.borrow().size.to_untyped());
let pipeline = &layer.extra_data.borrow().pipeline; let pipeline = &layer.extra_data.borrow().pipeline;
let ScriptControlChan(ref chan) = pipeline.script_chan; let ScriptControlChan(ref chan) = pipeline.script_chan;
chan.send(ViewportMsg(pipeline.id.clone(), layer_rect)); chan.send(ConstellationControlMsg::Viewport(pipeline.id.clone(), layer_rect));
} }
for kid in layer.children().iter() { for kid in layer.children().iter() {
@ -1012,7 +1013,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
let mut num_paint_msgs_sent = 0; let mut num_paint_msgs_sent = 0;
for (_pipeline_id, (chan, requests)) in pipeline_requests.into_iter() { for (_pipeline_id, (chan, requests)) in pipeline_requests.into_iter() {
num_paint_msgs_sent += 1; num_paint_msgs_sent += 1;
let _ = chan.send_opt(PaintMsg(requests)); let _ = chan.send_opt(PaintMsg::Paint(requests));
} }
self.add_outstanding_paint_msg(num_paint_msgs_sent); self.add_outstanding_paint_msg(num_paint_msgs_sent);
@ -1073,7 +1074,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
gl::bind_texture(gl::TEXTURE_2D, 0); gl::bind_texture(gl::TEXTURE_2D, 0);
} }
profile(time::CompositingCategory, None, self.time_profiler_chan.clone(), || { profile(TimeProfilerCategory::Compositing, None, self.time_profiler_chan.clone(), || {
debug!("compositor: compositing"); debug!("compositor: compositing");
// Adjust the layer dimensions as necessary to correspond to the size of the window. // Adjust the layer dimensions as necessary to correspond to the size of the window.
self.scene.viewport = Rect { self.scene.viewport = Rect {
@ -1129,7 +1130,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
debug!("shutting down the constellation after generating an output file"); debug!("shutting down the constellation after generating an output file");
let ConstellationChan(ref chan) = self.constellation_chan; let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(ExitMsg); chan.send(ConstellationMsg::Exit);
self.shutdown_state = ShutdownState::ShuttingDown; self.shutdown_state = ShutdownState::ShuttingDown;
} }
@ -1339,6 +1340,6 @@ impl<Window> CompositorEventListener for IOCompositor<Window> where Window: Wind
Some(ref root_pipeline) => root_pipeline.id, Some(ref root_pipeline) => root_pipeline.id,
}; };
let ConstellationChan(ref chan) = self.constellation_chan; let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(GetPipelineTitleMsg(root_pipeline_id)); chan.send(ConstellationMsg::GetPipelineTitle(root_pipeline_id));
} }
} }

View file

@ -12,13 +12,13 @@ use geom::matrix::identity;
use geom::point::{Point2D, TypedPoint2D}; use geom::point::{Point2D, TypedPoint2D};
use geom::size::TypedSize2D; use geom::size::TypedSize2D;
use geom::rect::Rect; use geom::rect::Rect;
use gfx::paint_task::UnusedBufferMsg; use gfx::paint_task::Msg as PaintMsg;
use layers::color::Color; use layers::color::Color;
use layers::geometry::LayerPixel; use layers::geometry::LayerPixel;
use layers::layers::{Layer, LayerBufferSet}; use layers::layers::{Layer, LayerBufferSet};
use layers::platform::surface::NativeSurfaceMethods; use layers::platform::surface::NativeSurfaceMethods;
use script_traits::{ClickEvent, MouseDownEvent, MouseMoveEvent, MouseUpEvent, SendEventMsg}; use script_traits::{ClickEvent, MouseDownEvent, MouseMoveEvent, MouseUpEvent};
use script_traits::{ScriptControlChan}; use script_traits::{ScriptControlChan, ConstellationControlMsg};
use servo_msg::compositor_msg::{Epoch, FixedPosition, LayerId, ScrollPolicy}; use servo_msg::compositor_msg::{Epoch, FixedPosition, LayerId, ScrollPolicy};
use std::num::Float; use std::num::Float;
use std::num::FloatMath; use std::num::FloatMath;
@ -196,7 +196,7 @@ impl CompositorLayer for Layer<CompositorData> {
self.extra_data.borrow().epoch, self.extra_data.borrow().epoch,
epoch, epoch,
self.extra_data.borrow().pipeline.id); self.extra_data.borrow().pipeline.id);
let msg = UnusedBufferMsg(new_buffers.buffers); let msg = PaintMsg::UnusedBuffer(new_buffers.buffers);
let _ = self.extra_data.borrow().pipeline.paint_chan.send_opt(msg); let _ = self.extra_data.borrow().pipeline.paint_chan.send_opt(msg);
return false; return false;
} }
@ -208,7 +208,7 @@ impl CompositorLayer for Layer<CompositorData> {
let unused_buffers = self.collect_unused_buffers(); let unused_buffers = self.collect_unused_buffers();
if !unused_buffers.is_empty() { // send back unused buffers if !unused_buffers.is_empty() { // send back unused buffers
let msg = UnusedBufferMsg(unused_buffers); let msg = PaintMsg::UnusedBuffer(unused_buffers);
let _ = self.extra_data.borrow().pipeline.paint_chan.send_opt(msg); let _ = self.extra_data.borrow().pipeline.paint_chan.send_opt(msg);
} }
} }
@ -227,7 +227,7 @@ impl CompositorLayer for Layer<CompositorData> {
buffer.mark_wont_leak() buffer.mark_wont_leak()
} }
let _ = self.extra_data.borrow().pipeline.paint_chan.send_opt(UnusedBufferMsg(buffers)); let _ = self.extra_data.borrow().pipeline.paint_chan.send_opt(PaintMsg::UnusedBuffer(buffers));
} }
} }
@ -328,7 +328,7 @@ impl CompositorLayer for Layer<CompositorData> {
}; };
let pipeline = &self.extra_data.borrow().pipeline; let pipeline = &self.extra_data.borrow().pipeline;
let ScriptControlChan(ref chan) = pipeline.script_chan; let ScriptControlChan(ref chan) = pipeline.script_chan;
let _ = chan.send_opt(SendEventMsg(pipeline.id.clone(), message)); let _ = chan.send_opt(ConstellationControlMsg::SendEvent(pipeline.id.clone(), message));
} }
fn send_mouse_move_event(&self, fn send_mouse_move_event(&self,
@ -336,7 +336,7 @@ impl CompositorLayer for Layer<CompositorData> {
let message = MouseMoveEvent(cursor.to_untyped()); let message = MouseMoveEvent(cursor.to_untyped());
let pipeline = &self.extra_data.borrow().pipeline; let pipeline = &self.extra_data.borrow().pipeline;
let ScriptControlChan(ref chan) = pipeline.script_chan; let ScriptControlChan(ref chan) = pipeline.script_chan;
let _ = chan.send_opt(SendEventMsg(pipeline.id.clone(), message)); let _ = chan.send_opt(ConstellationControlMsg::SendEvent(pipeline.id.clone(), message));
} }
fn scroll_layer_and_all_child_layers(&self, fn scroll_layer_and_all_child_layers(&self,

View file

@ -14,17 +14,15 @@ use gfx::font_cache_task::FontCacheTask;
use layers::geometry::DevicePixel; use layers::geometry::DevicePixel;
use layout_traits::LayoutTaskFactory; use layout_traits::LayoutTaskFactory;
use libc; use libc;
use script_traits::{mod, GetTitleMsg, ResizeMsg, ResizeInactiveMsg, SendEventMsg}; use script_traits::{mod, ConstellationControlMsg};
use script_traits::{ScriptControlChan, ScriptTaskFactory}; use script_traits::{ScriptControlChan, ScriptTaskFactory};
use servo_msg::compositor_msg::LayerId; use servo_msg::compositor_msg::LayerId;
use servo_msg::constellation_msg::{mod, ConstellationChan, ExitMsg, FailureMsg, Failure}; use servo_msg::constellation_msg::{mod, ConstellationChan, Failure};
use servo_msg::constellation_msg::{FrameRectMsg, GetPipelineTitleMsg}; use servo_msg::constellation_msg::{IFrameSandboxState, IFrameUnsandboxed};
use servo_msg::constellation_msg::{IFrameSandboxState, IFrameUnsandboxed, InitLoadUrlMsg}; use servo_msg::constellation_msg::{KeyEvent, Key, KeyState, KeyModifiers};
use servo_msg::constellation_msg::{KeyEvent, Key, KeyState, KeyModifiers, LoadCompleteMsg}; use servo_msg::constellation_msg::{LoadData, NavigationType};
use servo_msg::constellation_msg::{LoadData, LoadUrlMsg, NavigateMsg, NavigationType}; use servo_msg::constellation_msg::{PipelineExitType, PipelineId};
use servo_msg::constellation_msg::{PainterReadyMsg, PipelineExitType, PipelineId, ResizedWindowMsg}; use servo_msg::constellation_msg::{SubpageId, WindowSizeData};
use servo_msg::constellation_msg::{ScriptLoadedURLInIFrameMsg, SetCursorMsg, SubpageId};
use servo_msg::constellation_msg::{WindowSizeData};
use servo_msg::constellation_msg::Msg as ConstellationMsg; use servo_msg::constellation_msg::Msg as ConstellationMsg;
use servo_net::image_cache_task::{ImageCacheTask, ImageCacheTaskClient}; use servo_net::image_cache_task::{ImageCacheTask, ImageCacheTaskClient};
use servo_net::resource_task::ResourceTask; use servo_net::resource_task::ResourceTask;
@ -446,65 +444,65 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
/// Handles loading pages, navigation, and granting access to the compositor /// Handles loading pages, navigation, and granting access to the compositor
fn handle_request(&mut self, request: ConstellationMsg) -> bool { fn handle_request(&mut self, request: ConstellationMsg) -> bool {
match request { match request {
ExitMsg => { ConstellationMsg::Exit => {
debug!("constellation exiting"); debug!("constellation exiting");
self.handle_exit(); self.handle_exit();
return false; return false;
} }
FailureMsg(Failure { pipeline_id, subpage_id }) => { ConstellationMsg::Failure(Failure { pipeline_id, subpage_id }) => {
self.handle_failure_msg(pipeline_id, subpage_id); self.handle_failure_msg(pipeline_id, subpage_id);
} }
// This should only be called once per constellation, and only by the browser // This should only be called once per constellation, and only by the browser
InitLoadUrlMsg(url) => { ConstellationMsg::InitLoadUrl(url) => {
debug!("constellation got init load URL message"); debug!("constellation got init load URL message");
self.handle_init_load(url); self.handle_init_load(url);
} }
// A layout assigned a size and position to a subframe. This needs to be reflected by // A layout assigned a size and position to a subframe. This needs to be reflected by
// all frame trees in the navigation context containing the subframe. // all frame trees in the navigation context containing the subframe.
FrameRectMsg(pipeline_id, subpage_id, rect) => { ConstellationMsg::FrameRect(pipeline_id, subpage_id, rect) => {
debug!("constellation got frame rect message"); debug!("constellation got frame rect message");
self.handle_frame_rect_msg(pipeline_id, subpage_id, Rect::from_untyped(&rect)); self.handle_frame_rect_msg(pipeline_id, subpage_id, Rect::from_untyped(&rect));
} }
ScriptLoadedURLInIFrameMsg(url, source_pipeline_id, subpage_id, sandbox) => { ConstellationMsg::ScriptLoadedURLInIFrame(url, source_pipeline_id, subpage_id, sandbox) => {
debug!("constellation got iframe URL load message"); debug!("constellation got iframe URL load message");
self.handle_script_loaded_url_in_iframe_msg(url, self.handle_script_loaded_url_in_iframe_msg(url,
source_pipeline_id, source_pipeline_id,
subpage_id, subpage_id,
sandbox); sandbox);
} }
SetCursorMsg(cursor) => self.handle_set_cursor_msg(cursor), ConstellationMsg::SetCursor(cursor) => self.handle_set_cursor_msg(cursor),
// Load a new page, usually -- but not always -- from a mouse click or typed url // Load a new page, usually -- but not always -- from a mouse click or typed url
// If there is already a pending page (self.pending_frames), it will not be overridden; // If there is already a pending page (self.pending_frames), it will not be overridden;
// However, if the id is not encompassed by another change, it will be. // However, if the id is not encompassed by another change, it will be.
LoadUrlMsg(source_id, load_data) => { ConstellationMsg::LoadUrl(source_id, load_data) => {
debug!("constellation got URL load message"); debug!("constellation got URL load message");
self.handle_load_url_msg(source_id, load_data); self.handle_load_url_msg(source_id, load_data);
} }
// A page loaded through one of several methods above has completed all parsing, // A page loaded through one of several methods above has completed all parsing,
// script, and reflow messages have been sent. // script, and reflow messages have been sent.
LoadCompleteMsg => { ConstellationMsg::LoadComplete => {
debug!("constellation got load complete message"); debug!("constellation got load complete message");
self.compositor_proxy.send(CompositorMsg::LoadComplete); self.compositor_proxy.send(CompositorMsg::LoadComplete);
} }
// Handle a forward or back request // Handle a forward or back request
NavigateMsg(direction) => { ConstellationMsg::Navigate(direction) => {
debug!("constellation got navigation message"); debug!("constellation got navigation message");
self.handle_navigate_msg(direction); self.handle_navigate_msg(direction);
} }
// Notification that painting has finished and is requesting permission to paint. // Notification that painting has finished and is requesting permission to paint.
PainterReadyMsg(pipeline_id) => { ConstellationMsg::PainterReady(pipeline_id) => {
debug!("constellation got painter ready message"); debug!("constellation got painter ready message");
self.handle_painter_ready_msg(pipeline_id); self.handle_painter_ready_msg(pipeline_id);
} }
ResizedWindowMsg(new_size) => { ConstellationMsg::ResizedWindow(new_size) => {
debug!("constellation got window resize message"); debug!("constellation got window resize message");
self.handle_resized_window_msg(new_size); self.handle_resized_window_msg(new_size);
} }
KeyEvent(key, state, modifiers) => { ConstellationMsg::KeyEvent(key, state, modifiers) => {
debug!("constellation got key event message"); debug!("constellation got key event message");
self.handle_key_msg(key, state, modifiers); self.handle_key_msg(key, state, modifiers);
} }
GetPipelineTitleMsg(pipeline_id) => { ConstellationMsg::GetPipelineTitle(pipeline_id) => {
debug!("constellation got get-pipeline-title message"); debug!("constellation got get-pipeline-title message");
self.handle_get_pipeline_title_msg(pipeline_id); self.handle_get_pipeline_title_msg(pipeline_id);
} }
@ -674,7 +672,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
if !already_sent.contains(&pipeline.id) { if !already_sent.contains(&pipeline.id) {
if is_active { if is_active {
let ScriptControlChan(ref script_chan) = pipeline.script_chan; let ScriptControlChan(ref script_chan) = pipeline.script_chan;
script_chan.send(ResizeMsg(pipeline.id, WindowSizeData { script_chan.send(ConstellationControlMsg::Resize(pipeline.id, WindowSizeData {
visible_viewport: rect.size, visible_viewport: rect.size,
initial_viewport: rect.size * ScaleFactor(1.0), initial_viewport: rect.size * ScaleFactor(1.0),
device_pixel_ratio: device_pixel_ratio, device_pixel_ratio: device_pixel_ratio,
@ -704,7 +702,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
// and add the new pipeline to their sub frames. // and add the new pipeline to their sub frames.
let frame_trees = self.find_all(source_pipeline_id); let frame_trees = self.find_all(source_pipeline_id);
if frame_trees.is_empty() { if frame_trees.is_empty() {
panic!("Constellation: source pipeline id of ScriptLoadedURLInIFrameMsg is not in panic!("Constellation: source pipeline id of ScriptLoadedURLInIFrame is not in
navigation context, nor is it in a pending frame. This should be navigation context, nor is it in a pending frame. This should be
impossible."); impossible.");
} }
@ -714,7 +712,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
// Compare the pipeline's url to the new url. If the origin is the same, // Compare the pipeline's url to the new url. If the origin is the same,
// then reuse the script task in creating the new pipeline // then reuse the script task in creating the new pipeline
let source_pipeline = self.pipelines.get(&source_pipeline_id).expect("Constellation: let source_pipeline = self.pipelines.get(&source_pipeline_id).expect("Constellation:
source Id of ScriptLoadedURLInIFrameMsg does have an associated pipeline in source Id of ScriptLoadedURLInIFrame does have an associated pipeline in
constellation. This should be impossible.").clone(); constellation. This should be impossible.").clone();
let source_url = source_pipeline.load_data.url.clone(); let source_url = source_pipeline.load_data.url.clone();
@ -759,7 +757,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
debug!("Constellation: received message to load {}", url); debug!("Constellation: received message to load {}", url);
// Make sure no pending page would be overridden. // Make sure no pending page would be overridden.
let source_frame = self.current_frame().as_ref().unwrap().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 LoadUrl message 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.");
@ -840,7 +838,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
fn handle_key_msg(&self, key: Key, state: KeyState, mods: KeyModifiers) { fn handle_key_msg(&self, key: Key, state: KeyState, mods: KeyModifiers) {
self.current_frame().as_ref().map(|frame| { self.current_frame().as_ref().map(|frame| {
let ScriptControlChan(ref chan) = frame.pipeline.script_chan; let ScriptControlChan(ref chan) = frame.pipeline.script_chan;
chan.send(SendEventMsg(frame.pipeline.id, script_traits::KeyEvent(key, state, mods))); chan.send(ConstellationControlMsg::SendEvent(frame.pipeline.id, script_traits::KeyEvent(key, state, mods)));
}); });
} }
@ -849,7 +847,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
None => self.compositor_proxy.send(CompositorMsg::ChangePageTitle(pipeline_id, None)), None => self.compositor_proxy.send(CompositorMsg::ChangePageTitle(pipeline_id, None)),
Some(pipeline) => { Some(pipeline) => {
let ScriptControlChan(ref script_channel) = pipeline.script_chan; let ScriptControlChan(ref script_channel) = pipeline.script_chan;
script_channel.send(GetTitleMsg(pipeline_id)); script_channel.send(ConstellationControlMsg::GetTitle(pipeline_id));
} }
} }
} }
@ -947,7 +945,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
debug!("constellation sending resize message to active frame"); debug!("constellation sending resize message to active frame");
let pipeline = &frame_tree.pipeline; let pipeline = &frame_tree.pipeline;
let ScriptControlChan(ref chan) = pipeline.script_chan; let ScriptControlChan(ref chan) = pipeline.script_chan;
let _ = chan.send_opt(ResizeMsg(pipeline.id, new_size)); let _ = chan.send_opt(ConstellationControlMsg::Resize(pipeline.id, new_size));
already_seen.insert(pipeline.id); already_seen.insert(pipeline.id);
} }
for frame_tree in self.navigation_context.previous.iter() for frame_tree in self.navigation_context.previous.iter()
@ -956,7 +954,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
if !already_seen.contains(&pipeline.id) { if !already_seen.contains(&pipeline.id) {
debug!("constellation sending resize message to inactive frame"); debug!("constellation sending resize message to inactive frame");
let ScriptControlChan(ref chan) = pipeline.script_chan; let ScriptControlChan(ref chan) = pipeline.script_chan;
let _ = chan.send_opt(ResizeInactiveMsg(pipeline.id, new_size)); let _ = chan.send_opt(ConstellationControlMsg::ResizeInactive(pipeline.id, new_size));
already_seen.insert(pipeline.id); already_seen.insert(pipeline.id);
} }
} }
@ -969,7 +967,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
debug!("constellation sending resize message to pending outer frame ({})", debug!("constellation sending resize message to pending outer frame ({})",
frame_tree.pipeline.id); frame_tree.pipeline.id);
let ScriptControlChan(ref chan) = frame_tree.pipeline.script_chan; let ScriptControlChan(ref chan) = frame_tree.pipeline.script_chan;
let _ = chan.send_opt(ResizeMsg(frame_tree.pipeline.id, new_size)); let _ = chan.send_opt(ConstellationControlMsg::Resize(frame_tree.pipeline.id, new_size));
} }
} }

View file

@ -7,7 +7,8 @@ use windowing::WindowEvent;
use geom::scale_factor::ScaleFactor; use geom::scale_factor::ScaleFactor;
use geom::size::TypedSize2D; use geom::size::TypedSize2D;
use servo_msg::constellation_msg::{ConstellationChan, ExitMsg, ResizedWindowMsg, WindowSizeData}; use servo_msg::constellation_msg::Msg as ConstellationMsg;
use servo_msg::constellation_msg::{ConstellationChan, WindowSizeData};
use servo_util::memory::MemoryProfilerChan; use servo_util::memory::MemoryProfilerChan;
use servo_util::memory; use servo_util::memory;
use servo_util::time::TimeProfilerChan; use servo_util::time::TimeProfilerChan;
@ -55,7 +56,7 @@ impl NullCompositor {
// Tell the constellation about the initial fake size. // Tell the constellation about the initial fake size.
{ {
let ConstellationChan(ref chan) = compositor.constellation_chan; let ConstellationChan(ref chan) = compositor.constellation_chan;
chan.send(ResizedWindowMsg(WindowSizeData { chan.send(ConstellationMsg::ResizedWindow(WindowSizeData {
initial_viewport: TypedSize2D(640_f32, 480_f32), initial_viewport: TypedSize2D(640_f32, 480_f32),
visible_viewport: TypedSize2D(640_f32, 480_f32), visible_viewport: TypedSize2D(640_f32, 480_f32),
device_pixel_ratio: ScaleFactor(1.0), device_pixel_ratio: ScaleFactor(1.0),
@ -72,7 +73,7 @@ impl CompositorEventListener for NullCompositor {
Msg::Exit(chan) => { Msg::Exit(chan) => {
debug!("shutting down the constellation"); debug!("shutting down the constellation");
let ConstellationChan(ref con_chan) = self.constellation_chan; let ConstellationChan(ref con_chan) = self.constellation_chan;
con_chan.send(ExitMsg); con_chan.send(ConstellationMsg::Exit);
chan.send(()); chan.send(());
} }

View file

@ -25,7 +25,6 @@ extern crate "util" as servo_util;
extern crate gleam; extern crate gleam;
extern crate libc; extern crate libc;
extern crate native;
extern crate time; extern crate time;
extern crate url; extern crate url;

View file

@ -5,13 +5,13 @@
use CompositorProxy; use CompositorProxy;
use layout_traits::{ExitNowMsg, LayoutTaskFactory, LayoutControlChan}; use layout_traits::{ExitNowMsg, LayoutTaskFactory, LayoutControlChan};
use script_traits::{ScriptControlChan, ScriptTaskFactory}; use script_traits::{ScriptControlChan, ScriptTaskFactory};
use script_traits::{AttachLayoutMsg, LoadMsg, NewLayoutInfo, ExitPipelineMsg}; use script_traits::{NewLayoutInfo, ConstellationControlMsg};
use devtools_traits::DevtoolsControlChan; use devtools_traits::DevtoolsControlChan;
use gfx::paint_task; use gfx::paint_task::Msg as PaintMsg;
use gfx::paint_task::{PaintPermissionGranted, PaintPermissionRevoked}; use gfx::paint_task::{PaintPermissionGranted, PaintPermissionRevoked};
use gfx::paint_task::{PaintChan, PaintTask}; use gfx::paint_task::{PaintChan, PaintTask};
use servo_msg::constellation_msg::{ConstellationChan, ExitMsg, Failure, PipelineId, SubpageId}; use servo_msg::constellation_msg::{ConstellationChan, Failure, PipelineId, SubpageId};
use servo_msg::constellation_msg::{LoadData, WindowSizeData, PipelineExitType}; use servo_msg::constellation_msg::{LoadData, WindowSizeData, PipelineExitType};
use servo_net::image_cache_task::ImageCacheTask; use servo_net::image_cache_task::ImageCacheTask;
use gfx::font_cache_task::FontCacheTask; use gfx::font_cache_task::FontCacheTask;
@ -100,7 +100,7 @@ impl Pipeline {
}; };
let ScriptControlChan(ref chan) = spipe.script_chan; let ScriptControlChan(ref chan) = spipe.script_chan;
chan.send(AttachLayoutMsg(new_layout_info)); chan.send(ConstellationControlMsg::AttachLayout(new_layout_info));
spipe.script_chan.clone() spipe.script_chan.clone()
} }
}; };
@ -162,7 +162,7 @@ impl Pipeline {
pub fn load(&self) { pub fn load(&self) {
let ScriptControlChan(ref chan) = self.script_chan; let ScriptControlChan(ref chan) = self.script_chan;
chan.send(LoadMsg(self.id, self.load_data.clone())); chan.send(ConstellationControlMsg::Load(self.id, self.load_data.clone()));
} }
pub fn grant_paint_permission(&self) { pub fn grant_paint_permission(&self) {
@ -180,7 +180,7 @@ impl Pipeline {
// Script task handles shutting down layout, and layout handles shutting down the painter. // Script task handles shutting down layout, and layout handles shutting down the painter.
// For now, if the script task has failed, we give up on clean shutdown. // For now, if the script task has failed, we give up on clean shutdown.
let ScriptControlChan(ref chan) = self.script_chan; let ScriptControlChan(ref chan) = self.script_chan;
if chan.send_opt(ExitPipelineMsg(self.id, exit_type)).is_ok() { if chan.send_opt(ConstellationControlMsg::ExitPipeline(self.id, exit_type)).is_ok() {
// Wait until all slave tasks have terminated and run destructors // Wait until all slave tasks have terminated and run destructors
// NOTE: We don't wait for script task as we don't always own it // NOTE: We don't wait for script task as we don't always own it
let _ = self.paint_shutdown_port.recv_opt(); let _ = self.paint_shutdown_port.recv_opt();
@ -191,8 +191,10 @@ impl Pipeline {
pub fn force_exit(&self) { pub fn force_exit(&self) {
let ScriptControlChan(ref script_channel) = self.script_chan; let ScriptControlChan(ref script_channel) = self.script_chan;
let _ = script_channel.send_opt( ExitPipelineMsg(self.id, PipelineExitType::PipelineOnly)); let _ = script_channel.send_opt(
let _ = self.paint_chan.send_opt(paint_task::ExitMsg(None, PipelineExitType::PipelineOnly)); ConstellationControlMsg::ExitPipeline(self.id,
PipelineExitType::PipelineOnly));
let _ = self.paint_chan.send_opt(PaintMsg::Exit(None, PipelineExitType::PipelineOnly));
let LayoutControlChan(ref layout_channel) = self.layout_chan; let LayoutControlChan(ref layout_channel) = self.layout_chan;
let _ = layout_channel.send_opt(ExitNowMsg(PipelineExitType::PipelineOnly)); let _ = layout_channel.send_opt(ExitNowMsg(PipelineExitType::PipelineOnly));
} }

View file

@ -6,7 +6,6 @@
use compositor_task::{CompositorProxy, Msg}; use compositor_task::{CompositorProxy, Msg};
use native::task::NativeTaskBuilder;
use std::io::timer; use std::io::timer;
use std::task::TaskBuilder; use std::task::TaskBuilder;
use std::time::duration::Duration; use std::time::duration::Duration;
@ -34,7 +33,7 @@ enum ToScrollingTimerMsg {
impl ScrollingTimerProxy { impl ScrollingTimerProxy {
pub fn new(compositor_proxy: Box<CompositorProxy+Send>) -> ScrollingTimerProxy { pub fn new(compositor_proxy: Box<CompositorProxy+Send>) -> ScrollingTimerProxy {
let (to_scrolling_timer_sender, to_scrolling_timer_receiver) = channel(); let (to_scrolling_timer_sender, to_scrolling_timer_receiver) = channel();
TaskBuilder::new().native().spawn(proc() { TaskBuilder::new().spawn(proc() {
let mut scrolling_timer = ScrollingTimer { let mut scrolling_timer = ScrollingTimer {
compositor_proxy: compositor_proxy, compositor_proxy: compositor_proxy,
receiver: to_scrolling_timer_receiver, receiver: to_scrolling_timer_receiver,

View file

@ -25,7 +25,7 @@ pub trait Actor : Any {
fn name(&self) -> String; fn name(&self) -> String;
} }
impl<'a> AnyMutRefExt<'a> for &'a mut Actor + 'a { impl<'a> AnyMutRefExt<'a> for &'a mut (Actor + 'a) {
fn downcast_mut<T: 'static>(self) -> Option<&'a mut T> { fn downcast_mut<T: 'static>(self) -> Option<&'a mut T> {
if self.is::<T>() { if self.is::<T>() {
unsafe { unsafe {
@ -41,7 +41,7 @@ impl<'a> AnyMutRefExt<'a> for &'a mut Actor + 'a {
} }
} }
impl<'a> AnyRefExt<'a> for &'a Actor + 'a { impl<'a> AnyRefExt<'a> for &'a (Actor + 'a) {
fn is<T: 'static>(self) -> bool { fn is<T: 'static>(self) -> bool {
// This implementation is only needed so long as there's a Rust bug that // This implementation is only needed so long as there's a Rust bug that
// prevents downcast_ref from giving realistic return values. // prevents downcast_ref from giving realistic return values.

View file

@ -6,6 +6,7 @@
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![allow(non_snake_case)] #![allow(non_snake_case)]
#![feature(globs)]
extern crate "msg" as servo_msg; extern crate "msg" as servo_msg;
extern crate serialize; extern crate serialize;
@ -16,6 +17,10 @@ extern crate "util" as servo_util;
/// The traits are here instead of in script so that the devtools crate can be /// The traits are here instead of in script so that the devtools crate can be
/// modified independently of the rest of Servo. /// modified independently of the rest of Servo.
pub use self::DevtoolsControlMsg::*;
pub use self::DevtoolScriptControlMsg::*;
pub use self::EvaluateJSReply::*;
use serialize::{Decodable, Decoder}; use serialize::{Decodable, Decoder};
use servo_msg::constellation_msg::PipelineId; use servo_msg::constellation_msg::PipelineId;
use servo_util::str::DOMString; use servo_util::str::DOMString;

View file

@ -41,7 +41,7 @@ use std::fmt;
use std::slice::Items; use std::slice::Items;
use style::ComputedValues; use style::ComputedValues;
use style::computed_values::border_style; use style::computed_values::border_style;
use style::computed_values::cursor::{AutoCursor, SpecifiedCursor}; use style::computed_values::cursor;
use sync::Arc; use sync::Arc;
// It seems cleaner to have layout code not mention Azure directly, so let's just reexport this for // It seems cleaner to have layout code not mention Azure directly, so let's just reexport this for
@ -629,8 +629,8 @@ impl DisplayItemMetadata {
DisplayItemMetadata { DisplayItemMetadata {
node: node, node: node,
cursor: match style.get_pointing().cursor { cursor: match style.get_pointing().cursor {
AutoCursor => default_cursor, cursor::T::AutoCursor => default_cursor,
SpecifiedCursor(cursor) => cursor, cursor::T::SpecifiedCursor(cursor) => cursor,
}, },
} }
} }

View file

@ -194,8 +194,8 @@ impl Font {
pub fn glyph_index(&self, codepoint: char) -> Option<GlyphId> { pub fn glyph_index(&self, codepoint: char) -> Option<GlyphId> {
let codepoint = match self.variant { let codepoint = match self.variant {
font_variant::small_caps => codepoint.to_uppercase(), font_variant::T::small_caps => codepoint.to_uppercase(),
font_variant::normal => codepoint, font_variant::T::normal => codepoint,
}; };
self.handle.glyph_index(codepoint) self.handle.glyph_index(codepoint)
} }

View file

@ -22,21 +22,22 @@ use std::cell::RefCell;
use sync::Arc; use sync::Arc;
use azure::AzFloat; use azure::AzFloat;
use azure::azure_hl::SkiaBackend; use azure::azure_hl::BackendType;
use azure::scaled_font::ScaledFont; use azure::scaled_font::ScaledFont;
#[cfg(any(target_os="linux", target_os = "android"))] #[cfg(any(target_os="linux", target_os = "android"))]
use azure::scaled_font::FontData; use azure::scaled_font::FontInfo;
#[cfg(any(target_os="linux", target_os = "android"))] #[cfg(any(target_os="linux", target_os = "android"))]
fn create_scaled_font(template: &Arc<FontTemplateData>, pt_size: Au) -> ScaledFont { fn create_scaled_font(template: &Arc<FontTemplateData>, pt_size: Au) -> ScaledFont {
ScaledFont::new(SkiaBackend, FontData(&template.bytes), pt_size.to_subpx() as AzFloat) ScaledFont::new(BackendType::SkiaBackend, FontInfo::FontData(&template.bytes),
pt_size.to_subpx() as AzFloat)
} }
#[cfg(target_os="macos")] #[cfg(target_os="macos")]
fn create_scaled_font(template: &Arc<FontTemplateData>, pt_size: Au) -> ScaledFont { fn create_scaled_font(template: &Arc<FontTemplateData>, pt_size: Au) -> ScaledFont {
let cgfont = template.ctfont.as_ref().unwrap().copy_to_CGFont(); let cgfont = template.ctfont.as_ref().unwrap().copy_to_CGFont();
ScaledFont::new(SkiaBackend, &cgfont, pt_size.to_subpx() as AzFloat) ScaledFont::new(BackendType::SkiaBackend, &cgfont, pt_size.to_subpx() as AzFloat)
} }
static SMALL_CAPS_SCALE_FACTOR: f64 = 0.8; // Matches FireFox (see gfxFont.h) static SMALL_CAPS_SCALE_FACTOR: f64 = 0.8; // Matches FireFox (see gfxFont.h)
@ -100,8 +101,8 @@ impl FontContext {
// painting. We should also support true small-caps (where the // painting. We should also support true small-caps (where the
// font supports it) in the future. // font supports it) in the future.
let actual_pt_size = match variant { let actual_pt_size = match variant {
font_variant::small_caps => pt_size.scale_by(SMALL_CAPS_SCALE_FACTOR), font_variant::T::small_caps => pt_size.scale_by(SMALL_CAPS_SCALE_FACTOR),
font_variant::normal => pt_size, font_variant::T::normal => pt_size,
}; };
let handle: FontHandle = FontHandleMethods::new_from_template(&self.platform_handle, let handle: FontHandle = FontHandleMethods::new_from_template(&self.platform_handle,
@ -138,7 +139,7 @@ impl FontContext {
// so they will never be released. Find out a good time to drop them. // so they will never be released. Find out a good time to drop them.
let desc = FontTemplateDescriptor::new(style.font_weight, let desc = FontTemplateDescriptor::new(style.font_weight,
style.font_style == font_style::italic); style.font_style == font_style::T::italic);
let mut fonts = SmallVec8::new(); let mut fonts = SmallVec8::new();
for family in style.font_family.iter() { for family in style.font_family.iter() {

View file

@ -16,7 +16,6 @@ extern crate collections;
extern crate geom; extern crate geom;
extern crate layers; extern crate layers;
extern crate libc; extern crate libc;
extern crate native;
extern crate rustrt; extern crate rustrt;
extern crate stb_image; extern crate stb_image;
extern crate png; extern crate png;

View file

@ -5,11 +5,11 @@
//! Painting of display lists using Moz2D/Azure. //! Painting of display lists using Moz2D/Azure.
use azure::azure::AzIntSize; use azure::azure::AzIntSize;
use azure::azure_hl::{A8, B8G8R8A8, Color, ColorPattern, ColorPatternRef, DrawOptions}; use azure::azure_hl::{SurfaceFormat, Color, ColorPattern, DrawOptions};
use azure::azure_hl::{DrawSurfaceOptions, DrawTarget, ExtendClamp, GaussianBlurFilterType}; use azure::azure_hl::{DrawSurfaceOptions, DrawTarget, ExtendMode, FilterType};
use azure::azure_hl::{GaussianBlurInput, GradientStop, Linear, LinearGradientPattern}; use azure::azure_hl::{GaussianBlurInput, GradientStop, Filter, LinearGradientPattern};
use azure::azure_hl::{LinearGradientPatternRef, Path, PathBuilder, SourceOp}; use azure::azure_hl::{PatternRef, Path, PathBuilder, CompositionOp};
use azure::azure_hl::{StdDeviationGaussianBlurAttribute, StrokeOptions}; use azure::azure_hl::{GaussianBlurAttribute, StrokeOptions};
use azure::scaled_font::ScaledFont; use azure::scaled_font::ScaledFont;
use azure::{AZ_CAP_BUTT, AzFloat, struct__AzDrawOptions, struct__AzGlyph}; use azure::{AZ_CAP_BUTT, AzFloat, struct__AzDrawOptions, struct__AzGlyph};
use azure::{struct__AzGlyphBuffer, struct__AzPoint, AzDrawTargetFillGlyphs}; use azure::{struct__AzGlyphBuffer, struct__AzPoint, AzDrawTargetFillGlyphs};
@ -23,7 +23,7 @@ use geom::side_offsets::SideOffsets2D;
use geom::size::Size2D; use geom::size::Size2D;
use libc::size_t; use libc::size_t;
use libc::types::common::c99::{uint16_t, uint32_t}; use libc::types::common::c99::{uint16_t, uint32_t};
use png::{RGB8, RGBA8, K8, KA8}; use png::PixelsByColorType;
use servo_net::image::base::Image; use servo_net::image::base::Image;
use servo_util::geometry::{Au, MAX_RECT}; use servo_util::geometry::{Au, MAX_RECT};
use servo_util::opts; use servo_util::opts;
@ -72,7 +72,7 @@ impl<'a> PaintContext<'a> {
pub fn draw_solid_color(&self, bounds: &Rect<Au>, color: Color) { pub fn draw_solid_color(&self, bounds: &Rect<Au>, color: Color) {
self.draw_target.make_current(); self.draw_target.make_current();
self.draw_target.fill_rect(&bounds.to_azure_rect(), self.draw_target.fill_rect(&bounds.to_azure_rect(),
ColorPatternRef(&ColorPattern::new(color)), PatternRef::ColorPatternRef(&ColorPattern::new(color)),
None); None);
} }
@ -123,10 +123,10 @@ impl<'a> PaintContext<'a> {
pub fn draw_image(&self, bounds: Rect<Au>, image: Arc<Box<Image>>) { pub fn draw_image(&self, bounds: Rect<Au>, image: Arc<Box<Image>>) {
let size = Size2D(image.width as i32, image.height as i32); let size = Size2D(image.width as i32, image.height as i32);
let (pixel_width, pixels, source_format) = match image.pixels { let (pixel_width, pixels, source_format) = match image.pixels {
RGBA8(ref pixels) => (4, pixels.as_slice(), B8G8R8A8), PixelsByColorType::RGBA8(ref pixels) => (4, pixels.as_slice(), SurfaceFormat::B8G8R8A8),
K8(ref pixels) => (1, pixels.as_slice(), A8), PixelsByColorType::K8(ref pixels) => (1, pixels.as_slice(), SurfaceFormat::A8),
RGB8(_) => panic!("RGB8 color type not supported"), PixelsByColorType::RGB8(_) => panic!("RGB8 color type not supported"),
KA8(_) => panic!("KA8 color type not supported"), PixelsByColorType::KA8(_) => panic!("KA8 color type not supported"),
}; };
let stride = image.width * pixel_width; let stride = image.width * pixel_width;
@ -139,7 +139,7 @@ impl<'a> PaintContext<'a> {
let source_rect = Rect(Point2D(0.0, 0.0), let source_rect = Rect(Point2D(0.0, 0.0),
Size2D(image.width as AzFloat, image.height as AzFloat)); Size2D(image.width as AzFloat, image.height as AzFloat));
let dest_rect = bounds.to_azure_rect(); let dest_rect = bounds.to_azure_rect();
let draw_surface_options = DrawSurfaceOptions::new(Linear, true); let draw_surface_options = DrawSurfaceOptions::new(Filter::Linear, true);
let draw_options = DrawOptions::new(1.0, 0); let draw_options = DrawOptions::new(1.0, 0);
draw_target_ref.draw_surface(azure_surface, draw_target_ref.draw_surface(azure_surface,
dest_rect, dest_rect,
@ -155,9 +155,10 @@ impl<'a> PaintContext<'a> {
Size2D(self.screen_rect.size.width as AzFloat, Size2D(self.screen_rect.size.width as AzFloat,
self.screen_rect.size.height as AzFloat)); self.screen_rect.size.height as AzFloat));
let mut draw_options = DrawOptions::new(1.0, 0); let mut draw_options = DrawOptions::new(1.0, 0);
draw_options.set_composition_op(SourceOp); draw_options.set_composition_op(CompositionOp::SourceOp);
self.draw_target.make_current(); self.draw_target.make_current();
self.draw_target.fill_rect(&rect, ColorPatternRef(&pattern), Some(&draw_options)); self.draw_target.fill_rect(&rect, PatternRef::ColorPatternRef(&pattern),
Some(&draw_options));
} }
fn draw_border_segment(&self, fn draw_border_segment(&self,
@ -175,8 +176,8 @@ impl<'a> PaintContext<'a> {
}; };
match style_select { match style_select {
border_style::none | border_style::hidden => {} border_style::T::none | border_style::T::hidden => {}
border_style::dotted => { border_style::T::dotted => {
// FIXME(sammykim): This doesn't work well with dash_pattern and cap_style. // FIXME(sammykim): This doesn't work well with dash_pattern and cap_style.
self.draw_dashed_border_segment(direction, self.draw_dashed_border_segment(direction,
bounds, bounds,
@ -184,20 +185,20 @@ impl<'a> PaintContext<'a> {
color_select, color_select,
DashSize::DottedBorder); DashSize::DottedBorder);
} }
border_style::dashed => { border_style::T::dashed => {
self.draw_dashed_border_segment(direction, self.draw_dashed_border_segment(direction,
bounds, bounds,
border, border,
color_select, color_select,
DashSize::DashedBorder); DashSize::DashedBorder);
} }
border_style::solid => { border_style::T::solid => {
self.draw_solid_border_segment(direction, bounds, border, radius, color_select); self.draw_solid_border_segment(direction, bounds, border, radius, color_select);
} }
border_style::double => { border_style::T::double => {
self.draw_double_border_segment(direction, bounds, border, radius, color_select); self.draw_double_border_segment(direction, bounds, border, radius, color_select);
} }
border_style::groove | border_style::ridge => { border_style::T::groove | border_style::T::ridge => {
self.draw_groove_ridge_border_segment(direction, self.draw_groove_ridge_border_segment(direction,
bounds, bounds,
border, border,
@ -205,7 +206,7 @@ impl<'a> PaintContext<'a> {
color_select, color_select,
style_select); style_select);
} }
border_style::inset | border_style::outset => { border_style::T::inset | border_style::T::outset => {
self.draw_inset_outset_border_segment(direction, self.draw_inset_outset_border_segment(direction,
bounds, bounds,
border, border,
@ -223,28 +224,28 @@ impl<'a> PaintContext<'a> {
style: border_style::T) { style: border_style::T) {
let border = SideOffsets2D::new_all_same(bounds.size.width).to_float_px(); let border = SideOffsets2D::new_all_same(bounds.size.width).to_float_px();
match style { match style {
border_style::none | border_style::hidden => {} border_style::T::none | border_style::T::hidden => {}
border_style::dotted => { border_style::T::dotted => {
self.draw_dashed_border_segment(Direction::Right, self.draw_dashed_border_segment(Direction::Right,
bounds, bounds,
&border, &border,
color, color,
DashSize::DottedBorder); DashSize::DottedBorder);
} }
border_style::dashed => { border_style::T::dashed => {
self.draw_dashed_border_segment(Direction::Right, self.draw_dashed_border_segment(Direction::Right,
bounds, bounds,
&border, &border,
color, color,
DashSize::DashedBorder); DashSize::DashedBorder);
} }
border_style::solid => { border_style::T::solid => {
self.draw_solid_border_segment(Direction::Right, bounds, &border, radius, color) self.draw_solid_border_segment(Direction::Right, bounds, &border, radius, color)
} }
border_style::double => { border_style::T::double => {
self.draw_double_border_segment(Direction::Right, bounds, &border, radius, color) self.draw_double_border_segment(Direction::Right, bounds, &border, radius, color)
} }
border_style::groove | border_style::ridge => { border_style::T::groove | border_style::T::ridge => {
self.draw_groove_ridge_border_segment(Direction::Right, self.draw_groove_ridge_border_segment(Direction::Right,
bounds, bounds,
&border, &border,
@ -252,7 +253,7 @@ impl<'a> PaintContext<'a> {
color, color,
style); style);
} }
border_style::inset | border_style::outset => { border_style::T::inset | border_style::T::outset => {
self.draw_inset_outset_border_segment(Direction::Right, self.draw_inset_outset_border_segment(Direction::Right,
bounds, bounds,
&border, &border,
@ -718,9 +719,9 @@ impl<'a> PaintContext<'a> {
0.5 * border.bottom, 0.5 * border.bottom,
0.5 * border.left); 0.5 * border.left);
let is_groove = match style { let is_groove = match style {
border_style::groove => true, border_style::T::groove => true,
border_style::ridge => false, border_style::T::ridge => false,
_ => panic!("invalid border style") _ => panic!("invalid border style")
}; };
let mut lighter_color; let mut lighter_color;
@ -761,9 +762,9 @@ impl<'a> PaintContext<'a> {
color: Color, color: Color,
style: border_style::T) { style: border_style::T) {
let is_inset = match style { let is_inset = match style {
border_style::inset => true, border_style::T::inset => true,
border_style::outset => false, border_style::T::outset => false,
_ => panic!("invalid border style") _ => panic!("invalid border style")
}; };
// original bounds as a Rect<f32> // original bounds as a Rect<f32>
let original_bounds = self.get_scaled_bounds(bounds, border, 0.0); let original_bounds = self.get_scaled_bounds(bounds, border, 0.0);
@ -855,14 +856,14 @@ impl<'a> PaintContext<'a> {
stops: &[GradientStop]) { stops: &[GradientStop]) {
self.draw_target.make_current(); self.draw_target.make_current();
let stops = self.draw_target.create_gradient_stops(stops, ExtendClamp); let stops = self.draw_target.create_gradient_stops(stops, ExtendMode::ExtendClamp);
let pattern = LinearGradientPattern::new(&start_point.to_azure_point(), let pattern = LinearGradientPattern::new(&start_point.to_azure_point(),
&end_point.to_azure_point(), &end_point.to_azure_point(),
stops, stops,
&Matrix2D::identity()); &Matrix2D::identity());
self.draw_target.fill_rect(&bounds.to_azure_rect(), self.draw_target.fill_rect(&bounds.to_azure_rect(),
LinearGradientPatternRef(&pattern), PatternRef::LinearGradientPatternRef(&pattern),
None); None);
} }
@ -905,7 +906,7 @@ impl<'a> PaintContext<'a> {
temporary_draw_target.set_transform(&Matrix2D::identity()); temporary_draw_target.set_transform(&Matrix2D::identity());
let rect = Rect(Point2D(0.0, 0.0), self.draw_target.get_size().to_azure_size()); let rect = Rect(Point2D(0.0, 0.0), self.draw_target.get_size().to_azure_size());
let source_surface = temporary_draw_target.snapshot(); let source_surface = temporary_draw_target.snapshot();
let draw_surface_options = DrawSurfaceOptions::new(Linear, true); let draw_surface_options = DrawSurfaceOptions::new(Filter::Linear, true);
let draw_options = DrawOptions::new(opacity, 0); let draw_options = DrawOptions::new(opacity, 0);
self.draw_target.draw_surface(source_surface, self.draw_target.draw_surface(source_surface,
rect, rect,
@ -970,9 +971,9 @@ impl<'a> PaintContext<'a> {
if blur_radius > Au(0) { if blur_radius > Au(0) {
// Go ahead and create the blur now. Despite the name, Azure's notion of `StdDeviation` // Go ahead and create the blur now. Despite the name, Azure's notion of `StdDeviation`
// describes the blur radius, not the sigma for the Gaussian blur. // describes the blur radius, not the sigma for the Gaussian blur.
let blur_filter = self.draw_target.create_filter(GaussianBlurFilterType); let blur_filter = self.draw_target.create_filter(FilterType::GaussianBlurFilterType);
blur_filter.set_attribute(StdDeviationGaussianBlurAttribute(blur_radius.to_subpx() as blur_filter.set_attribute(GaussianBlurAttribute::StdDeviationGaussianBlurAttribute(
AzFloat)); blur_radius.to_subpx() as AzFloat));
blur_filter.set_input(GaussianBlurInput, &temporary_draw_target.snapshot()); blur_filter.set_input(GaussianBlurInput, &temporary_draw_target.snapshot());
// Blit the blur onto the tile. We undo the transforms here because we want to directly // Blit the blur onto the tile. We undo the transforms here because we want to directly

View file

@ -10,7 +10,7 @@ use font_cache_task::FontCacheTask;
use font_context::FontContext; use font_context::FontContext;
use paint_context::PaintContext; use paint_context::PaintContext;
use azure::azure_hl::{B8G8R8A8, Color, DrawTarget, SkiaBackend, StolenGLResources}; use azure::azure_hl::{SurfaceFormat, Color, DrawTarget, BackendType, StolenGLResources};
use azure::AzFloat; use azure::AzFloat;
use geom::matrix2d::Matrix2D; use geom::matrix2d::Matrix2D;
use geom::point::Point2D; use geom::point::Point2D;
@ -20,19 +20,18 @@ use layers::platform::surface::{NativeGraphicsMetadata, NativePaintingGraphicsCo
use layers::platform::surface::{NativeSurface, NativeSurfaceMethods}; use layers::platform::surface::{NativeSurface, NativeSurfaceMethods};
use layers::layers::{BufferRequest, LayerBuffer, LayerBufferSet}; use layers::layers::{BufferRequest, LayerBuffer, LayerBufferSet};
use layers; use layers;
use native::task::NativeTaskBuilder; use servo_msg::compositor_msg::{Epoch, PaintState, LayerId};
use servo_msg::compositor_msg::{Epoch, IdlePaintState, LayerId}; use servo_msg::compositor_msg::{LayerMetadata, PaintListener, ScrollPolicy};
use servo_msg::compositor_msg::{LayerMetadata, PaintListener, PaintingPaintState, ScrollPolicy}; use servo_msg::constellation_msg::Msg as ConstellationMsg;
use servo_msg::constellation_msg::{ConstellationChan, Failure, FailureMsg, PipelineExitType}; use servo_msg::constellation_msg::{ConstellationChan, Failure, PipelineId};
use servo_msg::constellation_msg::{PipelineId, PainterReadyMsg}; use servo_msg::constellation_msg::PipelineExitType;
use servo_msg::platform::surface::NativeSurfaceAzureMethods; use servo_msg::platform::surface::NativeSurfaceAzureMethods;
use servo_util::geometry::{Au, ZERO_POINT}; use servo_util::geometry::{Au, ZERO_POINT};
use servo_util::opts; use servo_util::opts;
use servo_util::smallvec::SmallVec; use servo_util::smallvec::SmallVec;
use servo_util::task::spawn_named_with_send_on_failure; use servo_util::task::spawn_named_with_send_on_failure;
use servo_util::task_state; use servo_util::task_state;
use servo_util::time::{TimeProfilerChan, profile}; use servo_util::time::{TimeProfilerChan, TimeProfilerCategory, profile};
use servo_util::time;
use std::comm::{Receiver, Sender, channel}; use std::comm::{Receiver, Sender, channel};
use std::mem; use std::mem;
use std::task::TaskBuilder; use std::task::TaskBuilder;
@ -68,12 +67,12 @@ pub struct PaintRequest {
} }
pub enum Msg { pub enum Msg {
PaintInitMsg(Arc<StackingContext>), PaintInit(Arc<StackingContext>),
PaintMsg(Vec<PaintRequest>), Paint(Vec<PaintRequest>),
UnusedBufferMsg(Vec<Box<LayerBuffer>>), UnusedBuffer(Vec<Box<LayerBuffer>>),
PaintPermissionGranted, PaintPermissionGranted,
PaintPermissionRevoked, PaintPermissionRevoked,
ExitMsg(Option<Sender<()>>, PipelineExitType), Exit(Option<Sender<()>>, PipelineExitType),
} }
#[deriving(Clone)] #[deriving(Clone)]
@ -224,7 +223,7 @@ impl<C> PaintTask<C> where C: PaintListener + Send {
debug!("paint_task: shutdown_chan send"); debug!("paint_task: shutdown_chan send");
shutdown_chan.send(()); shutdown_chan.send(());
}, FailureMsg(failure_msg), c, true); }, ConstellationMsg::Failure(failure_msg), c, true);
} }
fn start(&mut self) { fn start(&mut self) {
@ -234,14 +233,14 @@ impl<C> PaintTask<C> where C: PaintListener + Send {
let mut waiting_for_compositor_buffers_to_exit = false; let mut waiting_for_compositor_buffers_to_exit = false;
loop { loop {
match self.port.recv() { match self.port.recv() {
Msg::PaintInitMsg(stacking_context) => { Msg::PaintInit(stacking_context) => {
self.epoch.next(); self.epoch.next();
self.root_stacking_context = Some(stacking_context.clone()); self.root_stacking_context = Some(stacking_context.clone());
if !self.paint_permission { if !self.paint_permission {
debug!("PaintTask: paint ready msg"); debug!("PaintTask: paint ready msg");
let ConstellationChan(ref mut c) = self.constellation_chan; let ConstellationChan(ref mut c) = self.constellation_chan;
c.send(PainterReadyMsg(self.id)); c.send(ConstellationMsg::PainterReady(self.id));
continue; continue;
} }
@ -250,17 +249,17 @@ impl<C> PaintTask<C> where C: PaintListener + Send {
self.epoch, self.epoch,
&*stacking_context); &*stacking_context);
} }
Msg::PaintMsg(requests) => { Msg::Paint(requests) => {
if !self.paint_permission { if !self.paint_permission {
debug!("PaintTask: paint ready msg"); debug!("PaintTask: paint ready msg");
let ConstellationChan(ref mut c) = self.constellation_chan; let ConstellationChan(ref mut c) = self.constellation_chan;
c.send(PainterReadyMsg(self.id)); c.send(ConstellationMsg::PainterReady(self.id));
self.compositor.paint_msg_discarded(); self.compositor.paint_msg_discarded();
continue; continue;
} }
let mut replies = Vec::new(); let mut replies = Vec::new();
self.compositor.set_paint_state(self.id, PaintingPaintState); self.compositor.set_paint_state(self.id, PaintState::Painting);
for PaintRequest { buffer_requests, scale, layer_id, epoch } for PaintRequest { buffer_requests, scale, layer_id, epoch }
in requests.into_iter() { in requests.into_iter() {
if self.epoch == epoch { if self.epoch == epoch {
@ -270,7 +269,7 @@ impl<C> PaintTask<C> where C: PaintListener + Send {
} }
} }
self.compositor.set_paint_state(self.id, IdlePaintState); self.compositor.set_paint_state(self.id, PaintState::Idle);
for reply in replies.iter() { for reply in replies.iter() {
let &(_, ref buffer_set) = reply; let &(_, ref buffer_set) = reply;
@ -280,7 +279,7 @@ impl<C> PaintTask<C> where C: PaintListener + Send {
debug!("PaintTask: returning surfaces"); debug!("PaintTask: returning surfaces");
self.compositor.paint(self.id, self.epoch, replies); self.compositor.paint(self.id, self.epoch, replies);
} }
Msg::UnusedBufferMsg(unused_buffers) => { Msg::UnusedBuffer(unused_buffers) => {
debug!("PaintTask: Received {} unused buffers", unused_buffers.len()); debug!("PaintTask: Received {} unused buffers", unused_buffers.len());
self.used_buffer_count -= unused_buffers.len(); self.used_buffer_count -= unused_buffers.len();
@ -311,7 +310,7 @@ impl<C> PaintTask<C> where C: PaintListener + Send {
Msg::PaintPermissionRevoked => { Msg::PaintPermissionRevoked => {
self.paint_permission = false; self.paint_permission = false;
} }
Msg::ExitMsg(response_channel, exit_type) => { Msg::Exit(response_channel, exit_type) => {
let should_wait_for_compositor_buffers = match exit_type { let should_wait_for_compositor_buffers = match exit_type {
PipelineExitType::Complete => false, PipelineExitType::Complete => false,
PipelineExitType::PipelineOnly => self.used_buffer_count != 0 PipelineExitType::PipelineOnly => self.used_buffer_count != 0
@ -383,7 +382,7 @@ impl<C> PaintTask<C> where C: PaintListener + Send {
mut tiles: Vec<BufferRequest>, mut tiles: Vec<BufferRequest>,
scale: f32, scale: f32,
layer_id: LayerId) { layer_id: LayerId) {
time::profile(time::PaintingCategory, None, self.time_profiler_chan.clone(), || { profile(TimeProfilerCategory::Painting, None, self.time_profiler_chan.clone(), || {
// Bail out if there is no appropriate stacking context. // Bail out if there is no appropriate stacking context.
let stacking_context = match self.root_stacking_context { let stacking_context = match self.root_stacking_context {
Some(ref stacking_context) => { Some(ref stacking_context) => {
@ -442,7 +441,7 @@ impl WorkerThreadProxy {
let native_graphics_metadata = native_graphics_metadata.clone(); let native_graphics_metadata = native_graphics_metadata.clone();
let font_cache_task = font_cache_task.clone(); let font_cache_task = font_cache_task.clone();
let time_profiler_chan = time_profiler_chan.clone(); let time_profiler_chan = time_profiler_chan.clone();
TaskBuilder::new().native().spawn(proc() { TaskBuilder::new().spawn(proc() {
let mut worker_thread = WorkerThread::new(from_worker_sender, let mut worker_thread = WorkerThread::new(from_worker_sender,
to_worker_receiver, to_worker_receiver,
native_graphics_metadata, native_graphics_metadata,
@ -525,14 +524,14 @@ impl WorkerThread {
-> DrawTarget { -> DrawTarget {
let size = Size2D(tile.screen_rect.size.width as i32, tile.screen_rect.size.height as i32); let size = Size2D(tile.screen_rect.size.width as i32, tile.screen_rect.size.height as i32);
let draw_target = if !opts::get().gpu_painting { let draw_target = if !opts::get().gpu_painting {
DrawTarget::new(SkiaBackend, size, B8G8R8A8) DrawTarget::new(BackendType::SkiaBackend, size, SurfaceFormat::B8G8R8A8)
} else { } else {
// FIXME(pcwalton): Cache the components of draw targets (texture color buffer, // FIXME(pcwalton): Cache the components of draw targets (texture color buffer,
// paintbuffers) instead of recreating them. // paintbuffers) instead of recreating them.
let draw_target = DrawTarget::new_with_fbo(SkiaBackend, let draw_target = DrawTarget::new_with_fbo(BackendType::SkiaBackend,
native_graphics_context!(self), native_graphics_context!(self),
size, size,
B8G8R8A8); SurfaceFormat::B8G8R8A8);
draw_target.make_current(); draw_target.make_current();
draw_target draw_target
}; };
@ -559,7 +558,8 @@ impl WorkerThread {
paint_context.clear(); paint_context.clear();
// Draw the display list. // Draw the display list.
profile(time::PaintingPerTileCategory, None, self.time_profiler_sender.clone(), || { profile(TimeProfilerCategory::PaintingPerTile, None,
self.time_profiler_sender.clone(), || {
stacking_context.optimize_and_draw_into_context(&mut paint_context, stacking_context.optimize_and_draw_into_context(&mut paint_context,
&tile.page_rect, &tile.page_rect,
&matrix, &matrix,
@ -586,8 +586,8 @@ impl WorkerThread {
let mut buffer = layer_buffer.unwrap(); let mut buffer = layer_buffer.unwrap();
draw_target.snapshot().get_data_surface().with_data(|data| { draw_target.snapshot().get_data_surface().with_data(|data| {
buffer.native_surface.upload(native_graphics_context!(self), data); buffer.native_surface.upload(native_graphics_context!(self), data);
debug!("painting worker thread uploading to native surface {:d}", debug!("painting worker thread uploading to native surface {}",
buffer.native_surface.get_id() as int); buffer.native_surface.get_id());
}); });
return buffer return buffer
} }

View file

@ -130,7 +130,7 @@ impl FontHandleMethods for FontHandle {
unsafe { (*self.face).style_flags & FT_STYLE_FLAG_ITALIC != 0 } unsafe { (*self.face).style_flags & FT_STYLE_FLAG_ITALIC != 0 }
} }
fn boldness(&self) -> font_weight::T { fn boldness(&self) -> font_weight::T {
let default_weight = font_weight::Weight400; let default_weight = font_weight::T::Weight400;
if unsafe { (*self.face).style_flags & FT_STYLE_FLAG_BOLD == 0 } { if unsafe { (*self.face).style_flags & FT_STYLE_FLAG_BOLD == 0 } {
default_weight default_weight
} else { } else {
@ -140,15 +140,15 @@ impl FontHandleMethods for FontHandle {
if valid { if valid {
let weight =(*os2).usWeightClass; let weight =(*os2).usWeightClass;
match weight { match weight {
1 | 100...199 => font_weight::Weight100, 1 | 100...199 => font_weight::T::Weight100,
2 | 200...299 => font_weight::Weight200, 2 | 200...299 => font_weight::T::Weight200,
3 | 300...399 => font_weight::Weight300, 3 | 300...399 => font_weight::T::Weight300,
4 | 400...499 => font_weight::Weight400, 4 | 400...499 => font_weight::T::Weight400,
5 | 500...599 => font_weight::Weight500, 5 | 500...599 => font_weight::T::Weight500,
6 | 600...699 => font_weight::Weight600, 6 | 600...699 => font_weight::T::Weight600,
7 | 700...799 => font_weight::Weight700, 7 | 700...799 => font_weight::T::Weight700,
8 | 800...899 => font_weight::Weight800, 8 | 800...899 => font_weight::T::Weight800,
9 | 900...999 => font_weight::Weight900, 9 | 900...999 => font_weight::T::Weight900,
_ => default_weight _ => default_weight
} }
} else { } else {
@ -255,7 +255,7 @@ impl FontHandleMethods for FontHandle {
line_gap: height, line_gap: height,
}; };
debug!("Font metrics (@{:f} pt): {}", geometry::to_pt(em_size), metrics); debug!("Font metrics (@{} pt): {}", geometry::to_pt(em_size), metrics);
return metrics; return metrics;
} }

View file

@ -557,7 +557,7 @@ impl<'a> GlyphStore {
(true, _) => GlyphEntry::missing(1), (true, _) => GlyphEntry::missing(1),
(false, true) => GlyphEntry::simple(data.id, data.advance), (false, true) => GlyphEntry::simple(data.id, data.advance),
(false, false) => { (false, false) => {
let glyph = [DetailedGlyph::new(data.id, data.advance, data.offset)]; let glyph = &[DetailedGlyph::new(data.id, data.advance, data.offset)];
self.detail_store.add_detailed_glyphs_for_entry(i, glyph); self.detail_store.add_detailed_glyphs_for_entry(i, glyph);
GlyphEntry::complex(data.cluster_start, data.ligature_start, 1) GlyphEntry::complex(data.cluster_start, data.ligature_start, 1)
} }

View file

@ -307,7 +307,7 @@ impl Shaper {
debug!("text: {}", text); debug!("text: {}", 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, *byte_to_glyph.get(i).unwrap() as int); debug!("{}: {} --> {}", i, ch, byte_to_glyph[i]);
} }
// some helpers // some helpers

View file

@ -32,7 +32,8 @@ use gfx::display_list::{SidewaysRight, SolidColorDisplayItem};
use gfx::display_list::{StackingContext, TextDisplayItem, Upright}; use gfx::display_list::{StackingContext, TextDisplayItem, Upright};
use gfx::paint_task::PaintLayer; use gfx::paint_task::PaintLayer;
use servo_msg::compositor_msg::{FixedPosition, Scrollable}; use servo_msg::compositor_msg::{FixedPosition, Scrollable};
use servo_msg::constellation_msg::{ConstellationChan, FrameRectMsg}; use servo_msg::constellation_msg::Msg as ConstellationMsg;
use servo_msg::constellation_msg::ConstellationChan;
use servo_net::image::holder::ImageHolder; use servo_net::image::holder::ImageHolder;
use servo_util::cursor::{DefaultCursor, TextCursor, VerticalTextCursor}; use servo_util::cursor::{DefaultCursor, TextCursor, VerticalTextCursor};
use servo_util::geometry::{mod, Au, ZERO_POINT}; use servo_util::geometry::{mod, Au, ZERO_POINT};
@ -904,9 +905,9 @@ impl FragmentDisplayListBuilding for Fragment {
iframe_fragment.pipeline_id, iframe_fragment.pipeline_id,
iframe_fragment.subpage_id); iframe_fragment.subpage_id);
let ConstellationChan(ref chan) = layout_context.shared.constellation_chan; let ConstellationChan(ref chan) = layout_context.shared.constellation_chan;
chan.send(FrameRectMsg(iframe_fragment.pipeline_id, chan.send(ConstellationMsg::FrameRect(iframe_fragment.pipeline_id,
iframe_fragment.subpage_id, iframe_fragment.subpage_id,
iframe_rect)); iframe_rect));
} }
fn clipping_region_for_children(&self, current_clip: &ClippingRegion, flow_origin: &Point2D<Au>) fn clipping_region_for_children(&self, current_clip: &ClippingRegion, flow_origin: &Point2D<Au>)

View file

@ -28,7 +28,8 @@ use gfx::color;
use gfx::display_list::{ClippingRegion, DisplayItemMetadata, DisplayList, OpaqueNode}; use gfx::display_list::{ClippingRegion, DisplayItemMetadata, DisplayList, OpaqueNode};
use gfx::display_list::{StackingContext}; use gfx::display_list::{StackingContext};
use gfx::font_cache_task::FontCacheTask; use gfx::font_cache_task::FontCacheTask;
use gfx::paint_task::{mod, PaintInitMsg, PaintChan, PaintLayer}; use gfx::paint_task::{PaintChan, PaintLayer};
use gfx::paint_task::Msg as PaintMsg;
use layout_traits::{mod, LayoutControlMsg, LayoutTaskFactory}; use layout_traits::{mod, LayoutControlMsg, LayoutTaskFactory};
use log; use log;
use script::dom::bindings::js::JS; use script::dom::bindings::js::JS;
@ -40,11 +41,12 @@ use script::layout_interface::{ContentBoxesQuery, ContentBoxQuery};
use script::layout_interface::{HitTestResponse, LayoutChan, LayoutRPC}; use script::layout_interface::{HitTestResponse, LayoutChan, LayoutRPC};
use script::layout_interface::{MouseOverResponse, Msg, NoQuery}; use script::layout_interface::{MouseOverResponse, Msg, NoQuery};
use script::layout_interface::{Reflow, ReflowGoal, ScriptLayoutChan, TrustedNodeAddress}; use script::layout_interface::{Reflow, ReflowGoal, ScriptLayoutChan, TrustedNodeAddress};
use script_traits::{SendEventMsg, ReflowEvent, ReflowCompleteMsg, OpaqueScriptLayoutChannel}; use script_traits::{ConstellationControlMsg, ReflowEvent, OpaqueScriptLayoutChannel};
use script_traits::{ScriptControlChan, UntrustedNodeAddress}; use script_traits::{ScriptControlChan, UntrustedNodeAddress};
use servo_msg::compositor_msg::Scrollable; use servo_msg::compositor_msg::Scrollable;
use servo_msg::constellation_msg::{ConstellationChan, Failure, FailureMsg, PipelineExitType}; use servo_msg::constellation_msg::Msg as ConstellationMsg;
use servo_msg::constellation_msg::{PipelineId, SetCursorMsg}; use servo_msg::constellation_msg::{ConstellationChan, Failure, PipelineExitType};
use servo_msg::constellation_msg::PipelineId;
use servo_net::image_cache_task::{ImageCacheTask, ImageResponseMsg}; use servo_net::image_cache_task::{ImageCacheTask, ImageResponseMsg};
use servo_net::local_image_cache::{ImageResponder, LocalImageCache}; use servo_net::local_image_cache::{ImageResponder, LocalImageCache};
use servo_net::resource_task::{ResourceTask, load_bytes_iter}; use servo_net::resource_task::{ResourceTask, load_bytes_iter};
@ -55,7 +57,7 @@ use servo_util::opts;
use servo_util::smallvec::{SmallVec, SmallVec1, VecLike}; use servo_util::smallvec::{SmallVec, SmallVec1, VecLike};
use servo_util::task::spawn_named_with_send_on_failure; use servo_util::task::spawn_named_with_send_on_failure;
use servo_util::task_state; use servo_util::task_state;
use servo_util::time::{mod, ProfilerMetadata, TimeProfilerChan, TimerMetadataFrameType}; use servo_util::time::{TimeProfilerCategory, ProfilerMetadata, TimeProfilerChan, TimerMetadataFrameType};
use servo_util::time::{TimerMetadataReflowType, profile}; use servo_util::time::{TimerMetadataReflowType, profile};
use servo_util::workqueue::WorkQueue; use servo_util::workqueue::WorkQueue;
use std::cell::Cell; use std::cell::Cell;
@ -159,7 +161,7 @@ impl ImageResponder<UntrustedNodeAddress> for LayoutImageResponder {
debug!("Dirtying {:x}", node_address as uint); debug!("Dirtying {:x}", node_address as uint);
let mut nodes = SmallVec1::new(); let mut nodes = SmallVec1::new();
nodes.vec_push(node_address); nodes.vec_push(node_address);
drop(chan.send_opt(SendEventMsg(id.clone(), ReflowEvent(nodes)))) drop(chan.send_opt(ConstellationControlMsg::SendEvent(id.clone(), ReflowEvent(nodes))))
}; };
f f
} }
@ -200,7 +202,7 @@ impl LayoutTaskFactory for LayoutTask {
layout.start(); layout.start();
} }
shutdown_chan.send(()); shutdown_chan.send(());
}, FailureMsg(failure_msg), con_chan, false); }, ConstellationMsg::Failure(failure_msg), con_chan, false);
} }
} }
@ -397,7 +399,7 @@ impl LayoutTask {
Box<LayoutRPC + Send>); Box<LayoutRPC + Send>);
}, },
Msg::Reflow(data) => { Msg::Reflow(data) => {
profile(time::LayoutPerformCategory, profile(TimeProfilerCategory::LayoutPerform,
self.profiler_metadata(&*data), self.profiler_metadata(&*data),
self.time_profiler_chan.clone(), self.time_profiler_chan.clone(),
|| self.handle_reflow(&*data, possibly_locked_rw_data)); || self.handle_reflow(&*data, possibly_locked_rw_data));
@ -465,7 +467,7 @@ impl LayoutTask {
LayoutTask::return_rw_data(possibly_locked_rw_data, rw_data); LayoutTask::return_rw_data(possibly_locked_rw_data, rw_data);
} }
self.paint_chan.send(paint_task::ExitMsg(Some(response_chan), exit_type)); self.paint_chan.send(PaintMsg::Exit(Some(response_chan), exit_type));
response_port.recv() response_port.recv()
} }
@ -626,7 +628,7 @@ impl LayoutTask {
shared_layout_context: &mut SharedLayoutContext, shared_layout_context: &mut SharedLayoutContext,
rw_data: &mut RWGuard<'a>) { rw_data: &mut RWGuard<'a>) {
let writing_mode = flow::base(&**layout_root).writing_mode; let writing_mode = flow::base(&**layout_root).writing_mode;
profile(time::LayoutDispListBuildCategory, profile(TimeProfilerCategory::LayoutDispListBuild,
self.profiler_metadata(data), self.profiler_metadata(data),
self.time_profiler_chan.clone(), self.time_profiler_chan.clone(),
|| { || {
@ -700,7 +702,7 @@ impl LayoutTask {
debug!("Layout done!"); debug!("Layout done!");
self.paint_chan.send(PaintInitMsg(stacking_context)); self.paint_chan.send(PaintMsg::PaintInit(stacking_context));
}); });
} }
@ -770,7 +772,7 @@ impl LayoutTask {
|mut flow| LayoutTask::reflow_all_nodes(flow.deref_mut())); |mut flow| LayoutTask::reflow_all_nodes(flow.deref_mut()));
} }
let mut layout_root = profile(time::LayoutStyleRecalcCategory, let mut layout_root = profile(TimeProfilerCategory::LayoutStyleRecalc,
self.profiler_metadata(data), self.profiler_metadata(data),
self.time_profiler_chan.clone(), self.time_profiler_chan.clone(),
|| { || {
@ -788,7 +790,7 @@ impl LayoutTask {
self.get_layout_root((*node).clone()) self.get_layout_root((*node).clone())
}); });
profile(time::LayoutRestyleDamagePropagation, profile(TimeProfilerCategory::LayoutRestyleDamagePropagation,
self.profiler_metadata(data), self.profiler_metadata(data),
self.time_profiler_chan.clone(), self.time_profiler_chan.clone(),
|| { || {
@ -810,7 +812,7 @@ impl LayoutTask {
// Perform the primary layout passes over the flow tree to compute the locations of all // Perform the primary layout passes over the flow tree to compute the locations of all
// the boxes. // the boxes.
profile(time::LayoutMainCategory, profile(TimeProfilerCategory::LayoutMain,
self.profiler_metadata(data), self.profiler_metadata(data),
self.time_profiler_chan.clone(), self.time_profiler_chan.clone(),
|| { || {
@ -870,7 +872,7 @@ impl LayoutTask {
// either select or a filtered recv() that only looks for messages of a given type. // either select or a filtered recv() that only looks for messages of a given type.
data.script_join_chan.send(()); data.script_join_chan.send(());
let ScriptControlChan(ref chan) = data.script_chan; let ScriptControlChan(ref chan) = data.script_chan;
chan.send(ReflowCompleteMsg(self.id, data.id)); chan.send(ConstellationControlMsg::ReflowComplete(self.id, data.id));
} }
unsafe fn dirty_all_nodes(node: &mut LayoutNode) { unsafe fn dirty_all_nodes(node: &mut LayoutNode) {
@ -999,7 +1001,7 @@ impl LayoutRPC for LayoutRPCImpl {
DefaultCursor DefaultCursor
}; };
let ConstellationChan(ref constellation_chan) = rw_data.constellation_chan; let ConstellationChan(ref constellation_chan) = rw_data.constellation_chan;
constellation_chan.send(SetCursorMsg(cursor)); constellation_chan.send(ConstellationMsg::SetCursor(cursor));
} }
if mouse_over_list.is_empty() { if mouse_over_list.is_empty() {

View file

@ -19,7 +19,7 @@ use wrapper::{PostorderNodeMutTraversal, UnsafeLayoutNode};
use wrapper::{PreorderDomTraversal, PostorderDomTraversal}; use wrapper::{PreorderDomTraversal, PostorderDomTraversal};
use servo_util::opts; use servo_util::opts;
use servo_util::time::{mod, ProfilerMetadata, TimeProfilerChan, profile}; use servo_util::time::{TimeProfilerCategory, ProfilerMetadata, TimeProfilerChan, profile};
use servo_util::workqueue::{WorkQueue, WorkUnit, WorkerProxy}; use servo_util::workqueue::{WorkQueue, WorkUnit, WorkerProxy};
use std::mem; use std::mem;
use std::ptr; use std::ptr;
@ -432,7 +432,8 @@ pub fn traverse_flow_tree_preorder(root: &mut FlowRef,
queue.data = shared_layout_context as *const _; queue.data = shared_layout_context as *const _;
profile(time::LayoutParallelWarmupCategory, profiler_metadata, time_profiler_chan, || { profile(TimeProfilerCategory::LayoutParallelWarmup, profiler_metadata,
time_profiler_chan, || {
queue.push(WorkUnit { queue.push(WorkUnit {
fun: assign_inline_sizes, fun: assign_inline_sizes,
data: mut_owned_flow_to_unsafe_flow(root), data: mut_owned_flow_to_unsafe_flow(root),
@ -451,7 +452,8 @@ pub fn build_display_list_for_subtree(root: &mut FlowRef,
queue: &mut WorkQueue<*const SharedLayoutContext,UnsafeFlow>) { queue: &mut WorkQueue<*const SharedLayoutContext,UnsafeFlow>) {
queue.data = shared_layout_context as *const _; queue.data = shared_layout_context as *const _;
profile(time::LayoutParallelWarmupCategory, profiler_metadata, time_profiler_chan, || { profile(TimeProfilerCategory::LayoutParallelWarmup, profiler_metadata,
time_profiler_chan, || {
queue.push(WorkUnit { queue.push(WorkUnit {
fun: compute_absolute_positions, fun: compute_absolute_positions,
data: mut_owned_flow_to_unsafe_flow(root), data: mut_owned_flow_to_unsafe_flow(root),

View file

@ -16,8 +16,8 @@ use constellation_msg::PipelineId;
/// The status of the painter. /// The status of the painter.
#[deriving(PartialEq, Clone)] #[deriving(PartialEq, Clone)]
pub enum PaintState { pub enum PaintState {
IdlePaintState, Idle,
PaintingPaintState, Painting,
} }
#[deriving(Eq, Ord, PartialEq, PartialOrd, Clone, Show)] #[deriving(Eq, Ord, PartialEq, PartialOrd, Clone, Show)]

View file

@ -9,7 +9,7 @@ use geom::rect::Rect;
use geom::size::TypedSize2D; use geom::size::TypedSize2D;
use geom::scale_factor::ScaleFactor; use geom::scale_factor::ScaleFactor;
use hyper::header::Headers; use hyper::header::Headers;
use hyper::method::{Method, Get}; use hyper::method::Method;
use layers::geometry::DevicePixel; use layers::geometry::DevicePixel;
use servo_util::cursor::Cursor; use servo_util::cursor::Cursor;
use servo_util::geometry::{PagePx, ViewportPx}; use servo_util::geometry::{PagePx, ViewportPx};
@ -195,26 +195,26 @@ bitflags! {
/// Messages from the compositor and script to the constellation. /// Messages from the compositor and script to the constellation.
pub enum Msg { pub enum Msg {
ExitMsg, Exit,
FailureMsg(Failure), Failure(Failure),
InitLoadUrlMsg(Url), InitLoadUrl(Url),
LoadCompleteMsg, LoadComplete,
FrameRectMsg(PipelineId, SubpageId, Rect<f32>), FrameRect(PipelineId, SubpageId, Rect<f32>),
LoadUrlMsg(PipelineId, LoadData), LoadUrl(PipelineId, LoadData),
ScriptLoadedURLInIFrameMsg(Url, PipelineId, SubpageId, IFrameSandboxState), ScriptLoadedURLInIFrame(Url, PipelineId, SubpageId, IFrameSandboxState),
NavigateMsg(NavigationDirection), Navigate(NavigationDirection),
PainterReadyMsg(PipelineId), PainterReady(PipelineId),
ResizedWindowMsg(WindowSizeData), ResizedWindow(WindowSizeData),
KeyEvent(Key, KeyState, KeyModifiers), KeyEvent(Key, KeyState, KeyModifiers),
/// Requests that the constellation inform the compositor of the title of the pipeline /// Requests that the constellation inform the compositor of the title of the pipeline
/// immediately. /// immediately.
GetPipelineTitleMsg(PipelineId), GetPipelineTitle(PipelineId),
/// Requests that the constellation inform the compositor of the a cursor change. /// Requests that the constellation inform the compositor of the a cursor change.
SetCursorMsg(Cursor), SetCursor(Cursor),
} }
/// Similar to net::resource_task::LoadData /// Similar to net::resource_task::LoadData
/// can be passed to LoadUrlMsg to load a page with GET/POST /// can be passed to LoadUrl to load a page with GET/POST
/// parameters or headers /// parameters or headers
#[deriving(Clone)] #[deriving(Clone)]
pub struct LoadData { pub struct LoadData {
@ -228,7 +228,7 @@ impl LoadData {
pub fn new(url: Url) -> LoadData { pub fn new(url: Url) -> LoadData {
LoadData { LoadData {
url: url, url: url,
method: Get, method: Method::Get,
headers: Headers::new(), headers: Headers::new(),
data: None, data: None,
} }

View file

@ -3,8 +3,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use url::Url; use url::Url;
use hyper::method::{Get, Method}; use hyper::method::Method;
use hyper::mime::{Mime, Text, Html, Charset, Utf8}; use hyper::mime::{Mime, TopLevel, SubLevel, Attr, Value};
use hyper::header::Headers; use hyper::header::Headers;
use hyper::header::common::ContentType; use hyper::header::common::ContentType;
use fetch::cors_cache::CORSCache; use fetch::cors_cache::CORSCache;
@ -87,7 +87,7 @@ pub struct Request {
impl Request { impl Request {
pub fn new(url: Url, context: Context) -> Request { pub fn new(url: Url, context: Context) -> Request {
Request { Request {
method: Get, method: Method::Get,
url: url, url: url,
headers: Headers::new(), headers: Headers::new(),
unsafe_request: false, unsafe_request: false,
@ -118,7 +118,9 @@ impl Request {
"about" => match self.url.non_relative_scheme_data() { "about" => match self.url.non_relative_scheme_data() {
Some(s) if s.as_slice() == "blank" => { Some(s) if s.as_slice() == "blank" => {
let mut response = Response::new(); let mut response = Response::new();
response.headers.set(ContentType(Mime(Text, Html, vec![(Charset, Utf8)]))); response.headers.set(ContentType(Mime(
TopLevel::Text, SubLevel::Html,
vec![(Attr::Charset, Value::Utf8)])));
response response
}, },
_ => Response::network_error() _ => Response::network_error()

View file

@ -4,7 +4,6 @@
use url::Url; use url::Url;
use hyper::status::StatusCode; use hyper::status::StatusCode;
use hyper::status::Ok as StatusOk;
use hyper::header::Headers; use hyper::header::Headers;
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
use std::comm::Receiver; use std::comm::Receiver;
@ -70,7 +69,7 @@ impl Response {
response_type: ResponseType::Default, response_type: ResponseType::Default,
termination_reason: None, termination_reason: None,
url: None, url: None,
status: Some(StatusOk), status: Some(StatusCode::Ok),
headers: Headers::new(), headers: Headers::new(),
body: ResponseBody::Empty, body: ResponseBody::Empty,
internal_response: None internal_response: None

View file

@ -9,8 +9,8 @@ use log;
use std::collections::HashSet; use std::collections::HashSet;
use hyper::client::Request; use hyper::client::Request;
use hyper::header::common::{ContentLength, ContentType, Host, Location}; use hyper::header::common::{ContentLength, ContentType, Host, Location};
use hyper::method::{Get, Head}; use hyper::method::Method;
use hyper::status::Redirection; use hyper::status::StatusClass;
use std::io::Reader; use std::io::Reader;
use servo_util::task::spawn_named; use servo_util::task::spawn_named;
use url::{Url, UrlParser}; use url::{Url, UrlParser};
@ -108,7 +108,7 @@ fn load(load_data: LoadData, start_chan: Sender<TargetedLoadResponse>) {
}, },
None => { None => {
match load_data.method { match load_data.method {
Get | Head => (), Method::Get | Method::Head => (),
_ => req.headers_mut().set(ContentLength(0)) _ => req.headers_mut().set(ContentLength(0))
} }
match req.start() { match req.start() {
@ -136,7 +136,7 @@ fn load(load_data: LoadData, start_chan: Sender<TargetedLoadResponse>) {
} }
} }
if response.status.class() == Redirection { if response.status.class() == StatusClass::Redirection {
match response.headers.get::<Location>() { match response.headers.get::<Location>() {
Some(&Location(ref new_url)) => { Some(&Location(ref new_url)) => {
// CORS (http://fetch.spec.whatwg.org/#http-fetch, status section, point 9, 10) // CORS (http://fetch.spec.whatwg.org/#http-fetch, status section, point 9, 10)

View file

@ -50,8 +50,8 @@ pub fn load_from_memory(buffer: &[u8]) -> Option<Image> {
match png::load_png_from_memory(buffer) { match png::load_png_from_memory(buffer) {
Ok(mut png_image) => { Ok(mut png_image) => {
match png_image.pixels { match png_image.pixels {
png::RGB8(ref mut data) => byte_swap(data.as_mut_slice()), png::PixelsByColorType::RGB8(ref mut data) => byte_swap(data.as_mut_slice()),
png::RGBA8(ref mut data) => { png::PixelsByColorType::RGBA8(ref mut data) => {
byte_swap_and_premultiply(data.as_mut_slice()) byte_swap_and_premultiply(data.as_mut_slice())
} }
_ => {} _ => {}
@ -66,20 +66,20 @@ pub fn load_from_memory(buffer: &[u8]) -> Option<Image> {
static FORCE_DEPTH: uint = 4; static FORCE_DEPTH: uint = 4;
match stb_image::load_from_memory_with_depth(buffer, FORCE_DEPTH, true) { match stb_image::load_from_memory_with_depth(buffer, FORCE_DEPTH, true) {
stb_image::ImageU8(mut image) => { stb_image::LoadResult::ImageU8(mut image) => {
assert!(image.depth == 4); assert!(image.depth == 4);
byte_swap(image.data.as_mut_slice()); byte_swap(image.data.as_mut_slice());
Some(png::Image { Some(png::Image {
width: image.width as u32, width: image.width as u32,
height: image.height as u32, height: image.height as u32,
pixels: png::RGBA8(image.data) pixels: png::PixelsByColorType::RGBA8(image.data)
}) })
} }
stb_image::ImageF32(_image) => { stb_image::LoadResult::ImageF32(_image) => {
error!("HDR images not implemented"); error!("HDR images not implemented");
None None
} }
stb_image::Error(e) => { stb_image::LoadResult::Error(e) => {
error!("stb_image failed: {}", e); error!("stb_image failed: {}", e);
None None
} }

View file

@ -13,7 +13,6 @@ use std::comm::{channel, Receiver, Sender};
use std::collections::HashMap; use std::collections::HashMap;
use std::collections::hash_map::{Occupied, Vacant}; use std::collections::hash_map::{Occupied, Vacant};
use std::mem::replace; use std::mem::replace;
use std::result;
use sync::{Arc, Mutex}; use sync::{Arc, Mutex};
use serialize::{Encoder, Encodable}; use serialize::{Encoder, Encodable};
use url::Url; use url::Url;
@ -456,10 +455,10 @@ fn load_image_data(url: Url, resource_task: ResourceTask) -> Result<Vec<u8>, ()>
Payload(data) => { Payload(data) => {
image_data.push_all(data.as_slice()); image_data.push_all(data.as_slice());
} }
Done(result::Ok(..)) => { Done(Ok(..)) => {
return Ok(image_data); return Ok(image_data);
} }
Done(result::Err(..)) => { Done(Err(..)) => {
return Err(()); return Err(());
} }
} }

View file

@ -16,8 +16,8 @@ use servo_util::task::spawn_named;
use hyper::header::common::UserAgent; use hyper::header::common::UserAgent;
use hyper::header::Headers; use hyper::header::Headers;
use hyper::http::RawStatus; use hyper::http::RawStatus;
use hyper::method::{Method, Get}; use hyper::method::Method;
use hyper::mime::{Mime, Charset}; use hyper::mime::{Mime, Attr};
use url::Url; use url::Url;
use std::comm::{channel, Receiver, Sender}; use std::comm::{channel, Receiver, Sender};
@ -43,7 +43,7 @@ impl LoadData {
pub fn new(url: Url, consumer: Sender<LoadResponse>) -> LoadData { pub fn new(url: Url, consumer: Sender<LoadResponse>) -> LoadData {
LoadData { LoadData {
url: url, url: url,
method: Get, method: Method::Get,
headers: Headers::new(), headers: Headers::new(),
data: None, data: None,
cors: None, cors: None,
@ -97,7 +97,7 @@ impl Metadata {
Some(&Mime(ref type_, ref subtype, ref parameters)) => { Some(&Mime(ref type_, ref subtype, ref parameters)) => {
self.content_type = Some((type_.to_string(), subtype.to_string())); self.content_type = Some((type_.to_string(), subtype.to_string()));
for &(ref k, ref v) in parameters.iter() { for &(ref k, ref v) in parameters.iter() {
if &Charset == k { if &Attr::Charset == k {
self.charset = Some(v.to_string()); self.charset = Some(v.to_string());
} }
} }

View file

@ -18,10 +18,10 @@ use time::{now, Timespec};
use hyper::header::{Headers, Header, HeaderFormat, HeaderView}; use hyper::header::{Headers, Header, HeaderFormat, HeaderView};
use hyper::header::common::util as header_util; use hyper::header::common::util as header_util;
use hyper::client::Request; use hyper::client::Request;
use hyper::mime::{mod, Mime}; use hyper::mime::{Mime, TopLevel, SubLevel};
use hyper::header::common::{ContentType, Host}; use hyper::header::common::{ContentType, Host};
use hyper::method::{Method, Get, Head, Post, Options}; use hyper::method::Method;
use hyper::status::Success; use hyper::status::StatusClass::Success;
use url::{SchemeData, Url}; use url::{SchemeData, Url};
@ -118,7 +118,7 @@ impl CORSRequest {
let mut cors_response = CORSResponse::new(); let mut cors_response = CORSResponse::new();
let mut preflight = self.clone(); // Step 1 let mut preflight = self.clone(); // Step 1
preflight.method = Options; // Step 2 preflight.method = Method::Options; // Step 2
preflight.headers = Headers::new(); // Step 3 preflight.headers = Headers::new(); // Step 3
// Step 4 // Step 4
preflight.headers.set(AccessControlRequestMethod(self.method.clone())); preflight.headers.set(AccessControlRequestMethod(self.method.clone()));
@ -364,9 +364,9 @@ fn is_simple_header(h: &HeaderView) -> bool {
match h.name().to_ascii_lower().as_slice() { match h.name().to_ascii_lower().as_slice() {
"accept" | "accept-language" | "content-language" => true, "accept" | "accept-language" | "content-language" => true,
"content-type" => match h.value() { "content-type" => match h.value() {
Some(&ContentType(Mime(mime::Text, mime::Plain, _))) | Some(&ContentType(Mime(TopLevel::Text, SubLevel::Plain, _))) |
Some(&ContentType(Mime(mime::Application, mime::WwwFormUrlEncoded, _))) | Some(&ContentType(Mime(TopLevel::Application, SubLevel::WwwFormUrlEncoded, _))) |
Some(&ContentType(Mime(mime::Multipart, mime::FormData, _))) => true, Some(&ContentType(Mime(TopLevel::Multipart, SubLevel::FormData, _))) => true,
_ => false _ => false
@ -377,7 +377,7 @@ fn is_simple_header(h: &HeaderView) -> bool {
fn is_simple_method(m: &Method) -> bool { fn is_simple_method(m: &Method) -> bool {
match *m { match *m {
Get | Head | Post => true, Method::Get | Method::Head | Method::Post => true,
_ => false _ => false
} }
} }

View file

@ -674,7 +674,7 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
default = "None" default = "None"
else: else:
assert defaultValue.type.tag() == IDLType.Tags.domstring assert defaultValue.type.tag() == IDLType.Tags.domstring
value = "str::from_utf8(data).unwrap().into_string()" value = "str::from_utf8(&data).unwrap().into_string()"
if type.nullable(): if type.nullable():
value = "Some(%s)" % value value = "Some(%s)" % value

View file

@ -39,7 +39,7 @@ use geom::rect::Rect;
use html5ever::tree_builder::QuirksMode; use html5ever::tree_builder::QuirksMode;
use hyper::header::Headers; use hyper::header::Headers;
use hyper::method::Method; use hyper::method::Method;
use js::jsapi::{JSObject, JSTracer, JS_CallTracer, JSTRACE_OBJECT}; use js::jsapi::{JSObject, JSTracer, JS_CallTracer, JSGCTraceKind};
use js::jsval::JSVal; use js::jsval::JSVal;
use js::rust::Cx; use js::rust::Cx;
use layout_interface::{LayoutRPC, LayoutChan}; use layout_interface::{LayoutRPC, LayoutChan};
@ -106,7 +106,7 @@ pub fn trace_object(tracer: *mut JSTracer, description: &str, obj: *mut JSObject
(*tracer).debugPrintIndex = -1; (*tracer).debugPrintIndex = -1;
(*tracer).debugPrintArg = name.as_ptr() as *const libc::c_void; (*tracer).debugPrintArg = name.as_ptr() as *const libc::c_void;
debug!("tracing {}", description); debug!("tracing {}", description);
JS_CallTracer(tracer, obj as *mut libc::c_void, JSTRACE_OBJECT); JS_CallTracer(tracer, obj as *mut libc::c_void, JSGCTraceKind::JSTRACE_OBJECT);
} }
} }

View file

@ -13,7 +13,8 @@ use geom::point::Point2D;
use geom::rect::Rect; use geom::rect::Rect;
use geom::size::Size2D; use geom::size::Size2D;
use canvas::canvas_paint_task::{CanvasMsg, CanvasPaintTask, ClearRect, Close, FillRect, Recreate, StrokeRect}; use canvas::canvas_paint_task::{CanvasMsg, CanvasPaintTask};
use canvas::canvas_paint_task::CanvasMsg::{ClearRect, Close, FillRect, Recreate, StrokeRect};
#[dom_struct] #[dom_struct]
pub struct CanvasRenderingContext2D { pub struct CanvasRenderingContext2D {

View file

@ -1396,7 +1396,7 @@ impl<'a> style::TElement<'a> for JSRef<'a, Element> {
} }
pub trait ActivationElementHelpers<'a> { pub trait ActivationElementHelpers<'a> {
fn as_maybe_activatable(&'a self) -> Option<&'a Activatable + 'a>; fn as_maybe_activatable(&'a self) -> Option<&'a (Activatable + 'a)>;
fn click_in_progress(self) -> bool; fn click_in_progress(self) -> bool;
fn set_click_in_progress(self, click: bool); fn set_click_in_progress(self, click: bool);
fn nearest_activable_element(self) -> Option<Temporary<Element>>; fn nearest_activable_element(self) -> Option<Temporary<Element>>;
@ -1404,12 +1404,12 @@ pub trait ActivationElementHelpers<'a> {
} }
impl<'a> ActivationElementHelpers<'a> for JSRef<'a, Element> { impl<'a> ActivationElementHelpers<'a> for JSRef<'a, Element> {
fn as_maybe_activatable(&'a self) -> Option<&'a Activatable + 'a> { fn as_maybe_activatable(&'a self) -> Option<&'a (Activatable + 'a)> {
let node: JSRef<Node> = NodeCast::from_ref(*self); let node: JSRef<Node> = NodeCast::from_ref(*self);
match node.type_id() { match node.type_id() {
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement)) => { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement)) => {
let element: &'a JSRef<'a, HTMLInputElement> = HTMLInputElementCast::to_borrowed_ref(self).unwrap(); let element: &'a JSRef<'a, HTMLInputElement> = HTMLInputElementCast::to_borrowed_ref(self).unwrap();
Some(element as &'a Activatable + 'a) Some(element as &'a (Activatable + 'a))
}, },
_ => { _ => {
None None

View file

@ -21,7 +21,7 @@ use dom::htmlelement::{HTMLElement, HTMLElementTypeId};
use dom::htmlinputelement::HTMLInputElement; use dom::htmlinputelement::HTMLInputElement;
use dom::htmltextareaelement::HTMLTextAreaElement; use dom::htmltextareaelement::HTMLTextAreaElement;
use dom::node::{Node, NodeHelpers, NodeTypeId, document_from_node, window_from_node}; use dom::node::{Node, NodeHelpers, NodeTypeId, document_from_node, window_from_node};
use hyper::method::Post; use hyper::method::Method;
use servo_msg::constellation_msg::LoadData; use servo_msg::constellation_msg::LoadData;
use servo_util::str::DOMString; use servo_util::str::DOMString;
use script_task::{ScriptChan, ScriptMsg}; use script_task::{ScriptChan, ScriptMsg};
@ -196,7 +196,7 @@ impl<'a> HTMLFormElementHelpers for JSRef<'a, HTMLFormElement> {
load_data.url.query = Some(parsed_data); load_data.url.query = Some(parsed_data);
}, },
("http", FormMethod::FormPost) | ("https", FormMethod::FormPost) => { ("http", FormMethod::FormPost) | ("https", FormMethod::FormPost) => {
load_data.method = Post; load_data.method = Method::Post;
load_data.data = Some(parsed_data.into_bytes()); load_data.data = Some(parsed_data.into_bytes());
}, },
// https://html.spec.whatwg.org/multipage/forms.html#submit-get-action // https://html.spec.whatwg.org/multipage/forms.html#submit-get-action

View file

@ -22,9 +22,9 @@ use dom::virtualmethods::VirtualMethods;
use dom::window::Window; use dom::window::Window;
use page::IterablePage; use page::IterablePage;
use servo_msg::constellation_msg::{PipelineId, SubpageId}; use servo_msg::constellation_msg::{PipelineId, SubpageId, ConstellationChan};
use servo_msg::constellation_msg::{IFrameSandboxed, IFrameUnsandboxed}; use servo_msg::constellation_msg::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed};
use servo_msg::constellation_msg::{ConstellationChan, ScriptLoadedURLInIFrameMsg}; use servo_msg::constellation_msg::Msg as ConstellationMsg;
use servo_util::str::DOMString; use servo_util::str::DOMString;
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
@ -123,7 +123,7 @@ impl<'a> HTMLIFrameElementHelpers for JSRef<'a, HTMLIFrameElement> {
})); }));
let ConstellationChan(ref chan) = page.constellation_chan; let ConstellationChan(ref chan) = page.constellation_chan;
chan.send(ScriptLoadedURLInIFrameMsg(url, page.id, subpage_id, sandboxed)); chan.send(ConstellationMsg::ScriptLoadedURLInIFrame(url, page.id, subpage_id, sandboxed));
} }
} }

View file

@ -61,7 +61,7 @@ impl<'a> PrivateHTMLImageElementHelpers for JSRef<'a, HTMLImageElement> {
// inform the image cache to load this, but don't store a // inform the image cache to load this, but don't store a
// handle. // handle.
image_cache.send(image_cache_task::Prefetch(img_url)); image_cache.send(image_cache_task::Msg::Prefetch(img_url));
} }
} }
} }

View file

@ -69,7 +69,7 @@ impl<'a> ProcessDataURL for JSRef<'a, HTMLObjectElement> {
if is_image_data(uri.as_slice()) { if is_image_data(uri.as_slice()) {
let data_url = Url::parse(uri.as_slice()).unwrap(); let data_url = Url::parse(uri.as_slice()).unwrap();
// Issue #84 // Issue #84
image_cache.send(image_cache_task::Prefetch(data_url)); image_cache.send(image_cache_task::Msg::Prefetch(data_url));
} }
} }
_ => { } _ => { }

View file

@ -145,76 +145,76 @@ pub trait VirtualMethods {
/// method call on the trait object will invoke the corresponding method on the /// method call on the trait object will invoke the corresponding method on the
/// concrete type, propagating up the parent hierarchy unless otherwise /// concrete type, propagating up the parent hierarchy unless otherwise
/// interrupted. /// interrupted.
pub fn vtable_for<'a>(node: &'a JSRef<'a, Node>) -> &'a VirtualMethods + 'a { pub fn vtable_for<'a>(node: &'a JSRef<'a, Node>) -> &'a (VirtualMethods + 'a) {
match node.type_id() { match node.type_id() {
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAnchorElement)) => { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAnchorElement)) => {
let element: &'a JSRef<'a, HTMLAnchorElement> = HTMLAnchorElementCast::to_borrowed_ref(node).unwrap(); let element: &'a JSRef<'a, HTMLAnchorElement> = HTMLAnchorElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a element as &'a (VirtualMethods + 'a)
} }
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAreaElement)) => { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAreaElement)) => {
let element: &'a JSRef<'a, HTMLAreaElement> = HTMLAreaElementCast::to_borrowed_ref(node).unwrap(); let element: &'a JSRef<'a, HTMLAreaElement> = HTMLAreaElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a element as &'a (VirtualMethods + 'a)
} }
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBodyElement)) => { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBodyElement)) => {
let element: &'a JSRef<'a, HTMLBodyElement> = HTMLBodyElementCast::to_borrowed_ref(node).unwrap(); let element: &'a JSRef<'a, HTMLBodyElement> = HTMLBodyElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a element as &'a (VirtualMethods + 'a)
} }
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLButtonElement)) => { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLButtonElement)) => {
let element: &'a JSRef<'a, HTMLButtonElement> = HTMLButtonElementCast::to_borrowed_ref(node).unwrap(); let element: &'a JSRef<'a, HTMLButtonElement> = HTMLButtonElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a element as &'a (VirtualMethods + 'a)
} }
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLCanvasElement)) => { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLCanvasElement)) => {
let element: &'a JSRef<'a, HTMLCanvasElement> = HTMLCanvasElementCast::to_borrowed_ref(node).unwrap(); let element: &'a JSRef<'a, HTMLCanvasElement> = HTMLCanvasElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a element as &'a (VirtualMethods + 'a)
} }
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFieldSetElement)) => { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFieldSetElement)) => {
let element: &'a JSRef<'a, HTMLFieldSetElement> = HTMLFieldSetElementCast::to_borrowed_ref(node).unwrap(); let element: &'a JSRef<'a, HTMLFieldSetElement> = HTMLFieldSetElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a element as &'a (VirtualMethods + 'a)
} }
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLImageElement)) => { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLImageElement)) => {
let element: &'a JSRef<'a, HTMLImageElement> = HTMLImageElementCast::to_borrowed_ref(node).unwrap(); let element: &'a JSRef<'a, HTMLImageElement> = HTMLImageElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a element as &'a (VirtualMethods + 'a)
} }
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLIFrameElement)) => { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLIFrameElement)) => {
let element: &'a JSRef<'a, HTMLIFrameElement> = HTMLIFrameElementCast::to_borrowed_ref(node).unwrap(); let element: &'a JSRef<'a, HTMLIFrameElement> = HTMLIFrameElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a element as &'a (VirtualMethods + 'a)
} }
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement)) => { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement)) => {
let element: &'a JSRef<'a, HTMLInputElement> = HTMLInputElementCast::to_borrowed_ref(node).unwrap(); let element: &'a JSRef<'a, HTMLInputElement> = HTMLInputElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a element as &'a (VirtualMethods + 'a)
} }
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLinkElement)) => { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLinkElement)) => {
let element: &'a JSRef<'a, HTMLLinkElement> = HTMLLinkElementCast::to_borrowed_ref(node).unwrap(); let element: &'a JSRef<'a, HTMLLinkElement> = HTMLLinkElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a element as &'a (VirtualMethods + 'a)
} }
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLObjectElement)) => { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLObjectElement)) => {
let element: &'a JSRef<'a, HTMLObjectElement> = HTMLObjectElementCast::to_borrowed_ref(node).unwrap(); let element: &'a JSRef<'a, HTMLObjectElement> = HTMLObjectElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a element as &'a (VirtualMethods + 'a)
} }
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptGroupElement)) => { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptGroupElement)) => {
let element: &'a JSRef<'a, HTMLOptGroupElement> = HTMLOptGroupElementCast::to_borrowed_ref(node).unwrap(); let element: &'a JSRef<'a, HTMLOptGroupElement> = HTMLOptGroupElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a element as &'a (VirtualMethods + 'a)
} }
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptionElement)) => { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptionElement)) => {
let element: &'a JSRef<'a, HTMLOptionElement> = HTMLOptionElementCast::to_borrowed_ref(node).unwrap(); let element: &'a JSRef<'a, HTMLOptionElement> = HTMLOptionElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a element as &'a (VirtualMethods + 'a)
} }
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLScriptElement)) => { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLScriptElement)) => {
let element: &'a JSRef<'a, HTMLScriptElement> = HTMLScriptElementCast::to_borrowed_ref(node).unwrap(); let element: &'a JSRef<'a, HTMLScriptElement> = HTMLScriptElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a element as &'a (VirtualMethods + 'a)
} }
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)) => { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)) => {
let element: &'a JSRef<'a, HTMLSelectElement> = HTMLSelectElementCast::to_borrowed_ref(node).unwrap(); let element: &'a JSRef<'a, HTMLSelectElement> = HTMLSelectElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a element as &'a (VirtualMethods + 'a)
} }
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLStyleElement)) => { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLStyleElement)) => {
let element: &'a JSRef<'a, HTMLStyleElement> = HTMLStyleElementCast::to_borrowed_ref(node).unwrap(); let element: &'a JSRef<'a, HTMLStyleElement> = HTMLStyleElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a element as &'a (VirtualMethods + 'a)
} }
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableElement)) => { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableElement)) => {
let element: &'a JSRef<'a, HTMLTableElement> = let element: &'a JSRef<'a, HTMLTableElement> =
HTMLTableElementCast::to_borrowed_ref(node).unwrap(); HTMLTableElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a element as &'a (VirtualMethods + 'a)
} }
NodeTypeId::Element(ElementTypeId::HTMLElement( NodeTypeId::Element(ElementTypeId::HTMLElement(
HTMLElementTypeId::HTMLTableCellElement( HTMLElementTypeId::HTMLTableCellElement(
@ -224,37 +224,37 @@ pub fn vtable_for<'a>(node: &'a JSRef<'a, Node>) -> &'a VirtualMethods + 'a {
HTMLTableCellElementTypeId::HTMLTableHeaderCellElement))) => { HTMLTableCellElementTypeId::HTMLTableHeaderCellElement))) => {
let element: &'a JSRef<'a, HTMLTableCellElement> = let element: &'a JSRef<'a, HTMLTableCellElement> =
HTMLTableCellElementCast::to_borrowed_ref(node).unwrap(); HTMLTableCellElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a element as &'a (VirtualMethods + 'a)
} }
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableRowElement)) => { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableRowElement)) => {
let element: &'a JSRef<'a, HTMLTableRowElement> = let element: &'a JSRef<'a, HTMLTableRowElement> =
HTMLTableRowElementCast::to_borrowed_ref(node).unwrap(); HTMLTableRowElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a element as &'a (VirtualMethods + 'a)
} }
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableSectionElement)) => { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableSectionElement)) => {
let element: &'a JSRef<'a, HTMLTableSectionElement> = let element: &'a JSRef<'a, HTMLTableSectionElement> =
HTMLTableSectionElementCast::to_borrowed_ref(node).unwrap(); HTMLTableSectionElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a element as &'a (VirtualMethods + 'a)
} }
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement)) => { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement)) => {
let element: &'a JSRef<'a, HTMLTextAreaElement> = HTMLTextAreaElementCast::to_borrowed_ref(node).unwrap(); let element: &'a JSRef<'a, HTMLTextAreaElement> = HTMLTextAreaElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a element as &'a (VirtualMethods + 'a)
} }
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTitleElement)) => { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTitleElement)) => {
let element: &'a JSRef<'a, HTMLTitleElement> = let element: &'a JSRef<'a, HTMLTitleElement> =
HTMLTitleElementCast::to_borrowed_ref(node).unwrap(); HTMLTitleElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a element as &'a (VirtualMethods + 'a)
} }
NodeTypeId::Element(ElementTypeId::Element) => { NodeTypeId::Element(ElementTypeId::Element) => {
let element: &'a JSRef<'a, Element> = ElementCast::to_borrowed_ref(node).unwrap(); let element: &'a JSRef<'a, Element> = ElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a element as &'a (VirtualMethods + 'a)
} }
NodeTypeId::Element(_) => { NodeTypeId::Element(_) => {
let element: &'a JSRef<'a, HTMLElement> = HTMLElementCast::to_borrowed_ref(node).unwrap(); let element: &'a JSRef<'a, HTMLElement> = HTMLElementCast::to_borrowed_ref(node).unwrap();
element as &'a VirtualMethods + 'a element as &'a (VirtualMethods + 'a)
} }
_ => { _ => {
node as &'a VirtualMethods + 'a node as &'a (VirtualMethods + 'a)
} }
} }
} }

View file

@ -36,13 +36,15 @@ use hyper::header::Headers;
use hyper::header::common::{Accept, ContentLength, ContentType}; use hyper::header::common::{Accept, ContentLength, ContentType};
use hyper::http::RawStatus; use hyper::http::RawStatus;
use hyper::mime::{mod, Mime}; use hyper::mime::{mod, Mime};
use hyper::method::{Method, Get, Head, Connect, Trace, Extension}; use hyper::method::Method;
use js::jsapi::{JS_ParseJSON, JSContext}; use js::jsapi::{JS_ParseJSON, JSContext};
use js::jsapi::JS_ClearPendingException; use js::jsapi::JS_ClearPendingException;
use js::jsval::{JSVal, NullValue, UndefinedValue}; use js::jsval::{JSVal, NullValue, UndefinedValue};
use net::resource_task::{ResourceTask, ResourceCORSData, Load, LoadData, LoadResponse, Payload, Done}; use net::resource_task::{ResourceTask, ResourceCORSData, LoadData, LoadResponse};
use net::resource_task::ControlMsg::Load;
use net::resource_task::ProgressMsg::{Payload, Done};
use cors::{allow_cross_origin_request, CORSRequest, RequestMode}; use cors::{allow_cross_origin_request, CORSRequest, RequestMode};
use servo_util::str::DOMString; use servo_util::str::DOMString;
use servo_util::task::spawn_named; use servo_util::task::spawn_named;
@ -173,7 +175,7 @@ impl XMLHttpRequest {
response_xml: Default::default(), response_xml: Default::default(),
response_headers: DOMRefCell::new(Headers::new()), response_headers: DOMRefCell::new(Headers::new()),
request_method: DOMRefCell::new(Get), request_method: DOMRefCell::new(Method::Get),
request_url: DOMRefCell::new(None), request_url: DOMRefCell::new(None),
request_headers: DOMRefCell::new(Headers::new()), request_headers: DOMRefCell::new(Headers::new()),
request_body_len: Cell::new(0), request_body_len: Cell::new(0),
@ -360,8 +362,8 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
// Step 2 // Step 2
match maybe_method { match maybe_method {
// Step 4 // Step 4
Some(Connect) | Some(Trace) => Err(Security), Some(Method::Connect) | Some(Method::Trace) => Err(Security),
Some(Extension(ref t)) if t.as_slice() == "TRACK" => Err(Security), Some(Method::Extension(ref t)) if t.as_slice() == "TRACK" => Err(Security),
Some(_) if method.is_token() => { Some(_) if method.is_token() => {
*self.request_method.borrow_mut() = maybe_method.unwrap(); *self.request_method.borrow_mut() = maybe_method.unwrap();
@ -493,7 +495,7 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
} }
let data = match *self.request_method.borrow() { let data = match *self.request_method.borrow() {
Get | Head => None, // Step 3 Method::Get | Method::Head => None, // Step 3
_ => data _ => data
}; };
let extracted = data.as_ref().map(|d| d.extract()); let extracted = data.as_ref().map(|d| d.extract());
@ -955,7 +957,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
match self.response_headers.borrow().get() { match self.response_headers.borrow().get() {
Some(&ContentType(mime::Mime(_, _, ref params))) => { Some(&ContentType(mime::Mime(_, _, ref params))) => {
for &(ref name, ref value) in params.iter() { for &(ref name, ref value) in params.iter() {
if name == &mime::Charset { if name == &mime::Attr::Charset {
encoding = encoding_from_whatwg_label(value.to_string().as_slice()).unwrap_or(encoding); encoding = encoding_from_whatwg_label(value.to_string().as_slice()).unwrap_or(encoding);
} }
} }

View file

@ -23,7 +23,6 @@ extern crate hyper;
extern crate js; extern crate js;
extern crate libc; extern crate libc;
extern crate msg; extern crate msg;
extern crate native;
extern crate net; extern crate net;
extern crate rustrt; extern crate rustrt;
extern crate serialize; extern crate serialize;

View file

@ -21,7 +21,7 @@ use parse::Parser;
use encoding::all::UTF_8; use encoding::all::UTF_8;
use encoding::types::{Encoding, DecoderTrap}; use encoding::types::{Encoding, DecoderTrap};
use servo_net::resource_task::{Payload, Done, LoadResponse}; use servo_net::resource_task::{ProgressMsg, LoadResponse};
use servo_util::task_state; use servo_util::task_state;
use servo_util::task_state::IN_HTML_PARSER; use servo_util::task_state::IN_HTML_PARSER;
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
@ -186,15 +186,15 @@ pub fn parse_html(document: JSRef<Document>,
_ => { _ => {
for msg in load_response.progress_port.iter() { for msg in load_response.progress_port.iter() {
match msg { match msg {
Payload(data) => { ProgressMsg::Payload(data) => {
// FIXME: use Vec<u8> (html5ever #34) // FIXME: use Vec<u8> (html5ever #34)
let data = UTF_8.decode(data.as_slice(), DecoderTrap::Replace).unwrap(); let data = UTF_8.decode(data.as_slice(), DecoderTrap::Replace).unwrap();
parser.parse_chunk(data); parser.parse_chunk(data);
} }
Done(Err(err)) => { ProgressMsg::Done(Err(err)) => {
panic!("Failed to load page URL {}, error: {}", url.serialize(), err); panic!("Failed to load page URL {}, error: {}", url.serialize(), err);
} }
Done(Ok(())) => break, ProgressMsg::Done(Ok(())) => break,
} }
} }
} }

View file

@ -38,22 +38,23 @@ use devtools;
use devtools_traits::{DevtoolsControlChan, DevtoolsControlPort, NewGlobal, GetRootNode, DevtoolsPageInfo}; use devtools_traits::{DevtoolsControlChan, DevtoolsControlPort, NewGlobal, GetRootNode, DevtoolsPageInfo};
use devtools_traits::{DevtoolScriptControlMsg, EvaluateJS, GetDocumentElement}; use devtools_traits::{DevtoolScriptControlMsg, EvaluateJS, GetDocumentElement};
use devtools_traits::{GetChildren, GetLayout, ModifyAttribute}; use devtools_traits::{GetChildren, GetLayout, ModifyAttribute};
use script_traits::{CompositorEvent, ResizeEvent, ReflowEvent, ClickEvent, MouseDownEvent}; use script_traits::CompositorEvent;
use script_traits::{MouseMoveEvent, MouseUpEvent, ConstellationControlMsg, ScriptTaskFactory}; use script_traits::CompositorEvent::{ResizeEvent, ReflowEvent, ClickEvent};
use script_traits::{ResizeMsg, AttachLayoutMsg, GetTitleMsg, KeyEvent, LoadMsg, ViewportMsg}; use script_traits::CompositorEvent::{MouseDownEvent, MouseUpEvent};
use script_traits::{ResizeInactiveMsg, ExitPipelineMsg, NewLayoutInfo, OpaqueScriptLayoutChannel}; use script_traits::CompositorEvent::{MouseMoveEvent, KeyEvent};
use script_traits::{ScriptControlChan, ReflowCompleteMsg, SendEventMsg}; use script_traits::{NewLayoutInfo, OpaqueScriptLayoutChannel};
use servo_msg::compositor_msg::{FinishedLoading, LayerId, Loading, PerformingLayout}; use script_traits::{ConstellationControlMsg, ScriptControlChan};
use servo_msg::compositor_msg::{ScriptListener}; use script_traits::ScriptTaskFactory;
use servo_msg::constellation_msg::{ConstellationChan, LoadCompleteMsg}; use servo_msg::compositor_msg::ReadyState::{FinishedLoading, Loading, PerformingLayout};
use servo_msg::constellation_msg::{LoadData, LoadUrlMsg, NavigationDirection, PipelineId}; use servo_msg::compositor_msg::{LayerId, ScriptListener};
use servo_msg::constellation_msg::{Failure, FailureMsg, WindowSizeData, Key, KeyState}; use servo_msg::constellation_msg::{ConstellationChan};
use servo_msg::constellation_msg::{KeyModifiers, SUPER, SHIFT, CONTROL, ALT, Repeated, Pressed}; use servo_msg::constellation_msg::{LoadData, NavigationDirection, PipelineId};
use servo_msg::constellation_msg::{Released}; use servo_msg::constellation_msg::{Failure, Msg, WindowSizeData, Key, KeyState};
use servo_msg::constellation_msg::{KeyModifiers, SUPER, SHIFT, CONTROL, ALT};
use servo_msg::constellation_msg::{PipelineExitType}; use servo_msg::constellation_msg::{PipelineExitType};
use servo_msg::constellation_msg; use servo_msg::constellation_msg::Msg as ConstellationMsg;
use servo_net::image_cache_task::ImageCacheTask; use servo_net::image_cache_task::ImageCacheTask;
use servo_net::resource_task::{ResourceTask, Load}; use servo_net::resource_task::{ResourceTask, ControlMsg};
use servo_net::resource_task::LoadData as NetLoadData; use servo_net::resource_task::LoadData as NetLoadData;
use servo_net::storage_task::StorageTask; use servo_net::storage_task::StorageTask;
use servo_util::geometry::to_frac_px; use servo_util::geometry::to_frac_px;
@ -313,7 +314,7 @@ impl ScriptTaskFactory for ScriptTask {
// This must always be the very last operation performed before the task completes // This must always be the very last operation performed before the task completes
failsafe.neuter(); failsafe.neuter();
}, FailureMsg(failure_msg), const_chan, false); }, ConstellationMsg::Failure(failure_msg), const_chan, false);
} }
} }
@ -505,15 +506,15 @@ impl ScriptTask {
// This has to be handled before the ResizeMsg below, // This has to be handled before the ResizeMsg below,
// otherwise the page may not have been added to the // otherwise the page may not have been added to the
// child list yet, causing the find() to fail. // child list yet, causing the find() to fail.
MixedMessage::FromConstellation(AttachLayoutMsg(new_layout_info)) => { MixedMessage::FromConstellation(ConstellationControlMsg::AttachLayout(new_layout_info)) => {
self.handle_new_layout(new_layout_info); self.handle_new_layout(new_layout_info);
} }
MixedMessage::FromConstellation(ResizeMsg(id, size)) => { MixedMessage::FromConstellation(ConstellationControlMsg::Resize(id, size)) => {
let page = self.page.borrow_mut(); let page = self.page.borrow_mut();
let page = page.find(id).expect("resize sent to nonexistent pipeline"); let page = page.find(id).expect("resize sent to nonexistent pipeline");
page.resize_event.set(Some(size)); page.resize_event.set(Some(size));
} }
MixedMessage::FromConstellation(ViewportMsg(id, rect)) => { MixedMessage::FromConstellation(ConstellationControlMsg::Viewport(id, rect)) => {
let page = self.page.borrow_mut(); let page = self.page.borrow_mut();
let inner_page = page.find(id).expect("Page rect message sent to nonexistent pipeline"); let inner_page = page.find(id).expect("Page rect message sent to nonexistent pipeline");
if inner_page.set_page_clip_rect_with_new_viewport(rect) { if inner_page.set_page_clip_rect_with_new_viewport(rect) {
@ -544,7 +545,7 @@ impl ScriptTask {
// Process the gathered events. // Process the gathered events.
for msg in sequential.into_iter() { for msg in sequential.into_iter() {
match msg { match msg {
MixedMessage::FromConstellation(ExitPipelineMsg(id, exit_type)) => { MixedMessage::FromConstellation(ConstellationControlMsg::ExitPipeline(id, exit_type)) => {
if self.handle_exit_pipeline_msg(id, exit_type) { if self.handle_exit_pipeline_msg(id, exit_type) {
return false return false
} }
@ -560,24 +561,23 @@ impl ScriptTask {
fn handle_msg_from_constellation(&self, msg: ConstellationControlMsg) { fn handle_msg_from_constellation(&self, msg: ConstellationControlMsg) {
match msg { match msg {
// TODO(tkuehn) need to handle auxiliary layouts for iframes ConstellationControlMsg::AttachLayout(_) =>
AttachLayoutMsg(_) => panic!("should have handled AttachLayout already"),
panic!("should have handled AttachLayoutMsg already"), ConstellationControlMsg::Load(id, load_data) =>
LoadMsg(id, load_data) =>
self.load(id, load_data), self.load(id, load_data),
SendEventMsg(id, event) => ConstellationControlMsg::SendEvent(id, event) =>
self.handle_event(id, event), self.handle_event(id, event),
ReflowCompleteMsg(id, reflow_id) => ConstellationControlMsg::ReflowComplete(id, reflow_id) =>
self.handle_reflow_complete_msg(id, reflow_id), self.handle_reflow_complete_msg(id, reflow_id),
ResizeInactiveMsg(id, new_size) => ConstellationControlMsg::ResizeInactive(id, new_size) =>
self.handle_resize_inactive_msg(id, new_size), self.handle_resize_inactive_msg(id, new_size),
ViewportMsg(..) => ConstellationControlMsg::Viewport(..) =>
panic!("should have handled ViewportMsg already"), panic!("should have handled Viewport already"),
ResizeMsg(..) => ConstellationControlMsg::Resize(..) =>
panic!("should have handled ResizeMsg already"), panic!("should have handled Resize already"),
ExitPipelineMsg(..) => ConstellationControlMsg::ExitPipeline(..) =>
panic!("should have handled ExitPipelineMsg already"), panic!("should have handled ExitPipeline already"),
GetTitleMsg(pipeline_id) => ConstellationControlMsg::GetTitle(pipeline_id) =>
self.handle_get_title_msg(pipeline_id), self.handle_get_title_msg(pipeline_id),
} }
} }
@ -677,7 +677,7 @@ impl ScriptTask {
/// TODO(tkuehn): is it ever possible to navigate only on a subframe? /// TODO(tkuehn): is it ever possible to navigate only on a subframe?
fn handle_navigate_msg(&self, direction: NavigationDirection) { fn handle_navigate_msg(&self, direction: NavigationDirection) {
let ConstellationChan(ref chan) = self.constellation_chan; let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(constellation_msg::NavigateMsg(direction)); chan.send(ConstellationMsg::Navigate(direction));
} }
/// Window was resized, but this script was not active, so don't reflow yet /// Window was resized, but this script was not active, so don't reflow yet
@ -807,7 +807,7 @@ impl ScriptTask {
let (parser_input, final_url) = if !is_javascript { let (parser_input, final_url) = if !is_javascript {
// Wait for the LoadResponse so that the parser knows the final URL. // Wait for the LoadResponse so that the parser knows the final URL.
let (input_chan, input_port) = channel(); let (input_chan, input_port) = channel();
self.resource_task.send(Load(NetLoadData { self.resource_task.send(ControlMsg::Load(NetLoadData {
url: url, url: url,
method: load_data.method, method: load_data.method,
headers: load_data.headers, headers: load_data.headers,
@ -882,7 +882,7 @@ impl ScriptTask {
*page.fragment_name.borrow_mut() = final_url.fragment.clone(); *page.fragment_name.borrow_mut() = final_url.fragment.clone();
let ConstellationChan(ref chan) = self.constellation_chan; let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(LoadCompleteMsg); chan.send(ConstellationMsg::LoadComplete);
// Notify devtools that a new script global exists. // Notify devtools that a new script global exists.
match self.devtools_chan { match self.devtools_chan {
@ -1054,7 +1054,7 @@ impl ScriptTask {
/// for the given pipeline. /// for the given pipeline.
fn trigger_load(&self, pipeline_id: PipelineId, load_data: LoadData) { fn trigger_load(&self, pipeline_id: PipelineId, load_data: LoadData) {
let ConstellationChan(ref const_chan) = self.constellation_chan; let ConstellationChan(ref const_chan) = self.constellation_chan;
const_chan.send(LoadUrlMsg(pipeline_id, load_data)); const_chan.send(ConstellationMsg::LoadUrl(pipeline_id, load_data));
} }
/// The entry point for content to notify that a fragment url has been requested /// The entry point for content to notify that a fragment url has been requested

View file

@ -50,23 +50,23 @@ pub struct NewLayoutInfo {
/// Messages sent from the constellation to the script task /// Messages sent from the constellation to the script task
pub enum ConstellationControlMsg { pub enum ConstellationControlMsg {
/// Loads a new URL on the specified pipeline. /// Loads a new URL on the specified pipeline.
LoadMsg(PipelineId, LoadData), Load(PipelineId, LoadData),
/// Gives a channel and ID to a layout task, as well as the ID of that layout's parent /// Gives a channel and ID to a layout task, as well as the ID of that layout's parent
AttachLayoutMsg(NewLayoutInfo), AttachLayout(NewLayoutInfo),
/// Window resized. Sends a DOM event eventually, but first we combine events. /// Window resized. Sends a DOM event eventually, but first we combine events.
ResizeMsg(PipelineId, WindowSizeData), Resize(PipelineId, WindowSizeData),
/// Notifies script that window has been resized but to not take immediate action. /// Notifies script that window has been resized but to not take immediate action.
ResizeInactiveMsg(PipelineId, WindowSizeData), ResizeInactive(PipelineId, WindowSizeData),
/// Notifies the script that a pipeline should be closed. /// Notifies the script that a pipeline should be closed.
ExitPipelineMsg(PipelineId, PipelineExitType), ExitPipeline(PipelineId, PipelineExitType),
/// Sends a DOM event. /// Sends a DOM event.
SendEventMsg(PipelineId, CompositorEvent), SendEvent(PipelineId, CompositorEvent),
/// Notifies script that reflow is finished. /// Notifies script that reflow is finished.
ReflowCompleteMsg(PipelineId, uint), ReflowComplete(PipelineId, uint),
/// Notifies script of the viewport. /// Notifies script of the viewport.
ViewportMsg(PipelineId, Rect<f32>), Viewport(PipelineId, Rect<f32>),
/// Requests that the script task immediately send the constellation the title of a pipeline. /// Requests that the script task immediately send the constellation the title of a pipeline.
GetTitleMsg(PipelineId), GetTitle(PipelineId),
} }
/// Events from the compositor that the script task needs to know about /// Events from the compositor that the script task needs to know about

View file

@ -20,7 +20,6 @@ extern crate script;
extern crate layout; extern crate layout;
extern crate gfx; extern crate gfx;
extern crate libc; extern crate libc;
extern crate native;
extern crate rustrt; extern crate rustrt;
extern crate url; extern crate url;
@ -30,7 +29,9 @@ use compositing::windowing::{WindowEvent, WindowMethods};
#[cfg(not(test))] #[cfg(not(test))]
use compositing::{CompositorProxy, CompositorTask, Constellation}; use compositing::{CompositorProxy, CompositorTask, Constellation};
#[cfg(not(test))] #[cfg(not(test))]
use servo_msg::constellation_msg::{ConstellationChan, InitLoadUrlMsg}; use servo_msg::constellation_msg::Msg as ConstellationMsg;
#[cfg(not(test))]
use servo_msg::constellation_msg::ConstellationChan;
#[cfg(not(test))] #[cfg(not(test))]
use script::dom::bindings::codegen::RegisterBindings; use script::dom::bindings::codegen::RegisterBindings;
@ -120,7 +121,7 @@ impl<Window> Browser<Window> where Window: WindowMethods + 'static {
}; };
let ConstellationChan(ref chan) = constellation_chan; let ConstellationChan(ref chan) = constellation_chan;
chan.send(InitLoadUrlMsg(url)); chan.send(ConstellationMsg::InitLoadUrl(url));
} }
// Send the constallation Chan as the result // Send the constallation Chan as the result

View file

@ -11,7 +11,6 @@
extern crate libc; extern crate libc;
extern crate servo; extern crate servo;
extern crate native;
extern crate time; extern crate time;
extern crate "util" as servo_util; extern crate "util" as servo_util;

View file

@ -3,6 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cssparser::ast::*; use cssparser::ast::*;
use cssparser::ast::ComponentValue::*;
use cssparser::parse_declaration_list; use cssparser::parse_declaration_list;
use errors::{ErrorLoggerIterator, log_css_error}; use errors::{ErrorLoggerIterator, log_css_error};
use std::ascii::AsciiExt; use std::ascii::AsciiExt;

View file

@ -5,6 +5,7 @@
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
use cssparser::parse_rule_list; use cssparser::parse_rule_list;
use cssparser::ast::*; use cssparser::ast::*;
use cssparser::ast::ComponentValue::*;
use errors::{ErrorLoggerIterator, log_css_error}; use errors::{ErrorLoggerIterator, log_css_error};
use geom::size::TypedSize2D; use geom::size::TypedSize2D;

View file

@ -3,6 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cssparser::ast::*; use cssparser::ast::*;
use cssparser::ast::ComponentValue::*;
use std::collections::HashMap; use std::collections::HashMap;
use servo_util::namespace; use servo_util::namespace;
use errors::log_css_error; use errors::log_css_error;

View file

@ -4,7 +4,8 @@
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
use cssparser::ast::{ComponentValue, Ident, Comma, SkipWhitespaceIterable, SkipWhitespaceIterator}; use cssparser::ast::{SkipWhitespaceIterable, SkipWhitespaceIterator};
use cssparser::ast::ComponentValue::{mod, Ident, Comma};
pub fn one_component_value<'a>(input: &'a [ComponentValue]) -> Result<&'a ComponentValue, ()> { pub fn one_component_value<'a>(input: &'a [ComponentValue]) -> Result<&'a ComponentValue, ()> {

View file

@ -24,7 +24,7 @@ macro_rules! define_css_keyword_enum {
impl $name { impl $name {
pub fn parse(component_value: &::cssparser::ast::ComponentValue) -> Result<$name, ()> { pub fn parse(component_value: &::cssparser::ast::ComponentValue) -> Result<$name, ()> {
match component_value { match component_value {
&::cssparser::ast::Ident(ref value) => { &::cssparser::ast::ComponentValue::Ident(ref value) => {
match_ignore_ascii_case! { value: match_ignore_ascii_case! { value:
$( $css => Ok($name::$variant) ),+ $( $css => Ok($name::$variant) ),+
_ => Err(()) _ => Err(())
@ -63,8 +63,9 @@ pub mod specified {
use std::fmt; use std::fmt;
use std::fmt::{Formatter, Show}; use std::fmt::{Formatter, Show};
use url::Url; use url::Url;
use cssparser::{mod, ast, ToCss, CssStringWriter}; use cssparser::{mod, ToCss, CssStringWriter};
use cssparser::ast::*; use cssparser::ast::*;
use cssparser::ast::ComponentValue::*;
use text_writer::{mod, TextWriter}; use text_writer::{mod, TextWriter};
use parsing_utils::{mod, BufferedIter, ParserIter}; use parsing_utils::{mod, BufferedIter, ParserIter};
use super::{Au, CSSFloat}; use super::{Au, CSSFloat};
@ -244,7 +245,7 @@ pub mod specified {
&Dimension(ref value, ref unit) if negative_ok || value.value >= 0. => &Dimension(ref value, ref unit) if negative_ok || value.value >= 0. =>
Length::parse_dimension(value.value, unit.as_slice()) Length::parse_dimension(value.value, unit.as_slice())
.map(LengthOrPercentage::Length), .map(LengthOrPercentage::Length),
&ast::Percentage(ref value) if negative_ok || value.value >= 0. => &Percentage(ref value) if negative_ok || value.value >= 0. =>
Ok(LengthOrPercentage::Percentage(value.value / 100.)), Ok(LengthOrPercentage::Percentage(value.value / 100.)),
&Number(ref value) if value.value == 0. => &Number(ref value) if value.value == 0. =>
Ok(LengthOrPercentage::Length(Length::Au(Au(0)))), Ok(LengthOrPercentage::Length(Length::Au(Au(0)))),
@ -289,7 +290,7 @@ pub mod specified {
match input { match input {
&Dimension(ref value, ref unit) if negative_ok || value.value >= 0. => &Dimension(ref value, ref unit) if negative_ok || value.value >= 0. =>
Length::parse_dimension(value.value, unit.as_slice()).map(LengthOrPercentageOrAuto::Length), Length::parse_dimension(value.value, unit.as_slice()).map(LengthOrPercentageOrAuto::Length),
&ast::Percentage(ref value) if negative_ok || value.value >= 0. => &Percentage(ref value) if negative_ok || value.value >= 0. =>
Ok(LengthOrPercentageOrAuto::Percentage(value.value / 100.)), Ok(LengthOrPercentageOrAuto::Percentage(value.value / 100.)),
&Number(ref value) if value.value == 0. => &Number(ref value) if value.value == 0. =>
Ok(LengthOrPercentageOrAuto::Length(Length::Au(Au(0)))), Ok(LengthOrPercentageOrAuto::Length(Length::Au(Au(0)))),
@ -335,7 +336,7 @@ pub mod specified {
match input { match input {
&Dimension(ref value, ref unit) if negative_ok || value.value >= 0. &Dimension(ref value, ref unit) if negative_ok || value.value >= 0.
=> Length::parse_dimension(value.value, unit.as_slice()).map(LengthOrPercentageOrNone::Length), => Length::parse_dimension(value.value, unit.as_slice()).map(LengthOrPercentageOrNone::Length),
&ast::Percentage(ref value) if negative_ok || value.value >= 0. &Percentage(ref value) if negative_ok || value.value >= 0.
=> Ok(LengthOrPercentageOrNone::Percentage(value.value / 100.)), => Ok(LengthOrPercentageOrNone::Percentage(value.value / 100.)),
&Number(ref value) if value.value == 0. => Ok(LengthOrPercentageOrNone::Length(Length::Au(Au(0)))), &Number(ref value) if value.value == 0. => Ok(LengthOrPercentageOrNone::Length(Length::Au(Au(0)))),
&Ident(ref value) if value.as_slice().eq_ignore_ascii_case("none") => Ok(LengthOrPercentageOrNone::None), &Ident(ref value) if value.as_slice().eq_ignore_ascii_case("none") => Ok(LengthOrPercentageOrNone::None),
@ -369,7 +370,7 @@ pub mod specified {
match input { match input {
&Dimension(ref value, ref unit) => &Dimension(ref value, ref unit) =>
Length::parse_dimension(value.value, unit.as_slice()).map(PositionComponent::Length), Length::parse_dimension(value.value, unit.as_slice()).map(PositionComponent::Length),
&ast::Percentage(ref value) => Ok(PositionComponent::Percentage(value.value / 100.)), &Percentage(ref value) => Ok(PositionComponent::Percentage(value.value / 100.)),
&Number(ref value) if value.value == 0. => Ok(PositionComponent::Length(Length::Au(Au(0)))), &Number(ref value) if value.value == 0. => Ok(PositionComponent::Length(Length::Au(Au(0)))),
&Ident(ref value) => { &Ident(ref value) => {
if value.as_slice().eq_ignore_ascii_case("center") { Ok(PositionComponent::Center) } if value.as_slice().eq_ignore_ascii_case("center") { Ok(PositionComponent::Center) }
@ -464,11 +465,11 @@ pub mod specified {
pub fn from_component_value(component_value: &ComponentValue, base_url: &Url) pub fn from_component_value(component_value: &ComponentValue, base_url: &Url)
-> Result<Image,()> { -> Result<Image,()> {
match component_value { match component_value {
&ast::URL(ref url) => { &URL(ref url) => {
let image_url = super::parse_url(url.as_slice(), base_url); let image_url = super::parse_url(url.as_slice(), base_url);
Ok(Image::Url(image_url)) Ok(Image::Url(image_url))
}, },
&ast::Function(ref name, ref args) => { &Function(ref name, ref args) => {
if name.as_slice().eq_ignore_ascii_case("linear-gradient") { if name.as_slice().eq_ignore_ascii_case("linear-gradient") {
Ok(Image::LinearGradient(try!( Ok(Image::LinearGradient(try!(
super::specified::LinearGradient::parse_function( super::specified::LinearGradient::parse_function(

View file

@ -14,6 +14,7 @@ pub use url::Url;
pub use cssparser::*; pub use cssparser::*;
pub use cssparser::ast::*; pub use cssparser::ast::*;
pub use cssparser::ast::ComponentValue::*;
pub use geom::SideOffsets2D; pub use geom::SideOffsets2D;
pub use self::common_types::specified::{Angle, AngleOrCorner}; pub use self::common_types::specified::{Angle, AngleOrCorner};
pub use self::common_types::specified::{HorizontalDirection, VerticalDirection}; pub use self::common_types::specified::{HorizontalDirection, VerticalDirection};
@ -480,7 +481,7 @@ pub mod longhands {
fn from_component_value(input: &ComponentValue, _: &Url) -> Result<SpecifiedValue,()> { fn from_component_value(input: &ComponentValue, _: &Url) -> Result<SpecifiedValue,()> {
match *input { match *input {
Ident(ref keyword) if keyword.as_slice().eq_ignore_ascii_case("auto") => Ok(T::Auto), Ident(ref keyword) if keyword.as_slice().eq_ignore_ascii_case("auto") => Ok(T::Auto),
ast::Number(ast::NumericValue { Number(NumericValue {
int_value: Some(value), int_value: Some(value),
.. ..
}) => Ok(T::Number(value as i32)), }) => Ok(T::Number(value as i32)),
@ -563,9 +564,9 @@ pub mod longhands {
pub fn from_component_value(input: &ComponentValue, _base_url: &Url) pub fn from_component_value(input: &ComponentValue, _base_url: &Url)
-> Result<SpecifiedValue, ()> { -> Result<SpecifiedValue, ()> {
match input { match input {
&ast::Number(ref value) if value.value >= 0. => &Number(ref value) if value.value >= 0. =>
Ok(SpecifiedValue::Number(value.value)), Ok(SpecifiedValue::Number(value.value)),
&ast::Percentage(ref value) if value.value >= 0. => &Percentage(ref value) if value.value >= 0. =>
Ok(SpecifiedValue::Percentage(value.value / 100.)), Ok(SpecifiedValue::Percentage(value.value / 100.)),
&Dimension(ref value, ref unit) if value.value >= 0. => &Dimension(ref value, ref unit) if value.value >= 0. =>
specified::Length::parse_dimension(value.value, unit.as_slice()) specified::Length::parse_dimension(value.value, unit.as_slice())
@ -829,7 +830,8 @@ pub mod longhands {
pub fn from_component_value(component_value: &ComponentValue, base_url: &Url) pub fn from_component_value(component_value: &ComponentValue, base_url: &Url)
-> Result<SpecifiedValue, ()> { -> Result<SpecifiedValue, ()> {
match component_value { match component_value {
&ast::Ident(ref value) if value.as_slice().eq_ignore_ascii_case("none") => { &Ident(ref value)
if value.as_slice().eq_ignore_ascii_case("none") => {
Ok(CSSImage(None)) Ok(CSSImage(None))
} }
_ => { _ => {

View file

@ -5,7 +5,6 @@
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
use std::collections::HashMap; use std::collections::HashMap;
use std::hash::Hash; use std::hash::Hash;
use std::num::div_rem;
use sync::Arc; use sync::Arc;
use url::Url; use url::Url;
@ -300,7 +299,7 @@ impl Stylist {
// (Does it make a difference?) // (Does it make a difference?)
for &filename in ["user-agent.css", "servo.css", "presentational-hints.css"].iter() { for &filename in ["user-agent.css", "servo.css", "presentational-hints.css"].iter() {
let ua_stylesheet = Stylesheet::from_bytes( let ua_stylesheet = Stylesheet::from_bytes(
read_resource_file([filename]).unwrap().as_slice(), read_resource_file(&[filename]).unwrap().as_slice(),
Url::parse(format!("chrome:///{}", filename).as_slice()).unwrap(), Url::parse(format!("chrome:///{}", filename).as_slice()).unwrap(),
None, None,
None, None,
@ -392,7 +391,7 @@ impl Stylist {
pub fn add_quirks_mode_stylesheet(&mut self) { pub fn add_quirks_mode_stylesheet(&mut self) {
self.add_stylesheet(Stylesheet::from_bytes( self.add_stylesheet(Stylesheet::from_bytes(
read_resource_file(["quirks-mode.css"]).unwrap().as_slice(), read_resource_file(&["quirks-mode.css"]).unwrap().as_slice(),
Url::parse("chrome:///quirks-mode.css").unwrap(), Url::parse("chrome:///quirks-mode.css").unwrap(),
None, None,
None, None,
@ -1083,15 +1082,14 @@ fn matches_generic_nth_child<'a,E,N>(element: &N,
index += 1; index += 1;
} }
} }
} }
if a == 0 { if a == 0 {
return b == index; b == index
} else {
(index - b) / a >= 0 &&
(index - b) % a == 0
} }
let (n, r) = div_rem(index - b, a);
n >= 0 && r == 0
} }
#[inline] #[inline]

View file

@ -7,6 +7,7 @@ use std::ascii::{AsciiExt, OwnedAsciiExt};
use sync::Arc; use sync::Arc;
use cssparser::ast::*; use cssparser::ast::*;
use cssparser::ast::ComponentValue::*;
use cssparser::{tokenize, parse_nth}; use cssparser::{tokenize, parse_nth};
use selector_matching::StylesheetOrigin; use selector_matching::StylesheetOrigin;

View file

@ -18,7 +18,6 @@ extern crate geom;
extern crate getopts; extern crate getopts;
extern crate layers; extern crate layers;
extern crate libc; extern crate libc;
extern crate native;
extern crate rand; extern crate rand;
extern crate rustrt; extern crate rustrt;
extern crate serialize; extern crate serialize;

View file

@ -6,7 +6,6 @@ use std::str::IntoMaybeOwned;
use std::task; use std::task;
use std::comm::Sender; use std::comm::Sender;
use std::task::TaskBuilder; use std::task::TaskBuilder;
use native::task::NativeTaskBuilder;
use rtinstrument; use rtinstrument;
use task_state; use task_state;
@ -18,10 +17,7 @@ pub fn spawn_named<S: IntoMaybeOwned<'static>>(name: S, f: proc():Send) {
} }
pub fn spawn_named_native<S: IntoMaybeOwned<'static>>(name: S, f: proc():Send) { pub fn spawn_named_native<S: IntoMaybeOwned<'static>>(name: S, f: proc():Send) {
let builder = task::TaskBuilder::new().named(name).native(); spawn_named(name, f)
builder.spawn(proc() {
rtinstrument::instrument(f);
});
} }
/// Arrange to send a particular message to a channel if the task fails. /// Arrange to send a particular message to a channel if the task fails.
@ -30,17 +26,11 @@ pub fn spawn_named_with_send_on_failure<T: Send>(name: &'static str,
f: proc(): Send, f: proc(): Send,
msg: T, msg: T,
dest: Sender<T>, dest: Sender<T>,
native: bool) { _native: bool) {
let with_state = proc() { let future_result = TaskBuilder::new().named(name).try_future(proc() {
task_state::initialize(state); task_state::initialize(state);
rtinstrument::instrument(f); rtinstrument::instrument(f);
}; });
let future_result = if native {
TaskBuilder::new().named(name).native().try_future(with_state)
} else {
TaskBuilder::new().named(name).try_future(with_state)
};
let watched_name = name.into_string(); let watched_name = name.into_string();
let watcher_name = format!("{}Watcher", watched_name); let watcher_name = format!("{}Watcher", watched_name);

View file

@ -71,21 +71,21 @@ pub enum TimeProfilerMsg {
#[repr(u32)] #[repr(u32)]
#[deriving(PartialEq, Clone, PartialOrd, Eq, Ord)] #[deriving(PartialEq, Clone, PartialOrd, Eq, Ord)]
pub enum TimeProfilerCategory { pub enum TimeProfilerCategory {
CompositingCategory, Compositing,
LayoutPerformCategory, LayoutPerform,
LayoutStyleRecalcCategory, LayoutStyleRecalc,
LayoutRestyleDamagePropagation, LayoutRestyleDamagePropagation,
LayoutNonIncrementalReset, LayoutNonIncrementalReset,
LayoutSelectorMatchCategory, LayoutSelectorMatch,
LayoutTreeBuilderCategory, LayoutTreeBuilder,
LayoutDamagePropagateCategory, LayoutDamagePropagate,
LayoutMainCategory, LayoutMain,
LayoutParallelWarmupCategory, LayoutParallelWarmup,
LayoutShapingCategory, LayoutShaping,
LayoutDispListBuildCategory, LayoutDispListBuild,
PaintingPerTileCategory, PaintingPerTile,
PaintingPrepBuffCategory, PaintingPrepBuff,
PaintingCategory, Painting,
} }
impl Formatable for TimeProfilerCategory { impl Formatable for TimeProfilerCategory {
@ -93,36 +93,36 @@ impl Formatable for TimeProfilerCategory {
// and should be printed to indicate this // and should be printed to indicate this
fn format(&self) -> String { fn format(&self) -> String {
let padding = match *self { let padding = match *self {
TimeProfilerCategory::LayoutStyleRecalcCategory | TimeProfilerCategory::LayoutStyleRecalc |
TimeProfilerCategory::LayoutRestyleDamagePropagation | TimeProfilerCategory::LayoutRestyleDamagePropagation |
TimeProfilerCategory::LayoutNonIncrementalReset | TimeProfilerCategory::LayoutNonIncrementalReset |
TimeProfilerCategory::LayoutMainCategory | TimeProfilerCategory::LayoutMain |
TimeProfilerCategory::LayoutDispListBuildCategory | TimeProfilerCategory::LayoutDispListBuild |
TimeProfilerCategory::LayoutShapingCategory | TimeProfilerCategory::LayoutShaping |
TimeProfilerCategory::LayoutDamagePropagateCategory | TimeProfilerCategory::LayoutDamagePropagate |
TimeProfilerCategory::PaintingPerTileCategory | TimeProfilerCategory::PaintingPerTile |
TimeProfilerCategory::PaintingPrepBuffCategory => "+ ", TimeProfilerCategory::PaintingPrepBuff => "+ ",
TimeProfilerCategory::LayoutParallelWarmupCategory | TimeProfilerCategory::LayoutParallelWarmup |
TimeProfilerCategory::LayoutSelectorMatchCategory | TimeProfilerCategory::LayoutSelectorMatch |
TimeProfilerCategory::LayoutTreeBuilderCategory => "| + ", TimeProfilerCategory::LayoutTreeBuilder => "| + ",
_ => "" _ => ""
}; };
let name = match *self { let name = match *self {
TimeProfilerCategory::CompositingCategory => "Compositing", TimeProfilerCategory::Compositing => "Compositing",
TimeProfilerCategory::LayoutPerformCategory => "Layout", TimeProfilerCategory::LayoutPerform => "Layout",
TimeProfilerCategory::LayoutStyleRecalcCategory => "Style Recalc", TimeProfilerCategory::LayoutStyleRecalc => "Style Recalc",
TimeProfilerCategory::LayoutRestyleDamagePropagation => "Restyle Damage Propagation", TimeProfilerCategory::LayoutRestyleDamagePropagation => "Restyle Damage Propagation",
TimeProfilerCategory::LayoutNonIncrementalReset => "Non-incremental reset (temporary)", TimeProfilerCategory::LayoutNonIncrementalReset => "Non-incremental reset (temporary)",
TimeProfilerCategory::LayoutSelectorMatchCategory => "Selector Matching", TimeProfilerCategory::LayoutSelectorMatch => "Selector Matching",
TimeProfilerCategory::LayoutTreeBuilderCategory => "Tree Building", TimeProfilerCategory::LayoutTreeBuilder => "Tree Building",
TimeProfilerCategory::LayoutDamagePropagateCategory => "Damage Propagation", TimeProfilerCategory::LayoutDamagePropagate => "Damage Propagation",
TimeProfilerCategory::LayoutMainCategory => "Primary Layout Pass", TimeProfilerCategory::LayoutMain => "Primary Layout Pass",
TimeProfilerCategory::LayoutParallelWarmupCategory => "Parallel Warmup", TimeProfilerCategory::LayoutParallelWarmup => "Parallel Warmup",
TimeProfilerCategory::LayoutShapingCategory => "Shaping", TimeProfilerCategory::LayoutShaping => "Shaping",
TimeProfilerCategory::LayoutDispListBuildCategory => "Display List Construction", TimeProfilerCategory::LayoutDispListBuild => "Display List Construction",
TimeProfilerCategory::PaintingPerTileCategory => "Painting Per Tile", TimeProfilerCategory::PaintingPerTile => "Painting Per Tile",
TimeProfilerCategory::PaintingPrepBuffCategory => "Buffer Prep", TimeProfilerCategory::PaintingPrepBuff => "Buffer Prep",
TimeProfilerCategory::PaintingCategory => "Painting", TimeProfilerCategory::Painting => "Painting",
}; };
format!("{}{}", padding, name) format!("{}{}", padding, name)
} }

View file

@ -23,8 +23,8 @@ use gleam::gl;
use layers::geometry::DevicePixel; use layers::geometry::DevicePixel;
use layers::platform::surface::NativeGraphicsMetadata; use layers::platform::surface::NativeGraphicsMetadata;
use libc::c_int; use libc::c_int;
use msg::compositor_msg::{Blank, FinishedLoading, IdlePaintState, Loading, PaintState}; use msg::compositor_msg::{Blank, FinishedLoading, Loading, PaintState};
use msg::compositor_msg::{PaintingPaintState, PerformingLayout, ReadyState}; use msg::compositor_msg::{PerformingLayout, ReadyState};
use msg::constellation_msg::{mod, LoadData}; use msg::constellation_msg::{mod, LoadData};
use msg::constellation_msg::{Key, KeyModifiers, CONTROL, SHIFT}; use msg::constellation_msg::{Key, KeyModifiers, CONTROL, SHIFT};
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
@ -81,7 +81,7 @@ impl Window {
mouse_down_point: Cell::new(Point2D(0 as c_int, 0)), mouse_down_point: Cell::new(Point2D(0 as c_int, 0)),
ready_state: Cell::new(Blank), ready_state: Cell::new(Blank),
paint_state: Cell::new(IdlePaintState), paint_state: Cell::new(PaintState::Idle),
last_title_set_time: Cell::new(Timespec::new(0, 0)), last_title_set_time: Cell::new(Timespec::new(0, 0)),
}; };
@ -354,10 +354,10 @@ impl Window {
} }
FinishedLoading => { FinishedLoading => {
match self.paint_state.get() { match self.paint_state.get() {
PaintingPaintState => { PaintState::Painting => {
self.glfw_window.set_title("Rendering — Servo [GLFW]") self.glfw_window.set_title("Rendering — Servo [GLFW]")
} }
IdlePaintState => { PaintState::Idle => {
self.glfw_window.set_title("Servo [GLFW]") self.glfw_window.set_title("Servo [GLFW]")
} }
} }

View file

@ -19,8 +19,8 @@ use layers::geometry::DevicePixel;
use layers::platform::surface::NativeGraphicsMetadata; use layers::platform::surface::NativeGraphicsMetadata;
use msg::constellation_msg; use msg::constellation_msg;
use msg::constellation_msg::{Key, CONTROL, SHIFT, ALT}; use msg::constellation_msg::{Key, CONTROL, SHIFT, ALT};
use msg::compositor_msg::{IdlePaintState, PaintState, PaintingPaintState}; use msg::compositor_msg::{PaintState, FinishedLoading, Blank, Loading};
use msg::compositor_msg::{FinishedLoading, Blank, Loading, PerformingLayout, ReadyState}; use msg::compositor_msg::{PerformingLayout, ReadyState};
use msg::constellation_msg::LoadData; use msg::constellation_msg::LoadData;
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::num::Float; use std::num::Float;
@ -156,7 +156,7 @@ impl Window {
mouse_pos: Cell::new(Point2D(0, 0)), mouse_pos: Cell::new(Point2D(0, 0)),
ready_state: Cell::new(Blank), ready_state: Cell::new(Blank),
paint_state: Cell::new(IdlePaintState), paint_state: Cell::new(PaintState::Idle),
key_modifiers: Cell::new(KeyModifiers::empty()), key_modifiers: Cell::new(KeyModifiers::empty()),
last_title_set_time: Cell::new(Timespec::new(0, 0)), last_title_set_time: Cell::new(Timespec::new(0, 0)),
@ -344,10 +344,10 @@ impl Window {
} }
FinishedLoading => { FinishedLoading => {
match self.paint_state.get() { match self.paint_state.get() {
PaintingPaintState => { PaintState::Painting => {
window.set_title("Rendering - Servo [glutin]") window.set_title("Rendering - Servo [glutin]")
} }
IdlePaintState => { PaintState::Idle => {
window.set_title("Servo [glutin]") window.set_title("Servo [glutin]")
} }
} }

View file

@ -20,7 +20,6 @@ extern crate script;
extern crate layout; extern crate layout;
extern crate gfx; extern crate gfx;
extern crate libc; extern crate libc;
extern crate native;
extern crate rustrt; extern crate rustrt;
extern crate url; extern crate url;

View file

@ -6,7 +6,6 @@
#![deny(unused_variables)] #![deny(unused_variables)]
extern crate servo; extern crate servo;
extern crate native;
extern crate time; extern crate time;
extern crate "util" as servo_util; extern crate "util" as servo_util;

View file

@ -11,8 +11,7 @@ use geom::size::TypedSize2D;
use layers::geometry::DevicePixel; use layers::geometry::DevicePixel;
use layers::platform::surface::NativeGraphicsMetadata; use layers::platform::surface::NativeGraphicsMetadata;
use libc::c_int; use libc::c_int;
use msg::compositor_msg::{Blank, IdlePaintState}; use msg::compositor_msg::{Blank, ReadyState, PaintState};
use msg::compositor_msg::{ReadyState, PaintState};
use msg::constellation_msg::{Key, KeyModifiers}; use msg::constellation_msg::{Key, KeyModifiers};
use msg::constellation_msg::LoadData; use msg::constellation_msg::LoadData;
use std::cell::Cell; use std::cell::Cell;
@ -748,7 +747,7 @@ impl Window {
surf: eglwindow, surf: eglwindow,
ready_state: Cell::new(Blank), ready_state: Cell::new(Blank),
paint_state: Cell::new(IdlePaintState), paint_state: Cell::new(PaintState::Idle),
}; };
Rc::new(window) Rc::new(window)