From 20a8946c6b360dd1d6bebcfe67a5d71ba600d23d Mon Sep 17 00:00:00 2001 From: Connor Brewster Date: Mon, 21 Mar 2016 20:44:56 -0600 Subject: [PATCH 01/20] Fixed jump tag issue --- components/compositing/compositor.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index c3f7b191886..b5df18b2564 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -1144,7 +1144,8 @@ impl IOCompositor { layer_id: LayerId, point: Point2D) { if self.move_layer(pipeline_id, layer_id, Point2D::from_untyped(&point)) { - self.perform_updates_after_scroll() + self.perform_updates_after_scroll(); + self.send_viewport_rects_for_all_layers() } else { self.fragment_point = Some(point) } From f3162cd31616ff2584e34aeacba98e7fd7efa608 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Tue, 22 Mar 2016 20:21:58 +0530 Subject: [PATCH 02/20] Add support for navigation keys --- components/msg/constellation_msg.rs | 3 +++ components/script/dom/keyboardevent.rs | 7 +++++++ ports/glutin/window.rs | 8 ++++++++ 3 files changed, 18 insertions(+) diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs index 83f308b26fd..f7bbbb39a2b 100644 --- a/components/msg/constellation_msg.rs +++ b/components/msg/constellation_msg.rs @@ -186,6 +186,9 @@ pub enum Key { RightAlt, RightSuper, Menu, + + NavigateBackward, + NavigateForward, } bitflags! { diff --git a/components/script/dom/keyboardevent.rs b/components/script/dom/keyboardevent.rs index 9feb08b7674..8075a18433a 100644 --- a/components/script/dom/keyboardevent.rs +++ b/components/script/dom/keyboardevent.rs @@ -319,6 +319,8 @@ pub fn key_value(key: Key, mods: KeyModifiers) -> &'static str { Key::RightAlt => "Alt", Key::RightSuper => "Super", Key::Menu => "ContextMenu", + Key::NavigateForward => "BrowserForward", + Key::NavigateBackward => "BrowserBack", } } @@ -489,6 +491,8 @@ fn key_from_string(key_string: &str, location: u32) -> Option { "Alt" if location == KeyboardEventConstants::DOM_KEY_LOCATION_RIGHT => Some(Key::RightAlt), "Super" if location == KeyboardEventConstants::DOM_KEY_LOCATION_RIGHT => Some(Key::RightSuper), "ContextMenu" => Some(Key::Menu), + "BrowserForward" => Some(Key::NavigateForward), + "BrowserBack" => Some(Key::NavigateBackward), _ => None } } @@ -614,6 +618,9 @@ fn code_value(key: Key) -> &'static str { Key::LeftAlt | Key::RightAlt => "Alt", Key::LeftSuper | Key::RightSuper => "Super", Key::Menu => "Menu", + + Key::NavigateForward => "BrowserForward", + Key::NavigateBackward => "BrowserBackward", } } diff --git a/ports/glutin/window.rs b/ports/glutin/window.rs index 22633931de1..5cebe5cc724 100644 --- a/ports/glutin/window.rs +++ b/ports/glutin/window.rs @@ -498,6 +498,8 @@ impl Window { VirtualKeyCode::Tab => Ok(Key::Tab), VirtualKeyCode::Subtract => Ok(Key::Minus), + VirtualKeyCode::NavigateBackward => Ok(Key::NavigateBackward), + VirtualKeyCode::NavigateForward => Ok(Key::NavigateForward), _ => Err(()), } } @@ -731,6 +733,12 @@ impl WindowMethods for Window { (NONE, Key::Backspace) => { self.event_queue.borrow_mut().push(WindowEvent::Navigation(WindowNavigateMsg::Back)); } + (SHIFT, Key::NavigateForward) => { + self.event_queue.borrow_mut().push(WindowEvent::Navigation(WindowNavigateMsg::Forward)); + } + (NONE, Key::NavigateBackward) => { + self.event_queue.borrow_mut().push(WindowEvent::Navigation(WindowNavigateMsg::Back)); + } (NONE, Key::Escape) => { self.event_queue.borrow_mut().push(WindowEvent::Quit); From 2f982e668c276fce3e4cde5670cb0f064a1bb147 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Tue, 22 Mar 2016 21:09:08 +0530 Subject: [PATCH 03/20] Update spec links for keyboardevent --- components/script/dom/keyboardevent.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/script/dom/keyboardevent.rs b/components/script/dom/keyboardevent.rs index 8075a18433a..864b0289cf2 100644 --- a/components/script/dom/keyboardevent.rs +++ b/components/script/dom/keyboardevent.rs @@ -148,7 +148,7 @@ impl KeyboardEvent { } -// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3Events-key.html +// https://w3c.github.io/uievents-key/#key-value-tables pub fn key_value(key: Key, mods: KeyModifiers) -> &'static str { let shift = mods.contains(constellation_msg::SHIFT); match key { @@ -497,7 +497,7 @@ fn key_from_string(key_string: &str, location: u32) -> Option { } } -// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3Events-code.html +// https://w3c.github.io/uievents-code/#code-value-tables fn code_value(key: Key) -> &'static str { match key { Key::Space => "Space", From b25d9de03d1cd51235bc08af5935e2371a8d88c4 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Tue, 22 Mar 2016 21:09:43 +0530 Subject: [PATCH 04/20] Spec says 'ContextMenu', not 'Menu' --- components/script/dom/keyboardevent.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/script/dom/keyboardevent.rs b/components/script/dom/keyboardevent.rs index 864b0289cf2..91d69e7cfd8 100644 --- a/components/script/dom/keyboardevent.rs +++ b/components/script/dom/keyboardevent.rs @@ -617,7 +617,7 @@ fn code_value(key: Key) -> &'static str { Key::LeftControl | Key::RightControl => "Control", Key::LeftAlt | Key::RightAlt => "Alt", Key::LeftSuper | Key::RightSuper => "Super", - Key::Menu => "Menu", + Key::Menu => "ContextMenu", Key::NavigateForward => "BrowserForward", Key::NavigateBackward => "BrowserBackward", From 1a77ccf3d054d79cde023ac6c552aba86bd9c24f Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Tue, 22 Mar 2016 23:30:58 -0400 Subject: [PATCH 05/20] Move appveyor env var setting our of install steps. --- appveyor.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 9a6037bac5f..e6c87bafe71 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,10 @@ version: 1.0.{build} +environment: + PATH: 'C:\msys64\mingw64\bin;C:\msys64\usr\bin\;%PATH%' + MSYSTEM: 'MSYS' + MSYS: 'winsymlinks=lnk' + branches: only: - master @@ -13,9 +18,6 @@ cache: - .cargo install: - - set MSYSTEM=MSYS - - set MSYS="winsymlinks=lnk" - - PATH C:\msys64\mingw64\bin;C:\msys64\usr\bin\;%PATH% - bash -lc "echo $MSYSTEM; pacman --needed --noconfirm -Sy pacman-mirrors" - bash -lc "pacman --noconfirm -Sy" - bash -lc "pacman -Sy --needed --noconfirm git mingw-w64-x86_64-toolchain mingw-w64-x86_64-freetype mingw-w64-x86_64-icu mingw-w64-x86_64-nspr mingw-w64-x86_64-ca-certificates mingw-w64-x86_64-expat mingw-w64-x86_64-cmake tar diffutils patch patchutils make python2-setuptools" @@ -31,4 +33,4 @@ build_script: bash -lc "cd $APPVEYOR_BUILD_FOLDER; ./mach build -d -v" -test: off \ No newline at end of file +test: off From 900583056bacce9f890cba38099686b3a8f6f1a3 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Wed, 23 Mar 2016 11:31:11 +0100 Subject: [PATCH 06/20] Remove outdated unsafe_code allowance. --- components/layout/traversal.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs index 6c774b76bcf..02cbedc41d4 100644 --- a/components/layout/traversal.rs +++ b/components/layout/traversal.rs @@ -4,9 +4,6 @@ //! Traversals over the DOM and flow trees, running the layout computations. -// For thread_local. -#![allow(unsafe_code)] - use construct::FlowConstructor; use context::{LayoutContext, SharedLayoutContext}; use display_list_builder::DisplayListBuildState; From dadba1fa22184cf44d5d513f2c6f690a459db140 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Wed, 23 Mar 2016 11:31:21 +0100 Subject: [PATCH 07/20] Remove unused import. --- components/layout/traversal.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs index 02cbedc41d4..2413348148a 100644 --- a/components/layout/traversal.rs +++ b/components/layout/traversal.rs @@ -12,7 +12,7 @@ use flow::{self, Flow, CAN_BE_FRAGMENTED}; use gfx::display_list::OpaqueNode; use incremental::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, RestyleDamage}; use std::mem; -use style::context::{StyleContext, ReflowGoal}; +use style::context::StyleContext; use style::matching::MatchMethods; use style::traversal::{DomTraversalContext, STYLE_BLOOM}; use style::traversal::{put_thread_local_bloom_filter, recalc_style_at}; From ddeb33bb414e196045c1c4d429822bd1778896fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jussi=20R=C3=A4s=C3=A4nen?= Date: Wed, 23 Mar 2016 16:43:01 +0200 Subject: [PATCH 08/20] Fixed missing test image for filter inline reftests --- tests/wpt/mozilla/tests/css/filter_inline_a.html | 2 +- tests/wpt/mozilla/tests/css/filter_inline_ref.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/wpt/mozilla/tests/css/filter_inline_a.html b/tests/wpt/mozilla/tests/css/filter_inline_a.html index faf692e1589..9392ab01de8 100644 --- a/tests/wpt/mozilla/tests/css/filter_inline_a.html +++ b/tests/wpt/mozilla/tests/css/filter_inline_a.html @@ -14,6 +14,6 @@ - + diff --git a/tests/wpt/mozilla/tests/css/filter_inline_ref.html b/tests/wpt/mozilla/tests/css/filter_inline_ref.html index 0bc34849029..420d796e4b1 100644 --- a/tests/wpt/mozilla/tests/css/filter_inline_ref.html +++ b/tests/wpt/mozilla/tests/css/filter_inline_ref.html @@ -13,6 +13,6 @@ - + From 644e8d09ebcb3682e4eb05ce4f133eb5d4e29adc Mon Sep 17 00:00:00 2001 From: malayaleecoder Date: Wed, 23 Mar 2016 20:17:02 +0530 Subject: [PATCH 09/20] Remove test-ref command from testing_commands.py. Fixes #10125 --- python/servo/testing_commands.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index ddd8cc90918..37ee8fcc7ec 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -270,15 +270,6 @@ class MachCommands(CommandBase): if result != 0: return result - @Command('test-ref', - description='Run the reference tests', - category='testing') - @CommandArgument('params', default=None, nargs=argparse.REMAINDER) - def test_ref(self, params=None): - print("Ref tests have been replaced by web-platform-tests under " - "tests/wpt/mozilla/.") - return 0 - @Command('test-content', description='Run the content tests', category='testing') From 2477f6a3630815b0de0e3af1ff463286d44ad83d Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 18 Feb 2016 11:54:47 -0700 Subject: [PATCH 10/20] Fix #9511. Export webidl enums using "pub use". Change typedef codegen to export the underlying enum itself, rather than an alias. Works around https://github.com/rust-lang/rust/issues/31355 --- components/script/dom/bindings/codegen/CodegenRust.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 4468bb13b6b..3dac77be733 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -5349,8 +5349,8 @@ class CGBindingRoot(CGThing): # Do codegen for all the typdefs for t in typedefs: if t.innerType.isUnion(): - cgthings.extend([CGGeneric("\npub type %s = %s;\n\n" % (t.identifier.name, - "UnionTypes::" + str(t.innerType)))]) + cgthings.extend([CGGeneric("\npub use dom::bindings::codegen::UnionTypes::%s as %s;\n\n" % + (t.innerType, t.identifier.name))]) else: assert not typeNeedsRooting(t.innerType, config.getDescriptorProvider) cgthings.extend([CGGeneric("\npub type %s = " % (t.identifier.name)), From a02daf71449d04ae040edf1ecf99e9d0bd0c1aa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 23 Mar 2016 16:29:19 +0100 Subject: [PATCH 11/20] canvas: Remove all the canvas layerization infrastructure It was never complete, and with webrender as a backend the way we render WebGL contexts has changed a bit. This should remove quite a bit of overhead. --- components/canvas/canvas_paint_thread.rs | 16 +--------------- components/canvas/webgl_paint_thread.rs | 18 ++---------------- components/canvas_traits/lib.rs | 18 ------------------ components/gfx/paint_thread.rs | 11 ----------- components/layout/context.rs | 7 +------ components/layout/display_list_builder.rs | 8 +------- components/layout/layout_thread.rs | 16 ---------------- components/layout/traversal.rs | 2 +- 8 files changed, 6 insertions(+), 90 deletions(-) diff --git a/components/canvas/canvas_paint_thread.rs b/components/canvas/canvas_paint_thread.rs index 85d92ee1e8f..ceaee808569 100644 --- a/components/canvas/canvas_paint_thread.rs +++ b/components/canvas/canvas_paint_thread.rs @@ -15,12 +15,11 @@ use gfx_traits::color; use ipc_channel::ipc::IpcSharedMemory; use ipc_channel::ipc::{self, IpcSender}; use ipc_channel::router::ROUTER; -use layers::platform::surface::NativeSurface; use num::ToPrimitive; use premultiplytable::PREMULTIPLY_TABLE; use std::borrow::ToOwned; use std::mem; -use std::sync::mpsc::{Sender, channel}; +use std::sync::mpsc::channel; use util::opts; use util::thread::spawn_named; use util::vec::byte_swap; @@ -205,13 +204,6 @@ impl<'a> CanvasPaintThread<'a> { } } } - CanvasMsg::FromPaint(message) => { - match message { - FromPaintMsg::SendNativeSurface(chan) => { - painter.send_native_surface(chan) - } - } - } CanvasMsg::WebGL(_) => panic!("Wrong message sent to Canvas2D thread"), } } @@ -550,12 +542,6 @@ impl<'a> CanvasPaintThread<'a> { }) } - fn send_native_surface(&self, _chan: Sender) { - // FIXME(mrobinson): We need a handle on the NativeDisplay to create compatible - // NativeSurfaces for the compositor. - unimplemented!() - } - fn image_data(&self, dest_rect: Rect, canvas_size: Size2D, diff --git a/components/canvas/webgl_paint_thread.rs b/components/canvas/webgl_paint_thread.rs index 08d8ea2f4b6..102a9f85f32 100644 --- a/components/canvas/webgl_paint_thread.rs +++ b/components/canvas/webgl_paint_thread.rs @@ -2,16 +2,14 @@ * 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, CanvasMsg, CanvasPixelData, CanvasData, CanvasWebGLMsg}; -use canvas_traits::{FromLayoutMsg, FromPaintMsg}; +use canvas_traits::{CanvasCommonMsg, CanvasMsg, CanvasPixelData, CanvasData, CanvasWebGLMsg, FromLayoutMsg}; use euclid::size::Size2D; use gleam::gl; use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory}; use ipc_channel::router::ROUTER; -use layers::platform::surface::NativeSurface; use offscreen_gl_context::{ColorAttachmentType, GLContext, GLContextAttributes, NativeGLContext}; use std::borrow::ToOwned; -use std::sync::mpsc::{Sender, channel}; +use std::sync::mpsc::channel; use util::thread::spawn_named; use util::vec::byte_swap; use webrender_traits; @@ -93,12 +91,6 @@ impl WebGLPaintThread { painter.send_data(chan), } } - CanvasMsg::FromPaint(message) => { - match message { - FromPaintMsg::SendNativeSurface(chan) => - painter.send_native_surface(chan), - } - } CanvasMsg::Canvas2d(_) => panic!("Wrong message sent to WebGLThread"), } } @@ -147,12 +139,6 @@ impl WebGLPaintThread { } } - fn send_native_surface(&self, _: Sender) { - // FIXME(ecoal95): We need to make a clone of the surface in order to - // implement this - unimplemented!() - } - #[allow(unsafe_code)] fn recreate(&mut self, size: Size2D) -> Result<(), &'static str> { match self.data { diff --git a/components/canvas_traits/lib.rs b/components/canvas_traits/lib.rs index 87f1f8c7e41..24af48aaa49 100644 --- a/components/canvas_traits/lib.rs +++ b/components/canvas_traits/lib.rs @@ -55,7 +55,6 @@ pub enum CanvasMsg { Canvas2d(Canvas2dMsg), Common(CanvasCommonMsg), FromLayout(FromLayoutMsg), - FromPaint(FromPaintMsg), WebGL(CanvasWebGLMsg), } @@ -82,23 +81,6 @@ pub enum FromLayoutMsg { SendData(IpcSender), } -#[derive(Clone)] -pub enum FromPaintMsg { - SendNativeSurface(Sender), -} - -impl Serialize for FromPaintMsg { - fn serialize(&self, _: &mut S) -> Result<(), S::Error> where S: Serializer { - panic!("can't serialize a `FromPaintMsg`!") - } -} - -impl Deserialize for FromPaintMsg { - fn deserialize(_: &mut D) -> Result where D: Deserializer { - panic!("can't deserialize a `FromPaintMsg`!") - } -} - #[derive(Clone, Deserialize, Serialize)] pub enum Canvas2dMsg { Arc(Point2D, f32, f32, f32, bool), diff --git a/components/gfx/paint_thread.rs b/components/gfx/paint_thread.rs index a0088fe5313..3f945c3898c 100644 --- a/components/gfx/paint_thread.rs +++ b/components/gfx/paint_thread.rs @@ -7,7 +7,6 @@ use app_units::Au; use azure::AzFloat; use azure::azure_hl::{BackendType, Color, DrawTarget, SurfaceFormat}; -use canvas_traits::CanvasMsg; use display_list::{DisplayItem, DisplayList, DisplayListEntry, DisplayListTraversal}; use display_list::{LayerInfo, StackingContext, StackingContextId, StackingContextType}; use euclid::Matrix4; @@ -343,7 +342,6 @@ pub enum Msg { #[derive(Deserialize, Serialize)] pub enum LayoutToPaintMsg { PaintInit(Epoch, Arc), - CanvasLayer(LayerId, IpcSender), Exit(IpcSender<()>), } @@ -379,9 +377,6 @@ pub struct PaintThread { /// Communication handles to each of the worker threads. worker_threads: Vec, - - /// A map to track the canvas specific layers - canvas_map: HashMap>, } // If we implement this as a function, we get borrowck errors from borrowing @@ -431,7 +426,6 @@ impl PaintThread where C: PaintListener + Send + 'static { paint_permission: false, current_epoch: None, worker_threads: worker_threads, - canvas_map: HashMap::new() }; let reporter_name = format!("paint-reporter-{}", id); @@ -475,11 +469,6 @@ impl PaintThread where C: PaintListener + Send + 'static { self.initialize_layers(); } } - // Inserts a new canvas renderer to the layer map - Msg::FromLayout(LayoutToPaintMsg::CanvasLayer(layer_id, canvas_renderer)) => { - debug!("Renderer received for canvas with layer {:?}", layer_id); - self.canvas_map.insert(layer_id, canvas_renderer); - } Msg::FromChrome(ChromeToPaintMsg::Paint(requests, frame_tree_id)) => { if self.paint_permission && self.root_display_list.is_some() { let mut replies = Vec::new(); diff --git a/components/layout/context.rs b/components/layout/context.rs index 143e78f810e..2775e6e791c 100644 --- a/components/layout/context.rs +++ b/components/layout/context.rs @@ -8,7 +8,6 @@ #![allow(unsafe_code)] use app_units::Au; -use canvas_traits::CanvasMsg; use euclid::Rect; use fnv::FnvHasher; use gfx::display_list::WebRenderImageInfo; @@ -16,7 +15,7 @@ use gfx::font_cache_thread::FontCacheThread; use gfx::font_context::FontContext; use gfx_traits::LayerId; use heapsize::HeapSizeOf; -use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory}; +use ipc_channel::ipc::{self, IpcSharedMemory}; use net_traits::image::base::Image; use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread, ImageResponse, ImageState}; use net_traits::image_cache_thread::{ImageOrMetadataAvailable, UsePlaceholder}; @@ -24,7 +23,6 @@ use std::cell::{RefCell, RefMut}; use std::collections::HashMap; use std::hash::BuildHasherDefault; use std::rc::Rc; -use std::sync::mpsc::Sender; use std::sync::{Arc, Mutex, RwLock}; use style::context::{LocalStyleContext, StyleContext}; use style::matching::{ApplicableDeclarationsCache, StyleSharingCandidateCache}; @@ -95,9 +93,6 @@ pub struct SharedLayoutContext { /// The URL. pub url: Url, - /// A channel to send canvas renderers to paint thread, in order to correctly paint the layers - pub canvas_layers_sender: Mutex)>>, - /// The visible rects for each layer, as reported to us by the compositor. pub visible_rects: Arc, BuildHasherDefault>>, diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index 407d4d19a05..4d62d221a5e 100644 --- a/components/layout/display_list_builder.rs +++ b/components/layout/display_list_builder.rs @@ -1197,13 +1197,7 @@ impl FragmentDisplayListBuilding for Fragment { let (sender, receiver) = ipc::channel().unwrap(); ipc_renderer.send(CanvasMsg::FromLayout( FromLayoutMsg::SendData(sender))).unwrap(); - let data = receiver.recv().unwrap(); - - // Propagate the layer and the renderer to the paint task. - state.layout_context.shared.canvas_layers_sender.lock().unwrap().send( - (layer_id, (*ipc_renderer).clone())).unwrap(); - - data + receiver.recv().unwrap() }, None => CanvasData::Pixels(CanvasPixelData { image_data: IpcSharedMemory::from_byte(0xFFu8, width * height * 4), diff --git a/components/layout/layout_thread.rs b/components/layout/layout_thread.rs index 041eab87168..cbad465b4f8 100644 --- a/components/layout/layout_thread.rs +++ b/components/layout/layout_thread.rs @@ -10,7 +10,6 @@ use animation; use app_units::Au; use azure::azure::AzColor; -use canvas_traits::CanvasMsg; use construct::ConstructionResult; use context::{LayoutContext, SharedLayoutContext, heap_size_of_local_context}; use display_list_builder::ToGfxColor; @@ -186,11 +185,6 @@ pub struct LayoutThread { /// Is this the first reflow in this LayoutThread? first_reflow: bool, - /// To receive a canvas renderer associated to a layer, this message is propagated - /// to the paint chan - canvas_layers_receiver: Receiver<(LayerId, IpcSender)>, - canvas_layers_sender: Sender<(LayerId, IpcSender)>, - /// The workers that we use for parallel operation. parallel_traversal: Option>, @@ -406,7 +400,6 @@ impl LayoutThread { // Create the channel on which new animations can be sent. let (new_animations_sender, new_animations_receiver) = channel(); - let (canvas_layers_sender, canvas_layers_receiver) = channel(); // Proxy IPC messages from the pipeline to the layout thread. let pipeline_receiver = ROUTER.route_ipc_receiver_to_new_mpsc_receiver(pipeline_port); @@ -449,8 +442,6 @@ impl LayoutThread { image_cache_sender: ImageCacheChan(ipc_image_cache_sender), font_cache_receiver: font_cache_receiver, font_cache_sender: ipc_font_cache_sender, - canvas_layers_receiver: canvas_layers_receiver, - canvas_layers_sender: canvas_layers_sender, parallel_traversal: parallel_traversal, generation: 0, new_animations_sender: new_animations_sender, @@ -521,7 +512,6 @@ impl LayoutThread { image_cache_thread: self.image_cache_thread.clone(), image_cache_sender: Mutex::new(self.image_cache_sender.clone()), font_cache_thread: Mutex::new(self.font_cache_thread.clone()), - canvas_layers_sender: Mutex::new(self.canvas_layers_sender.clone()), url: (*url).clone(), visible_rects: self.visible_rects.clone(), webrender_image_cache: self.webrender_image_cache.clone(), @@ -1148,12 +1138,6 @@ impl LayoutThread { self.root_flow = self.try_get_layout_root(node); } - // Send new canvas renderers to the paint thread - while let Ok((layer_id, renderer)) = self.canvas_layers_receiver.try_recv() { - // Just send if there's an actual renderer - self.paint_chan.send(LayoutToPaintMsg::CanvasLayer(layer_id, renderer)).unwrap(); - } - // Perform post-style recalculation layout passes. self.perform_post_style_recalc_layout_passes(&data.reflow_info, &mut rw_data, diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs index 6c774b76bcf..61d045a4048 100644 --- a/components/layout/traversal.rs +++ b/components/layout/traversal.rs @@ -15,7 +15,7 @@ use flow::{self, Flow, CAN_BE_FRAGMENTED}; use gfx::display_list::OpaqueNode; use incremental::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, RestyleDamage}; use std::mem; -use style::context::{StyleContext, ReflowGoal}; +use style::context::StyleContext; use style::matching::MatchMethods; use style::traversal::{DomTraversalContext, STYLE_BLOOM}; use style::traversal::{put_thread_local_bloom_filter, recalc_style_at}; From 35ce58ef985409c63aa1914f23d5d54326c85061 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 23 Mar 2016 16:42:41 +0100 Subject: [PATCH 12/20] layout: Drop "canvas" dependency --- components/layout/Cargo.toml | 3 --- components/servo/Cargo.lock | 1 - ports/cef/Cargo.lock | 1 - ports/gonk/Cargo.lock | 1 - 4 files changed, 6 deletions(-) diff --git a/components/layout/Cargo.toml b/components/layout/Cargo.toml index 304e903f72f..f7371a7a34a 100644 --- a/components/layout/Cargo.toml +++ b/components/layout/Cargo.toml @@ -12,9 +12,6 @@ path = "lib.rs" git = "https://github.com/servo/rust-azure" features = ["plugins"] -[dependencies.canvas] -path = "../canvas" - [dependencies.canvas_traits] path = "../canvas_traits" diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index 28b51b5545e..cf75f0043a0 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -1048,7 +1048,6 @@ dependencies = [ "app_units 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "azure 0.4.3 (git+https://github.com/servo/rust-azure)", "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "canvas 0.0.1", "canvas_traits 0.0.1", "cssparser 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index b2a7f8df776..3f15fa70006 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -968,7 +968,6 @@ dependencies = [ "app_units 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "azure 0.4.3 (git+https://github.com/servo/rust-azure)", "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "canvas 0.0.1", "canvas_traits 0.0.1", "cssparser 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/ports/gonk/Cargo.lock b/ports/gonk/Cargo.lock index 73b2519eb32..cf9bafe3c30 100644 --- a/ports/gonk/Cargo.lock +++ b/ports/gonk/Cargo.lock @@ -950,7 +950,6 @@ dependencies = [ "app_units 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "azure 0.4.3 (git+https://github.com/servo/rust-azure)", "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "canvas 0.0.1", "canvas_traits 0.0.1", "cssparser 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", From 50ba78c5126a30b4f860187fc7e2634189eb09bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 23 Mar 2016 16:44:21 +0100 Subject: [PATCH 13/20] gfx: Drop "canvas_traits" dependency --- components/gfx/Cargo.toml | 3 --- components/gfx/lib.rs | 1 - components/servo/Cargo.lock | 1 - ports/cef/Cargo.lock | 1 - ports/gonk/Cargo.lock | 1 - 5 files changed, 7 deletions(-) diff --git a/components/gfx/Cargo.toml b/components/gfx/Cargo.toml index e9463619002..823b78ed271 100644 --- a/components/gfx/Cargo.toml +++ b/components/gfx/Cargo.toml @@ -41,9 +41,6 @@ path = "../gfx_traits" [dependencies.net_traits] path = "../net_traits" -[dependencies.canvas_traits] -path = "../canvas_traits" - [dependencies.util] path = "../util" diff --git a/components/gfx/lib.rs b/components/gfx/lib.rs index 45b164cbe88..f60575cd625 100644 --- a/components/gfx/lib.rs +++ b/components/gfx/lib.rs @@ -25,7 +25,6 @@ extern crate app_units; extern crate azure; #[macro_use] extern crate bitflags; -extern crate canvas_traits; // Mac OS-specific library dependencies #[cfg(target_os = "macos")] extern crate core_foundation; diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index cf75f0043a0..51971e2cc0c 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -681,7 +681,6 @@ dependencies = [ "app_units 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "azure 0.4.3 (git+https://github.com/servo/rust-azure)", "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "canvas_traits 0.0.1", "core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "core-text 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index 3f15fa70006..798530bb8c6 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -610,7 +610,6 @@ dependencies = [ "app_units 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "azure 0.4.3 (git+https://github.com/servo/rust-azure)", "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "canvas_traits 0.0.1", "core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "core-text 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/ports/gonk/Cargo.lock b/ports/gonk/Cargo.lock index cf9bafe3c30..b483aa467ea 100644 --- a/ports/gonk/Cargo.lock +++ b/ports/gonk/Cargo.lock @@ -613,7 +613,6 @@ dependencies = [ "app_units 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "azure 0.4.3 (git+https://github.com/servo/rust-azure)", "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "canvas_traits 0.0.1", "core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "core-text 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", From 8e61a8a97420f2d96814d1e04643fad47017dee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 23 Mar 2016 16:53:27 +0100 Subject: [PATCH 14/20] script: Update angle url --- components/script/Cargo.toml | 2 +- components/servo/Cargo.lock | 4 ++-- ports/cef/Cargo.lock | 4 ++-- ports/gonk/Cargo.lock | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index ffde81f1a91..cb3a8d81181 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -50,7 +50,7 @@ git = "https://github.com/servo/rust-mozjs" git = "https://github.com/ecoal95/rust-offscreen-rendering-context" [dependencies.angle] -git = "https://github.com/ecoal95/angle" +git = "https://github.com/emilio/angle" branch = "servo" [dependencies.ipc-channel] diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index 51971e2cc0c..c80dcadbeef 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -72,7 +72,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "angle" version = "0.1.0" -source = "git+https://github.com/ecoal95/angle?branch=servo#b31e70ef5cb675582de910d09b0c385ea2000a64" +source = "git+https://github.com/emilio/angle?branch=servo#b31e70ef5cb675582de910d09b0c385ea2000a64" dependencies = [ "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1687,7 +1687,7 @@ dependencies = [ name = "script" version = "0.0.1" dependencies = [ - "angle 0.1.0 (git+https://github.com/ecoal95/angle?branch=servo)", + "angle 0.1.0 (git+https://github.com/emilio/angle?branch=servo)", "app_units 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "canvas 0.0.1", diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index 798530bb8c6..2bec2e051a6 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -57,7 +57,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "angle" version = "0.1.0" -source = "git+https://github.com/ecoal95/angle?branch=servo#b31e70ef5cb675582de910d09b0c385ea2000a64" +source = "git+https://github.com/emilio/angle?branch=servo#b31e70ef5cb675582de910d09b0c385ea2000a64" dependencies = [ "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1562,7 +1562,7 @@ dependencies = [ name = "script" version = "0.0.1" dependencies = [ - "angle 0.1.0 (git+https://github.com/ecoal95/angle?branch=servo)", + "angle 0.1.0 (git+https://github.com/emilio/angle?branch=servo)", "app_units 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "canvas 0.0.1", diff --git a/ports/gonk/Cargo.lock b/ports/gonk/Cargo.lock index b483aa467ea..3ed2f49114f 100644 --- a/ports/gonk/Cargo.lock +++ b/ports/gonk/Cargo.lock @@ -50,7 +50,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "angle" version = "0.1.0" -source = "git+https://github.com/ecoal95/angle?branch=servo#b31e70ef5cb675582de910d09b0c385ea2000a64" +source = "git+https://github.com/emilio/angle?branch=servo#b31e70ef5cb675582de910d09b0c385ea2000a64" dependencies = [ "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1544,7 +1544,7 @@ dependencies = [ name = "script" version = "0.0.1" dependencies = [ - "angle 0.1.0 (git+https://github.com/ecoal95/angle?branch=servo)", + "angle 0.1.0 (git+https://github.com/emilio/angle?branch=servo)", "app_units 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "canvas 0.0.1", From 5ed93a5c4a2b74a005fe15a39ae38b63eb1265ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 23 Mar 2016 16:57:53 +0100 Subject: [PATCH 15/20] Change old references of ecoal95 --- components/canvas/webgl_paint_thread.rs | 2 +- components/script/dom/htmlcanvaselement.rs | 2 +- components/script/dom/webglprogram.rs | 2 +- components/script/dom/webglrenderingcontext.rs | 11 +++++------ components/style/selector_matching.rs | 2 +- tests/wpt/web-platform-tests/XMLHttpRequest/OWNERS | 2 +- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/components/canvas/webgl_paint_thread.rs b/components/canvas/webgl_paint_thread.rs index 102a9f85f32..85f03e758ba 100644 --- a/components/canvas/webgl_paint_thread.rs +++ b/components/canvas/webgl_paint_thread.rs @@ -81,7 +81,7 @@ impl WebGLPaintThread { CanvasMsg::Common(message) => { match message { CanvasCommonMsg::Close => break, - // TODO(ecoal95): handle error nicely + // TODO(emilio): handle error nicely CanvasCommonMsg::Recreate(size) => painter.recreate(size).unwrap(), } }, diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs index b078e87fe45..622824f88d9 100644 --- a/components/script/dom/htmlcanvaselement.rs +++ b/components/script/dom/htmlcanvaselement.rs @@ -206,7 +206,7 @@ impl HTMLCanvasElement { CanvasData::Pixels(pixel_data) => pixel_data.image_data.to_vec(), CanvasData::WebGL(_) - // TODO(ecoal95): Not sure if WebGL canvas is required for 2d spec, + // TODO(emilio): Not sure if WebGL canvas is required for 2d spec, // but I think it's not. => return None, } diff --git a/components/script/dom/webglprogram.rs b/components/script/dom/webglprogram.rs index 42eb0a23581..9df581f9afc 100644 --- a/components/script/dom/webglprogram.rs +++ b/components/script/dom/webglprogram.rs @@ -96,7 +96,7 @@ impl WebGLProgram { _ => return Err(WebGLError::InvalidOperation), }; - // TODO(ecoal95): Differentiate between same shader already assigned and other previous + // TODO(emilio): Differentiate between same shader already assigned and other previous // shader. if shader_slot.get().is_some() { return Err(WebGLError::InvalidOperation); diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 5251585ea94..c5070cca69e 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -610,7 +610,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { } } - // TODO(ecoal95): Probably in the future we should keep track of the + // TODO(emilio): Probably in the future we should keep track of the // generated objects, either here or in the webgl thread // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5 fn CreateBuffer(&self) -> Option> { @@ -1116,8 +1116,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { if texture.is_none() { return self.webgl_error(InvalidOperation); } - // TODO(ecoal95): Validate more parameters - + // TODO(emilio): Validate more parameters let source = match source { Some(s) => s, None => return, @@ -1144,7 +1143,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { }; let size = Size2D::new(img.width as i32, img.height as i32); - // TODO(ecoal95): Validate that the format argument is coherent with the image. + // TODO(emilio): Validate that the format argument is coherent with the image. // RGB8 should be easy to support too let mut data = match img.format { PixelFormat::RGBA8 => img.bytes.to_vec(), @@ -1155,7 +1154,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { (data, size) }, - // TODO(ecoal95): Getting canvas data is implemented in CanvasRenderingContext2D, but + // TODO(emilio): Getting canvas data is implemented in CanvasRenderingContext2D, but // we need to refactor it moving it to `HTMLCanvasElement` and supporting WebGLContext ImageDataOrHTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement::HTMLCanvasElement(canvas) => { let canvas = canvas.r(); @@ -1170,7 +1169,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { => unimplemented!(), }; - // TODO(ecoal95): Invert axis, convert colorspace, premultiply alpha if requested + // TODO(emilio): Invert axis, convert colorspace, premultiply alpha if requested let msg = CanvasWebGLMsg::TexImage2D(target, level, internal_format as i32, size.width, size.height, format, data_type, pixels); diff --git a/components/style/selector_matching.rs b/components/style/selector_matching.rs index 2321b953e4c..90748ed7be9 100644 --- a/components/style/selector_matching.rs +++ b/components/style/selector_matching.rs @@ -266,7 +266,7 @@ impl Stylist { let map = match pseudo_element { Some(ref pseudo) => match self.pseudos_map.get(pseudo) { Some(map) => map, - // TODO(ecoal95): get non eagerly-cascaded pseudo-element rules here. + // TODO(emilio): get non eagerly-cascaded pseudo-element rules here. // Actually assume there are no rules applicable. None => return true, }, diff --git a/tests/wpt/web-platform-tests/XMLHttpRequest/OWNERS b/tests/wpt/web-platform-tests/XMLHttpRequest/OWNERS index 7a809e70f6c..27421d921a0 100644 --- a/tests/wpt/web-platform-tests/XMLHttpRequest/OWNERS +++ b/tests/wpt/web-platform-tests/XMLHttpRequest/OWNERS @@ -1,4 +1,4 @@ -@ecoal95 +@emilio @hallvors @kangxu @caitp From 5a6eaf8621cc3e8a616caa7539a9cda08efaef2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 23 Mar 2016 18:16:47 +0100 Subject: [PATCH 16/20] canvas_traits: Remove unused layers dependency --- components/canvas_traits/Cargo.toml | 4 ---- components/canvas_traits/lib.rs | 4 ---- components/servo/Cargo.lock | 1 - ports/cef/Cargo.lock | 1 - ports/gonk/Cargo.lock | 1 - 5 files changed, 11 deletions(-) diff --git a/components/canvas_traits/Cargo.toml b/components/canvas_traits/Cargo.toml index b694f422aa5..33e128048f4 100644 --- a/components/canvas_traits/Cargo.toml +++ b/components/canvas_traits/Cargo.toml @@ -15,10 +15,6 @@ path = "../gfx_traits" git = "https://github.com/servo/rust-azure" features = ["plugins"] -[dependencies.layers] -git = "https://github.com/servo/rust-layers" -features = ["plugins"] - [dependencies.offscreen_gl_context] git = "https://github.com/ecoal95/rust-offscreen-rendering-context" diff --git a/components/canvas_traits/lib.rs b/components/canvas_traits/lib.rs index 24af48aaa49..7abe3a7e665 100644 --- a/components/canvas_traits/lib.rs +++ b/components/canvas_traits/lib.rs @@ -17,7 +17,6 @@ extern crate euclid; extern crate gfx_traits; extern crate heapsize; extern crate ipc_channel; -extern crate layers; extern crate offscreen_gl_context; extern crate serde; extern crate util; @@ -35,11 +34,8 @@ use euclid::rect::Rect; use euclid::size::Size2D; use gfx_traits::color; use ipc_channel::ipc::{IpcSender, IpcSharedMemory}; -use layers::platform::surface::NativeSurface; -use serde::{Deserialize, Deserializer, Serialize, Serializer}; use std::default::Default; use std::str::FromStr; -use std::sync::mpsc::Sender; pub use webrender_traits::{WebGLFramebufferBindingRequest, WebGLError, WebGLParameter, WebGLResult, WebGLContextId}; pub use webrender_traits::WebGLCommand as CanvasWebGLMsg; diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index c80dcadbeef..94107943706 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -187,7 +187,6 @@ dependencies = [ "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)", - "layers 0.2.4 (git+https://github.com/servo/rust-layers)", "offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)", "plugins 0.0.1", "serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index 2bec2e051a6..6a25b60781d 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -172,7 +172,6 @@ dependencies = [ "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)", - "layers 0.2.4 (git+https://github.com/servo/rust-layers)", "offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)", "plugins 0.0.1", "serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/ports/gonk/Cargo.lock b/ports/gonk/Cargo.lock index 3ed2f49114f..b61388ce9c5 100644 --- a/ports/gonk/Cargo.lock +++ b/ports/gonk/Cargo.lock @@ -165,7 +165,6 @@ dependencies = [ "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)", - "layers 0.2.4 (git+https://github.com/servo/rust-layers)", "offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)", "plugins 0.0.1", "serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", From b40992611171d4db4e0ce1188315637c6eabfff3 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Wed, 23 Mar 2016 20:04:58 +0100 Subject: [PATCH 17/20] Properly return an empty list in devtools' listAddons --- components/devtools/actors/root.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/components/devtools/actors/root.rs b/components/devtools/actors/root.rs index 0a589db3466..b9e6fee98c9 100644 --- a/components/devtools/actors/root.rs +++ b/components/devtools/actors/root.rs @@ -21,12 +21,14 @@ struct ActorTraits { } #[derive(RustcEncodable)] -struct ErrorReply { +struct ListAddonsReply { from: String, - error: String, - message: String, + addons: Vec, } +#[derive(RustcEncodable)] +enum AddonMsg {} + #[derive(RustcEncodable)] struct ListTabsReply { from: String, @@ -57,10 +59,9 @@ impl Actor for RootActor { stream: &mut TcpStream) -> Result { Ok(match msg_type { "listAddons" => { - let actor = ErrorReply { + let actor = ListAddonsReply { from: "root".to_owned(), - error: "noAddons".to_owned(), - message: "This root actor has no browser addons.".to_owned(), + addons: vec![], }; stream.write_json_packet(&actor); ActorMessageStatus::Processed From dbfa4f06b727eaa15aad4a8db1cd1d2d98119d55 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Thu, 24 Mar 2016 00:40:06 +0100 Subject: [PATCH 18/20] Implement a basic thread actor These should represent JavaScript contexts, but not defining them at all prevent any remote debugging session to be started from Firefox. They shouldn't be conflated with tab actors. --- components/devtools/actors/tab.rs | 3 +- components/devtools/actors/thread.rs | 80 ++++++++++++++++++++++++++++ components/devtools/lib.rs | 10 +++- 3 files changed, 90 insertions(+), 3 deletions(-) create mode 100644 components/devtools/actors/thread.rs diff --git a/components/devtools/actors/tab.rs b/components/devtools/actors/tab.rs index 90a03688f12..7c93f3b4a71 100644 --- a/components/devtools/actors/tab.rs +++ b/components/devtools/actors/tab.rs @@ -74,6 +74,7 @@ pub struct TabActor { pub timeline: String, pub profiler: String, pub performance: String, + pub thread: String, } impl Actor for TabActor { @@ -98,7 +99,7 @@ impl Actor for TabActor { let msg = TabAttachedReply { from: self.name(), __type__: "tabAttached".to_owned(), - threadActor: self.name(), + threadActor: self.thread.clone(), cacheDisabled: false, javascriptEnabled: true, traits: TabTraits, diff --git a/components/devtools/actors/thread.rs b/components/devtools/actors/thread.rs new file mode 100644 index 00000000000..087e1e9027f --- /dev/null +++ b/components/devtools/actors/thread.rs @@ -0,0 +1,80 @@ +/* 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 actor::{Actor, ActorMessageStatus, ActorRegistry}; +use protocol::JsonPacketStream; +use rustc_serialize::json; +use std::net::TcpStream; + +#[derive(RustcEncodable)] +struct ThreadAttachedReply { + from: String, + __type__: String, + actor: String, + poppedFrames: Vec, + why: WhyMsg, +} + +#[derive(RustcEncodable)] +enum PoppedFrameMsg {} + +#[derive(RustcEncodable)] +struct WhyMsg { + __type__: String, +} + +#[derive(RustcEncodable)] +struct ThreadResumedReply { + from: String, + __type__: String, +} + +pub struct ThreadActor { + name: String, +} + +impl ThreadActor { + pub fn new(name: String) -> ThreadActor { + ThreadActor { + name: name, + } + } +} + +impl Actor for ThreadActor { + fn name(&self) -> String { + self.name.clone() + } + + fn handle_message(&self, + registry: &ActorRegistry, + msg_type: &str, + _msg: &json::Object, + stream: &mut TcpStream) -> Result { + Ok(match msg_type { + "attach" => { + let msg = ThreadAttachedReply { + from: self.name(), + __type__: "paused".to_owned(), + actor: registry.new_name("pause"), + poppedFrames: vec![], + why: WhyMsg { __type__: "attached".to_owned() }, + }; + stream.write_json_packet(&msg); + ActorMessageStatus::Processed + }, + + "resume" => { + let msg = ThreadResumedReply { + from: self.name(), + __type__: "resumed".to_owned(), + }; + stream.write_json_packet(&msg); + ActorMessageStatus::Processed + }, + + _ => ActorMessageStatus::Ignored, + }) + } +} diff --git a/components/devtools/lib.rs b/components/devtools/lib.rs index 3ee14422d53..2a6c532e05b 100644 --- a/components/devtools/lib.rs +++ b/components/devtools/lib.rs @@ -42,6 +42,7 @@ use actors::performance::PerformanceActor; use actors::profiler::ProfilerActor; use actors::root::RootActor; use actors::tab::TabActor; +use actors::thread::ThreadActor; use actors::timeline::TimelineActor; use actors::worker::WorkerActor; use devtools_traits::{ChromeToDevtoolsControlMsg, ConsoleMessage, DevtoolsControlMsg}; @@ -73,6 +74,7 @@ mod actors { pub mod profiler; pub mod root; pub mod tab; + pub mod thread; pub mod timeline; pub mod worker; } @@ -248,7 +250,7 @@ fn run_server(sender: Sender, let (pipeline, worker_id) = ids; //TODO: move all this actor creation into a constructor method on TabActor - let (tab, console, inspector, timeline, profiler, performance) = { + let (tab, console, inspector, timeline, profiler, performance, thread) = { let console = ConsoleActor { name: actors.new_name("console"), script_chan: script_sender.clone(), @@ -271,6 +273,8 @@ fn run_server(sender: Sender, let profiler = ProfilerActor::new(actors.new_name("profiler")); let performance = PerformanceActor::new(actors.new_name("performance")); + let thread = ThreadActor::new(actors.new_name("context")); + let DevtoolsPageInfo { title, url } = page_info; let tab = TabActor { name: actors.new_name("tab"), @@ -281,12 +285,13 @@ fn run_server(sender: Sender, timeline: timeline.name(), profiler: profiler.name(), performance: performance.name(), + thread: thread.name(), }; let root = actors.find_mut::("root"); root.tabs.push(tab.name.clone()); - (tab, console, inspector, timeline, profiler, performance) + (tab, console, inspector, timeline, profiler, performance, thread) }; if let Some(id) = worker_id { @@ -306,6 +311,7 @@ fn run_server(sender: Sender, actors.register(box timeline); actors.register(box profiler); actors.register(box performance); + actors.register(box thread); } fn handle_console_message(actors: Arc>, From 04e085a4e50df45ed38e43172ceee055d3e68280 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Thu, 24 Mar 2016 01:21:08 +0100 Subject: [PATCH 19/20] Add a dummy reconfigure reply in the thread actor --- components/devtools/actors/console.rs | 15 +++++++++++++++ components/devtools/actors/thread.rs | 10 ++++++++++ 2 files changed, 25 insertions(+) diff --git a/components/devtools/actors/console.rs b/components/devtools/actors/console.rs index 31c404966e8..427e7eee043 100644 --- a/components/devtools/actors/console.rs +++ b/components/devtools/actors/console.rs @@ -77,6 +77,12 @@ struct EvaluateJSReply { helperResult: Json, } +#[derive(RustcEncodable)] +struct SetPreferencesReply { + from: String, + updated: Vec, +} + pub struct ConsoleActor { pub name: String, pub pipeline: PipelineId, @@ -237,6 +243,15 @@ impl Actor for ConsoleActor { ActorMessageStatus::Processed } + "setPreferences" => { + let msg = SetPreferencesReply { + from: self.name(), + updated: vec![], + }; + stream.write_json_packet(&msg); + ActorMessageStatus::Processed + } + _ => ActorMessageStatus::Ignored }) } diff --git a/components/devtools/actors/thread.rs b/components/devtools/actors/thread.rs index 087e1e9027f..232e91d0a56 100644 --- a/components/devtools/actors/thread.rs +++ b/components/devtools/actors/thread.rs @@ -30,6 +30,11 @@ struct ThreadResumedReply { __type__: String, } +#[derive(RustcEncodable)] +struct ReconfigureReply { + from: String +} + pub struct ThreadActor { name: String, } @@ -74,6 +79,11 @@ impl Actor for ThreadActor { ActorMessageStatus::Processed }, + "reconfigure" => { + stream.write_json_packet(&ReconfigureReply { from: self.name() }); + ActorMessageStatus::Processed + } + _ => ActorMessageStatus::Ignored, }) } From bcd813d961c829afca90b246fcd73a87c48c1f5f Mon Sep 17 00:00:00 2001 From: Stjepan Glavina Date: Thu, 24 Mar 2016 11:17:12 +0100 Subject: [PATCH 20/20] Fix fetching about:blank When fetching about:blank, response body should be the empty byte sequence. Spec: https://fetch.spec.whatwg.org/#concept-basic-fetch Before this change, response body would be set to `ResponseBody::Empty`, and then fetching would result in an infinite loop at step 19 in fn `main_fetch` (methods.rs). --- components/net/fetch/methods.rs | 1 + tests/unit/net/fetch.rs | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/components/net/fetch/methods.rs b/components/net/fetch/methods.rs index 481da031056..976b1e0b5ee 100644 --- a/components/net/fetch/methods.rs +++ b/components/net/fetch/methods.rs @@ -294,6 +294,7 @@ fn basic_fetch(request: Rc) -> Response { response.headers.set(ContentType(Mime( TopLevel::Text, SubLevel::Html, vec![(Attr::Charset, Value::Utf8)]))); + *response.body.lock().unwrap() = ResponseBody::Done(vec![]); response }, _ => Response::network_error() diff --git a/tests/unit/net/fetch.rs b/tests/unit/net/fetch.rs index 010d49e5732..1a6168f77d6 100644 --- a/tests/unit/net/fetch.rs +++ b/tests/unit/net/fetch.rs @@ -94,6 +94,20 @@ fn test_fetch_response_body_matches_const_message() { }; } +#[test] +fn test_fetch_aboutblank() { + + let url = Url::parse("about:blank").unwrap(); + let origin = Origin::Origin(url.origin()); + let mut request = Request::new(url, Some(origin), false); + request.referer = Referer::NoReferer; + let wrapped_request = Rc::new(request); + + let fetch_response = fetch(wrapped_request); + assert!(!fetch_response.is_network_error()); + assert!(*fetch_response.body.lock().unwrap() == ResponseBody::Done(vec![])); +} + #[test] fn test_fetch_response_is_basic_filtered() {