diff options
100 files changed, 1108 insertions, 2133 deletions
diff --git a/components/canvas/canvas_paint_thread.rs b/components/canvas/canvas_paint_thread.rs index b87470f53c6..26863482a99 100644 --- a/components/canvas/canvas_paint_thread.rs +++ b/components/canvas/canvas_paint_thread.rs @@ -12,7 +12,6 @@ use euclid::point::Point2D; use euclid::rect::Rect; use euclid::size::Size2D; use ipc_channel::ipc::{self, IpcSender}; -use ipc_channel::ipc::IpcSharedMemory; use num_traits::ToPrimitive; use std::borrow::ToOwned; use std::mem; @@ -195,6 +194,13 @@ impl<'a> CanvasPaintThread<'a> { CanvasCommonMsg::Recreate(size) => painter.recreate(size), } }, + CanvasMsg::FromScript(message) => { + match message { + FromScriptMsg::SendPixels(chan) => { + painter.send_pixels(chan) + } + } + } CanvasMsg::FromLayout(message) => { match message { FromLayoutMsg::SendData(chan) => { @@ -539,6 +545,12 @@ impl<'a> CanvasPaintThread<'a> { self.drawtarget = CanvasPaintThread::create(size); } + fn send_pixels(&mut self, chan: IpcSender<Option<Vec<u8>>>) { + self.drawtarget.snapshot().get_data_surface().with_data(|element| { + chan.send(Some(element.into())).unwrap(); + }) + } + fn send_data(&mut self, chan: IpcSender<CanvasData>) { self.drawtarget.snapshot().get_data_surface().with_data(|element| { let size = self.drawtarget.get_size(); @@ -548,11 +560,10 @@ impl<'a> CanvasPaintThread<'a> { webrender_traits::ImageFormat::RGBA8, element.into()); - let pixel_data = CanvasPixelData { - image_data: IpcSharedMemory::from_bytes(element), + let data = CanvasImageData { image_key: self.webrender_image_key, }; - chan.send(CanvasData::Pixels(pixel_data)).unwrap(); + chan.send(CanvasData::Image(data)).unwrap(); }) } diff --git a/components/canvas/webgl_paint_thread.rs b/components/canvas/webgl_paint_thread.rs index 88ab2080a81..13a69718f2d 100644 --- a/components/canvas/webgl_paint_thread.rs +++ b/components/canvas/webgl_paint_thread.rs @@ -2,11 +2,11 @@ * 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/. */ -use canvas_traits::{CanvasCommonMsg, CanvasData, CanvasMsg, CanvasPixelData}; -use canvas_traits::{FromLayoutMsg, byte_swap}; +use canvas_traits::{CanvasCommonMsg, CanvasData, CanvasMsg, CanvasImageData}; +use canvas_traits::{FromLayoutMsg, FromScriptMsg, byte_swap}; use euclid::size::Size2D; use gleam::gl; -use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory}; +use ipc_channel::ipc::{self, IpcSender}; use offscreen_gl_context::{ColorAttachmentType, GLContext, GLLimits}; use offscreen_gl_context::{GLContextAttributes, NativeGLContext, OSMesaContext}; use std::borrow::ToOwned; @@ -173,6 +173,15 @@ impl WebGLPaintThread { CanvasCommonMsg::Recreate(size) => painter.recreate(size).unwrap(), } }, + CanvasMsg::FromScript(message) => { + match message { + FromScriptMsg::SendPixels(chan) =>{ + // Read the comment on + // HTMLCanvasElement::fetch_all_data. + chan.send(None).unwrap(); + } + } + } CanvasMsg::FromLayout(message) => { match message { FromLayoutMsg::SendData(chan) => @@ -218,12 +227,11 @@ impl WebGLPaintThread { webrender_traits::ImageFormat::RGBA8, pixels.clone()); - let pixel_data = CanvasPixelData { - image_data: IpcSharedMemory::from_bytes(&pixels[..]), + let image_data = CanvasImageData { image_key: image_key, }; - chan.send(CanvasData::Pixels(pixel_data)).unwrap(); + chan.send(CanvasData::Image(image_data)).unwrap(); } WebGLPaintTaskData::WebRender(_, id) => { chan.send(CanvasData::WebGL(id)).unwrap(); diff --git a/components/canvas_traits/lib.rs b/components/canvas_traits/lib.rs index 5a1acc710d5..8269664cd46 100644 --- a/components/canvas_traits/lib.rs +++ b/components/canvas_traits/lib.rs @@ -31,7 +31,7 @@ use euclid::matrix2d::Matrix2D; use euclid::point::Point2D; use euclid::rect::Rect; use euclid::size::Size2D; -use ipc_channel::ipc::{IpcSender, IpcSharedMemory}; +use ipc_channel::ipc::IpcSender; use std::default::Default; use std::str::FromStr; use webrender_traits::{WebGLCommand, WebGLContextId}; @@ -47,6 +47,7 @@ pub enum CanvasMsg { Canvas2d(Canvas2dMsg), Common(CanvasCommonMsg), FromLayout(FromLayoutMsg), + FromScript(FromScriptMsg), WebGL(WebGLCommand), } @@ -58,13 +59,12 @@ pub enum CanvasCommonMsg { #[derive(Clone, Deserialize, Serialize)] pub enum CanvasData { - Pixels(CanvasPixelData), + Image(CanvasImageData), WebGL(WebGLContextId), } #[derive(Clone, Deserialize, Serialize)] -pub struct CanvasPixelData { - pub image_data: IpcSharedMemory, +pub struct CanvasImageData { pub image_key: webrender_traits::ImageKey, } @@ -74,6 +74,11 @@ pub enum FromLayoutMsg { } #[derive(Clone, Deserialize, Serialize)] +pub enum FromScriptMsg { + SendPixels(IpcSender<Option<Vec<u8>>>), +} + +#[derive(Clone, Deserialize, Serialize)] pub enum Canvas2dMsg { Arc(Point2D<f32>, f32, f32, f32, bool), ArcTo(Point2D<f32>, Point2D<f32>, f32), diff --git a/components/constellation/Cargo.toml b/components/constellation/Cargo.toml index 7ae0408d200..85785ffff60 100644 --- a/components/constellation/Cargo.toml +++ b/components/constellation/Cargo.toml @@ -15,6 +15,7 @@ bluetooth_traits = { path = "../bluetooth_traits" } canvas = {path = "../canvas"} canvas_traits = {path = "../canvas_traits"} compositing = {path = "../compositing"} +debugger = {path = "../debugger"} devtools_traits = {path = "../devtools_traits"} euclid = "0.10.1" gfx = {path = "../gfx"} diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index cbf08c58a47..54d78851420 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -17,6 +17,7 @@ use canvas_traits::CanvasMsg; use compositing::SendableFrameTree; use compositing::compositor_thread::CompositorProxy; use compositing::compositor_thread::Msg as ToCompositorMsg; +use debugger; use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg}; use euclid::scale_factor::ScaleFactor; use euclid::size::{Size2D, TypedSize2D}; @@ -113,6 +114,9 @@ pub struct Constellation<Message, LTF, STF> { /// A channel through which messages can be sent to the image cache thread. image_cache_thread: ImageCacheThread, + /// A channel through which messages can be sent to the debugger. + debugger_chan: Option<debugger::Sender>, + /// A channel through which messages can be sent to the developer tools. devtools_chan: Option<Sender<DevtoolsControlMsg>>, @@ -190,6 +194,8 @@ pub struct Constellation<Message, LTF, STF> { pub struct InitialConstellationState { /// A channel through which messages can be sent to the compositor. pub compositor_proxy: Box<CompositorProxy + Send>, + /// A channel to the debugger, if applicable. + pub debugger_chan: Option<debugger::Sender>, /// A channel to the developer tools, if applicable. pub devtools_chan: Option<Sender<DevtoolsControlMsg>>, /// A channel to the bluetooth thread. @@ -482,6 +488,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> compositor_receiver: compositor_receiver, layout_receiver: layout_receiver, compositor_proxy: state.compositor_proxy, + debugger_chan: state.debugger_chan, devtools_chan: state.devtools_chan, bluetooth_thread: state.bluetooth_thread, public_resource_threads: state.public_resource_threads, @@ -1070,6 +1077,10 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> warn!("Exit resource thread failed ({})", e); } + if let Some(ref chan) = self.debugger_chan { + debugger::shutdown_server(chan); + } + if let Some(ref chan) = self.devtools_chan { debug!("Exiting devtools."); let msg = DevtoolsControlMsg::FromChrome(ChromeToDevtoolsControlMsg::ServerExitMsg); diff --git a/components/constellation/lib.rs b/components/constellation/lib.rs index 19b800baa19..dfb384ac58b 100644 --- a/components/constellation/lib.rs +++ b/components/constellation/lib.rs @@ -15,6 +15,7 @@ extern crate bluetooth_traits; extern crate canvas; extern crate canvas_traits; extern crate compositing; +extern crate debugger; extern crate devtools_traits; extern crate euclid; #[cfg(not(target_os = "windows"))] diff --git a/components/debugger/Cargo.toml b/components/debugger/Cargo.toml index 9a12e74b5bb..413e17b3dc2 100644 --- a/components/debugger/Cargo.toml +++ b/components/debugger/Cargo.toml @@ -11,5 +11,6 @@ path = "lib.rs" crate_type = ["rlib"] [dependencies] -util = { path = "../util" } -websocket = "0.17.1" +log = "0.3.5" +util = {path = "../util"} +ws = "0.5.3" diff --git a/components/debugger/lib.rs b/components/debugger/lib.rs index d2f9713c4f9..c5c69074b4f 100644 --- a/components/debugger/lib.rs +++ b/components/debugger/lib.rs @@ -2,49 +2,68 @@ * 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/. */ +#[macro_use] +extern crate log; extern crate util; -extern crate websocket; +extern crate ws; +use std::sync::mpsc; +use std::sync::mpsc::channel; use util::thread::spawn_named; -use websocket::{Message, Receiver, Sender, Server}; -use websocket::message::Type; +use ws::{Builder, CloseCode, Handler, Handshake}; -pub fn start_server(port: u16) { - println!("Starting debugger server."); - spawn_named("debugger-server".to_owned(), move || { - run_server(port) - }); +enum Message { + ShutdownServer, +} + +pub struct Sender(mpsc::Sender<Message>); + +struct Connection { + sender: ws::Sender +} + +impl Handler for Connection { + fn on_open(&mut self, _: Handshake) -> ws::Result<()> { + debug!("Connection opened."); + Ok(()) + } + + fn on_close(&mut self, _: CloseCode, _: &str) { + debug!("Connection closed."); + } + + fn on_message(&mut self, message: ws::Message) -> ws::Result<()> { + self.sender.send(message) + } } -fn run_server(port: u16) { - let server = Server::bind(("127.0.0.1", port)).unwrap(); - for connection in server { - spawn_named("debugger-connection".to_owned(), move || { - let connection = connection.unwrap(); - let request = connection.read_request().unwrap(); - let response = request.accept(); - let client = response.send().unwrap(); - let (mut sender, mut receiver) = client.split(); - for message in receiver.incoming_messages() { - let message: Message = message.unwrap(); - match message.opcode { - Type::Close => { - let message = Message::close(); - sender.send_message(&message).unwrap(); - break; - } - Type::Ping => { - let message = Message::pong(message.payload); - sender.send_message(&message).unwrap(); - } - Type::Text => { - sender.send_message(&message).unwrap(); - } - _ => { - panic!("Unexpected message type."); - } +pub fn start_server(port: u16) -> Sender { + debug!("Starting server."); + let (sender, receiver) = channel(); + spawn_named("debugger".to_owned(), move || { + let socket = Builder::new().build(|sender: ws::Sender| { + Connection { sender: sender } + }).unwrap(); + let sender = socket.broadcaster(); + spawn_named("debugger-websocket".to_owned(), move || { + socket.listen(("127.0.0.1", port)).unwrap(); + }); + while let Ok(message) = receiver.recv() { + match message { + Message::ShutdownServer => { + break; } } - }); + } + sender.shutdown().unwrap(); + }); + Sender(sender) +} + +pub fn shutdown_server(sender: &Sender) { + debug!("Shutting down server."); + let &Sender(ref sender) = sender; + if let Err(_) = sender.send(Message::ShutdownServer) { + warn!("Failed to shut down server."); } } diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs index 99b1fc0b21c..ab8f1ba7a8f 100644 --- a/components/gfx/display_list/mod.rs +++ b/components/gfx/display_list/mod.rs @@ -81,7 +81,15 @@ impl DisplayList { scroll_offsets, result); } - &DisplayItem::PopStackingContext(_) => return, + &DisplayItem::PushScrollRoot(ref item) => { + self.hit_test_scroll_root(traversal, + &item.scroll_root, + *translated_point, + client_point, + scroll_offsets, + result); + } + &DisplayItem::PopStackingContext(_) | &DisplayItem::PopScrollRoot(_) => return, _ => { if let Some(meta) = item.hit_test(*translated_point) { result.push(meta); @@ -91,6 +99,26 @@ impl DisplayList { } } + fn hit_test_scroll_root<'a>(&self, + traversal: &mut DisplayListTraversal<'a>, + scroll_root: &ScrollRoot, + mut translated_point: Point2D<Au>, + client_point: &Point2D<Au>, + scroll_offsets: &ScrollOffsetMap, + result: &mut Vec<DisplayItemMetadata>) { + // Adjust the translated point to account for the scroll offset if + // necessary. This can only happen when WebRender is in use. + // + // We don't perform this adjustment on the root stacking context because + // the DOM-side code has already translated the point for us (e.g. in + // `Window::hit_test_query()`) by now. + if let Some(scroll_offset) = scroll_offsets.get(&scroll_root.id) { + translated_point.x -= Au::from_f32_px(scroll_offset.x); + translated_point.y -= Au::from_f32_px(scroll_offset.y); + } + self.hit_test_contents(traversal, &translated_point, client_point, scroll_offsets, result); + } + fn hit_test_stacking_context<'a>(&self, traversal: &mut DisplayListTraversal<'a>, stacking_context: &StackingContext, @@ -102,7 +130,7 @@ impl DisplayList { // stacking context isn't fixed. If it's fixed, we need to use the client point anyway. debug_assert!(stacking_context.context_type == StackingContextType::Real); let is_fixed = stacking_context.scroll_policy == ScrollPolicy::FixedPosition; - let mut translated_point = if is_fixed { + let translated_point = if is_fixed { *client_point } else { let point = *translated_point - stacking_context.bounds.origin; @@ -112,21 +140,6 @@ impl DisplayList { Point2D::new(Au::from_f32_px(frac_point.x), Au::from_f32_px(frac_point.y)) }; - // Adjust the translated point to account for the scroll offset if - // necessary. This can only happen when WebRender is in use. - // - // We don't perform this adjustment on the root stacking context because - // the DOM-side code has already translated the point for us (e.g. in - // `Window::hit_test_query()`) by now. - if !is_fixed && stacking_context.id != StackingContextId::root() { - if let Some(scroll_root_id) = stacking_context.overflow_scroll_id { - if let Some(scroll_offset) = scroll_offsets.get(&scroll_root_id) { - translated_point.x -= Au::from_f32_px(scroll_offset.x); - translated_point.y -= Au::from_f32_px(scroll_offset.y); - } - } - } - self.hit_test_contents(traversal, &translated_point, client_point, scroll_offsets, result); } @@ -138,9 +151,10 @@ impl DisplayList { pub fn print_with_tree(&self, print_tree: &mut PrintTree) { print_tree.new_level("Items".to_owned()); for item in &self.list { - print_tree.add_item(format!("{:?} StackingContext: {:?}", + print_tree.add_item(format!("{:?} StackingContext: {:?} ScrollRoot: {:?}", item, - item.base().stacking_context_id)); + item.base().stacking_context_id, + item.scroll_root_id())); } print_tree.end_level(); } @@ -250,6 +264,7 @@ pub enum StackingContextType { Real, PseudoPositioned, PseudoFloat, + PseudoScrollingArea, } #[derive(Clone, HeapSizeOf, Deserialize, Serialize)] @@ -291,8 +306,8 @@ pub struct StackingContext { /// Children of this StackingContext. pub children: Vec<StackingContext>, - /// If this StackingContext scrolls its overflow area, this will contain the id. - pub overflow_scroll_id: Option<ScrollRootId>, + /// The id of the parent scrolling area that contains this StackingContext. + pub parent_scroll_id: ScrollRootId, } impl StackingContext { @@ -309,7 +324,7 @@ impl StackingContext { perspective: Matrix4D<f32>, establishes_3d_context: bool, scroll_policy: ScrollPolicy, - scroll_root_id: Option<ScrollRootId>) + parent_scroll_id: ScrollRootId) -> StackingContext { StackingContext { id: id, @@ -324,7 +339,7 @@ impl StackingContext { establishes_3d_context: establishes_3d_context, scroll_policy: scroll_policy, children: Vec::new(), - overflow_scroll_id: scroll_root_id, + parent_scroll_id: parent_scroll_id, } } @@ -341,7 +356,7 @@ impl StackingContext { Matrix4D::identity(), true, ScrollPolicy::Scrollable, - None) + ScrollRootId::root()) } pub fn add_child(&mut self, mut child: StackingContext) { @@ -453,21 +468,40 @@ impl fmt::Debug for StackingContext { "Pseudo-StackingContext" }; - let scrollable_string = if self.overflow_scroll_id.is_some() { - " (scrolls overflow area)" - } else { - "" - }; - - write!(f, "{}{} at {:?} with overflow {:?}: {:?}", + write!(f, "{} at {:?} with overflow {:?}: {:?}", type_string, - scrollable_string, self.bounds, self.overflow, self.id) } } +/// Defines a stacking context. +#[derive(Clone, Debug, HeapSizeOf, Deserialize, Serialize)] +pub struct ScrollRoot { + /// The unique ID of this ScrollRoot. + pub id: ScrollRootId, + + /// The unique ID of the parent of this ScrollRoot. + pub parent_id: ScrollRootId, + + /// The position of this scroll root's frame in the parent stacking context. + pub clip: Rect<Au>, + + /// The size of the contents that can be scrolled inside of the scroll root. + pub size: Size2D<Au>, +} + +impl ScrollRoot { + pub fn to_push(&self) -> DisplayItem { + DisplayItem::PushScrollRoot(box PushScrollRootItem { + base: BaseDisplayItem::empty(), + scroll_root: self.clone(), + }) + } +} + + /// One drawing command in the list. #[derive(Clone, Deserialize, HeapSizeOf, Serialize)] pub enum DisplayItem { @@ -482,6 +516,8 @@ pub enum DisplayItem { Iframe(Box<IframeDisplayItem>), PushStackingContext(Box<PushStackingContextItem>), PopStackingContext(Box<PopStackingContextItem>), + PushScrollRoot(Box<PushScrollRootItem>), + PopScrollRoot(Box<BaseDisplayItem>), } /// Information common to all display items. @@ -501,6 +537,9 @@ pub struct BaseDisplayItem { /// The id of the stacking context this item belongs to. pub stacking_context_id: StackingContextId, + + /// The id of the scroll root this item belongs to. + pub scroll_root_id: ScrollRootId, } impl BaseDisplayItem { @@ -509,7 +548,8 @@ impl BaseDisplayItem { metadata: DisplayItemMetadata, clip: &ClippingRegion, section: DisplayListSection, - stacking_context_id: StackingContextId) + stacking_context_id: StackingContextId, + scroll_root_id: ScrollRootId) -> BaseDisplayItem { // Detect useless clipping regions here and optimize them to `ClippingRegion::max()`. // The painting backend may want to optimize out clipping regions and this makes it easier @@ -524,6 +564,7 @@ impl BaseDisplayItem { }, section: section, stacking_context_id: stacking_context_id, + scroll_root_id: scroll_root_id, } } @@ -538,6 +579,7 @@ impl BaseDisplayItem { clip: ClippingRegion::max(), section: DisplayListSection::Content, stacking_context_id: StackingContextId::root(), + scroll_root_id: ScrollRootId::root(), } } } @@ -981,6 +1023,15 @@ pub struct PopStackingContextItem { pub stacking_context_id: StackingContextId, } +/// Starts a group of items inside a particular scroll root. +#[derive(Clone, HeapSizeOf, Deserialize, Serialize)] +pub struct PushScrollRootItem { + /// Fields common to all display items. + pub base: BaseDisplayItem, + + /// The scroll root that this item starts. + pub scroll_root: ScrollRoot, +} /// How a box shadow should be clipped. #[derive(Clone, Copy, Debug, PartialEq, HeapSizeOf, Deserialize, Serialize)] @@ -1009,9 +1060,15 @@ impl DisplayItem { DisplayItem::Iframe(ref iframe) => &iframe.base, DisplayItem::PushStackingContext(ref stacking_context) => &stacking_context.base, DisplayItem::PopStackingContext(ref item) => &item.base, + DisplayItem::PushScrollRoot(ref item) => &item.base, + DisplayItem::PopScrollRoot(ref base) => &base, } } + pub fn scroll_root_id(&self) -> ScrollRootId { + self.base().scroll_root_id + } + pub fn stacking_context_id(&self) -> StackingContextId { self.base().stacking_context_id } @@ -1090,6 +1147,14 @@ impl fmt::Debug for DisplayItem { return write!(f, "PopStackingContext({:?}", item.stacking_context_id); } + if let DisplayItem::PushScrollRoot(ref item) = *self { + return write!(f, "PushScrollRoot({:?}", item.scroll_root); + } + + if let DisplayItem::PopScrollRoot(_) = *self { + return write!(f, "PopScrollRoot"); + } + write!(f, "{} @ {:?} {:?}", match *self { DisplayItem::SolidColor(ref solid_color) => @@ -1106,8 +1171,10 @@ impl fmt::Debug for DisplayItem { DisplayItem::Line(_) => "Line".to_owned(), DisplayItem::BoxShadow(_) => "BoxShadow".to_owned(), DisplayItem::Iframe(_) => "Iframe".to_owned(), - DisplayItem::PushStackingContext(_) => "".to_owned(), - DisplayItem::PopStackingContext(_) => "".to_owned(), + DisplayItem::PushStackingContext(_) | + DisplayItem::PopStackingContext(_) | + DisplayItem::PushScrollRoot(_) | + DisplayItem::PopScrollRoot(_) => "".to_owned(), }, self.bounds(), self.base().clip diff --git a/components/gfx_traits/lib.rs b/components/gfx_traits/lib.rs index 09593189512..9925326da7e 100644 --- a/components/gfx_traits/lib.rs +++ b/components/gfx_traits/lib.rs @@ -211,6 +211,11 @@ impl ScrollRootId { pub fn fragment_type(&self) -> FragmentType { FragmentType::from_usize(self.0 & 3) } + + #[inline] + pub fn to_stacking_context_id(&self) -> StackingContextId { + StackingContextId(self.0) + } } /// The type of fragment that a stacking context represents. diff --git a/components/layout/animation.rs b/components/layout/animation.rs index 22387dff562..9147970f8cf 100644 --- a/components/layout/animation.rs +++ b/components/layout/animation.rs @@ -9,12 +9,12 @@ use flow::{self, Flow}; use gfx::display_list::OpaqueNode; use ipc_channel::ipc::IpcSender; use msg::constellation_msg::PipelineId; -use script_layout_interface::restyle_damage::RestyleDamage; use script_traits::{AnimationState, ConstellationControlMsg, LayoutMsg as ConstellationMsg}; use std::collections::HashMap; use std::sync::mpsc::Receiver; use style::animation::{Animation, update_style_for_animation}; use style::dom::TRestyleDamage; +use style::selector_impl::RestyleDamage; use style::timer::Timer; /// Processes any new animations that were discovered after style recalculation. diff --git a/components/layout/block.rs b/components/layout/block.rs index 71db966d69c..7702783bf4c 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -48,8 +48,6 @@ use gfx_traits::print_tree::PrintTree; use layout_debug; use model::{CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo, MaybeAuto}; use model::{specified, specified_or_none}; -use script_layout_interface::restyle_damage::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW}; -use script_layout_interface::restyle_damage::REPOSITION; use sequential; use serde::{Serialize, Serializer}; use std::cmp::{max, min}; @@ -60,6 +58,7 @@ use style::computed_values::{position, text_align}; use style::context::{SharedStyleContext, StyleContext}; use style::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMode}; use style::properties::ServoComputedValues; +use style::servo::restyle_damage::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, REPOSITION}; use style::values::computed::{LengthOrPercentageOrNone, LengthOrPercentage}; use style::values::computed::LengthOrPercentageOrAuto; use util::clamp; @@ -1942,17 +1941,6 @@ impl Flow for BlockFlow { } if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) { - // `overflow: auto` and `overflow: scroll` force creation of layers, since we can only - // scroll layers. - match (self.fragment.style().get_box().overflow_x, - self.fragment.style().get_box().overflow_y.0) { - (overflow_x::T::auto, _) | (overflow_x::T::scroll, _) | - (_, overflow_x::T::auto) | (_, overflow_x::T::scroll) => { - self.base.clip = ClippingRegion::max(); - } - _ => {} - } - let position_start = self.base.position.start.to_physical(self.base.writing_mode, container_size); diff --git a/components/layout/construct.rs b/components/layout/construct.rs index 69e3a2d20d2..0b489459352 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -36,7 +36,6 @@ use list_item::{ListItemFlow, ListStyleTypeContent}; use multicol::{MulticolColumnFlow, MulticolFlow}; use parallel; use script_layout_interface::{LayoutElementType, LayoutNodeType, is_image_data}; -use script_layout_interface::restyle_damage::{BUBBLE_ISIZES, RECONSTRUCT_FLOW, RestyleDamage}; use script_layout_interface::wrapper_traits::{PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode}; use std::borrow::ToOwned; use std::collections::LinkedList; @@ -49,8 +48,9 @@ use style::computed_values::content::ContentItem; use style::computed_values::position; use style::context::SharedStyleContext; use style::properties::{self, ServoComputedValues}; +use style::selector_impl::{PseudoElement, RestyleDamage}; use style::selector_matching::Stylist; -use style::servo_selector_impl::PseudoElement; +use style::servo::restyle_damage::{BUBBLE_ISIZES, RECONSTRUCT_FLOW}; use table::TableFlow; use table_caption::TableCaptionFlow; use table_cell::TableCellFlow; diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index 17b3e07f716..3e5328afc27 100644 --- a/components/layout/display_list_builder.rs +++ b/components/layout/display_list_builder.rs @@ -15,6 +15,7 @@ use block::{BlockFlow, BlockStackingContextType}; use canvas_traits::{CanvasData, CanvasMsg, FromLayoutMsg}; use context::SharedLayoutContext; use euclid::{Matrix4D, Point2D, Radians, Rect, SideOffsets2D, Size2D}; +use euclid::point::TypedPoint2D; use flex::FlexFlow; use flow::{BaseFlow, Flow, IS_ABSOLUTELY_POSITIONED}; use flow_ref::FlowRef; @@ -25,7 +26,7 @@ use gfx::display_list::{BorderRadii, BoxShadowClipMode, BoxShadowDisplayItem, Cl use gfx::display_list::{DisplayItem, DisplayItemMetadata, DisplayList, DisplayListSection}; use gfx::display_list::{GradientDisplayItem, IframeDisplayItem, ImageDisplayItem}; use gfx::display_list::{LineDisplayItem, OpaqueNode}; -use gfx::display_list::{SolidColorDisplayItem, StackingContext, StackingContextType}; +use gfx::display_list::{SolidColorDisplayItem, ScrollRoot, StackingContext, StackingContextType}; use gfx::display_list::{TextDisplayItem, TextOrientation, WebGLDisplayItem, WebRenderImageInfo}; use gfx_traits::{ScrollPolicy, ScrollRootId, StackingContextId}; use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFlow, LAST_FRAGMENT_OF_ELEMENT}; @@ -35,7 +36,6 @@ use model::{self, MaybeAuto, ToGfxMatrix}; use net_traits::image::base::PixelFormat; use net_traits::image_cache_thread::UsePlaceholder; use range::Range; -use script_layout_interface::restyle_damage::REPAINT; use std::{cmp, f32}; use std::collections::HashMap; use std::default::Default; @@ -43,14 +43,15 @@ use std::mem; use std::sync::Arc; use style::computed_values::{background_attachment, background_clip, background_origin}; use style::computed_values::{background_repeat, background_size, border_style}; -use style::computed_values::{cursor, image_rendering, overflow_x, pointer_events, position}; -use style::computed_values::{transform, transform_style, visibility}; +use style::computed_values::{cursor, image_rendering, overflow_x}; +use style::computed_values::{pointer_events, position, transform, transform_style, visibility}; use style::computed_values::_servo_overflow_clip_box as overflow_clip_box; use style::computed_values::filter::Filter; use style::computed_values::text_shadow::TextShadow; use style::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMode}; use style::properties::{self, ServoComputedValues}; use style::properties::style_structs; +use style::servo::restyle_damage::REPAINT; use style::values::RGBA; use style::values::computed; use style::values::computed::{Gradient, GradientKind, LengthOrNone, LengthOrPercentage, LengthOrPercentageOrAuto}; @@ -95,6 +96,7 @@ pub struct DisplayListBuildState<'a> { pub shared_layout_context: &'a SharedLayoutContext, pub root_stacking_context: StackingContext, pub items: HashMap<StackingContextId, Vec<DisplayItem>>, + pub scroll_roots: HashMap<ScrollRootId, ScrollRoot>, pub stacking_context_id_stack: Vec<StackingContextId>, pub scroll_root_id_stack: Vec<ScrollRootId>, } @@ -107,6 +109,7 @@ impl<'a> DisplayListBuildState<'a> { shared_layout_context: shared_layout_context, root_stacking_context: StackingContext::root(), items: HashMap::new(), + scroll_roots: HashMap::new(), stacking_context_id_stack: vec!(stacking_context_id), scroll_root_id_stack: vec!(ScrollRootId::root()), } @@ -117,6 +120,11 @@ impl<'a> DisplayListBuildState<'a> { items.push(display_item); } + fn add_scroll_root(&mut self, scroll_root: ScrollRoot) { + debug_assert!(!self.scroll_roots.contains_key(&scroll_root.id)); + self.scroll_roots.insert(scroll_root.id, scroll_root); + } + pub fn stacking_context_id(&self) -> StackingContextId { self.stacking_context_id_stack.last().unwrap().clone() } @@ -126,14 +134,19 @@ impl<'a> DisplayListBuildState<'a> { } pub fn pop_stacking_context_id(&mut self) { - self.stacking_context_id_stack.pop(); assert!(!self.stacking_context_id_stack.is_empty()); + self.stacking_context_id_stack.pop(); } - pub fn scroll_root_id(&mut self) -> ScrollRootId { + pub fn scroll_root_id(&self) -> ScrollRootId { self.scroll_root_id_stack.last().unwrap().clone() } + pub fn parent_scroll_root_id(&self) -> ScrollRootId { + debug_assert!(self.scroll_root_id_stack.len() > 1); + self.scroll_root_id_stack[self.scroll_root_id_stack.len() - 2] + } + pub fn push_scroll_root_id(&mut self, id: ScrollRootId) { self.scroll_root_id_stack.push(id); } @@ -157,14 +170,18 @@ impl<'a> DisplayListBuildState<'a> { }, &clip, section, - self.stacking_context_id()) + self.stacking_context_id(), + self.scroll_root_id()) } pub fn to_display_list(mut self) -> DisplayList { + let mut scroll_root_stack = Vec::new(); + scroll_root_stack.push(ScrollRootId::root()); + let mut list = Vec::new(); let root_context = mem::replace(&mut self.root_stacking_context, StackingContext::root()); - self.to_display_list_for_stacking_context(&mut list, root_context); + self.to_display_list_for_stacking_context(&mut list, root_context, &mut scroll_root_stack); DisplayList { list: list, @@ -173,7 +190,8 @@ impl<'a> DisplayListBuildState<'a> { fn to_display_list_for_stacking_context(&mut self, list: &mut Vec<DisplayItem>, - mut stacking_context: StackingContext) { + mut stacking_context: StackingContext, + scroll_root_stack: &mut Vec<ScrollRootId>) { let mut child_items = self.items.remove(&stacking_context.id).unwrap_or(Vec::new()); child_items.sort_by(|a, b| a.base().section.cmp(&b.base().section)); child_items.reverse(); @@ -186,63 +204,114 @@ impl<'a> DisplayListBuildState<'a> { if !real_stacking_context { self.to_display_list_for_items(list, child_items, - child_stacking_contexts); + child_stacking_contexts, + scroll_root_stack); return; } + let mut scroll_root_stack = Vec::new(); + scroll_root_stack.push(stacking_context.parent_scroll_id); + let (push_item, pop_item) = stacking_context.to_display_list_items(); list.push(push_item); self.to_display_list_for_items(list, child_items, - child_stacking_contexts); + child_stacking_contexts, + &mut scroll_root_stack); list.push(pop_item); } fn to_display_list_for_items(&mut self, list: &mut Vec<DisplayItem>, mut child_items: Vec<DisplayItem>, - child_stacking_contexts: Vec<StackingContext>) { + child_stacking_contexts: Vec<StackingContext>, + scroll_root_stack: &mut Vec<ScrollRootId>) { // Properly order display items that make up a stacking context. "Steps" here // refer to the steps in CSS 2.1 Appendix E. // Steps 1 and 2: Borders and background for the root. while child_items.last().map_or(false, |child| child.section() == DisplayListSection::BackgroundAndBorders) { - list.push(child_items.pop().unwrap()); + let item = child_items.pop().unwrap(); + self.switch_scroll_roots(list, item.scroll_root_id(), scroll_root_stack); + list.push(item); } // Step 3: Positioned descendants with negative z-indices. let mut child_stacking_contexts = child_stacking_contexts.into_iter().peekable(); while child_stacking_contexts.peek().map_or(false, |child| child.z_index < 0) { let context = child_stacking_contexts.next().unwrap(); - self.to_display_list_for_stacking_context(list, context); + self.switch_scroll_roots(list, context.parent_scroll_id, scroll_root_stack); + self.to_display_list_for_stacking_context(list, context, scroll_root_stack); } // Step 4: Block backgrounds and borders. while child_items.last().map_or(false, |child| child.section() == DisplayListSection::BlockBackgroundsAndBorders) { - list.push(child_items.pop().unwrap()); + let item = child_items.pop().unwrap(); + self.switch_scroll_roots(list, item.scroll_root_id(), scroll_root_stack); + list.push(item); } // Step 5: Floats. while child_stacking_contexts.peek().map_or(false, |child| child.context_type == StackingContextType::PseudoFloat) { let context = child_stacking_contexts.next().unwrap(); - self.to_display_list_for_stacking_context(list, context); + self.switch_scroll_roots(list, context.parent_scroll_id, scroll_root_stack); + self.to_display_list_for_stacking_context(list, context, scroll_root_stack); } // Step 6 & 7: Content and inlines that generate stacking contexts. while child_items.last().map_or(false, |child| child.section() == DisplayListSection::Content) { - list.push(child_items.pop().unwrap()); + let item = child_items.pop().unwrap(); + self.switch_scroll_roots(list, item.scroll_root_id(), scroll_root_stack); + list.push(item); } // Step 8 & 9: Positioned descendants with nonnegative, numeric z-indices. for child in child_stacking_contexts { - self.to_display_list_for_stacking_context(list, child); + self.switch_scroll_roots(list, child.parent_scroll_id, scroll_root_stack); + self.to_display_list_for_stacking_context(list, child, scroll_root_stack); } // Step 10: Outlines. - list.extend(child_items); + for item in child_items.drain(..) { + self.switch_scroll_roots(list, item.scroll_root_id(), scroll_root_stack); + list.push(item); + } + + for _ in scroll_root_stack.drain(1..) { + list.push(DisplayItem::PopScrollRoot(Box::new(BaseDisplayItem::empty()))); + } + } + + fn switch_scroll_roots(&self, + list: &mut Vec<DisplayItem>, + new_id: ScrollRootId, + scroll_root_stack: &mut Vec<ScrollRootId>) { + if new_id == *scroll_root_stack.last().unwrap() { + return; + } + + if new_id == *scroll_root_stack.first().unwrap() { + for _ in scroll_root_stack.drain(1..) { + list.push(DisplayItem::PopScrollRoot(Box::new(BaseDisplayItem::empty()))); + } + return; + } + + // We never want to reach the root of the ScrollRoot tree without encountering the + // containing scroll root of this StackingContext. If this does happen we've tried to + // switch to a ScrollRoot that does not contain our current stacking context or isn't + // itself a direct child of our current stacking context. This should never happen + // due to CSS stacking rules. + debug_assert!(new_id != ScrollRootId::root()); + + let scroll_root = self.scroll_roots.get(&new_id).unwrap(); + self.switch_scroll_roots(list, scroll_root.parent_id, scroll_root_stack); + + scroll_root_stack.push(new_id); + list.push(scroll_root.to_push()); } } @@ -419,7 +488,7 @@ pub trait FragmentDisplayListBuilding { base_flow: &BaseFlow, scroll_policy: ScrollPolicy, mode: StackingContextCreationMode, - scroll_root_id: Option<ScrollRootId>) + parent_scroll_id: ScrollRootId) -> StackingContext; /// Returns the 4D matrix representing this fragment's transform. @@ -1436,16 +1505,16 @@ impl FragmentDisplayListBuilding for Fragment { self.style.get_cursor(Cursor::Default), DisplayListSection::Content); let display_item = match canvas_data { - CanvasData::Pixels(canvas_data) => { + CanvasData::Image(canvas_data) => { DisplayItem::Image(box ImageDisplayItem { base: base, - image_data: Some(Arc::new(canvas_data.image_data)), webrender_image: WebRenderImageInfo { width: computed_width as u32, height: computed_height as u32, format: PixelFormat::RGBA8, key: Some(canvas_data.image_key), }, + image_data: None, stretch_size: stacking_relative_content_box.size, tile_spacing: Size2D::zero(), image_rendering: image_rendering::T::auto, @@ -1476,9 +1545,8 @@ impl FragmentDisplayListBuilding for Fragment { base_flow: &BaseFlow, scroll_policy: ScrollPolicy, mode: StackingContextCreationMode, - scroll_root_id: Option<ScrollRootId>) + parent_scroll_id: ScrollRootId) -> StackingContext { - let scrolls_overflow_area = mode == StackingContextCreationMode::ScrollWrapper; let border_box = self.stacking_relative_border_box(&base_flow.stacking_relative_position, &base_flow.early_absolute_position_info @@ -1486,16 +1554,12 @@ impl FragmentDisplayListBuilding for Fragment { base_flow.early_absolute_position_info .relative_containing_block_mode, CoordinateSystem::Parent); - let overflow = if scrolls_overflow_area { - Rect::new(Point2D::zero(), base_flow.overflow.scroll.size) - } else { - // First, compute the offset of our border box (including relative positioning) - // from our flow origin, since that is what `BaseFlow::overflow` is relative to. - let border_box_offset = - border_box.translate(&-base_flow.stacking_relative_position).origin; - // Then, using that, compute our overflow region relative to our border box. - base_flow.overflow.paint.translate(&-border_box_offset) - }; + // First, compute the offset of our border box (including relative positioning) + // from our flow origin, since that is what `BaseFlow::overflow` is relative to. + let border_box_offset = + border_box.translate(&-base_flow.stacking_relative_position).origin; + // Then, using that, compute our overflow region relative to our border box. + let overflow = base_flow.overflow.paint.translate(&-border_box_offset); let transform = self.transform_matrix(&border_box); let perspective = match self.style().get_effects().perspective { @@ -1531,8 +1595,7 @@ impl FragmentDisplayListBuilding for Fragment { } let transform_style = self.style().get_used_transform_style(); - let establishes_3d_context = scrolls_overflow_area || - transform_style == transform_style::T::flat; + let establishes_3d_context = transform_style == transform_style::T::flat; let context_type = match mode { StackingContextCreationMode::PseudoFloat => StackingContextType::PseudoFloat, @@ -1551,7 +1614,7 @@ impl FragmentDisplayListBuilding for Fragment { perspective, establishes_3d_context, scroll_policy, - scroll_root_id) + parent_scroll_id) } fn adjust_clipping_region_for_children(&self, @@ -1829,18 +1892,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow { fn collect_stacking_contexts_for_block(&mut self, parent: &mut StackingContext, parent_scroll_root_id: ScrollRootId) { - let block_stacking_context_type = self.block_stacking_context_type(); - if block_stacking_context_type == BlockStackingContextType::NonstackingContext { - self.base.stacking_context_id = parent.id; - self.base.collect_stacking_contexts_for_children(parent, parent_scroll_root_id); - return; - } - - let stacking_context_id = StackingContextId::new_of_type(self.fragment.node.id() as usize, - self.fragment.fragment_type()); - - let has_scrolling_overflow = self.has_scrolling_overflow(); - let scroll_root_id = if has_scrolling_overflow { + let scroll_root_id = if self.has_scrolling_overflow() { ScrollRootId::new_of_type(self.fragment.node.id() as usize, self.fragment.fragment_type()) } else { @@ -1848,7 +1900,15 @@ impl BlockFlowDisplayListBuilding for BlockFlow { }; self.base.scroll_root_id = scroll_root_id; + let block_stacking_context_type = self.block_stacking_context_type(); + if block_stacking_context_type == BlockStackingContextType::NonstackingContext { + self.base.stacking_context_id = parent.id; + self.base.collect_stacking_contexts_for_children(parent, scroll_root_id); + return; + } + let stacking_context_id = StackingContextId::new_of_type(self.fragment.node.id() as usize, + self.fragment.fragment_type()); self.base.stacking_context_id = stacking_context_id; if block_stacking_context_type == BlockStackingContextType::PseudoStackingContext { @@ -1864,7 +1924,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow { &self.base, ScrollPolicy::Scrollable, creation_mode, - None); + parent_scroll_root_id); self.base.collect_stacking_contexts_for_children(&mut new_context, scroll_root_id); let new_children: Vec<StackingContext> = new_context.children.drain(..).collect(); @@ -1888,20 +1948,13 @@ impl BlockFlowDisplayListBuilding for BlockFlow { ScrollPolicy::Scrollable }; - let (creation_mode, internal_id) = if has_scrolling_overflow { - (StackingContextCreationMode::ScrollWrapper, Some(self.base.scroll_root_id)) - } else { - (StackingContextCreationMode::Normal, None) - }; - let mut stacking_context = self.fragment.create_stacking_context( stacking_context_id, &self.base, scroll_policy, - creation_mode, - internal_id); + StackingContextCreationMode::Normal, + parent_scroll_root_id); self.base.collect_stacking_contexts_for_children(&mut stacking_context, scroll_root_id); - parent.add_child(stacking_context); } @@ -1921,6 +1974,28 @@ impl BlockFlowDisplayListBuilding for BlockFlow { DisplayListSection::BlockBackgroundsAndBorders }; + if self.has_scrolling_overflow() { + let size = self.base.overflow.scroll.size; + let mut clip = self.fragment.stacking_relative_border_box( + &self.base.stacking_relative_position, + &self.base.early_absolute_position_info.relative_containing_block_size, + self.base.early_absolute_position_info.relative_containing_block_mode, + CoordinateSystem::Parent); + if establishes_stacking_context { + clip = Rect::new(TypedPoint2D::zero(), clip.size); + } + + let parent_id = state.parent_scroll_root_id(); + state.add_scroll_root( + ScrollRoot { + id: self.base.scroll_root_id, + parent_id: parent_id, + clip: clip, + size: size, + } + ); + } + // Add the box that starts the block context. self.fragment .build_display_list(state, @@ -2025,7 +2100,7 @@ impl InlineFlowDisplayListBuilding for InlineFlow { &self.base, ScrollPolicy::Scrollable, StackingContextCreationMode::Normal, - None)); + parent_scroll_root_id)); } _ => fragment.stacking_context_id = parent.id, } @@ -2229,7 +2304,6 @@ pub enum BorderPaintingMode<'a> { #[derive(Copy, Clone, PartialEq)] pub enum StackingContextCreationMode { Normal, - ScrollWrapper, PseudoPositioned, PseudoFloat, } diff --git a/components/layout/flex.rs b/components/layout/flex.rs index 0fca93fb5f3..337abc3227a 100644 --- a/components/layout/flex.rs +++ b/components/layout/flex.rs @@ -21,7 +21,6 @@ use gfx_traits::ScrollRootId; use layout_debug; use model::{Direction, IntrinsicISizes, MaybeAuto, MinMaxConstraint}; use model::{specified, specified_or_none}; -use script_layout_interface::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW}; use std::cmp::{max, min}; use std::ops::Range; use std::sync::Arc; @@ -30,6 +29,7 @@ use style::computed_values::border_collapse; use style::context::{SharedStyleContext, StyleContext}; use style::logical_geometry::LogicalSize; use style::properties::ServoComputedValues; +use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW}; use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto}; use style::values::computed::{LengthOrPercentageOrAutoOrContent, LengthOrPercentageOrNone}; diff --git a/components/layout/flow.rs b/components/layout/flow.rs index 22f64438f91..3da277d924d 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -41,8 +41,6 @@ use inline::InlineFlow; use model::{CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo}; use multicol::MulticolFlow; use parallel::FlowParallelInfo; -use script_layout_interface::restyle_damage::{RECONSTRUCT_FLOW, REFLOW, REFLOW_OUT_OF_FLOW}; -use script_layout_interface::restyle_damage::{REPAINT, REPOSITION, RestyleDamage}; use serde::{Serialize, Serializer}; use std::{fmt, mem, raw}; use std::iter::Zip; @@ -54,6 +52,8 @@ use style::context::SharedStyleContext; use style::dom::TRestyleDamage; use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode}; use style::properties::ServoComputedValues; +use style::selector_impl::RestyleDamage; +use style::servo::restyle_damage::{RECONSTRUCT_FLOW, REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, REPOSITION}; use style::values::computed::LengthOrPercentageOrAuto; use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, TableFlow}; use table_caption::TableCaptionFlow; diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index e624ad6013c..1fa3ae0612a 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -30,7 +30,6 @@ use net_traits::image_cache_thread::{ImageOrMetadataAvailable, UsePlaceholder}; use range::*; use script_layout_interface::HTMLCanvasData; use script_layout_interface::SVGSVGData; -use script_layout_interface::restyle_damage::{RECONSTRUCT_FLOW, RestyleDamage}; use script_layout_interface::wrapper_traits::{PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode}; use serde::{Serialize, Serializer}; use std::borrow::ToOwned; @@ -47,6 +46,8 @@ use style::context::SharedStyleContext; use style::dom::TRestyleDamage; use style::logical_geometry::{LogicalMargin, LogicalRect, LogicalSize, WritingMode}; use style::properties::ServoComputedValues; +use style::selector_impl::RestyleDamage; +use style::servo::restyle_damage::RECONSTRUCT_FLOW; use style::str::char_is_whitespace; use style::values::computed::{LengthOrNone, LengthOrPercentage, LengthOrPercentageOrAuto}; use style::values::computed::LengthOrPercentageOrNone; @@ -2594,8 +2595,6 @@ impl Fragment { transform_style::T::auto => {} } - // FIXME(pcwalton): Don't unconditionally form stacking contexts for `overflow_x: scroll` - // and `overflow_y: scroll`. This needs multiple layers per stacking context. match (self.style().get_box().position, self.style().get_position().z_index, self.style().get_box().overflow_x, @@ -2614,11 +2613,7 @@ impl Fragment { overflow_x::T::visible) => false, (position::T::absolute, _, _, _) | (position::T::fixed, _, _, _) | - (position::T::relative, _, _, _) | - (_, _, overflow_x::T::auto, _) | - (_, _, overflow_x::T::scroll, _) | - (_, _, _, overflow_x::T::auto) | - (_, _, _, overflow_x::T::scroll) => true, + (position::T::relative, _, _, _) => true, (position::T::static_, _, _, _) => false } } diff --git a/components/layout/generated_content.rs b/components/layout/generated_content.rs index a4c7f4e06fa..0d8038a0348 100644 --- a/components/layout/generated_content.rs +++ b/components/layout/generated_content.rs @@ -13,7 +13,6 @@ use flow::{self, AFFECTS_COUNTERS, Flow, HAS_COUNTER_AFFECTING_CHILDREN, Immutab use flow::InorderFlowTraversal; use fragment::{Fragment, GeneratedContentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo}; use gfx::display_list::OpaqueNode; -use script_layout_interface::restyle_damage::{RESOLVE_GENERATED_CONTENT, RestyleDamage}; use script_layout_interface::wrapper_traits::PseudoElementType; use smallvec::SmallVec; use std::collections::{HashMap, LinkedList}; @@ -22,6 +21,8 @@ use style::computed_values::{display, list_style_type}; use style::computed_values::content::ContentItem; use style::dom::TRestyleDamage; use style::properties::ServoComputedValues; +use style::selector_impl::RestyleDamage; +use style::servo::restyle_damage::RESOLVE_GENERATED_CONTENT; use text::TextRunScanner; // Decimal styles per CSS-COUNTER-STYLES § 6.1: diff --git a/components/layout/incremental.rs b/components/layout/incremental.rs index 14644be6ddc..83c9a5f4ddb 100644 --- a/components/layout/incremental.rs +++ b/components/layout/incremental.rs @@ -3,9 +3,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use flow::{self, AFFECTS_COUNTERS, Flow, HAS_COUNTER_AFFECTING_CHILDREN, IS_ABSOLUTELY_POSITIONED}; -use script_layout_interface::restyle_damage::{RestyleDamage, REFLOW, RECONSTRUCT_FLOW}; use style::computed_values::float; use style::dom::TRestyleDamage; +use style::selector_impl::RestyleDamage; +use style::servo::restyle_damage::{REFLOW, RECONSTRUCT_FLOW}; bitflags! { pub flags SpecialRestyleDamage: u8 { diff --git a/components/layout/inline.rs b/components/layout/inline.rs index 80b8c29eae6..735ee0acf90 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -24,8 +24,6 @@ use gfx_traits::print_tree::PrintTree; use layout_debug; use model::IntrinsicISizesContribution; use range::{Range, RangeIndex}; -use script_layout_interface::restyle_damage::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW}; -use script_layout_interface::restyle_damage::{REPOSITION, RESOLVE_GENERATED_CONTENT}; use script_layout_interface::wrapper_traits::PseudoElementType; use std::{fmt, i32, isize, mem}; use std::cmp::max; @@ -37,6 +35,7 @@ use style::computed_values::{text_overflow, vertical_align, white_space}; use style::context::{SharedStyleContext, StyleContext}; use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode}; use style::properties::ServoComputedValues; +use style::servo::restyle_damage::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, REPOSITION, RESOLVE_GENERATED_CONTENT}; use text; use unicode_bidi; diff --git a/components/layout/list_item.rs b/components/layout/list_item.rs index 2a925acd883..b3f8df9752d 100644 --- a/components/layout/list_item.rs +++ b/components/layout/list_item.rs @@ -20,12 +20,12 @@ use generated_content; use gfx::display_list::StackingContext; use gfx_traits::ScrollRootId; use inline::InlineFlow; -use script_layout_interface::restyle_damage::RESOLVE_GENERATED_CONTENT; use std::sync::Arc; use style::computed_values::{list_style_type, position}; use style::context::SharedStyleContext; use style::logical_geometry::LogicalSize; use style::properties::ServoComputedValues; +use style::servo::restyle_damage::RESOLVE_GENERATED_CONTENT; /// A block with the CSS `display` property equal to `list-item`. #[derive(Debug)] diff --git a/components/layout/sequential.rs b/components/layout/sequential.rs index 59819efe414..71626243206 100644 --- a/components/layout/sequential.rs +++ b/components/layout/sequential.rs @@ -15,8 +15,8 @@ use flow::IS_ABSOLUTELY_POSITIONED; use fragment::FragmentBorderBoxIterator; use generated_content::ResolveGeneratedContent; use gfx_traits::ScrollRootId; -use script_layout_interface::restyle_damage::{REFLOW, STORE_OVERFLOW}; use style::context::StyleContext; +use style::servo::restyle_damage::{REFLOW, STORE_OVERFLOW}; use traversal::{AssignBSizes, AssignISizes, BubbleISizes, BuildDisplayList}; use util::opts; diff --git a/components/layout/table.rs b/components/layout/table.rs index 3ffc5231f5a..b1f3a01fc22 100644 --- a/components/layout/table.rs +++ b/components/layout/table.rs @@ -21,7 +21,6 @@ use gfx_traits::ScrollRootId; use gfx_traits::print_tree::PrintTree; use layout_debug; use model::{IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto}; -use script_layout_interface::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW}; use std::cmp; use std::fmt; use std::sync::Arc; @@ -29,6 +28,7 @@ use style::computed_values::{border_collapse, border_spacing, table_layout}; use style::context::SharedStyleContext; use style::logical_geometry::LogicalSize; use style::properties::ServoComputedValues; +use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW}; use style::values::CSSFloat; use style::values::computed::LengthOrPercentageOrAuto; use table_row::{self, CellIntrinsicInlineSize, CollapsedBorder, CollapsedBorderProvenance}; diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs index 1b4df7b7bfc..3a39b4c1ce1 100644 --- a/components/layout/table_row.rs +++ b/components/layout/table_row.rs @@ -20,7 +20,6 @@ use gfx_traits::ScrollRootId; use gfx_traits::print_tree::PrintTree; use layout_debug; use model::MaybeAuto; -use script_layout_interface::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW}; use serde::{Serialize, Serializer}; use std::cmp::max; use std::fmt; @@ -30,6 +29,7 @@ use style::computed_values::{border_collapse, border_spacing, border_top_style}; use style::context::SharedStyleContext; use style::logical_geometry::{LogicalSize, PhysicalSide, WritingMode}; use style::properties::ServoComputedValues; +use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW}; use style::values::computed::LengthOrPercentageOrAuto; use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, VecExt}; use table_cell::{CollapsedBordersForCell, TableCellFlow}; diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs index c897838875a..b054568d5d5 100644 --- a/components/layout/traversal.rs +++ b/components/layout/traversal.rs @@ -10,13 +10,14 @@ use display_list_builder::DisplayListBuildState; use flow::{self, PreorderFlowTraversal}; use flow::{CAN_BE_FRAGMENTED, Flow, ImmutableFlowUtils, PostorderFlowTraversal}; use gfx::display_list::OpaqueNode; -use script_layout_interface::restyle_damage::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, RestyleDamage}; use script_layout_interface::wrapper_traits::{LayoutElement, LayoutNode, ThreadSafeLayoutNode}; use std::mem; use style::atomic_refcell::AtomicRefCell; use style::context::{LocalStyleContext, SharedStyleContext, StyleContext}; use style::data::ElementData; use style::dom::{StylingMode, TElement, TNode}; +use style::selector_impl::RestyleDamage; +use style::servo::restyle_damage::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, REPAINT}; use style::traversal::{DomTraversalContext, put_thread_local_bloom_filter}; use style::traversal::{recalc_style_at, remove_from_bloom_filter}; use style::traversal::take_thread_local_bloom_filter; @@ -270,34 +271,34 @@ pub struct BuildDisplayList<'a> { impl<'a> BuildDisplayList<'a> { #[inline] pub fn traverse(&mut self, flow: &mut Flow) { - if self.should_process() { - let new_stacking_context = - flow::base(flow).stacking_context_id != self.state.stacking_context_id(); - if new_stacking_context { - self.state.push_stacking_context_id(flow::base(flow).stacking_context_id); - } + let new_stacking_context = + flow::base(flow).stacking_context_id != self.state.stacking_context_id(); + if new_stacking_context { + self.state.push_stacking_context_id(flow::base(flow).stacking_context_id); + } - let new_scroll_root = - flow::base(flow).scroll_root_id != self.state.scroll_root_id(); - if new_scroll_root { - self.state.push_scroll_root_id(flow::base(flow).scroll_root_id); - } + let new_scroll_root = + flow::base(flow).scroll_root_id != self.state.scroll_root_id(); + if new_scroll_root { + self.state.push_scroll_root_id(flow::base(flow).scroll_root_id); + } + if self.should_process() { flow.build_display_list(&mut self.state); flow::mut_base(flow).restyle_damage.remove(REPAINT); - - if new_stacking_context { - self.state.pop_stacking_context_id(); - } - - if new_scroll_root { - self.state.pop_scroll_root_id(); - } } for kid in flow::child_iter_mut(flow) { self.traverse(kid); } + + if new_stacking_context { + self.state.pop_stacking_context_id(); + } + + if new_scroll_root { + self.state.pop_scroll_root_id(); + } } #[inline] diff --git a/components/layout/webrender_helpers.rs b/components/layout/webrender_helpers.rs index cf239f79258..07979940314 100644 --- a/components/layout/webrender_helpers.rs +++ b/components/layout/webrender_helpers.rs @@ -8,7 +8,7 @@ // completely converting layout to directly generate WebRender display lists, for example. use app_units::Au; -use euclid::{Point2D, Rect, Size2D}; +use euclid::{Matrix4D, Point2D, Rect, Size2D, TypedRect}; use gfx::display_list::{BorderRadii, BoxShadowClipMode, ClippingRegion}; use gfx::display_list::{DisplayItem, DisplayList, DisplayListTraversal}; use gfx::display_list::{StackingContext, StackingContextType}; @@ -24,7 +24,8 @@ trait WebRenderStackingContextConverter { api: &mut webrender_traits::RenderApi, pipeline_id: webrender_traits::PipelineId, epoch: webrender_traits::Epoch, - frame_builder: &mut WebRenderFrameBuilder) + frame_builder: &mut WebRenderFrameBuilder, + scroll_layer_id: Option<webrender_traits::ScrollLayerId>) -> webrender_traits::StackingContextId; fn convert_children_to_webrender<'a>(&self, @@ -235,17 +236,39 @@ impl WebRenderStackingContextConverter for StackingContext { &DisplayItem::PushStackingContext(ref stacking_context_item) => { let stacking_context = &stacking_context_item.stacking_context; debug_assert!(stacking_context.context_type == StackingContextType::Real); - - let stacking_context_id = + builder.push_stacking_context( stacking_context.convert_to_webrender(traversal, api, pipeline_id, epoch, - frame_builder); - builder.push_stacking_context(stacking_context_id); - + frame_builder, + None)); } - &DisplayItem::PopStackingContext(_) => return, + &DisplayItem::PushScrollRoot(ref item) => { + let stacking_context = StackingContext::new( + StackingContextId::new(0), + StackingContextType::Real, + &item.scroll_root.clip, + &TypedRect::new(Point2D::zero(), item.scroll_root.size), + 0, + filter::T::new(Vec::new()), + mix_blend_mode::T::normal, + Matrix4D::identity(), + Matrix4D::identity(), + true, + ScrollPolicy::Scrollable, + ScrollRootId::root()); + let scroll_layer_id = + Some(frame_builder.next_scroll_layer_id(item.scroll_root.id)); + builder.push_stacking_context( + stacking_context.convert_to_webrender(traversal, + api, + pipeline_id, + epoch, + frame_builder, + scroll_layer_id)); + } + &DisplayItem::PopStackingContext(_) | &DisplayItem::PopScrollRoot(_) => return, _ => item.convert_to_webrender(builder, frame_builder), } } @@ -256,21 +279,14 @@ impl WebRenderStackingContextConverter for StackingContext { api: &mut webrender_traits::RenderApi, pipeline_id: webrender_traits::PipelineId, epoch: webrender_traits::Epoch, - frame_builder: &mut WebRenderFrameBuilder) + frame_builder: &mut WebRenderFrameBuilder, + scroll_layer_id: Option<webrender_traits::ScrollLayerId>) -> webrender_traits::StackingContextId { let webrender_scroll_policy = match self.scroll_policy { ScrollPolicy::Scrollable => webrender_traits::ScrollPolicy::Scrollable, ScrollPolicy::FixedPosition => webrender_traits::ScrollPolicy::Fixed, }; - let scroll_layer_id = if let Some(scroll_root_id) = self.overflow_scroll_id { - Some(frame_builder.next_scroll_layer_id(scroll_root_id)) - } else if self.id == StackingContextId::root() { - Some(frame_builder.next_scroll_layer_id(ScrollRootId::root())) - } else { - None - }; - let mut sc = webrender_traits::StackingContext::new(scroll_layer_id, webrender_scroll_policy, @@ -310,11 +326,14 @@ impl WebRenderDisplayListConverter for DisplayList { match item { Some(&DisplayItem::PushStackingContext(ref stacking_context_item)) => { let stacking_context = &stacking_context_item.stacking_context; + let scroll_layer_id = + Some(frame_builder.next_scroll_layer_id(ScrollRootId::root())); stacking_context.convert_to_webrender(&mut traversal, api, pipeline_id, epoch, - frame_builder) + frame_builder, + scroll_layer_id) } _ => unreachable!("DisplayList did not start with StackingContext."), @@ -453,7 +472,11 @@ impl WebRenderDisplayItemConverter for DisplayItem { item.base.clip.to_clip_region(frame_builder), pipeline_id); } - DisplayItem::PushStackingContext(_) | DisplayItem::PopStackingContext(_) => {} + DisplayItem::PushStackingContext(_) | + DisplayItem::PopStackingContext(_) | + DisplayItem::PushScrollRoot(_) | + DisplayItem::PopScrollRoot(_) => + unreachable!("Tried to convert a scroll root or stacking context structure item."), } } } diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs index 60956b00150..859183935b1 100644 --- a/components/layout_thread/lib.rs +++ b/components/layout_thread/lib.rs @@ -50,7 +50,8 @@ use euclid::rect::Rect; use euclid::scale_factor::ScaleFactor; use euclid::size::Size2D; use fnv::FnvHasher; -use gfx::display_list::{ClippingRegion, OpaqueNode, WebRenderImageInfo}; +use gfx::display_list::{ClippingRegion, OpaqueNode}; +use gfx::display_list::WebRenderImageInfo; use gfx::font; use gfx::font_cache_thread::FontCacheThread; use gfx::font_context; @@ -87,8 +88,6 @@ use profile_traits::time::{TimerMetadataFrameType, TimerMetadataReflowType}; use script::layout_wrapper::{ServoLayoutDocument, ServoLayoutNode}; use script_layout_interface::message::{Msg, NewLayoutThreadInfo, Reflow, ReflowQueryType, ScriptReflow}; use script_layout_interface::reporter::CSSErrorReporter; -use script_layout_interface::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, REPOSITION}; -use script_layout_interface::restyle_damage::STORE_OVERFLOW; use script_layout_interface::rpc::{LayoutRPC, MarginStyleResponse, NodeOverflowResponse, OffsetParentResponse}; use script_layout_interface::wrapper_traits::LayoutNode; use script_traits::{ConstellationControlMsg, LayoutControlMsg, LayoutMsg as ConstellationMsg}; @@ -111,6 +110,7 @@ use style::media_queries::{Device, MediaType}; use style::parallel::WorkQueueData; use style::parser::ParserContextExtraData; use style::selector_matching::Stylist; +use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, REPOSITION, STORE_OVERFLOW}; use style::stylesheets::{Origin, Stylesheet, UserAgentStylesheets}; use style::thread_state; use style::timer::Timer; @@ -906,8 +906,8 @@ impl LayoutThread { match (data.goal, display_list_needed) { (ReflowGoal::ForDisplay, _) | (ReflowGoal::ForScriptQuery, true) => { let mut build_state = - sequential::build_display_list_for_subtree(layout_root, - shared_layout_context); + sequential::build_display_list_for_subtree(layout_root, + shared_layout_context); debug!("Done building display list."); diff --git a/components/net/fetch/methods.rs b/components/net/fetch/methods.rs index 0e066e918aa..092a5e7f0ef 100644 --- a/components/net/fetch/methods.rs +++ b/components/net/fetch/methods.rs @@ -8,7 +8,7 @@ use data_loader::decode; use devtools_traits::DevtoolsControlMsg; use fetch::cors_cache::CORSCache; use filemanager_thread::{FileManager, UIProvider}; -use http_loader::{HttpState, set_default_accept_encoding, set_request_cookies}; +use http_loader::{HttpState, set_default_accept_encoding, set_default_accept_language, set_request_cookies}; use http_loader::{NetworkHttpRequestFactory, ReadResult, StreamedResponse, obtain_response, read_block}; use http_loader::{auth_from_cache, determine_request_referrer, set_cookies_from_headers}; use http_loader::{send_response_to_devtools, send_request_to_devtools, LoadErrorType}; @@ -120,9 +120,7 @@ pub fn fetch_with_cors_cache<UI: 'static + UIProvider>(request: Rc<Request>, } // Step 4 - if !request.headers.borrow().has::<AcceptLanguage>() { - request.headers.borrow_mut().set(AcceptLanguage(vec![qitem("en-US".parse().unwrap())])); - } + set_default_accept_language(&mut request.headers.borrow_mut()); // Step 5 // TODO: Figure out what a Priority object is @@ -607,7 +605,7 @@ fn http_fetch<UI: 'static + UIProvider>(request: Rc<Request>, RedirectMode::Follow => { // set back to default response.return_internal.set(true); - http_redirect_fetch(request, cache, Rc::new(response), + http_redirect_fetch(request, cache, response, cors_flag, target, done_chan, context) } } @@ -677,7 +675,7 @@ fn http_fetch<UI: 'static + UIProvider>(request: Rc<Request>, /// [HTTP redirect fetch](https://fetch.spec.whatwg.org#http-redirect-fetch) fn http_redirect_fetch<UI: 'static + UIProvider>(request: Rc<Request>, cache: &mut CORSCache, - response: Rc<Response>, + response: Response, cors_flag: bool, target: &mut Target, done_chan: &mut DoneChannel, @@ -688,7 +686,7 @@ fn http_redirect_fetch<UI: 'static + UIProvider>(request: Rc<Request>, // Step 2 if !response.actual_response().headers.has::<Location>() { - return Rc::try_unwrap(response).ok().unwrap(); + return response; } // Step 3 @@ -1017,88 +1015,8 @@ fn http_network_fetch<UI: 'static + UIProvider>(request: Rc<Request>, request_id.as_ref().map(Deref::deref), is_xhr); let pipeline_id = request.pipeline_id.get(); - let mut response = Response::new(); - match wrapped_response { - Ok((res, msg)) => { - response.url = Some(url.clone()); - response.status = Some(res.response.status); - response.raw_status = Some((res.response.status_raw().0, - res.response.status_raw().1.as_bytes().to_vec())); - response.headers = res.response.headers.clone(); - response.referrer = request.referrer.borrow().to_url().cloned(); - - let res_body = response.body.clone(); - - // We're about to spawn a thread to be waited on here - *done_chan = Some(channel()); - let meta = match response.metadata().expect("Response metadata should exist at this stage") { - FetchMetadata::Unfiltered(m) => m, - FetchMetadata::Filtered { unsafe_, .. } => unsafe_ - }; - let done_sender = done_chan.as_ref().map(|ch| ch.0.clone()); - let devtools_sender = context.devtools_chan.clone(); - let meta_status = meta.status.clone(); - let meta_headers = meta.headers.clone(); - spawn_named(format!("fetch worker thread"), move || { - match StreamedResponse::from_http_response(box res, meta) { - Ok(mut res) => { - *res_body.lock().unwrap() = ResponseBody::Receiving(vec![]); - - if let Some(ref sender) = devtools_sender { - if let Some(m) = msg { - send_request_to_devtools(m, &sender); - } - - // --- Tell devtools that we got a response - // Send an HttpResponse message to devtools with the corresponding request_id - if let Some(pipeline_id) = pipeline_id { - send_response_to_devtools( - &sender, request_id.unwrap(), - meta_headers.map(Serde::into_inner), - meta_status, - pipeline_id); - } - } - - loop { - match read_block(&mut res) { - Ok(ReadResult::Payload(chunk)) => { - if let ResponseBody::Receiving(ref mut body) = *res_body.lock().unwrap() { - body.extend_from_slice(&chunk); - if let Some(ref sender) = done_sender { - let _ = sender.send(Data::Payload(chunk)); - } - } - }, - Ok(ReadResult::EOF) | Err(_) => { - let mut empty_vec = Vec::new(); - let completed_body = match *res_body.lock().unwrap() { - ResponseBody::Receiving(ref mut body) => { - // avoid cloning the body - swap(body, &mut empty_vec); - empty_vec - }, - _ => empty_vec, - }; - *res_body.lock().unwrap() = ResponseBody::Done(completed_body); - if let Some(ref sender) = done_sender { - let _ = sender.send(Data::Done); - } - break; - } - } - } - } - Err(_) => { - // XXXManishearth we should propagate this error somehow - *res_body.lock().unwrap() = ResponseBody::Done(vec![]); - if let Some(ref sender) = done_sender { - let _ = sender.send(Data::Done); - } - } - } - }); - }, + let (res, msg) = match wrapped_response { + Ok(wrapped_response) => wrapped_response, Err(error) => { let error = match error.error { LoadErrorType::ConnectionAborted { .. } => unreachable!(), @@ -1110,6 +1028,86 @@ fn http_network_fetch<UI: 'static + UIProvider>(request: Rc<Request>, } }; + let mut response = Response::new(); + response.url = Some(url.clone()); + response.status = Some(res.response.status); + response.raw_status = Some((res.response.status_raw().0, + res.response.status_raw().1.as_bytes().to_vec())); + response.headers = res.response.headers.clone(); + response.referrer = request.referrer.borrow().to_url().cloned(); + + let res_body = response.body.clone(); + + // We're about to spawn a thread to be waited on here + *done_chan = Some(channel()); + let meta = match response.metadata().expect("Response metadata should exist at this stage") { + FetchMetadata::Unfiltered(m) => m, + FetchMetadata::Filtered { unsafe_, .. } => unsafe_ + }; + let done_sender = done_chan.as_ref().map(|ch| ch.0.clone()); + let devtools_sender = context.devtools_chan.clone(); + let meta_status = meta.status.clone(); + let meta_headers = meta.headers.clone(); + spawn_named(format!("fetch worker thread"), move || { + match StreamedResponse::from_http_response(box res, meta) { + Ok(mut res) => { + *res_body.lock().unwrap() = ResponseBody::Receiving(vec![]); + + if let Some(ref sender) = devtools_sender { + if let Some(m) = msg { + send_request_to_devtools(m, &sender); + } + + // --- Tell devtools that we got a response + // Send an HttpResponse message to devtools with the corresponding request_id + if let Some(pipeline_id) = pipeline_id { + send_response_to_devtools( + &sender, request_id.unwrap(), + meta_headers.map(Serde::into_inner), + meta_status, + pipeline_id); + } + } + + loop { + match read_block(&mut res) { + Ok(ReadResult::Payload(chunk)) => { + if let ResponseBody::Receiving(ref mut body) = *res_body.lock().unwrap() { + body.extend_from_slice(&chunk); + if let Some(ref sender) = done_sender { + let _ = sender.send(Data::Payload(chunk)); + } + } + }, + Ok(ReadResult::EOF) | Err(_) => { + let mut empty_vec = Vec::new(); + let completed_body = match *res_body.lock().unwrap() { + ResponseBody::Receiving(ref mut body) => { + // avoid cloning the body + swap(body, &mut empty_vec); + empty_vec + }, + _ => empty_vec, + }; + *res_body.lock().unwrap() = ResponseBody::Done(completed_body); + if let Some(ref sender) = done_sender { + let _ = sender.send(Data::Done); + } + break; + } + } + } + } + Err(_) => { + // XXXManishearth we should propagate this error somehow + *res_body.lock().unwrap() = ResponseBody::Done(vec![]); + if let Some(ref sender) = done_sender { + let _ = sender.send(Data::Done); + } + } + } + }); + // TODO these substeps aren't possible yet // Substep 1 diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs index 095f7b32863..3b0202db868 100644 --- a/components/net/http_loader.rs +++ b/components/net/http_loader.rs @@ -413,7 +413,7 @@ fn set_default_accept(headers: &mut Headers) { } } -fn set_default_accept_language(headers: &mut Headers) { +pub fn set_default_accept_language(headers: &mut Headers) { if headers.has::<AcceptLanguage>() { return; } diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index 59a6178e462..b8274aec90c 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -92,9 +92,9 @@ use std::sync::mpsc::{Receiver, Sender}; use std::time::{SystemTime, Instant}; use style::attr::{AttrIdentifier, AttrValue, LengthOrPercentageOrAuto}; use style::element_state::*; -use style::media_queries::MediaQueryList; +use style::media_queries::MediaList; use style::properties::PropertyDeclarationBlock; -use style::selector_impl::{ElementSnapshot, PseudoElement}; +use style::selector_impl::{PseudoElement, Snapshot}; use style::values::specified::Length; use time::Duration; use url::Origin as UrlOrigin; @@ -346,7 +346,7 @@ no_jsmanaged_fields!(DOMString); no_jsmanaged_fields!(Mime); no_jsmanaged_fields!(AttrIdentifier); no_jsmanaged_fields!(AttrValue); -no_jsmanaged_fields!(ElementSnapshot); +no_jsmanaged_fields!(Snapshot); no_jsmanaged_fields!(HttpsState); no_jsmanaged_fields!(Request); no_jsmanaged_fields!(SharedRt); @@ -369,7 +369,7 @@ no_jsmanaged_fields!(WebGLProgramId); no_jsmanaged_fields!(WebGLRenderbufferId); no_jsmanaged_fields!(WebGLShaderId); no_jsmanaged_fields!(WebGLTextureId); -no_jsmanaged_fields!(MediaQueryList); +no_jsmanaged_fields!(MediaList); impl JSTraceable for Box<ScriptChan + Send> { #[inline] diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index cb8a2d37cf9..5b1f4cfe404 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -125,7 +125,7 @@ use std::sync::Arc; use std::time::{Duration, Instant}; use style::attr::AttrValue; use style::context::ReflowGoal; -use style::selector_impl::ElementSnapshot; +use style::selector_impl::Snapshot; use style::str::{split_html_space_chars, str_join}; use style::stylesheets::Stylesheet; use time; @@ -236,7 +236,7 @@ pub struct Document { appropriate_template_contents_owner_document: MutNullableHeap<JS<Document>>, /// For each element that has had a state or attribute change since the last restyle, /// track the original condition of the element. - modified_elements: DOMRefCell<HashMap<JS<Element>, ElementSnapshot>>, + modified_elements: DOMRefCell<HashMap<JS<Element>, Snapshot>>, /// This flag will be true if layout suppressed a reflow attempt that was /// needed in order for the page to be painted. needs_paint: Cell<bool>, @@ -1708,7 +1708,7 @@ pub enum DocumentSource { #[allow(unsafe_code)] pub trait LayoutDocumentHelpers { unsafe fn is_html_document_for_layout(&self) -> bool; - unsafe fn drain_modified_elements(&self) -> Vec<(LayoutJS<Element>, ElementSnapshot)>; + unsafe fn drain_modified_elements(&self) -> Vec<(LayoutJS<Element>, Snapshot)>; unsafe fn needs_paint_from_layout(&self); unsafe fn will_paint(&self); } @@ -1722,7 +1722,7 @@ impl LayoutDocumentHelpers for LayoutJS<Document> { #[inline] #[allow(unrooted_must_root)] - unsafe fn drain_modified_elements(&self) -> Vec<(LayoutJS<Element>, ElementSnapshot)> { + unsafe fn drain_modified_elements(&self) -> Vec<(LayoutJS<Element>, Snapshot)> { let mut elements = (*self.unsafe_get()).modified_elements.borrow_mut_for_layout(); let result = elements.drain().map(|(k, v)| (k.to_layout(), v)).collect(); result @@ -1970,7 +1970,7 @@ impl Document { let mut map = self.modified_elements.borrow_mut(); let snapshot = map.entry(JS::from_ref(el)) .or_insert_with(|| { - ElementSnapshot::new(el.html_element_in_html_document()) + Snapshot::new(el.html_element_in_html_document()) }); if snapshot.state.is_none() { snapshot.state = Some(el.state()); @@ -1981,7 +1981,7 @@ impl Document { let mut map = self.modified_elements.borrow_mut(); let mut snapshot = map.entry(JS::from_ref(el)) .or_insert_with(|| { - ElementSnapshot::new(el.html_element_in_html_document()) + Snapshot::new(el.html_element_in_html_document()) }); if snapshot.attrs.is_none() { let attrs = el.attrs() diff --git a/components/script/dom/htmlanchorelement.rs b/components/script/dom/htmlanchorelement.rs index 7683fc02330..24d86df0cc0 100644 --- a/components/script/dom/htmlanchorelement.rs +++ b/components/script/dom/htmlanchorelement.rs @@ -284,6 +284,23 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement { self.set_url(); } + // https://html.spec.whatwg.org/multipage/#dom-hyperlink-origin + fn Origin(&self) -> USVString { + // Step 1. + self.reinitialize_url(); + + USVString(match *self.url.borrow() { + None => { + // Step 2. + "".to_owned() + }, + Some(ref url) => { + // Step 3. + url.origin().unicode_serialization() + }, + }) + } + // https://html.spec.whatwg.org/multipage/#dom-hyperlink-password fn Password(&self) -> USVString { // Step 1. diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs index 60f6482a49f..326b1804ddf 100644 --- a/components/script/dom/htmlcanvaselement.rs +++ b/components/script/dom/htmlcanvaselement.rs @@ -2,7 +2,7 @@ * 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/. */ -use canvas_traits::{CanvasMsg, FromLayoutMsg, CanvasData}; +use canvas_traits::{CanvasMsg, FromScriptMsg}; use dom::attr::Attr; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasRenderingContext2DMethods; @@ -202,16 +202,17 @@ impl HTMLCanvasElement { let data = if let Some(renderer) = self.ipc_renderer() { let (sender, receiver) = ipc::channel().unwrap(); - let msg = CanvasMsg::FromLayout(FromLayoutMsg::SendData(sender)); + let msg = CanvasMsg::FromScript(FromScriptMsg::SendPixels(sender)); renderer.send(msg).unwrap(); match receiver.recv().unwrap() { - CanvasData::Pixels(pixel_data) - => pixel_data.image_data.to_vec(), - CanvasData::WebGL(_) - // TODO(emilio): Not sure if WebGL canvas is required for 2d spec, - // but I think it's not. - => return None, + Some(pixels) => pixels, + None => { + // TODO(emilio, #14109): Not sure if WebGL canvas is + // required for 2d spec, but I think it's not, if so, make + // this return a readback from the GL context. + return None; + } } } else { repeat(0xffu8).take((size.height as usize) * (size.width as usize) * 4).collect() diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs index ed8bc27ccdb..9fb5a5609f1 100644 --- a/components/script/dom/htmllinkelement.rs +++ b/components/script/dom/htmllinkelement.rs @@ -42,7 +42,7 @@ use std::default::Default; use std::mem; use std::sync::{Arc, Mutex}; use style::attr::AttrValue; -use style::media_queries::{MediaQueryList, parse_media_query_list}; +use style::media_queries::{MediaList, parse_media_query_list}; use style::parser::ParserContextExtraData; use style::str::HTML_SPACE_CHARACTERS; use style::stylesheets::{Stylesheet, Origin}; @@ -297,7 +297,7 @@ impl HTMLLinkElement { struct StylesheetContext { /// The element that initiated the request. elem: Trusted<HTMLLinkElement>, - media: Option<MediaQueryList>, + media: Option<MediaList>, /// The response body received to date. data: Vec<u8>, /// The response metadata received to date. diff --git a/components/script/dom/mediaquerylist.rs b/components/script/dom/mediaquerylist.rs index b5007d9fe83..8b77bc4155b 100644 --- a/components/script/dom/mediaquerylist.rs +++ b/components/script/dom/mediaquerylist.rs @@ -19,8 +19,7 @@ use euclid::scale_factor::ScaleFactor; use js::jsapi::JSTracer; use std::cell::Cell; use std::rc::Rc; -use style; -use style::media_queries::{Device, MediaType}; +use style::media_queries::{Device, MediaList, MediaType}; use style_traits::{PagePx, ToCss, ViewportPx}; pub enum MediaQueryListMatchState { @@ -32,13 +31,12 @@ pub enum MediaQueryListMatchState { pub struct MediaQueryList { eventtarget: EventTarget, document: JS<Document>, - media_query_list: style::media_queries::MediaQueryList, + media_query_list: MediaList, last_match_state: Cell<Option<bool>> } impl MediaQueryList { - fn new_inherited(document: &Document, - media_query_list: style::media_queries::MediaQueryList) -> MediaQueryList { + fn new_inherited(document: &Document, media_query_list: MediaList) -> MediaQueryList { MediaQueryList { eventtarget: EventTarget::new_inherited(), document: JS::from_ref(document), @@ -47,8 +45,7 @@ impl MediaQueryList { } } - pub fn new(document: &Document, - media_query_list: style::media_queries::MediaQueryList) -> Root<MediaQueryList> { + pub fn new(document: &Document, media_query_list: MediaList) -> Root<MediaQueryList> { reflect_dom_object(box MediaQueryList::new_inherited(document, media_query_list), document.window(), MediaQueryListBinding::Wrap) diff --git a/components/script/dom/webidls/HTMLHyperlinkElementUtils.webidl b/components/script/dom/webidls/HTMLHyperlinkElementUtils.webidl index 3ff0418b13f..a75ecb970a0 100644 --- a/components/script/dom/webidls/HTMLHyperlinkElementUtils.webidl +++ b/components/script/dom/webidls/HTMLHyperlinkElementUtils.webidl @@ -7,7 +7,7 @@ interface HTMLHyperlinkElementUtils { // stringifier attribute USVString href; attribute USVString href; -// attribute USVString origin; + readonly attribute USVString origin; attribute USVString protocol; attribute USVString username; attribute USVString password; diff --git a/components/script/layout_wrapper.rs b/components/script/layout_wrapper.rs index c83e8232a40..00c7ce1413c 100644 --- a/components/script/layout_wrapper.rs +++ b/components/script/layout_wrapper.rs @@ -46,7 +46,6 @@ use parking_lot::RwLock; use range::Range; use script_layout_interface::{HTMLCanvasData, LayoutNodeType, SVGSVGData, TrustedNodeAddress}; use script_layout_interface::{OpaqueStyleAndLayoutData, PartialPersistentLayoutData}; -use script_layout_interface::restyle_damage::RestyleDamage; use script_layout_interface::wrapper_traits::{DangerousThreadSafeLayoutNode, GetLayoutData, LayoutElement, LayoutNode}; use script_layout_interface::wrapper_traits::{PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode}; use selectors::matching::ElementFlags; @@ -66,7 +65,7 @@ use style::dom::{LayoutIterator, NodeInfo, OpaqueNode, PresentationalHintsSynthe use style::dom::{TRestyleDamage, UnsafeNode}; use style::element_state::*; use style::properties::{ComputedValues, PropertyDeclarationBlock}; -use style::selector_impl::{ElementSnapshot, NonTSPseudoClass, PseudoElement, ServoSelectorImpl}; +use style::selector_impl::{NonTSPseudoClass, PseudoElement, RestyleDamage, ServoSelectorImpl, Snapshot}; use style::selector_matching::ApplicableDeclarationBlock; use style::sink::Push; use style::str::is_whitespace; @@ -382,7 +381,7 @@ impl<'ld> TDocument for ServoLayoutDocument<'ld> { self.as_node().children().find(ServoLayoutNode::is_element) } - fn drain_modified_elements(&self) -> Vec<(ServoLayoutElement<'ld>, ElementSnapshot)> { + fn drain_modified_elements(&self) -> Vec<(ServoLayoutElement<'ld>, Snapshot)> { let elements = unsafe { self.document.drain_modified_elements() }; elements.into_iter().map(|(el, snapshot)| (ServoLayoutElement::from_layout_js(el), snapshot)).collect() } @@ -435,7 +434,6 @@ impl<'le> PresentationalHintsSynthetizer for ServoLayoutElement<'le> { impl<'le> TElement for ServoLayoutElement<'le> { type ConcreteNode = ServoLayoutNode<'le>; type ConcreteDocument = ServoLayoutDocument<'le>; - type ConcreteRestyleDamage = RestyleDamage; fn as_node(&self) -> ServoLayoutNode<'le> { ServoLayoutNode::from_layout_js(self.element.upcast()) diff --git a/components/script_layout_interface/lib.rs b/components/script_layout_interface/lib.rs index b442e502b2b..284f6f33498 100644 --- a/components/script_layout_interface/lib.rs +++ b/components/script_layout_interface/lib.rs @@ -41,7 +41,6 @@ extern crate url; pub mod message; pub mod reporter; -pub mod restyle_damage; pub mod rpc; pub mod wrapper_traits; @@ -49,10 +48,10 @@ use canvas_traits::CanvasMsg; use core::nonzero::NonZero; use ipc_channel::ipc::IpcSender; use libc::c_void; -use restyle_damage::RestyleDamage; use std::sync::atomic::AtomicIsize; use style::atomic_refcell::AtomicRefCell; use style::data::ElementData; +use style::selector_impl::RestyleDamage; pub struct PartialPersistentLayoutData { /// Data that the style system associates with a node. When the diff --git a/components/script_layout_interface/wrapper_traits.rs b/components/script_layout_interface/wrapper_traits.rs index 7bd91bdb0d0..9123c0c1f45 100644 --- a/components/script_layout_interface/wrapper_traits.rs +++ b/components/script_layout_interface/wrapper_traits.rs @@ -12,7 +12,6 @@ use gfx_traits::ByteIndex; use html5ever_atoms::{Namespace, LocalName}; use msg::constellation_msg::PipelineId; use range::Range; -use restyle_damage::RestyleDamage; use std::fmt::Debug; use std::sync::Arc; use style::atomic_refcell::AtomicRefCell; @@ -22,7 +21,7 @@ use style::data::ElementData; use style::dom::{LayoutIterator, NodeInfo, PresentationalHintsSynthetizer, TElement, TNode}; use style::dom::OpaqueNode; use style::properties::ServoComputedValues; -use style::selector_impl::{PseudoElement, PseudoElementCascadeType, ServoSelectorImpl}; +use style::selector_impl::{PseudoElement, PseudoElementCascadeType, RestyleDamage, ServoSelectorImpl}; use url::Url; #[derive(Copy, PartialEq, Clone, Debug)] diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index c5e6963a63a..b67414822dc 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -180,6 +180,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "bitflags" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bitflags" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -254,6 +259,11 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "bytes" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "canvas" version = "0.0.1" dependencies = [ @@ -384,6 +394,7 @@ dependencies = [ "canvas 0.0.1", "canvas_traits 0.0.1", "compositing 0.0.1", + "debugger 0.0.1", "devtools_traits 0.0.1", "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "gaol 0.0.1 (git+https://github.com/servo/gaol)", @@ -511,8 +522,9 @@ dependencies = [ name = "debugger" version = "0.0.1" dependencies = [ + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ws 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1420,6 +1432,33 @@ dependencies = [ ] [[package]] +name = "mio" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "miow 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miow" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "mozjs_sys" version = "0.0.0" source = "git+https://github.com/servo/mozjs#f7917c480e3378441ee54c0554f6a3af9fb57464" @@ -1560,6 +1599,15 @@ dependencies = [ ] [[package]] +name = "nix" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "nodrop" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2286,6 +2334,11 @@ dependencies = [ ] [[package]] +name = "sha1" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "shared_library" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2319,6 +2372,11 @@ version = "0.1.1" source = "git+https://github.com/huonw/simd#0d85d25d5cc3788062b252e31ad48dd19e805e90" [[package]] +name = "slab" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "smallvec" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2774,7 +2832,7 @@ dependencies = [ [[package]] name = "webrender" version = "0.8.0" -source = "git+https://github.com/servo/webrender#8b53081a3de714f8c1296e20658fabe4e75a6244" +source = "git+https://github.com/servo/webrender#c5eb15a9b8030bbad15809aba7dd1b5906d96397" dependencies = [ "app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "bincode 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2799,7 +2857,7 @@ dependencies = [ [[package]] name = "webrender_traits" version = "0.8.0" -source = "git+https://github.com/servo/webrender#8b53081a3de714f8c1296e20658fabe4e75a6244" +source = "git+https://github.com/servo/webrender#c5eb15a9b8030bbad15809aba7dd1b5906d96397" dependencies = [ "app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2840,6 +2898,19 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "ws" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "httparse 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "ws2_32-sys" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2914,6 +2985,7 @@ dependencies = [ "checksum bincode 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9fbba641f73d3e74a5431d4a6d9e42a70bcce76d466d796c852ba1db31ba41bc" "checksum bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9bf6104718e80d7b26a68fdbacff3481cfc05df670821affc7e9cbc1884400c" "checksum bit-vec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5b97c2c8e8bbb4251754f559df8af22fb264853c7d009084a576cdf12565089d" +"checksum bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dead7461c1127cf637931a1e50934eb6eee8bff2f74433ac7909e9afcee04a3" "checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" "checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" "checksum blurdroid 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5fce4ea3366b583e9d49e1aa3a42252e53b42911bccd06f31c3e81c48ccfc79e" @@ -2922,6 +2994,7 @@ dependencies = [ "checksum brotli 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "bff2d5511b5ba5840f46cc3f9c0c3ab09db20e9b9a4db344ef7df3fb547a627a" "checksum browserhtml 0.1.17 (git+https://github.com/browserhtml/browserhtml?branch=crate)" = "<none>" "checksum byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855" +"checksum bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c129aff112dcc562970abb69e2508b40850dd24c274761bb50fb8a0067ba6c27" "checksum caseless 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b6893f86ac0c9275b5cbba9212ccd71020b447d4c3e2eebad70e1bc47fdd6dfb" "checksum cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de1e760d7b6535af4241fca8bd8adf68e2e7edacc6b29f5d399050c5e48cf88c" "checksum cgl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8bdd78cca65a739cb5475dbf6b6bbb49373e327f4a6f2b499c0f98632df38c10" @@ -3017,10 +3090,13 @@ dependencies = [ "checksum mime 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b5c93a4bd787ddc6e7833c519b73a50883deb5863d76d9b71eb8216fb7f94e66" "checksum mime_guess 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e9a7d89cb3bce9145b0d0339a0588b044e3e3e3faa1dcd74822ebdc36bfac020" "checksum miniz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d1f4d337a01c32e1f2122510fed46393d53ca35a7f429cb0450abaedfa3ed54" +"checksum mio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a637d1ca14eacae06296a008fa7ad955347e34efcb5891cfd8ba05491a37907e" +"checksum miow 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d5bfc6782530ac8ace97af10a540054a37126b63b0702ddaaa243b73b5745b9a" "checksum mozjs_sys 0.0.0 (git+https://github.com/servo/mozjs)" = "<none>" "checksum mp3-metadata 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2f61cf32f7fc3cec83a15a255ac60bceb6cac59a7ce190cb824ca25c0fce0feb" "checksum mp4parse 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1e3d4b79704ee1a9d307a92d2cb2c7186a8eb7e40bfca41e1c2fa9fcb152390a" "checksum net2 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)" = "5edf9cb6be97212423aed9413dd4729d62b370b5e1c571750e882cebbbc1e3e2" +"checksum nix 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bfb3ddedaa14746434a02041940495bf11325c22f6d36125d3bdd56090d50a79" "checksum nodrop 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "0dbbadd3f4c98dea0bd3d9b4be4c0cdaf1ab57035cb2e41fce3983db5add7cc5" "checksum num 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "5a9699207fab8b02bd0e56f8f06fee3f26d640303130de548898b4c9704f6d01" "checksum num-bigint 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "88b14378471f7c2adc5262f05b4701ef53e8da376453a8d8fee48e51db745e49" @@ -3078,11 +3154,13 @@ dependencies = [ "checksum servo-freetype-sys 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9232032c2e85118c0282c6562c84cab12316e655491ba0a5d1905b2320060d1b" "checksum servo-glutin 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ffc7cae7df54ab2c3b9f8cab92b2de395bd8033a3380521d2d23c340e24cc779" "checksum servo-skia 0.20130412.24 (registry+https://github.com/rust-lang/crates.io-index)" = "bb975cdf292243956e6b6acfac336ac8be0aa567e32bb89901be161e4003d0b3" +"checksum sha1 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cc30b1e1e8c40c121ca33b86c23308a090d19974ef001b4bf6e61fd1a0fb095c" "checksum shared_library 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fb04126b6fcfd2710fb5b6d18f4207b6c535f2850a7e1a43bcd526d44f30a79a" "checksum shell32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "72f20b8f3c060374edb8046591ba28f62448c369ccbdc7b02075103fb3a9e38d" "checksum sig 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c6649e43c1a1e68d29ed56d0dc3b5b6cf3b901da77cf107c4066b9e3da036df5" "checksum signpost 0.1.0 (git+https://github.com/pcwalton/signpost.git)" = "<none>" "checksum simd 0.1.1 (git+https://github.com/huonw/simd)" = "<none>" +"checksum slab 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d807fd58c4181bbabed77cb3b891ba9748241a552bcc5be698faaebefc54f46e" "checksum smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "fcc8d19212aacecf95e4a7a2179b26f7aeb9732a915cf01f05b0d3e044865410" "checksum solicit 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "172382bac9424588d7840732b250faeeef88942e37b6e35317dce98cafdd75b2" "checksum string_cache 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d192db2123fac37399e1ca61557904a5c3fb6fc24c73d2e47b15d20dc32470" @@ -3126,6 +3204,7 @@ dependencies = [ "checksum websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a1a6ea5ed0367f32eb3d94dcc58859ef4294b5f75ba983dbf56ac314af45d" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" +"checksum ws 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7c47e9ca2f5c47d27f731b1bb9bb50cc05f9886bb84fbd52afa0ff97f4f61b06" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum x11 2.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bfc828b6baf54ccdde44e0b5f16e035ab9c54f60a0f0c218fb5ddbc6ab38a2a9" "checksum x11-dl 2.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6acc29bdc98d7565e18dc71b3e933aa94a195d0c2f4ec84f675679d9744b0d6b" diff --git a/components/servo/lib.rs b/components/servo/lib.rs index a7ed6a04664..023015e56fa 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -128,9 +128,9 @@ impl<Window> Browser<Window> where Window: WindowMethods + 'static { let time_profiler_chan = profile_time::Profiler::create(&opts.time_profiling, opts.time_profiler_trace_path.clone()); let mem_profiler_chan = profile_mem::Profiler::create(opts.mem_profiler_period); - if let Some(port) = opts.debugger_port { + let debugger_chan = opts.debugger_port.map(|port| { debugger::start_server(port) - } + }); let devtools_chan = opts.devtools_port.map(|port| { devtools::start_server(port) }); @@ -176,6 +176,7 @@ impl<Window> Browser<Window> where Window: WindowMethods + 'static { compositor_proxy.clone_compositor_proxy(), time_profiler_chan.clone(), mem_profiler_chan.clone(), + debugger_chan, devtools_chan, supports_clipboard, webrender_api_sender.clone()); @@ -240,6 +241,7 @@ fn create_constellation(opts: opts::Opts, compositor_proxy: Box<CompositorProxy + Send>, time_profiler_chan: time::ProfilerChan, mem_profiler_chan: mem::ProfilerChan, + debugger_chan: Option<debugger::Sender>, devtools_chan: Option<Sender<devtools_traits::DevtoolsControlMsg>>, supports_clipboard: bool, webrender_api_sender: webrender_traits::RenderApiSender) @@ -260,6 +262,7 @@ fn create_constellation(opts: opts::Opts, let initial_state = InitialConstellationState { compositor_proxy: compositor_proxy, + debugger_chan: debugger_chan, devtools_chan: devtools_chan, bluetooth_thread: bluetooth_thread, image_cache_thread: image_cache_thread, diff --git a/components/style/dom.rs b/components/style/dom.rs index 702d56a6f4d..388a7310ab0 100644 --- a/components/style/dom.rs +++ b/components/style/dom.rs @@ -14,7 +14,7 @@ use parking_lot::RwLock; use properties::{ComputedValues, PropertyDeclarationBlock}; use properties::longhands::display::computed_value as display; use restyle_hints::{RESTYLE_DESCENDANTS, RESTYLE_LATER_SIBLINGS, RESTYLE_SELF, RestyleHint}; -use selector_impl::{ElementExt, PseudoElement}; +use selector_impl::{ElementExt, PseudoElement, RestyleDamage, Snapshot}; use selector_matching::ApplicableDeclarationBlock; use sink::Push; use std::fmt::Debug; @@ -159,8 +159,7 @@ pub trait TDocument : Sized + Copy + Clone { fn root_node(&self) -> Option<Self::ConcreteNode>; - fn drain_modified_elements(&self) -> Vec<(Self::ConcreteElement, - <Self::ConcreteElement as ElementExt>::Snapshot)>; + fn drain_modified_elements(&self) -> Vec<(Self::ConcreteElement, Snapshot)>; fn needs_paint_from_layout(&self); fn will_paint(&self); @@ -174,7 +173,6 @@ pub trait PresentationalHintsSynthetizer { pub trait TElement : PartialEq + Debug + Sized + Copy + Clone + ElementExt + PresentationalHintsSynthetizer { type ConcreteNode: TNode<ConcreteElement = Self, ConcreteDocument = Self::ConcreteDocument>; type ConcreteDocument: TDocument<ConcreteNode = Self::ConcreteNode, ConcreteElement = Self>; - type ConcreteRestyleDamage: TRestyleDamage; fn as_node(&self) -> Self::ConcreteNode; @@ -186,7 +184,7 @@ pub trait TElement : PartialEq + Debug + Sized + Copy + Clone + ElementExt + Pre fn attr_equals(&self, namespace: &Namespace, attr: &LocalName, value: &Atom) -> bool; /// Set the restyle damage field. - fn set_restyle_damage(self, damage: Self::ConcreteRestyleDamage); + fn set_restyle_damage(self, damage: RestyleDamage); /// XXX: It's a bit unfortunate we need to pass the current computed values /// as an argument here, but otherwise Servo would crash due to double @@ -194,7 +192,7 @@ pub trait TElement : PartialEq + Debug + Sized + Copy + Clone + ElementExt + Pre fn existing_style_for_restyle_damage<'a>(&'a self, current_computed_values: Option<&'a Arc<ComputedValues>>, pseudo: Option<&PseudoElement>) - -> Option<&'a <Self::ConcreteRestyleDamage as TRestyleDamage>::PreExistingComputedValues>; + -> Option<&'a <RestyleDamage as TRestyleDamage>::PreExistingComputedValues>; /// The concept of a dirty bit doesn't exist in our new restyle algorithm. /// Instead, we associate restyle and change hints with nodes. However, we diff --git a/components/style/gecko/mod.rs b/components/style/gecko/mod.rs index 7153a7e3da2..ee462ef4b81 100644 --- a/components/style/gecko/mod.rs +++ b/components/style/gecko/mod.rs @@ -5,6 +5,7 @@ pub mod context; pub mod data; +pub mod restyle_damage; pub mod snapshot; pub mod snapshot_helpers; pub mod traversal; diff --git a/components/style/gecko/restyle_damage.rs b/components/style/gecko/restyle_damage.rs new file mode 100644 index 00000000000..ed23bb15062 --- /dev/null +++ b/components/style/gecko/restyle_damage.rs @@ -0,0 +1,53 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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/. */ + +use dom::TRestyleDamage; +use gecko_bindings::bindings; +use gecko_bindings::structs::{nsChangeHint, nsStyleContext}; +use gecko_bindings::sugar::ownership::FFIArcHelpers; +use properties::ComputedValues; +use std::ops::BitOr; +use std::sync::Arc; + +#[derive(Clone, Copy, Debug, PartialEq)] +pub struct GeckoRestyleDamage(nsChangeHint); + +impl GeckoRestyleDamage { + pub fn as_change_hint(&self) -> nsChangeHint { + self.0 + } +} + +impl TRestyleDamage for GeckoRestyleDamage { + type PreExistingComputedValues = nsStyleContext; + + fn empty() -> Self { + use std::mem; + GeckoRestyleDamage(unsafe { mem::transmute(0u32) }) + } + + fn compute(source: &nsStyleContext, + new_style: &Arc<ComputedValues>) -> Self { + let context = source as *const nsStyleContext as *mut nsStyleContext; + let hint = unsafe { + bindings::Gecko_CalcStyleDifference(context, + new_style.as_borrowed_opt().unwrap()) + }; + GeckoRestyleDamage(hint) + } + + fn rebuild_and_reflow() -> Self { + GeckoRestyleDamage(nsChangeHint::nsChangeHint_ReconstructFrame) + } +} + +impl BitOr for GeckoRestyleDamage { + type Output = Self; + + fn bitor(self, other: Self) -> Self { + use std::mem; + GeckoRestyleDamage(unsafe { mem::transmute(self.0 as u32 | other.0 as u32) }) + } +} + diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 3723045bae7..9adac5f269f 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -7,15 +7,15 @@ use atomic_refcell::{AtomicRef, AtomicRefCell}; use data::ElementData; -use dom::{LayoutIterator, NodeInfo, TDocument, TElement, TNode, TRestyleDamage, UnsafeNode}; +use dom::{LayoutIterator, NodeInfo, TDocument, TElement, TNode, UnsafeNode}; use dom::{OpaqueNode, PresentationalHintsSynthetizer}; use element_state::ElementState; use error_reporting::StdoutErrorReporter; +use gecko::restyle_damage::GeckoRestyleDamage; use gecko::selector_impl::{GeckoSelectorImpl, NonTSPseudoClass, PseudoElement}; use gecko::snapshot::GeckoElementSnapshot; use gecko::snapshot_helpers; use gecko_bindings::bindings; -use gecko_bindings::bindings::{Gecko_CalcStyleDifference, Gecko_StoreStyleDifference}; use gecko_bindings::bindings::{Gecko_DropStyleChildrenIterator, Gecko_MaybeCreateStyleChildrenIterator}; use gecko_bindings::bindings::{Gecko_ElementState, Gecko_GetDocumentElement}; use gecko_bindings::bindings::{Gecko_GetLastChild, Gecko_GetNextStyleChild}; @@ -26,10 +26,10 @@ use gecko_bindings::bindings::{RawGeckoDocument, RawGeckoElement, RawGeckoNode}; use gecko_bindings::bindings::Gecko_ClassOrClassList; use gecko_bindings::bindings::Gecko_GetStyleContext; use gecko_bindings::bindings::Gecko_SetNodeFlags; +use gecko_bindings::bindings::Gecko_StoreStyleDifference; use gecko_bindings::structs; use gecko_bindings::structs::{NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO, NODE_IS_DIRTY_FOR_SERVO}; -use gecko_bindings::structs::{nsChangeHint, nsIAtom, nsIContent, nsStyleContext}; -use gecko_bindings::sugar::ownership::FFIArcHelpers; +use gecko_bindings::structs::{nsIAtom, nsIContent, nsStyleContext}; use libc::uintptr_t; use parking_lot::RwLock; use parser::ParserContextExtraData; @@ -41,7 +41,6 @@ use selectors::Element; use selectors::parser::{AttrSelector, NamespaceConstraint}; use sink::Push; use std::fmt; -use std::ops::BitOr; use std::ptr; use std::sync::Arc; use string_cache::{Atom, Namespace, WeakAtom, WeakNamespace}; @@ -66,39 +65,6 @@ impl<'ln> GeckoNode<'ln> { } } -#[derive(Clone, Copy, Debug, PartialEq)] -pub struct GeckoRestyleDamage(nsChangeHint); - -impl TRestyleDamage for GeckoRestyleDamage { - type PreExistingComputedValues = nsStyleContext; - - fn empty() -> Self { - use std::mem; - GeckoRestyleDamage(unsafe { mem::transmute(0u32) }) - } - - fn compute(source: &nsStyleContext, - new_style: &Arc<ComputedValues>) -> Self { - let context = source as *const nsStyleContext as *mut nsStyleContext; - let hint = unsafe { Gecko_CalcStyleDifference(context, new_style.as_borrowed_opt().unwrap()) }; - GeckoRestyleDamage(hint) - } - - fn rebuild_and_reflow() -> Self { - GeckoRestyleDamage(nsChangeHint::nsChangeHint_ReconstructFrame) - } -} - -impl BitOr for GeckoRestyleDamage { - type Output = Self; - - fn bitor(self, other: Self) -> Self { - use std::mem; - GeckoRestyleDamage(unsafe { mem::transmute(self.0 as u32 | other.0 as u32) }) - } -} - - impl<'ln> NodeInfo for GeckoNode<'ln> { fn is_element(&self) -> bool { use gecko_bindings::structs::nsINode_BooleanFlag; @@ -358,7 +324,6 @@ lazy_static! { impl<'le> TElement for GeckoElement<'le> { type ConcreteNode = GeckoNode<'le>; type ConcreteDocument = GeckoDocument<'le>; - type ConcreteRestyleDamage = GeckoRestyleDamage; fn as_node(&self) -> Self::ConcreteNode { unsafe { GeckoNode(&*(self.0 as *const _ as *const RawGeckoNode)) } @@ -400,7 +365,7 @@ impl<'le> TElement for GeckoElement<'le> { // drive the post-traversal. This will go away soon. unsafe { self.set_flags(NODE_IS_DIRTY_FOR_SERVO as u32) } - unsafe { Gecko_StoreStyleDifference(self.as_node().0, damage.0) } + unsafe { Gecko_StoreStyleDifference(self.as_node().0, damage.as_change_hint()) } } fn existing_style_for_restyle_damage<'a>(&'a self, @@ -691,8 +656,6 @@ impl<'le> ::selectors::MatchAttr for GeckoElement<'le> { } impl<'le> ElementExt for GeckoElement<'le> { - type Snapshot = GeckoElementSnapshot; - #[inline] fn is_link(&self) -> bool { self.match_non_ts_pseudo_class(NonTSPseudoClass::AnyLink) diff --git a/components/style/lib.rs b/components/style/lib.rs index c6010def374..d7312bbb904 100644 --- a/components/style/lib.rs +++ b/components/style/lib.rs @@ -117,8 +117,8 @@ pub mod restyle_hints; pub mod rule_tree; pub mod selector_impl; pub mod selector_matching; +#[cfg(feature = "servo")] #[allow(unsafe_code)] pub mod servo; pub mod sequential; -#[cfg(feature = "servo")] pub mod servo_selector_impl; pub mod sink; pub mod str; pub mod stylesheets; diff --git a/components/style/matching.rs b/components/style/matching.rs index ac4bdb0b59a..97faf4d0a6a 100644 --- a/components/style/matching.rs +++ b/components/style/matching.rs @@ -17,7 +17,7 @@ use dom::{TElement, TNode, TRestyleDamage, UnsafeNode}; use properties::{CascadeFlags, ComputedValues, SHAREABLE, cascade}; use properties::longhands::display::computed_value as display; use rule_tree::StrongRuleNode; -use selector_impl::{TheSelectorImpl, PseudoElement}; +use selector_impl::{PseudoElement, RestyleDamage, TheSelectorImpl}; use selector_matching::{ApplicableDeclarationBlock, Stylist}; use selectors::MatchAttr; use selectors::bloom::BloomFilter; @@ -373,14 +373,14 @@ impl StyleSharingCandidateCache { } /// The results of attempting to share a style. -pub enum StyleSharingResult<ConcreteRestyleDamage: TRestyleDamage> { +pub enum StyleSharingResult { /// We didn't find anybody to share the style with. CannotShare, /// The node's style can be shared. The integer specifies the index in the /// LRU cache that was hit and the damage that was done, and the restyle /// result the original result of the candidate's styling, that is, whether /// it should stop the traversal or not. - StyleWasShared(usize, ConcreteRestyleDamage), + StyleWasShared(usize, RestyleDamage), } // Callers need to pass several boolean flags to cascade_node_pseudo_element. @@ -565,7 +565,7 @@ pub trait MatchMethods : TElement { &mut StyleSharingCandidateCache, shared_context: &SharedStyleContext, data: &mut AtomicRefMut<ElementData>) - -> StyleSharingResult<Self::ConcreteRestyleDamage> { + -> StyleSharingResult { if opts::get().disable_share_style_cache { return StyleSharingResult::CannotShare } @@ -591,12 +591,8 @@ pub trait MatchMethods : TElement { // replaced content, or similar stuff! let damage = match self.existing_style_for_restyle_damage(data.previous_styles().map(|x| &x.primary), None) { - Some(ref source) => { - Self::ConcreteRestyleDamage::compute(source, &shared_style) - } - None => { - Self::ConcreteRestyleDamage::rebuild_and_reflow() - } + Some(ref source) => RestyleDamage::compute(source, &shared_style), + None => RestyleDamage::rebuild_and_reflow(), }; data.finish_styling(ElementStyles::new(shared_style, rule_node)); @@ -678,13 +674,10 @@ pub trait MatchMethods : TElement { old_style: Option<&Arc<ComputedValues>>, new_style: &Arc<ComputedValues>, pseudo: Option<&PseudoElement>) - -> Self::ConcreteRestyleDamage + -> RestyleDamage { match self.existing_style_for_restyle_damage(old_style, pseudo) { - Some(ref source) => { - Self::ConcreteRestyleDamage::compute(source, - new_style) - } + Some(ref source) => RestyleDamage::compute(source, new_style), None => { // If there's no style source, two things can happen: // @@ -710,7 +703,7 @@ pub trait MatchMethods : TElement { // stick without the assertions. debug_assert!(pseudo.is_none() || new_style.get_box().clone_display() != display::T::none); - Self::ConcreteRestyleDamage::rebuild_and_reflow() + RestyleDamage::rebuild_and_reflow() } } } @@ -783,7 +776,7 @@ pub trait MatchMethods : TElement { new_pseudos: &mut PseudoStyles, context: &Ctx, applicable_declarations: &mut ApplicableDeclarations) - -> Self::ConcreteRestyleDamage + -> RestyleDamage where Ctx: StyleContext<'a> { // Here we optimise the case of the style changing but both the @@ -800,9 +793,9 @@ pub trait MatchMethods : TElement { // otherwise, we don't do anything. let damage = match old_display { Some(display) if display == this_display => { - Self::ConcreteRestyleDamage::empty() + RestyleDamage::empty() } - _ => Self::ConcreteRestyleDamage::rebuild_and_reflow() + _ => RestyleDamage::rebuild_and_reflow() }; debug!("Short-circuiting traversal: {:?} {:?} {:?}", @@ -820,8 +813,7 @@ pub trait MatchMethods : TElement { return damage; } - let rebuild_and_reflow = - Self::ConcreteRestyleDamage::rebuild_and_reflow(); + let rebuild_and_reflow = RestyleDamage::rebuild_and_reflow(); debug_assert!(new_pseudos.is_empty()); <Self as MatchAttr>::Impl::each_eagerly_cascaded_pseudo_element(|pseudo| { diff --git a/components/style/media_queries.rs b/components/style/media_queries.rs index 30609403925..4970ef8b2c2 100644 --- a/components/style/media_queries.rs +++ b/components/style/media_queries.rs @@ -19,11 +19,11 @@ use values::specified; #[derive(Debug, PartialEq)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] -pub struct MediaQueryList { +pub struct MediaList { pub media_queries: Vec<MediaQuery> } -impl ToCss for MediaQueryList { +impl ToCss for MediaList { fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { @@ -252,7 +252,7 @@ impl MediaQuery { } } -pub fn parse_media_query_list(input: &mut Parser) -> MediaQueryList { +pub fn parse_media_query_list(input: &mut Parser) -> MediaList { let queries = if input.is_exhausted() { vec![MediaQuery::new(None, MediaQueryType::All, vec!())] } else { @@ -271,10 +271,10 @@ pub fn parse_media_query_list(input: &mut Parser) -> MediaQueryList { } media_queries }; - MediaQueryList { media_queries: queries } + MediaList { media_queries: queries } } -impl MediaQueryList { +impl MediaList { pub fn evaluate(&self, device: &Device) -> bool { let viewport_size = device.au_viewport_size(); diff --git a/components/style/properties/longhand/box.mako.rs b/components/style/properties/longhand/box.mako.rs index fb843144c36..8b145c5ee77 100644 --- a/components/style/properties/longhand/box.mako.rs +++ b/components/style/properties/longhand/box.mako.rs @@ -23,7 +23,6 @@ """.split() if product == "gecko": values += "-moz-box -moz-inline-box".split() - experimental_values = set("flex".split()) %> pub use self::computed_value::T as SpecifiedValue; use values::computed::ComputedValueAsSpecified; @@ -61,12 +60,6 @@ match_ignore_ascii_case! { try!(input.expect_ident()), % for value in values: "${value}" => { - % if value in experimental_values and product == "servo": - if !::util::prefs::PREFS.get("layout.${value}.enabled") - .as_boolean().unwrap_or(false) { - return Err(()) - } - % endif Ok(computed_value::T::${to_rust_ident(value)}) }, % endfor diff --git a/components/style/properties/longhand/position.mako.rs b/components/style/properties/longhand/position.mako.rs index a3166ea8238..ab1ae61b435 100644 --- a/components/style/properties/longhand/position.mako.rs +++ b/components/style/properties/longhand/position.mako.rs @@ -66,15 +66,14 @@ // Flex container properties ${helpers.single_keyword("flex-direction", "row row-reverse column column-reverse", - experimental=True, animatable=False)} + animatable=False)} ${helpers.single_keyword("flex-wrap", "nowrap wrap wrap-reverse", - experimental=True, animatable=False)} + animatable=False)} // FIXME(stshine): The type of 'justify-content' and 'align-content' is uint16_t in gecko // FIXME(stshine): Its higher bytes are used to store fallback value. Disable them in geckolib for now ${helpers.single_keyword("justify-content", "flex-start flex-end center space-between space-around", - experimental=True, gecko_constant_prefix="NS_STYLE_JUSTIFY", products="servo", animatable=False)} @@ -82,14 +81,12 @@ ${helpers.single_keyword("justify-content", "flex-start flex-end center space-be // FIXME(heycam): Disable align-items in geckolib since we don't support the Gecko initial value // 'normal' yet. ${helpers.single_keyword("align-items", "stretch flex-start flex-end center baseline", - experimental=True, need_clone=True, gecko_constant_prefix="NS_STYLE_ALIGN", animatable=False, products="servo")} ${helpers.single_keyword("align-content", "stretch flex-start flex-end center space-between space-around", - experimental=True, gecko_constant_prefix="NS_STYLE_ALIGN", products="servo", animatable=False)} @@ -97,14 +94,13 @@ ${helpers.single_keyword("align-content", "stretch flex-start flex-end center sp // Flex item properties ${helpers.predefined_type("flex-grow", "Number", "0.0", "parse_non_negative", - experimental=True, animatable=True)} + animatable=True)} ${helpers.predefined_type("flex-shrink", "Number", "1.0", "parse_non_negative", - experimental=True, animatable=True)} + animatable=True)} ${helpers.single_keyword("align-self", "auto stretch flex-start flex-end center baseline", - experimental=True, need_clone=True, gecko_constant_prefix="NS_STYLE_ALIGN", animatable=False)} diff --git a/components/style/properties/shorthand/position.mako.rs b/components/style/properties/shorthand/position.mako.rs index 5064c375215..7eeebd9c1ab 100644 --- a/components/style/properties/shorthand/position.mako.rs +++ b/components/style/properties/shorthand/position.mako.rs @@ -5,8 +5,7 @@ <%namespace name="helpers" file="/helpers.mako.rs" /> // https://drafts.csswg.org/css-flexbox/#flex-flow-property -<%helpers:shorthand name="flex-flow" sub_properties="flex-direction flex-wrap" - experimental="True"> +<%helpers:shorthand name="flex-flow" sub_properties="flex-direction flex-wrap"> use properties::longhands::{flex_direction, flex_wrap}; pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result<Longhands, ()> { @@ -56,8 +55,7 @@ </%helpers:shorthand> // https://drafts.csswg.org/css-flexbox/#flex-property -<%helpers:shorthand name="flex" sub_properties="flex-grow flex-shrink flex-basis" - experimental="True"> +<%helpers:shorthand name="flex" sub_properties="flex-grow flex-shrink flex-basis"> use app_units::Au; use values::specified::{Number, Length, LengthOrPercentageOrAutoOrContent}; diff --git a/components/style/restyle_hints.rs b/components/style/restyle_hints.rs index a856d02a823..c2e4da3dede 100644 --- a/components/style/restyle_hints.rs +++ b/components/style/restyle_hints.rs @@ -8,7 +8,7 @@ use Atom; use element_state::*; #[cfg(feature = "servo")] use heapsize::HeapSizeOf; -use selector_impl::{AttrValue, ElementExt, NonTSPseudoClass, TheSelectorImpl}; +use selector_impl::{AttrValue, ElementExt, NonTSPseudoClass, Snapshot, TheSelectorImpl}; use selectors::{Element, MatchAttr}; use selectors::matching::{MatchingReason, StyleRelations}; use selectors::matching::matches_complex_selector; @@ -85,7 +85,7 @@ struct ElementWrapper<'a, E> where E: ElementExt { element: E, - snapshot: Option<&'a E::Snapshot>, + snapshot: Option<&'a Snapshot>, } impl<'a, E> ElementWrapper<'a, E> @@ -95,7 +95,7 @@ impl<'a, E> ElementWrapper<'a, E> ElementWrapper { element: el, snapshot: None } } - pub fn new_with_snapshot(el: E, snapshot: &'a E::Snapshot) -> ElementWrapper<'a, E> { + pub fn new_with_snapshot(el: E, snapshot: &'a Snapshot) -> ElementWrapper<'a, E> { ElementWrapper { element: el, snapshot: Some(snapshot) } } } @@ -424,7 +424,7 @@ impl DependencySet { } pub fn compute_hint<E>(&self, el: &E, - snapshot: &E::Snapshot, + snapshot: &Snapshot, current_state: ElementState) -> RestyleHint where E: ElementExt + Clone diff --git a/components/style/selector_impl.rs b/components/style/selector_impl.rs index 3d1d7813bd2..85734d51387 100644 --- a/components/style/selector_impl.rs +++ b/components/style/selector_impl.rs @@ -5,23 +5,34 @@ //! The pseudo-classes and pseudo-elements supported by the style system. use matching::{common_style_affecting_attributes, CommonStyleAffectingAttributeMode}; -use restyle_hints; use selectors::Element; use selectors::parser::{AttrSelector, SelectorImpl}; pub type AttrValue = <TheSelectorImpl as SelectorImpl>::AttrValue; #[cfg(feature = "servo")] -pub use servo_selector_impl::*; +pub use servo::selector_impl::*; + +#[cfg(feature = "gecko")] +pub use gecko::selector_impl::*; #[cfg(feature = "servo")] -pub use servo_selector_impl::{ServoSelectorImpl as TheSelectorImpl, ServoElementSnapshot as ElementSnapshot}; +pub use servo::selector_impl::ServoSelectorImpl as TheSelectorImpl; #[cfg(feature = "gecko")] -pub use gecko::selector_impl::*; +pub use gecko::selector_impl::GeckoSelectorImpl as TheSelectorImpl; + +#[cfg(feature = "servo")] +pub use servo::selector_impl::ServoElementSnapshot as Snapshot; #[cfg(feature = "gecko")] -pub use gecko::selector_impl::{GeckoSelectorImpl as TheSelectorImpl}; +pub use gecko::snapshot::GeckoElementSnapshot as Snapshot; + +#[cfg(feature = "servo")] +pub use servo::restyle_damage::ServoRestyleDamage as RestyleDamage; + +#[cfg(feature = "gecko")] +pub use gecko::restyle_damage::GeckoRestyleDamage as RestyleDamage; /// This function determines if a pseudo-element is eagerly cascaded or not. /// @@ -71,8 +82,6 @@ impl PseudoElementCascadeType { } pub trait ElementExt: Element<Impl=TheSelectorImpl> { - type Snapshot: restyle_hints::ElementSnapshot + 'static; - fn is_link(&self) -> bool; } diff --git a/components/style/selector_matching.rs b/components/style/selector_matching.rs index 1a0a07b32e4..3cac2d48670 100644 --- a/components/style/selector_matching.rs +++ b/components/style/selector_matching.rs @@ -16,7 +16,7 @@ use properties::{PropertyDeclaration, PropertyDeclarationBlock}; use quickersort::sort_by; use restyle_hints::{RestyleHint, DependencySet}; use rule_tree::{RuleTree, StrongRuleNode, StyleSource}; -use selector_impl::{ElementExt, TheSelectorImpl, PseudoElement}; +use selector_impl::{ElementExt, TheSelectorImpl, PseudoElement, Snapshot}; use selectors::Element; use selectors::bloom::BloomFilter; use selectors::matching::{AFFECTED_BY_STYLE_ATTRIBUTE, AFFECTED_BY_PRESENTATIONAL_HINTS}; @@ -611,7 +611,7 @@ impl Stylist { } pub fn compute_restyle_hint<E>(&self, element: &E, - snapshot: &E::Snapshot, + snapshot: &Snapshot, // NB: We need to pass current_state as an argument because // selectors::Element doesn't provide access to ElementState // directly, and computing it from the ElementState would be diff --git a/components/style/servo/mod.rs b/components/style/servo/mod.rs new file mode 100644 index 00000000000..bd3db996eff --- /dev/null +++ b/components/style/servo/mod.rs @@ -0,0 +1,6 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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/. */ + +pub mod restyle_damage; +pub mod selector_impl; diff --git a/components/script_layout_interface/restyle_damage.rs b/components/style/servo/restyle_damage.rs index ff0e26af03f..08dd549b288 100644 --- a/components/script_layout_interface/restyle_damage.rs +++ b/components/style/servo/restyle_damage.rs @@ -2,15 +2,15 @@ * 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/. */ +use computed_values::display; +use dom::TRestyleDamage; +use properties::ServoComputedValues; use std::fmt; use std::sync::Arc; -use style::computed_values::display; -use style::dom::TRestyleDamage; -use style::properties::ServoComputedValues; bitflags! { #[doc = "Individual layout actions that may be necessary after restyling."] - pub flags RestyleDamage: u8 { + pub flags ServoRestyleDamage: u8 { #[doc = "Repaint the node itself."] #[doc = "Currently unused; need to decide how this propagates."] const REPAINT = 0x01, @@ -48,35 +48,35 @@ bitflags! { } } -impl TRestyleDamage for RestyleDamage { +impl TRestyleDamage for ServoRestyleDamage { /// For Servo the style source is always the computed values. type PreExistingComputedValues = Arc<ServoComputedValues>; fn empty() -> Self { - RestyleDamage::empty() + ServoRestyleDamage::empty() } fn compute(old: &Arc<ServoComputedValues>, - new: &Arc<ServoComputedValues>) -> RestyleDamage { + new: &Arc<ServoComputedValues>) -> ServoRestyleDamage { compute_damage(old, new) } /// Returns a bitmask that represents a flow that needs to be rebuilt and /// reflowed. /// - /// Use this instead of `RestyleDamage::all()` because - /// `RestyleDamage::all()` will result in unnecessary sequential resolution + /// Use this instead of `ServoRestyleDamage::all()` because + /// `ServoRestyleDamage::all()` will result in unnecessary sequential resolution /// of generated content. - fn rebuild_and_reflow() -> RestyleDamage { + fn rebuild_and_reflow() -> ServoRestyleDamage { REPAINT | REPOSITION | STORE_OVERFLOW | BUBBLE_ISIZES | REFLOW_OUT_OF_FLOW | REFLOW | RECONSTRUCT_FLOW } } -impl RestyleDamage { +impl ServoRestyleDamage { /// Supposing a flow has the given `position` property and this damage, /// returns the damage that we should add to the *parent* of this flow. - pub fn damage_for_parent(self, child_is_absolutely_positioned: bool) -> RestyleDamage { + pub fn damage_for_parent(self, child_is_absolutely_positioned: bool) -> ServoRestyleDamage { if child_is_absolutely_positioned { self & (REPAINT | REPOSITION | STORE_OVERFLOW | REFLOW_OUT_OF_FLOW | RESOLVE_GENERATED_CONTENT) @@ -91,7 +91,7 @@ impl RestyleDamage { pub fn damage_for_child(self, parent_is_absolutely_positioned: bool, child_is_absolutely_positioned: bool) - -> RestyleDamage { + -> ServoRestyleDamage { match (parent_is_absolutely_positioned, child_is_absolutely_positioned) { (false, true) => { // Absolute children are out-of-flow and therefore insulated from changes. @@ -116,7 +116,7 @@ impl RestyleDamage { } } -impl fmt::Display for RestyleDamage { +impl fmt::Display for ServoRestyleDamage { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { let mut first_elem = true; @@ -162,8 +162,8 @@ macro_rules! add_if_not_equal( }) ); -fn compute_damage(old: &ServoComputedValues, new: &ServoComputedValues) -> RestyleDamage { - let mut damage = RestyleDamage::empty(); +fn compute_damage(old: &ServoComputedValues, new: &ServoComputedValues) -> ServoRestyleDamage { + let mut damage = ServoRestyleDamage::empty(); // This should check every CSS property, as enumerated in the fields of // http://doc.servo.org/style/properties/struct.ServoComputedValues.html @@ -260,7 +260,7 @@ fn compute_damage(old: &ServoComputedValues, new: &ServoComputedValues) -> Resty // If the layer requirements of this flow have changed due to the value // of the transform, then reflow is required to rebuild the layers. if old.transform_requires_layer() != new.transform_requires_layer() { - damage.insert(RestyleDamage::rebuild_and_reflow()); + damage.insert(ServoRestyleDamage::rebuild_and_reflow()); } damage diff --git a/components/style/servo_selector_impl.rs b/components/style/servo/selector_impl.rs index f0dd0b3695c..9e5516da9cc 100644 --- a/components/style/servo_selector_impl.rs +++ b/components/style/servo/selector_impl.rs @@ -384,8 +384,6 @@ impl MatchAttrGeneric for ServoElementSnapshot { } impl<E: Element<Impl=TheSelectorImpl>> ElementExt for E { - type Snapshot = ServoElementSnapshot; - fn is_link(&self) -> bool { self.match_non_ts_pseudo_class(NonTSPseudoClass::AnyLink) } diff --git a/components/style/stylesheets.rs b/components/style/stylesheets.rs index f859e1ed549..2f37415351c 100644 --- a/components/style/stylesheets.rs +++ b/components/style/stylesheets.rs @@ -11,7 +11,7 @@ use encoding::EncodingRef; use error_reporting::ParseErrorReporter; use font_face::{FontFaceRule, parse_font_face_block}; use keyframes::{Keyframe, parse_keyframe_list}; -use media_queries::{Device, MediaQueryList, parse_media_query_list}; +use media_queries::{Device, MediaList, parse_media_query_list}; use parking_lot::RwLock; use parser::{ParserContext, ParserContextExtraData, log_css_error}; use properties::{PropertyDeclarationBlock, parse_property_declaration_list}; @@ -46,7 +46,7 @@ pub struct Stylesheet { /// cascading order) pub rules: Vec<CSSRule>, /// List of media associated with the Stylesheet, if any. - pub media: Option<MediaQueryList>, + pub media: Option<MediaList>, pub origin: Origin, pub dirty_on_viewport_size_change: bool, } @@ -77,7 +77,7 @@ impl CSSRule { /// /// Note that only some types of rules can contain rules. An empty slice is used for others. pub fn with_nested_rules_and_mq<F, R>(&self, mut f: F) -> R - where F: FnMut(&[CSSRule], Option<&MediaQueryList>) -> R { + where F: FnMut(&[CSSRule], Option<&MediaList>) -> R { match *self { CSSRule::Namespace(_) | CSSRule::Style(_) | @@ -111,7 +111,7 @@ pub struct KeyframesRule { #[derive(Debug)] pub struct MediaRule { - pub media_queries: Arc<RwLock<MediaQueryList>>, + pub media_queries: Arc<RwLock<MediaList>>, pub rules: Vec<CSSRule>, } @@ -187,15 +187,15 @@ impl Stylesheet { } } - /// Set the MediaQueryList associated with the style-sheet. - pub fn set_media(&mut self, media: Option<MediaQueryList>) { + /// Set the MediaList associated with the style-sheet. + pub fn set_media(&mut self, media: Option<MediaList>) { self.media = media; } /// Returns whether the style-sheet applies for the current device depending - /// on the associated MediaQueryList. + /// on the associated MediaList. /// - /// Always true if no associated MediaQueryList exists. + /// Always true if no associated MediaList exists. pub fn is_effective_for_device(&self, device: &Device) -> bool { self.media.as_ref().map_or(true, |ref media| media.evaluate(device)) } @@ -287,7 +287,7 @@ enum AtRulePrelude { /// A @font-face rule prelude. FontFace, /// A @media rule prelude, with its media queries. - Media(Arc<RwLock<MediaQueryList>>), + Media(Arc<RwLock<MediaList>>), /// A @viewport rule prelude. Viewport, /// A @keyframes rule, with its animation name. diff --git a/docs/glossary.md b/docs/glossary.md index 7328db28528..77970c48cbb 100644 --- a/docs/glossary.md +++ b/docs/glossary.md @@ -16,7 +16,7 @@ The thread that controls a collection of related web content. This could be thou ### Display list ### -TODO +A list of concrete rendering instructions. The display list is post-layout, so all items have stacking-context-relative pixel positions, and z-index has already been applied, so items later in the display list will always be on top of items earlier in it. ### Layout thread ### diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index 5e5ab938a28..d5ee02102b6 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -151,6 +151,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "bitflags" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bitflags" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -225,6 +230,11 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "bytes" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "canvas" version = "0.0.1" dependencies = [ @@ -339,6 +349,7 @@ dependencies = [ "canvas 0.0.1", "canvas_traits 0.0.1", "compositing 0.0.1", + "debugger 0.0.1", "devtools_traits 0.0.1", "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "gaol 0.0.1 (git+https://github.com/servo/gaol)", @@ -466,8 +477,9 @@ dependencies = [ name = "debugger" version = "0.0.1" dependencies = [ + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ws 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1318,6 +1330,33 @@ dependencies = [ ] [[package]] +name = "mio" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "miow 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miow" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "mozjs_sys" version = "0.0.0" source = "git+https://github.com/servo/mozjs#f7917c480e3378441ee54c0554f6a3af9fb57464" @@ -1429,6 +1468,15 @@ dependencies = [ ] [[package]] +name = "nix" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "nodrop" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2169,6 +2217,11 @@ dependencies = [ ] [[package]] +name = "sha1" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "shared_library" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2202,6 +2255,11 @@ version = "0.1.1" source = "git+https://github.com/huonw/simd#0d85d25d5cc3788062b252e31ad48dd19e805e90" [[package]] +name = "slab" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "smallvec" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2632,7 +2690,7 @@ dependencies = [ [[package]] name = "webrender" version = "0.8.0" -source = "git+https://github.com/servo/webrender#8b53081a3de714f8c1296e20658fabe4e75a6244" +source = "git+https://github.com/servo/webrender#c5eb15a9b8030bbad15809aba7dd1b5906d96397" dependencies = [ "app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "bincode 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2657,7 +2715,7 @@ dependencies = [ [[package]] name = "webrender_traits" version = "0.8.0" -source = "git+https://github.com/servo/webrender#8b53081a3de714f8c1296e20658fabe4e75a6244" +source = "git+https://github.com/servo/webrender#c5eb15a9b8030bbad15809aba7dd1b5906d96397" dependencies = [ "app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2698,6 +2756,19 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "ws" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "httparse 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "ws2_32-sys" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2772,6 +2843,7 @@ dependencies = [ "checksum bincode 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9fbba641f73d3e74a5431d4a6d9e42a70bcce76d466d796c852ba1db31ba41bc" "checksum bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9bf6104718e80d7b26a68fdbacff3481cfc05df670821affc7e9cbc1884400c" "checksum bit-vec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5b97c2c8e8bbb4251754f559df8af22fb264853c7d009084a576cdf12565089d" +"checksum bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dead7461c1127cf637931a1e50934eb6eee8bff2f74433ac7909e9afcee04a3" "checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" "checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" "checksum blurdroid 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5fce4ea3366b583e9d49e1aa3a42252e53b42911bccd06f31c3e81c48ccfc79e" @@ -2780,6 +2852,7 @@ dependencies = [ "checksum brotli 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "bff2d5511b5ba5840f46cc3f9c0c3ab09db20e9b9a4db344ef7df3fb547a627a" "checksum browserhtml 0.1.17 (git+https://github.com/browserhtml/browserhtml?branch=crate)" = "<none>" "checksum byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855" +"checksum bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c129aff112dcc562970abb69e2508b40850dd24c274761bb50fb8a0067ba6c27" "checksum caseless 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b6893f86ac0c9275b5cbba9212ccd71020b447d4c3e2eebad70e1bc47fdd6dfb" "checksum cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de1e760d7b6535af4241fca8bd8adf68e2e7edacc6b29f5d399050c5e48cf88c" "checksum cgl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8bdd78cca65a739cb5475dbf6b6bbb49373e327f4a6f2b499c0f98632df38c10" @@ -2869,10 +2942,13 @@ dependencies = [ "checksum mime 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b5c93a4bd787ddc6e7833c519b73a50883deb5863d76d9b71eb8216fb7f94e66" "checksum mime_guess 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e9a7d89cb3bce9145b0d0339a0588b044e3e3e3faa1dcd74822ebdc36bfac020" "checksum miniz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d1f4d337a01c32e1f2122510fed46393d53ca35a7f429cb0450abaedfa3ed54" +"checksum mio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a637d1ca14eacae06296a008fa7ad955347e34efcb5891cfd8ba05491a37907e" +"checksum miow 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d5bfc6782530ac8ace97af10a540054a37126b63b0702ddaaa243b73b5745b9a" "checksum mozjs_sys 0.0.0 (git+https://github.com/servo/mozjs)" = "<none>" "checksum mp3-metadata 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2f61cf32f7fc3cec83a15a255ac60bceb6cac59a7ce190cb824ca25c0fce0feb" "checksum mp4parse 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1e3d4b79704ee1a9d307a92d2cb2c7186a8eb7e40bfca41e1c2fa9fcb152390a" "checksum net2 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)" = "5edf9cb6be97212423aed9413dd4729d62b370b5e1c571750e882cebbbc1e3e2" +"checksum nix 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bfb3ddedaa14746434a02041940495bf11325c22f6d36125d3bdd56090d50a79" "checksum nodrop 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "0dbbadd3f4c98dea0bd3d9b4be4c0cdaf1ab57035cb2e41fce3983db5add7cc5" "checksum num 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "5a9699207fab8b02bd0e56f8f06fee3f26d640303130de548898b4c9704f6d01" "checksum num-bigint 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "88b14378471f7c2adc5262f05b4701ef53e8da376453a8d8fee48e51db745e49" @@ -2930,11 +3006,13 @@ dependencies = [ "checksum servo-freetype-sys 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9232032c2e85118c0282c6562c84cab12316e655491ba0a5d1905b2320060d1b" "checksum servo-glutin 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ffc7cae7df54ab2c3b9f8cab92b2de395bd8033a3380521d2d23c340e24cc779" "checksum servo-skia 0.20130412.24 (registry+https://github.com/rust-lang/crates.io-index)" = "bb975cdf292243956e6b6acfac336ac8be0aa567e32bb89901be161e4003d0b3" +"checksum sha1 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cc30b1e1e8c40c121ca33b86c23308a090d19974ef001b4bf6e61fd1a0fb095c" "checksum shared_library 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fb04126b6fcfd2710fb5b6d18f4207b6c535f2850a7e1a43bcd526d44f30a79a" "checksum shell32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "72f20b8f3c060374edb8046591ba28f62448c369ccbdc7b02075103fb3a9e38d" "checksum sig 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c6649e43c1a1e68d29ed56d0dc3b5b6cf3b901da77cf107c4066b9e3da036df5" "checksum signpost 0.1.0 (git+https://github.com/pcwalton/signpost.git)" = "<none>" "checksum simd 0.1.1 (git+https://github.com/huonw/simd)" = "<none>" +"checksum slab 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d807fd58c4181bbabed77cb3b891ba9748241a552bcc5be698faaebefc54f46e" "checksum smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "fcc8d19212aacecf95e4a7a2179b26f7aeb9732a915cf01f05b0d3e044865410" "checksum solicit 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "172382bac9424588d7840732b250faeeef88942e37b6e35317dce98cafdd75b2" "checksum string_cache 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d192db2123fac37399e1ca61557904a5c3fb6fc24c73d2e47b15d20dc32470" @@ -2978,6 +3056,7 @@ dependencies = [ "checksum websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a1a6ea5ed0367f32eb3d94dcc58859ef4294b5f75ba983dbf56ac314af45d" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" +"checksum ws 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7c47e9ca2f5c47d27f731b1bb9bb50cc05f9886bb84fbd52afa0ff97f4f61b06" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum x11 2.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bfc828b6baf54ccdde44e0b5f16e035ab9c54f60a0f0c218fb5ddbc6ab38a2a9" "checksum x11-dl 2.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6acc29bdc98d7565e18dc71b3e933aa94a195d0c2f4ec84f675679d9744b0d6b" diff --git a/resources/package-prefs.json b/resources/package-prefs.json index d77d13f4b0c..7f0cda53b13 100644 --- a/resources/package-prefs.json +++ b/resources/package-prefs.json @@ -49,8 +49,6 @@ "layout.column-gap.enabled": false, "layout.column-width.enabled": false, "layout.columns.enabled": false, - "layout.flex-direction.enabled": false, - "layout.flex.enabled": false, "layout.text-orientation.enabled": false, "layout.viewport.enabled": false, "layout.writing-mode.enabled": false, diff --git a/resources/prefs.json b/resources/prefs.json index c8fe13590e5..0b542acabfc 100644 --- a/resources/prefs.json +++ b/resources/prefs.json @@ -50,8 +50,6 @@ "layout.column-gap.enabled": false, "layout.column-width.enabled": false, "layout.columns.enabled": false, - "layout.flex-direction.enabled": false, - "layout.flex.enabled": false, "layout.text-orientation.enabled": false, "layout.viewport.enabled": false, "layout.writing-mode.enabled": false, diff --git a/resources/shaders/clip_shared.glsl b/resources/shaders/clip_shared.glsl index 2c1993b1fa5..62e51c3bbf1 100644 --- a/resources/shaders/clip_shared.glsl +++ b/resources/shaders/clip_shared.glsl @@ -9,7 +9,7 @@ flat varying vec4 vClipMaskUvRect; flat varying vec4 vClipMaskLocalRect; #ifdef WR_VERTEX_SHADER -void write_clip(ClipInfo clip) { +void write_clip(ClipData clip) { vClipRect = vec4(clip.rect.rect.xy, clip.rect.rect.xy + clip.rect.rect.zw); vClipRadius = vec4(clip.top_left.outer_inner_radius.x, clip.top_right.outer_inner_radius.x, @@ -17,8 +17,8 @@ void write_clip(ClipInfo clip) { clip.bottom_left.outer_inner_radius.x); //TODO: interpolate the final mask UV vec2 texture_size = textureSize(sMask, 0); - vClipMaskUvRect = clip.mask_info.uv_rect / texture_size.xyxy; - vClipMaskLocalRect = clip.mask_info.local_rect; //TODO: transform + vClipMaskUvRect = clip.mask_data.uv_rect / texture_size.xyxy; + vClipMaskLocalRect = clip.mask_data.local_rect; //TODO: transform } #endif diff --git a/resources/shaders/prim_shared.glsl b/resources/shaders/prim_shared.glsl index d6248030646..e4803c42a6f 100644 --- a/resources/shaders/prim_shared.glsl +++ b/resources/shaders/prim_shared.glsl @@ -347,13 +347,13 @@ ClipRect fetch_clip_rect(int index) { return rect; } -struct ImageMaskInfo { +struct ImageMaskData { vec4 uv_rect; vec4 local_rect; }; -ImageMaskInfo fetch_mask_info(int index) { - ImageMaskInfo info; +ImageMaskData fetch_mask_data(int index) { + ImageMaskData info; ivec2 uv = get_fetch_uv_2(index); @@ -379,24 +379,24 @@ ClipCorner fetch_clip_corner(int index) { return corner; } -struct ClipInfo { +struct ClipData { ClipRect rect; ClipCorner top_left; ClipCorner top_right; ClipCorner bottom_left; ClipCorner bottom_right; - ImageMaskInfo mask_info; + ImageMaskData mask_data; }; -ClipInfo fetch_clip(int index) { - ClipInfo clip; +ClipData fetch_clip(int index) { + ClipData clip; clip.rect = fetch_clip_rect(index + 0); clip.top_left = fetch_clip_corner(index + 1); clip.top_right = fetch_clip_corner(index + 2); clip.bottom_left = fetch_clip_corner(index + 3); clip.bottom_right = fetch_clip_corner(index + 4); - clip.mask_info = fetch_mask_info(index + 5); + clip.mask_data = fetch_mask_data(index + 5); return clip; } diff --git a/resources/shaders/ps_gradient_clip.vs.glsl b/resources/shaders/ps_gradient_clip.vs.glsl index 62e7caeb7f7..8c20dfdbfa4 100644 --- a/resources/shaders/ps_gradient_clip.vs.glsl +++ b/resources/shaders/ps_gradient_clip.vs.glsl @@ -66,6 +66,6 @@ void main(void) { break; } - ClipInfo clip = fetch_clip(prim.clip_index); + ClipData clip = fetch_clip(prim.clip_index); write_clip(clip); } diff --git a/resources/shaders/ps_image_clip.vs.glsl b/resources/shaders/ps_image_clip.vs.glsl index 5426d997e4d..5e9161008e5 100644 --- a/resources/shaders/ps_image_clip.vs.glsl +++ b/resources/shaders/ps_image_clip.vs.glsl @@ -23,7 +23,7 @@ void main(void) { vLocalPos = vi.local_clamped_pos; #endif - ClipInfo clip = fetch_clip(prim.clip_index); + ClipData clip = fetch_clip(prim.clip_index); write_clip(clip); // vUv will contain how many times this image has wrapped around the image size. diff --git a/resources/shaders/ps_rectangle_clip.vs.glsl b/resources/shaders/ps_rectangle_clip.vs.glsl index 20fef16a3d7..1cc281ac61c 100644 --- a/resources/shaders/ps_rectangle_clip.vs.glsl +++ b/resources/shaders/ps_rectangle_clip.vs.glsl @@ -22,6 +22,6 @@ void main(void) { vPos = vi.local_clamped_pos; #endif - ClipInfo clip = fetch_clip(prim.clip_index); + ClipData clip = fetch_clip(prim.clip_index); write_clip(clip); } diff --git a/servo-tidy.toml b/servo-tidy.toml index b0df193e7fb..323df3d8f6a 100644 --- a/servo-tidy.toml +++ b/servo-tidy.toml @@ -8,7 +8,7 @@ check-ordered-json-keys = [ [ignore] # Ignored packages with duplicated versions -packages = ["lazy_static"] +packages = ["bitflags", "lazy_static"] # Files that are ignored for all tidy and lint checks. files = [ # Generated and upstream code combined with our own. Could use cleanup diff --git a/tests/unit/net/fetch.rs b/tests/unit/net/fetch.rs index 308ef309204..4d56668ad6e 100644 --- a/tests/unit/net/fetch.rs +++ b/tests/unit/net/fetch.rs @@ -2,7 +2,7 @@ * 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/. */ -use {DEFAULT_USER_AGENT, FetchResponseCollector, new_fetch_context, fetch_async, fetch_sync}; +use {DEFAULT_USER_AGENT, FetchResponseCollector, new_fetch_context, fetch_async, fetch_sync, make_server}; use devtools_traits::DevtoolsControlMsg; use devtools_traits::HttpRequest as DevtoolsHttpRequest; use devtools_traits::HttpResponse as DevtoolsHttpResponse; @@ -12,11 +12,10 @@ use hyper::header::{Accept, AccessControlAllowCredentials, AccessControlAllowHea use hyper::header::{AcceptEncoding, AcceptLanguage, AccessControlAllowMethods, AccessControlMaxAge}; use hyper::header::{AccessControlRequestHeaders, AccessControlRequestMethod, Date, UserAgent}; use hyper::header::{CacheControl, ContentLanguage, ContentLength, ContentType, Expires, LastModified}; -use hyper::header::{Encoding, Location, Pragma, SetCookie, qitem}; +use hyper::header::{Encoding, Location, Pragma, Quality, QualityItem, SetCookie, qitem}; use hyper::header::{Headers, Host, HttpDate, Referer as HyperReferer}; use hyper::method::Method; use hyper::mime::{Mime, SubLevel, TopLevel}; -use hyper::server::{Handler, Listening, Server}; use hyper::server::{Request as HyperRequest, Response as HyperResponse}; use hyper::status::StatusCode; use hyper::uri::RequestUri; @@ -39,16 +38,6 @@ use util::resource_files::resources_dir_path; // TODO write a struct that impls Handler for storing test values -fn make_server<H: Handler + 'static>(handler: H) -> (Listening, Url) { - // this is a Listening server because of handle_threads() - let server = Server::http("0.0.0.0:0").unwrap().handle_threads(handler, 1).unwrap(); - let port = server.socket.port().to_string(); - let mut url_string = "http://localhost:".to_owned(); - url_string.push_str(&port); - let url = Url::parse(&url_string).unwrap(); - (server, url) -} - #[test] fn test_fetch_response_is_not_network_error() { static MESSAGE: &'static [u8] = b""; @@ -787,7 +776,12 @@ fn test_fetch_with_devtools() { let mut en_us: LanguageTag = Default::default(); en_us.language = Some("en".to_owned()); en_us.region = Some("US".to_owned()); - headers.set(AcceptLanguage(vec![qitem(en_us)])); + let mut en: LanguageTag = Default::default(); + en.language = Some("en".to_owned()); + headers.set(AcceptLanguage(vec![ + qitem(en_us), + QualityItem::new(en, Quality(500)), + ])); headers.set(UserAgent(DEFAULT_USER_AGENT.to_owned())); diff --git a/tests/unit/net/http_loader.rs b/tests/unit/net/http_loader.rs index 87ef95f9eca..dd38ce2be43 100644 --- a/tests/unit/net/http_loader.rs +++ b/tests/unit/net/http_loader.rs @@ -7,6 +7,7 @@ use cookie_rs::Cookie as CookiePair; use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg, NetworkEvent}; use devtools_traits::HttpRequest as DevtoolsHttpRequest; use devtools_traits::HttpResponse as DevtoolsHttpResponse; +use fetch_sync; use flate2::Compression; use flate2::write::{DeflateEncoder, GzEncoder}; use hyper::LanguageTag; @@ -17,7 +18,9 @@ use hyper::header::{StrictTransportSecurity, UserAgent}; use hyper::http::RawStatus; use hyper::method::Method; use hyper::mime::{Mime, SubLevel, TopLevel}; +use hyper::server::{Request as HyperRequest, Response as HyperResponse}; use hyper::status::StatusCode; +use make_server; use msg::constellation_msg::{PipelineId, TEST_PIPELINE_ID}; use net::cookie::Cookie; use net::cookie_storage::CookieStorage; @@ -27,9 +30,10 @@ use net::test::{HttpRequest, HttpRequestFactory, HttpState, LoadError, UIProvide use net::test::{HttpResponse, LoadErrorType}; use net_traits::{CookieSource, IncludeSubdomains, LoadContext, LoadData}; use net_traits::{CustomResponse, LoadOrigin, Metadata, ReferrerPolicy}; +use net_traits::request::{Request, RequestInit, Destination}; use std::borrow::Cow; use std::io::{self, Cursor, Read, Write}; -use std::sync::{Arc, RwLock, mpsc}; +use std::sync::{Arc, Mutex, RwLock, mpsc}; use std::sync::mpsc::Receiver; use std::thread; use url::Url; @@ -229,20 +233,6 @@ impl HttpRequest for MockRequest { } } -struct AssertMustHaveHeadersRequestFactory { - expected_headers: Headers, - body: Vec<u8> -} - -impl HttpRequestFactory for AssertMustHaveHeadersRequestFactory { - type R = MockRequest; - - fn create(&self, _: Url, _: Method, headers: Headers) -> Result<MockRequest, LoadError> { - assert_eq!(headers, self.expected_headers); - Ok(MockRequest::new(ResponseType::Text(self.body.clone()))) - } -} - struct AssertAuthHeaderRequestFactory { expected_headers: Headers, body: Vec<u8> @@ -373,14 +363,12 @@ pub fn expect_devtools_http_response(devtools_port: &Receiver<DevtoolsControlMsg #[test] fn test_check_default_headers_loaded_in_every_request() { - let url = Url::parse("http://mozilla.com").unwrap(); - - let http_state = HttpState::new(); - let ui_provider = TestProvider::new(); - - let mut load_data = LoadData::new(LoadContext::Browsing, url.clone(), &HttpTest); - load_data.data = None; - load_data.method = Method::Get; + let expected_headers = Arc::new(Mutex::new(None)); + let expected_headers_clone = expected_headers.clone(); + let handler = move |request: HyperRequest, _: HyperResponse| { + assert_eq!(request.headers, expected_headers_clone.lock().unwrap().take().unwrap()); + }; + let (mut server, url) = make_server(handler); let mut headers = Headers::new(); @@ -388,7 +376,12 @@ fn test_check_default_headers_loaded_in_every_request() { qitem(Encoding::Deflate), qitem(Encoding::EncodingExt("br".to_owned()))])); - headers.set(Host { hostname: "mozilla.com".to_owned() , port: None }); + let hostname = match url.host_str() { + Some(hostname) => hostname.to_owned(), + _ => panic!() + }; + + headers.set(Host { hostname: hostname, port: url.port() }); let accept = Accept(vec![ qitem(Mime(TopLevel::Text, SubLevel::Html, vec![])), @@ -408,25 +401,37 @@ fn test_check_default_headers_loaded_in_every_request() { QualityItem::new(en, Quality(500)), ])); - headers.set(UserAgent(DEFAULT_USER_AGENT.to_owned())); + headers.set(UserAgent(::DEFAULT_USER_AGENT.to_owned())); + + *expected_headers.lock().unwrap() = Some(headers.clone()); // Testing for method.GET - let _ = load(&load_data, &ui_provider, &http_state, None, - &AssertMustHaveHeadersRequestFactory { - expected_headers: headers.clone(), - body: <[_]>::to_vec(&[]) - }, DEFAULT_USER_AGENT.into(), &CancellationListener::new(None), None); + let request = Request::from_init(RequestInit { + url: url.clone(), + method: Method::Get, + destination: Destination::Document, + origin: url.clone(), + pipeline_id: Some(TEST_PIPELINE_ID), + .. RequestInit::default() + }); + let response = fetch_sync(request, None); + assert!(response.status.unwrap().is_success()); // Testing for method.POST - load_data.method = Method::Post; - headers.set(ContentLength(0 as u64)); + *expected_headers.lock().unwrap() = Some(headers.clone()); + let request = Request::from_init(RequestInit { + url: url.clone(), + method: Method::Post, + destination: Destination::Document, + origin: url.clone(), + pipeline_id: Some(TEST_PIPELINE_ID), + .. RequestInit::default() + }); + let response = fetch_sync(request, None); + assert!(response.status.unwrap().is_success()); - let _ = load(&load_data, &ui_provider, &http_state, None, - &AssertMustHaveHeadersRequestFactory { - expected_headers: headers, - body: <[_]>::to_vec(&[]) - }, DEFAULT_USER_AGENT.into(), &CancellationListener::new(None), None); + let _ = server.close(); } #[test] diff --git a/tests/unit/net/lib.rs b/tests/unit/net/lib.rs index 4f1f91f923d..60cd847ba99 100644 --- a/tests/unit/net/lib.rs +++ b/tests/unit/net/lib.rs @@ -35,6 +35,7 @@ extern crate util; use devtools_traits::DevtoolsControlMsg; use filemanager_thread::{TestProvider, TEST_PROVIDER}; +use hyper::server::{Handler, Listening, Server}; use net::fetch::methods::{FetchContext, fetch}; use net::filemanager_thread::FileManager; use net::test::HttpState; @@ -44,6 +45,7 @@ use net_traits::response::Response; use std::rc::Rc; use std::sync::mpsc::Sender; use std::thread; +use url::Url; const DEFAULT_USER_AGENT: &'static str = "Such Browser. Very Layout. Wow."; @@ -79,3 +81,11 @@ fn fetch_async(request: Request, target: Box<FetchTaskTarget + Send>, dc: Option fn fetch_sync(request: Request, dc: Option<Sender<DevtoolsControlMsg>>) -> Response { fetch(Rc::new(request), &mut None, new_fetch_context(dc)) } + +fn make_server<H: Handler + 'static>(handler: H) -> (Listening, Url) { + // this is a Listening server because of handle_threads() + let server = Server::http("0.0.0.0:0").unwrap().handle_threads(handler, 1).unwrap(); + let url_string = format!("http://localhost:{}", server.socket.port()); + let url = Url::parse(&url_string).unwrap(); + (server, url) +} diff --git a/tests/unit/style/media_queries.rs b/tests/unit/style/media_queries.rs index 3d3a49afb40..7cc55c412c4 100644 --- a/tests/unit/style/media_queries.rs +++ b/tests/unit/style/media_queries.rs @@ -24,7 +24,7 @@ impl ParseErrorReporter for CSSErrorReporterTest { } } -fn test_media_rule<F>(css: &str, callback: F) where F: Fn(&MediaQueryList, &str) { +fn test_media_rule<F>(css: &str, callback: F) where F: Fn(&MediaList, &str) { let url = Url::parse("http://localhost").unwrap(); let stylesheet = Stylesheet::from_str(css, url, Origin::Author, Box::new(CSSErrorReporterTest), ParserContextExtraData::default()); @@ -36,7 +36,7 @@ fn test_media_rule<F>(css: &str, callback: F) where F: Fn(&MediaQueryList, &str) assert!(rule_count > 0); } -fn media_queries<F>(rules: &[CSSRule], f: &mut F) where F: FnMut(&MediaQueryList) { +fn media_queries<F>(rules: &[CSSRule], f: &mut F) where F: FnMut(&MediaList) { for rule in rules { rule.with_nested_rules_and_mq(|rules, mq| { if let Some(mq) = mq { diff --git a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flex-order.htm.ini b/tests/wpt/metadata-css/css-flexbox-1_dev/html/flex-order.htm.ini deleted file mode 100644 index a9689d9d607..00000000000 --- a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flex-order.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[flex-order.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-align-self-baseline-horiz-004.htm.ini b/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-align-self-baseline-horiz-004.htm.ini deleted file mode 100644 index 86855e1d300..00000000000 --- a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-align-self-baseline-horiz-004.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[flexbox-align-self-baseline-horiz-004.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-align-self-horiz-005.htm.ini b/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-align-self-horiz-005.htm.ini deleted file mode 100644 index 852c25e5146..00000000000 --- a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-align-self-horiz-005.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[flexbox-align-self-horiz-005.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-overflow-horiz-003.htm.ini b/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-overflow-horiz-003.htm.ini deleted file mode 100644 index 8466e0c20a3..00000000000 --- a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-overflow-horiz-003.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[flexbox-overflow-horiz-003.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-overflow-horiz-004.htm.ini b/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-overflow-horiz-004.htm.ini deleted file mode 100644 index 65b75830feb..00000000000 --- a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-overflow-horiz-004.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[flexbox-overflow-horiz-004.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-overflow-horiz-005.htm.ini b/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-overflow-horiz-005.htm.ini deleted file mode 100644 index 57bca16a45c..00000000000 --- a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-overflow-horiz-005.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[flexbox-overflow-horiz-005.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-root-node-001a.htm.ini b/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-root-node-001a.htm.ini deleted file mode 100644 index 212779ad895..00000000000 --- a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-root-node-001a.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[flexbox-root-node-001a.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-root-node-001b.htm.ini b/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-root-node-001b.htm.ini deleted file mode 100644 index ff8dd0be09b..00000000000 --- a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-root-node-001b.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[flexbox-root-node-001b.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-whitespace-handling-002.htm.ini b/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-whitespace-handling-002.htm.ini deleted file mode 100644 index 5d49fbbd99d..00000000000 --- a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-whitespace-handling-002.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[flexbox-whitespace-handling-002.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-with-pseudo-elements-001.htm.ini b/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-with-pseudo-elements-001.htm.ini deleted file mode 100644 index 195d8daf140..00000000000 --- a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-with-pseudo-elements-001.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[flexbox-with-pseudo-elements-001.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-with-pseudo-elements-002.htm.ini b/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-with-pseudo-elements-002.htm.ini deleted file mode 100644 index 5e2885b05b6..00000000000 --- a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-with-pseudo-elements-002.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[flexbox-with-pseudo-elements-002.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-with-pseudo-elements-003.htm.ini b/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-with-pseudo-elements-003.htm.ini deleted file mode 100644 index c55e038cd46..00000000000 --- a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox-with-pseudo-elements-003.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[flexbox-with-pseudo-elements-003.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox_absolute-atomic.htm.ini b/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox_absolute-atomic.htm.ini deleted file mode 100644 index 36406b0ddfb..00000000000 --- a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox_absolute-atomic.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[flexbox_absolute-atomic.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/abspos-overflow-010.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/abspos-overflow-010.htm.ini deleted file mode 100644 index 5504b7061bf..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/abspos-overflow-010.htm.ini +++ /dev/null @@ -1,4 +0,0 @@ -[abspos-overflow-010.htm] - type: reftest - expected: - if os == "linux": FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/abspos-overflow-011.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/abspos-overflow-011.htm.ini deleted file mode 100644 index 6ef62736b3c..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/abspos-overflow-011.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[abspos-overflow-011.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/max-width-106.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/max-width-106.htm.ini deleted file mode 100644 index 4aea4cf359c..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/max-width-106.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[max-width-106.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata/html/dom/interfaces.html.ini b/tests/wpt/metadata/html/dom/interfaces.html.ini index d9e3bda0495..c2fd0d37c5c 100644 --- a/tests/wpt/metadata/html/dom/interfaces.html.ini +++ b/tests/wpt/metadata/html/dom/interfaces.html.ini @@ -6291,12 +6291,6 @@ [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onsort" with the proper type (149)] expected: FAIL - [HTMLAnchorElement interface: attribute origin] - expected: FAIL - - [HTMLAnchorElement interface: document.createElement("a") must inherit property "origin" with the proper type (14)] - expected: FAIL - [HTMLAreaElement interface: attribute href] expected: FAIL diff --git a/tests/wpt/metadata/url/a-element-xhtml.xhtml.ini b/tests/wpt/metadata/url/a-element-xhtml.xhtml.ini deleted file mode 100644 index 975c9bddbfc..00000000000 --- a/tests/wpt/metadata/url/a-element-xhtml.xhtml.ini +++ /dev/null @@ -1,740 +0,0 @@ -[a-element-xhtml.xhtml] - type: testharness - [Parsing: <http://example\t.\norg> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://user:pass@foo:21/bar;par?b#c> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http:foo.com> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <\t :foo.com \n> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: < foo.com > against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <a:\t foo.com> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://f:21/ b ? d # e > against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://f:/c> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://f:0/c> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://f:00000000000000/c> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://f:00000000000000000000080/c> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://f:\n/c> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: < \t> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <:foo.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <:foo.com\\> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <:> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <:a> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <:/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <:\\> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <:#> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <#> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <#/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <#\\> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <#;?> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <?> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: </> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <:23> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: </:23> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <::> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <::23> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <foo://> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://a:b@c:29/d> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http::@c:29> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://&a:foo(b\]c@d:2/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://::@c@d:2> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://foo.com:b@d/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://foo.com/\\@> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http:\\\\foo.com\\> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http:\\\\a\\b:c\\d@foo.com\\> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <foo:/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <foo:/bar.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <foo://///////> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <foo://///////bar.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <foo:////://///> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <c:/foo> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <//foo/bar> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://foo/path;a??e#f#g> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://foo/abcd?efgh?ijkl> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://foo/abcd#foo?bar> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <[61:24:74\]:98> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http:[61:27\]/:foo> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://[2001::1\]> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://[2001::1\]:80> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http:/example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <ftp:/example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <https:/example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <madeupscheme:/example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <ftps:/example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <gopher:/example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <ws:/example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <wss:/example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <data:/example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <javascript:/example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <mailto:/example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http:example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <ftp:example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <https:example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <madeupscheme:example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <ftps:example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <gopher:example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <ws:example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <wss:example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <data:example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <javascript:example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <mailto:example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: </a/b/c> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: </a/ /c> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: </a%2fc> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: </a/%2f/c> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <#β> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <data:text/html,test#test> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://example.com/././foo> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/./.foo> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/.> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/./> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/bar/..> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/bar/../> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/..bar> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/bar/../ton> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/bar/../ton/../../a> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/../../..> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/../../../ton> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/%2e> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/%2e%2> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com////../..> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/bar//../..> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/bar//..> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/%20foo> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo%> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo%2> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo%2zbar> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo%2©zbar> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo%41%7a> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo\t%91> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo%00%51> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/(%28:%3A%29)> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/%3A%3a%3C%3c> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo\tbar> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com\\\\foo\\\\bar> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/%7Ffp3%3Eju%3Dduvgw%3Dd> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/@asdf%40> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/你好你好> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/‥/foo> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com//foo> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com//foo//bar> against <about:blank>] - expected: FAIL - - [Parsing: <http://www.google.com/foo?bar=baz#> against <about:blank>] - expected: FAIL - - [Parsing: <http://www.google.com/foo?bar=baz# »> against <about:blank>] - expected: FAIL - - [Parsing: <data:test# »> against <about:blank>] - expected: FAIL - - [Parsing: <http://www.google.com> against <about:blank>] - expected: FAIL - - [Parsing: <http://192.0x00A80001> against <about:blank>] - expected: FAIL - - [Parsing: <http://www/foo%2Ehtml> against <about:blank>] - expected: FAIL - - [Parsing: <http://www/foo/%2E/html> against <about:blank>] - expected: FAIL - - [Parsing: <http://%25DOMAIN:foobar@foodomain.com/> against <about:blank>] - expected: FAIL - - [Parsing: <http:\\\\www.google.com\\foo> against <about:blank>] - expected: FAIL - - [Parsing: <http://foo:80/> against <about:blank>] - expected: FAIL - - [Parsing: <http://foo:81/> against <about:blank>] - expected: FAIL - - [Parsing: <httpa://foo:80/> against <about:blank>] - expected: FAIL - - [Parsing: <https://foo:443/> against <about:blank>] - expected: FAIL - - [Parsing: <https://foo:80/> against <about:blank>] - expected: FAIL - - [Parsing: <ftp://foo:21/> against <about:blank>] - expected: FAIL - - [Parsing: <ftp://foo:80/> against <about:blank>] - expected: FAIL - - [Parsing: <gopher://foo:70/> against <about:blank>] - expected: FAIL - - [Parsing: <gopher://foo:443/> against <about:blank>] - expected: FAIL - - [Parsing: <ws://foo:80/> against <about:blank>] - expected: FAIL - - [Parsing: <ws://foo:81/> against <about:blank>] - expected: FAIL - - [Parsing: <ws://foo:443/> against <about:blank>] - expected: FAIL - - [Parsing: <ws://foo:815/> against <about:blank>] - expected: FAIL - - [Parsing: <wss://foo:80/> against <about:blank>] - expected: FAIL - - [Parsing: <wss://foo:81/> against <about:blank>] - expected: FAIL - - [Parsing: <wss://foo:443/> against <about:blank>] - expected: FAIL - - [Parsing: <wss://foo:815/> against <about:blank>] - expected: FAIL - - [Parsing: <http:/example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <ftp:/example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <https:/example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <madeupscheme:/example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <ftps:/example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <gopher:/example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <ws:/example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <wss:/example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <data:/example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <javascript:/example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <mailto:/example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <http:example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <ftp:example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <https:example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <madeupscheme:example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <ftps:example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <gopher:example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <ws:example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <wss:example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <data:example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <javascript:example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <mailto:example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <http:@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: <http:/@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: <http://@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: <http:a:b@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: <http:/a:b@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: <http://a:b@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: <http://@pple.com> against <about:blank>] - expected: FAIL - - [Parsing: <http::b@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: <http:/:b@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: <http://:b@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: <http:a:@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: <http:/a:@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: <http://a:@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: <http://www.@pple.com> against <about:blank>] - expected: FAIL - - [Parsing: <http://:@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: </> against <http://www.example.com/test>] - expected: FAIL - - [Parsing: </test.txt> against <http://www.example.com/test>] - expected: FAIL - - [Parsing: <.> against <http://www.example.com/test>] - expected: FAIL - - [Parsing: <..> against <http://www.example.com/test>] - expected: FAIL - - [Parsing: <test.txt> against <http://www.example.com/test>] - expected: FAIL - - [Parsing: <./test.txt> against <http://www.example.com/test>] - expected: FAIL - - [Parsing: <../test.txt> against <http://www.example.com/test>] - expected: FAIL - - [Parsing: <../aaa/test.txt> against <http://www.example.com/test>] - expected: FAIL - - [Parsing: <../../test.txt> against <http://www.example.com/test>] - expected: FAIL - - [Parsing: <中/test.txt> against <http://www.example.com/test>] - expected: FAIL - - [Parsing: <http://www.example2.com> against <http://www.example.com/test>] - expected: FAIL - - [Parsing: <//www.example2.com> against <http://www.example.com/test>] - expected: FAIL - - [Parsing: <http://ExAmPlE.CoM> against <http://other.com/>] - expected: FAIL - - [Parsing: <http://GOOgoo.com> against <http://other.com/>] - expected: FAIL - - [Parsing: <http://www.foo。bar.com> against <http://other.com/>] - expected: FAIL - - [Parsing: <http://Go.com> against <http://other.com/>] - expected: FAIL - - [Parsing: <http://你好你好> against <http://other.com/>] - expected: FAIL - - [Parsing: <http://%30%78%63%30%2e%30%32%35%30.01> against <http://other.com/>] - expected: FAIL - - [Parsing: <http://%30%78%63%30%2e%30%32%35%30.01%2e> against <http://other.com/>] - expected: FAIL - - [Parsing: <http://0Xc0.0250.01> against <http://other.com/>] - expected: FAIL - - [Parsing: <http://foo:💩@example.com/bar> against <http://other.com/>] - expected: FAIL - - [Parsing: <#> against <test:test>] - expected: FAIL - - [Parsing: <#x> against <mailto:x@x.com>] - expected: FAIL - - [Parsing: <#x> against <data:,>] - expected: FAIL - - [Parsing: <#x> against <about:blank>] - expected: FAIL - - [Parsing: <#> against <test:test?test>] - expected: FAIL - - [Parsing: <https://@test@test@example:800/> against <http://doesnotmatter/>] - expected: FAIL - - [Parsing: <https://@@@example> against <http://doesnotmatter/>] - expected: FAIL - - [Parsing: <http://`{}:`{}@h/`{}?`{}> against <http://doesnotmatter/>] - expected: FAIL - - [Parsing: </some/path> against <http://user@example.org/smth>] - expected: FAIL - - [Parsing: <> against <http://user:pass@example.org:21/smth>] - expected: FAIL - - [Parsing: </some/path> against <http://user:pass@example.org:21/smth>] - expected: FAIL - - [Parsing: <i> against <sc:/pa/pa>] - expected: FAIL - - [Parsing: <i> against <sc://ho/pa>] - expected: FAIL - - [Parsing: <i> against <sc:///pa/pa>] - expected: FAIL - - [Parsing: <../i> against <sc:/pa/pa>] - expected: FAIL - - [Parsing: <../i> against <sc://ho/pa>] - expected: FAIL - - [Parsing: <../i> against <sc:///pa/pa>] - expected: FAIL - - [Parsing: </i> against <sc:/pa/pa>] - expected: FAIL - - [Parsing: </i> against <sc://ho/pa>] - expected: FAIL - - [Parsing: </i> against <sc:///pa/pa>] - expected: FAIL - - [Parsing: <?i> against <sc:/pa/pa>] - expected: FAIL - - [Parsing: <?i> against <sc://ho/pa>] - expected: FAIL - - [Parsing: <?i> against <sc:///pa/pa>] - expected: FAIL - - [Parsing: <#i> against <sc:sd>] - expected: FAIL - - [Parsing: <#i> against <sc:sd/sd>] - expected: FAIL - - [Parsing: <#i> against <sc:/pa/pa>] - expected: FAIL - - [Parsing: <#i> against <sc://ho/pa>] - expected: FAIL - - [Parsing: <#i> against <sc:///pa/pa>] - expected: FAIL - - [Parsing: <about:/../> against <about:blank>] - expected: FAIL - - [Parsing: <data:/../> against <about:blank>] - expected: FAIL - - [Parsing: <javascript:/../> against <about:blank>] - expected: FAIL - - [Parsing: <mailto:/../> against <about:blank>] - expected: FAIL - - [Parsing: <sc://ñ.test/> against <about:blank>] - expected: FAIL - - [Parsing: <sc:\\../> against <about:blank>] - expected: FAIL - - [Parsing: <http://127.0.0.1:10100/relative_import.html> against <about:blank>] - expected: FAIL - - [Parsing: <http://facebook.com/?foo=%7B%22abc%22> against <about:blank>] - expected: FAIL - - [Parsing: <https://localhost:3000/jqueryui@1.2.3> against <about:blank>] - expected: FAIL - - [Parsing: <h\tt\nt\rp://h\to\ns\rt:9\t0\n0\r0/p\ta\nt\rh?q\tu\ne\rry#f\tr\na\rg> against <about:blank>] - expected: FAIL - - [Parsing: <?a=b&c=d> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <??a=b&c=d> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <sc::a@example.net> against <about:blank>] - expected: FAIL - - [Parsing: <http:> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <sc:> against <https://example.org/foo/bar>] - expected: FAIL - - [Parsing: <tel:1234567890> against <http://example.org/foo/bar>] - expected: FAIL - diff --git a/tests/wpt/metadata/url/a-element.html.ini b/tests/wpt/metadata/url/a-element.html.ini deleted file mode 100644 index 056f31747fa..00000000000 --- a/tests/wpt/metadata/url/a-element.html.ini +++ /dev/null @@ -1,740 +0,0 @@ -[a-element.html] - type: testharness - [Parsing: <http://example\t.\norg> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://user:pass@foo:21/bar;par?b#c> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http:foo.com> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <\t :foo.com \n> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: < foo.com > against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <a:\t foo.com> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://f:21/ b ? d # e > against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://f:/c> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://f:0/c> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://f:00000000000000/c> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://f:00000000000000000000080/c> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://f:\n/c> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: < \t> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <:foo.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <:foo.com\\> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <:> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <:a> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <:/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <:\\> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <:#> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <#> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <#/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <#\\> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <#;?> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <?> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: </> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <:23> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: </:23> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <::> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <::23> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <foo://> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://a:b@c:29/d> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http::@c:29> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://&a:foo(b\]c@d:2/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://::@c@d:2> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://foo.com:b@d/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://foo.com/\\@> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http:\\\\foo.com\\> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http:\\\\a\\b:c\\d@foo.com\\> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <foo:/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <foo:/bar.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <foo://///////> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <foo://///////bar.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <foo:////://///> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <c:/foo> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <//foo/bar> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://foo/path;a??e#f#g> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://foo/abcd?efgh?ijkl> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://foo/abcd#foo?bar> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <[61:24:74\]:98> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http:[61:27\]/:foo> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://[2001::1\]> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://[2001::1\]:80> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http:/example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <ftp:/example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <https:/example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <madeupscheme:/example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <ftps:/example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <gopher:/example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <ws:/example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <wss:/example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <data:/example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <javascript:/example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <mailto:/example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http:example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <ftp:example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <https:example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <madeupscheme:example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <ftps:example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <gopher:example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <ws:example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <wss:example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <data:example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <javascript:example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <mailto:example.com/> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: </a/b/c> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: </a/ /c> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: </a%2fc> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: </a/%2f/c> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <#β> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <data:text/html,test#test> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <http://example.com/././foo> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/./.foo> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/.> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/./> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/bar/..> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/bar/../> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/..bar> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/bar/../ton> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/bar/../ton/../../a> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/../../..> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/../../../ton> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/%2e> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/%2e%2> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com////../..> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/bar//../..> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo/bar//..> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/%20foo> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo%> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo%2> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo%2zbar> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo%2©zbar> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo%41%7a> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo\t%91> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo%00%51> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/(%28:%3A%29)> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/%3A%3a%3C%3c> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/foo\tbar> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com\\\\foo\\\\bar> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/%7Ffp3%3Eju%3Dduvgw%3Dd> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/@asdf%40> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/你好你好> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com/‥/foo> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com//foo> against <about:blank>] - expected: FAIL - - [Parsing: <http://example.com//foo//bar> against <about:blank>] - expected: FAIL - - [Parsing: <http://www.google.com/foo?bar=baz#> against <about:blank>] - expected: FAIL - - [Parsing: <http://www.google.com/foo?bar=baz# »> against <about:blank>] - expected: FAIL - - [Parsing: <data:test# »> against <about:blank>] - expected: FAIL - - [Parsing: <http://www.google.com> against <about:blank>] - expected: FAIL - - [Parsing: <http://192.0x00A80001> against <about:blank>] - expected: FAIL - - [Parsing: <http://www/foo%2Ehtml> against <about:blank>] - expected: FAIL - - [Parsing: <http://www/foo/%2E/html> against <about:blank>] - expected: FAIL - - [Parsing: <http://%25DOMAIN:foobar@foodomain.com/> against <about:blank>] - expected: FAIL - - [Parsing: <http:\\\\www.google.com\\foo> against <about:blank>] - expected: FAIL - - [Parsing: <http://foo:80/> against <about:blank>] - expected: FAIL - - [Parsing: <http://foo:81/> against <about:blank>] - expected: FAIL - - [Parsing: <httpa://foo:80/> against <about:blank>] - expected: FAIL - - [Parsing: <https://foo:443/> against <about:blank>] - expected: FAIL - - [Parsing: <https://foo:80/> against <about:blank>] - expected: FAIL - - [Parsing: <ftp://foo:21/> against <about:blank>] - expected: FAIL - - [Parsing: <ftp://foo:80/> against <about:blank>] - expected: FAIL - - [Parsing: <gopher://foo:70/> against <about:blank>] - expected: FAIL - - [Parsing: <gopher://foo:443/> against <about:blank>] - expected: FAIL - - [Parsing: <ws://foo:80/> against <about:blank>] - expected: FAIL - - [Parsing: <ws://foo:81/> against <about:blank>] - expected: FAIL - - [Parsing: <ws://foo:443/> against <about:blank>] - expected: FAIL - - [Parsing: <ws://foo:815/> against <about:blank>] - expected: FAIL - - [Parsing: <wss://foo:80/> against <about:blank>] - expected: FAIL - - [Parsing: <wss://foo:81/> against <about:blank>] - expected: FAIL - - [Parsing: <wss://foo:443/> against <about:blank>] - expected: FAIL - - [Parsing: <wss://foo:815/> against <about:blank>] - expected: FAIL - - [Parsing: <http:/example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <ftp:/example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <https:/example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <madeupscheme:/example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <ftps:/example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <gopher:/example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <ws:/example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <wss:/example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <data:/example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <javascript:/example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <mailto:/example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <http:example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <ftp:example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <https:example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <madeupscheme:example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <ftps:example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <gopher:example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <ws:example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <wss:example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <data:example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <javascript:example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <mailto:example.com/> against <about:blank>] - expected: FAIL - - [Parsing: <http:@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: <http:/@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: <http://@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: <http:a:b@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: <http:/a:b@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: <http://a:b@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: <http://@pple.com> against <about:blank>] - expected: FAIL - - [Parsing: <http::b@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: <http:/:b@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: <http://:b@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: <http:a:@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: <http:/a:@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: <http://a:@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: <http://www.@pple.com> against <about:blank>] - expected: FAIL - - [Parsing: <http://:@www.example.com> against <about:blank>] - expected: FAIL - - [Parsing: </> against <http://www.example.com/test>] - expected: FAIL - - [Parsing: </test.txt> against <http://www.example.com/test>] - expected: FAIL - - [Parsing: <.> against <http://www.example.com/test>] - expected: FAIL - - [Parsing: <..> against <http://www.example.com/test>] - expected: FAIL - - [Parsing: <test.txt> against <http://www.example.com/test>] - expected: FAIL - - [Parsing: <./test.txt> against <http://www.example.com/test>] - expected: FAIL - - [Parsing: <../test.txt> against <http://www.example.com/test>] - expected: FAIL - - [Parsing: <../aaa/test.txt> against <http://www.example.com/test>] - expected: FAIL - - [Parsing: <../../test.txt> against <http://www.example.com/test>] - expected: FAIL - - [Parsing: <中/test.txt> against <http://www.example.com/test>] - expected: FAIL - - [Parsing: <http://www.example2.com> against <http://www.example.com/test>] - expected: FAIL - - [Parsing: <//www.example2.com> against <http://www.example.com/test>] - expected: FAIL - - [Parsing: <http://ExAmPlE.CoM> against <http://other.com/>] - expected: FAIL - - [Parsing: <http://GOOgoo.com> against <http://other.com/>] - expected: FAIL - - [Parsing: <http://www.foo。bar.com> against <http://other.com/>] - expected: FAIL - - [Parsing: <http://Go.com> against <http://other.com/>] - expected: FAIL - - [Parsing: <http://你好你好> against <http://other.com/>] - expected: FAIL - - [Parsing: <http://%30%78%63%30%2e%30%32%35%30.01> against <http://other.com/>] - expected: FAIL - - [Parsing: <http://%30%78%63%30%2e%30%32%35%30.01%2e> against <http://other.com/>] - expected: FAIL - - [Parsing: <http://0Xc0.0250.01> against <http://other.com/>] - expected: FAIL - - [Parsing: <http://foo:💩@example.com/bar> against <http://other.com/>] - expected: FAIL - - [Parsing: </some/path> against <http://user@example.org/smth>] - expected: FAIL - - [Parsing: <> against <http://user:pass@example.org:21/smth>] - expected: FAIL - - [Parsing: </some/path> against <http://user:pass@example.org:21/smth>] - expected: FAIL - - [Parsing: <#> against <test:test>] - expected: FAIL - - [Parsing: <#x> against <mailto:x@x.com>] - expected: FAIL - - [Parsing: <#x> against <data:,>] - expected: FAIL - - [Parsing: <#x> against <about:blank>] - expected: FAIL - - [Parsing: <#> against <test:test?test>] - expected: FAIL - - [Parsing: <https://@test@test@example:800/> against <http://doesnotmatter/>] - expected: FAIL - - [Parsing: <https://@@@example> against <http://doesnotmatter/>] - expected: FAIL - - [Parsing: <http://`{}:`{}@h/`{}?`{}> against <http://doesnotmatter/>] - expected: FAIL - - [Parsing: <i> against <sc:/pa/pa>] - expected: FAIL - - [Parsing: <i> against <sc://ho/pa>] - expected: FAIL - - [Parsing: <i> against <sc:///pa/pa>] - expected: FAIL - - [Parsing: <../i> against <sc:/pa/pa>] - expected: FAIL - - [Parsing: <../i> against <sc://ho/pa>] - expected: FAIL - - [Parsing: <../i> against <sc:///pa/pa>] - expected: FAIL - - [Parsing: </i> against <sc:/pa/pa>] - expected: FAIL - - [Parsing: </i> against <sc://ho/pa>] - expected: FAIL - - [Parsing: </i> against <sc:///pa/pa>] - expected: FAIL - - [Parsing: <?i> against <sc:/pa/pa>] - expected: FAIL - - [Parsing: <?i> against <sc://ho/pa>] - expected: FAIL - - [Parsing: <?i> against <sc:///pa/pa>] - expected: FAIL - - [Parsing: <#i> against <sc:sd>] - expected: FAIL - - [Parsing: <#i> against <sc:sd/sd>] - expected: FAIL - - [Parsing: <#i> against <sc:/pa/pa>] - expected: FAIL - - [Parsing: <#i> against <sc://ho/pa>] - expected: FAIL - - [Parsing: <#i> against <sc:///pa/pa>] - expected: FAIL - - [Parsing: <about:/../> against <about:blank>] - expected: FAIL - - [Parsing: <data:/../> against <about:blank>] - expected: FAIL - - [Parsing: <javascript:/../> against <about:blank>] - expected: FAIL - - [Parsing: <mailto:/../> against <about:blank>] - expected: FAIL - - [Parsing: <sc://ñ.test/> against <about:blank>] - expected: FAIL - - [Parsing: <sc:\\../> against <about:blank>] - expected: FAIL - - [Parsing: <http://127.0.0.1:10100/relative_import.html> against <about:blank>] - expected: FAIL - - [Parsing: <http://facebook.com/?foo=%7B%22abc%22> against <about:blank>] - expected: FAIL - - [Parsing: <https://localhost:3000/jqueryui@1.2.3> against <about:blank>] - expected: FAIL - - [Parsing: <h\tt\nt\rp://h\to\ns\rt:9\t0\n0\r0/p\ta\nt\rh?q\tu\ne\rry#f\tr\na\rg> against <about:blank>] - expected: FAIL - - [Parsing: <?a=b&c=d> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <??a=b&c=d> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <sc::a@example.net> against <about:blank>] - expected: FAIL - - [Parsing: <http:> against <http://example.org/foo/bar>] - expected: FAIL - - [Parsing: <sc:> against <https://example.org/foo/bar>] - expected: FAIL - - [Parsing: <tel:1234567890> against <http://example.org/foo/bar>] - expected: FAIL - diff --git a/tests/wpt/metadata/url/url-setters.html.ini b/tests/wpt/metadata/url/url-setters.html.ini index 1f6563a640f..8831fae8677 100644 --- a/tests/wpt/metadata/url/url-setters.html.ini +++ b/tests/wpt/metadata/url/url-setters.html.ini @@ -6,12 +6,6 @@ [Setting <ssh://me@example.net>.protocol = 'http' Can’t switch from non-special scheme to special. Note: this may change, see https://github.com/whatwg/url/issues/104] expected: FAIL - [Setting <http://example.net:8080>.host = 'example.com:' Port number is unchanges if empty in the new value. Note: this may change, see https://github.com/whatwg/url/pull/113] - expected: FAIL - - [Setting <http://example.net:8080>.port = '' Port number is unchanged if empty in the new value. Note: this may change, see https://github.com/whatwg/url/pull/113] - expected: FAIL - [Setting <a:/>.pathname = '\x00\x01\t\n\r\x1f !"#$%&'()*+,-./09:;<=>?@AZ[\\\]^_`az{|}~Éé' UTF-8 percent encoding with the default encode set. Tabs and newlines are removed.] expected: FAIL diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 3961a0d42eb..b0b62309839 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -5016,6 +5016,30 @@ "url": "/_mozilla/css/stacking_context_rtl.html" } ], + "css/stacking_order_overflow_auto.html": [ + { + "path": "css/stacking_order_overflow_auto.html", + "references": [ + [ + "/_mozilla/css/stacking_order_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/stacking_order_overflow_auto.html" + } + ], + "css/stacking_order_overflow_scroll.html": [ + { + "path": "css/stacking_order_overflow_scroll.html", + "references": [ + [ + "/_mozilla/css/stacking_order_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/stacking_order_overflow_scroll.html" + } + ], "css/style_is_in_doc.html": [ { "path": "css/style_is_in_doc.html", @@ -19848,6 +19872,30 @@ "url": "/_mozilla/css/stacking_context_rtl.html" } ], + "css/stacking_order_overflow_auto.html": [ + { + "path": "css/stacking_order_overflow_auto.html", + "references": [ + [ + "/_mozilla/css/stacking_order_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/stacking_order_overflow_auto.html" + } + ], + "css/stacking_order_overflow_scroll.html": [ + { + "path": "css/stacking_order_overflow_scroll.html", + "references": [ + [ + "/_mozilla/css/stacking_order_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/stacking_order_overflow_scroll.html" + } + ], "css/style_is_in_doc.html": [ { "path": "css/style_is_in_doc.html", diff --git a/tests/wpt/mozilla/tests/css/stacking_order_overflow_auto.html b/tests/wpt/mozilla/tests/css/stacking_order_overflow_auto.html new file mode 100644 index 00000000000..9da6457ce1f --- /dev/null +++ b/tests/wpt/mozilla/tests/css/stacking_order_overflow_auto.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>The position:absolute element should be on top of the overflow:auto element</title> + <link rel='match' href='stacking_order_ref.html'> + <style> + body { + margin: 0; + } + + .scrollbox { + margin: 50px; + width: 50px; + height: 50px; + overflow: auto; + background: red; + } + + .overlay { + position: absolute; + left: 50px; + top: 50px; + width: 50px; + height: 50px; + background: green; + } + </style> + +<div class="overlay"></div> +<div class="scrollbox"></div> diff --git a/tests/wpt/mozilla/tests/css/stacking_order_overflow_scroll.html b/tests/wpt/mozilla/tests/css/stacking_order_overflow_scroll.html new file mode 100644 index 00000000000..c8e3729dce3 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/stacking_order_overflow_scroll.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>The position:absolute element should be on top of the overflow:scroll element</title> + <link rel='match' href='stacking_order_ref.html'> + <style> + body { + margin: 0; + } + + .scrollbox { + margin: 50px; + width: 50px; + height: 50px; + overflow: scroll; + background: red; + } + + .overlay { + position: absolute; + left: 50px; + top: 50px; + width: 50px; + height: 50px; + background: green; + } + </style> + +<div class="overlay"></div> +<div class="scrollbox"></div> diff --git a/tests/wpt/mozilla/tests/css/stacking_order_ref.html b/tests/wpt/mozilla/tests/css/stacking_order_ref.html new file mode 100644 index 00000000000..908f43b1295 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/stacking_order_ref.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <style> + body { + margin: 0; + } + + .box { + position: absolute; + left: 50px; + top: 50px; + width: 50px; + height: 50px; + background: green; + } + </style> + +<div class="box"></div> diff --git a/tests/wpt/mozilla/tests/mozilla/bluetooth/requestDevice/canonicalizeFilter/no-arguments.html b/tests/wpt/mozilla/tests/mozilla/bluetooth/requestDevice/canonicalizeFilter/no-arguments.html index 107614c557f..9713e748315 100644 --- a/tests/wpt/mozilla/tests/mozilla/bluetooth/requestDevice/canonicalizeFilter/no-arguments.html +++ b/tests/wpt/mozilla/tests/mozilla/bluetooth/requestDevice/canonicalizeFilter/no-arguments.html @@ -4,13 +4,8 @@ <script src="/_mozilla/mozilla/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +promise_test(t => { window.testRunner.setBluetoothMockDataSet(adapter_type.empty); - try { - window.navigator.bluetooth.requestDevice() - .then(() => assert_unreached('requestDevice() should have thrown an error')); - } catch(error) { - assert_equals('TypeError', error.name); - } + return promise_rejects(t, new TypeError(), window.navigator.bluetooth.requestDevice()); }, 'requestDevice() requires an argument.'); </script> diff --git a/tests/wpt/mozilla/tests/mozilla/bluetooth/requestDevice/canonicalizeFilter/no-filters-member.html b/tests/wpt/mozilla/tests/mozilla/bluetooth/requestDevice/canonicalizeFilter/no-filters-member.html index 7aa27067133..302a3072efb 100644 --- a/tests/wpt/mozilla/tests/mozilla/bluetooth/requestDevice/canonicalizeFilter/no-filters-member.html +++ b/tests/wpt/mozilla/tests/mozilla/bluetooth/requestDevice/canonicalizeFilter/no-filters-member.html @@ -4,13 +4,11 @@ <script src="/_mozilla/mozilla/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -promise_test(() => { +promise_test(t => { window.testRunner.setBluetoothMockDataSet(adapter_type.empty); - try { - window.navigator.bluetooth.requestDevice([{}, {optionalServices: ['wrong_service']}]) - .then(() => assert_unreached('requestDevice() should have thrown an error')); - } catch(error) { - assert_equals('TypeError', error.name); - } + return promise_rejects( + t, + new TypeError(), + window.navigator.bluetooth.requestDevice([{}, {optionalServices: ['wrong_service']}])); }, 'RequestDeviceOptions requires a |filters| member.'); </script> diff --git a/tests/wpt/mozilla/tests/mozilla/service-workers/service-worker-registration.html b/tests/wpt/mozilla/tests/mozilla/service-workers/service-worker-registration.html index 291256c38b1..416c61806e1 100644 --- a/tests/wpt/mozilla/tests/mozilla/service-workers/service-worker-registration.html +++ b/tests/wpt/mozilla/tests/mozilla/service-workers/service-worker-registration.html @@ -36,7 +36,7 @@ promise_test(function() { }, "Test: Service Worker Registration property scope when provided a scope"); promise_test(function (p) { - promise_rejects(p, new TypeError(), register_sw('./in%5Csome%5fdir/sw.js')); + return promise_rejects(p, new TypeError(), register_sw('./in%5Csome%5fdir/sw.js')); }, "Test: Throws Error when Invalid Url Path"); promise_test(function (p) { diff --git a/tests/wpt/web-platform-tests/url/setters_tests.json b/tests/wpt/web-platform-tests/url/setters_tests.json index 9512d2547e3..a62210ec6b3 100644 --- a/tests/wpt/web-platform-tests/url/setters_tests.json +++ b/tests/wpt/web-platform-tests/url/setters_tests.json @@ -346,14 +346,14 @@ } }, { - "comment": "Port number is unchanges if empty in the new value. Note: this may change, see https://github.com/whatwg/url/pull/113", + "comment": "Port number is removed if empty in the new value", "href": "http://example.net:8080", "new_value": "example.com:", "expected": { - "href": "http://example.com:8080/", - "host": "example.com:8080", + "href": "http://example.com/", + "host": "example.com", "hostname": "example.com", - "port": "8080" + "port": "" } }, { @@ -761,14 +761,14 @@ } }, { - "comment": "Port number is unchanged if empty in the new value. Note: this may change, see https://github.com/whatwg/url/pull/113", + "comment": "Port number is removed if empty in the new value", "href": "http://example.net:8080", "new_value": "", "expected": { - "href": "http://example.net:8080/", - "host": "example.net:8080", + "href": "http://example.net/", + "host": "example.net", "hostname": "example.net", - "port": "8080" + "port": "" } }, { |