aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rw-r--r--components/devtools/lib.rs4
-rw-r--r--components/devtools/protocol.rs35
-rw-r--r--components/layout/block.rs15
-rw-r--r--components/layout/layout_task.rs304
-rw-r--r--components/layout/lib.rs1
-rw-r--r--components/layout/query.rs309
-rw-r--r--components/script/dom/canvasrenderingcontext2d.rs206
-rw-r--r--components/script/dom/filereader.rs7
-rw-r--r--components/script/dom/macros.rs3
-rw-r--r--components/script/dom/webidls/EventHandler.webidl3
-rw-r--r--components/script/dom/window.rs7
-rw-r--r--components/script/dom/workerglobalscope.rs5
-rw-r--r--components/servo/Cargo.lock4
-rw-r--r--ports/cef/Cargo.lock6
-rw-r--r--ports/gonk/Cargo.lock6
-rw-r--r--python/tidy.py2
-rw-r--r--tests/ref/basic.list1
-rw-r--r--tests/ref/floated_negative_margins_a.html16
-rw-r--r--tests/ref/floated_negative_margins_ref.html15
-rw-r--r--tests/wpt/metadata-css/css21_dev/html4/counter-reset-increment-002.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css21_dev/html4/first-letter-dynamic-002.htm.ini3
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.copy.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.destination-atop.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.destination-in.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.destination-out.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.destination-over.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.source-atop.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.source-in.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.source-out.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.source-over.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.xor.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.image.copy.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.image.destination-atop.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.image.destination-in.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.image.destination-out.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.image.destination-over.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.image.source-atop.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.image.source-in.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.image.source-out.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.image.source-over.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.image.xor.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.copy.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.destination-atop.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.destination-in.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.destination-out.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.destination-over.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.source-atop.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.source-in.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.source-out.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.source-over.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.xor.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/fill-and-stroke-styles/2d.fillStyle.parse.hsla-1.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/fill-and-stroke-styles/2d.fillStyle.parse.rgba-num-1.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/fill-and-stroke-styles/2d.fillStyle.parse.rgba-num-2.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/fill-and-stroke-styles/2d.fillStyle.parse.rgba-percent.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/fill-and-stroke-styles/2d.gradient.interpolate.colouralpha.html.ini5
-rw-r--r--tests/wpt/metadata/2dcontext/pixel-manipulation/2d.imageData.get.nonpremul.html.ini5
-rw-r--r--tests/wpt/metadata/html/dom/interfaces.html.ini36
59 files changed, 482 insertions, 692 deletions
diff --git a/README.md b/README.md
index 4637586b250..f242fd23dec 100644
--- a/README.md
+++ b/README.md
@@ -133,3 +133,6 @@ Use `./mach run [url]` to run Servo.
There are lots of mach commands you can use. You can list them with `./mach
--help`.
+
+
+The generated documentation can be found on http://doc.servo.org/servo/index.html
diff --git a/components/devtools/lib.rs b/components/devtools/lib.rs
index f268934ccbd..c791a9c46f2 100644
--- a/components/devtools/lib.rs
+++ b/components/devtools/lib.rs
@@ -172,8 +172,8 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,
println!("error: EOF");
break 'outer
}
- Err(e) => {
- println!("error: {}", e.description());
+ Err(err_msg) => {
+ println!("error: {}", err_msg);
break 'outer
}
}
diff --git a/components/devtools/protocol.rs b/components/devtools/protocol.rs
index daa7c19fba6..1b54b92d01a 100644
--- a/components/devtools/protocol.rs
+++ b/components/devtools/protocol.rs
@@ -8,12 +8,14 @@
use rustc_serialize::{json, Encodable};
use rustc_serialize::json::Json;
-use std::io::{self, Read, Write};
+use rustc_serialize::json::ParserError::{IoError, SyntaxError};
+use std::error::Error;
+use std::io::{Read, Write};
use std::net::TcpStream;
pub trait JsonPacketStream {
fn write_json_packet<'a, T: Encodable>(&mut self, obj: &T);
- fn read_json_packet(&mut self) -> io::Result<Option<Json>>;
+ fn read_json_packet(&mut self) -> Result<Option<Json>, String>;
}
impl JsonPacketStream for TcpStream {
@@ -25,25 +27,38 @@ impl JsonPacketStream for TcpStream {
self.write_all(s.as_bytes()).unwrap();
}
- fn read_json_packet<'a>(&mut self) -> io::Result<Option<Json>> {
+ fn read_json_packet<'a>(&mut self) -> Result<Option<Json>, String> {
// https://wiki.mozilla.org/Remote_Debugging_Protocol_Stream_Transport
// In short, each JSON packet is [ascii length]:[JSON data of given length]
let mut buffer = vec!();
loop {
let mut buf = [0];
- let byte = match try!(self.read(&mut buf)) {
- 0 => return Ok(None), // EOF
- 1 => buf[0],
- _ => unreachable!(),
+ let byte = match self.read(&mut buf) {
+ Ok(0) => return Ok(None), // EOF
+ Ok(1) => buf[0],
+ Ok(_) => unreachable!(),
+ Err(e) => return Err(e.description().to_string()),
};
match byte {
b':' => {
- let packet_len_str = String::from_utf8(buffer).unwrap();
- let packet_len = u64::from_str_radix(&packet_len_str, 10).unwrap();
+ let packet_len_str = match String::from_utf8(buffer) {
+ Ok(packet_len) => packet_len,
+ Err(_) => return Err("nonvalid UTF8 in packet length".to_string()),
+ };
+ let packet_len = match u64::from_str_radix(&packet_len_str, 10) {
+ Ok(packet_len) => packet_len,
+ Err(_) => return Err("packet length missing / not parsable".to_string()),
+ };
let mut packet = String::new();
self.take(packet_len).read_to_string(&mut packet).unwrap();
println!("{}", packet);
- return Ok(Some(Json::from_str(&packet).unwrap()))
+ return match Json::from_str(&packet) {
+ Ok(json) => Ok(Some(json)),
+ Err(err) => match err {
+ IoError(ioerr) => return Err(ioerr.description().to_string()),
+ SyntaxError(_, l, c) => return Err(format!("syntax at {}:{}", l, c)),
+ },
+ };
},
c => buffer.push(c),
}
diff --git a/components/layout/block.rs b/components/layout/block.rs
index d1a333f2b83..c703542b5f9 100644
--- a/components/layout/block.rs
+++ b/components/layout/block.rs
@@ -1058,10 +1058,17 @@ impl BlockFlow {
};
let float_info: FloatedBlockInfo = (**self.float.as_ref().unwrap()).clone();
+
+ // Our `position` field accounts for positive margins, but not negative margins. (See
+ // calculation of `extra_inline_size_from_margin` below.) Negative margins must be taken
+ // into account for float placement, however. So we add them in here.
+ let inline_size_for_float_placement = self.base.position.size.inline +
+ min(Au(0), self.fragment.margin.inline_start_end());
+
let info = PlacementInfo {
size: LogicalSize::new(
self.fragment.style.writing_mode,
- self.base.position.size.inline,
+ inline_size_for_float_placement,
block_size + self.fragment.margin.block_start_end())
.convert(self.fragment.style.writing_mode, self.base.floats.writing_mode),
ceiling: clearance + float_info.float_ceiling,
@@ -2214,9 +2221,9 @@ pub trait ISizeAndMarginsComputer {
container_size - inline_size - fragment.margin.inline_end
};
- // To calculate the total size of this block, we also need to account for any additional
- // size contribution from positive margins. Negative margins means the block isn't made
- // larger at all by the margin.
+ // To calculate the total size of this block, we also need to account for any
+ // additional size contribution from positive margins. Negative margins means the block
+ // isn't made larger at all by the margin.
extra_inline_size_from_margin = max(Au(0), fragment.margin.inline_start) +
max(Au(0), fragment.margin.inline_end);
}
diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs
index a2dc0d8d6bf..fb5b6e5ef79 100644
--- a/components/layout/layout_task.rs
+++ b/components/layout/layout_task.rs
@@ -20,6 +20,8 @@ use incremental::{LayoutDamageComputation, REFLOW, REFLOW_ENTIRE_DOCUMENT, REPAI
use layout_debug;
use opaque_node::OpaqueNodeMethods;
use parallel::{self, WorkQueueData};
+use query::{LayoutRPCImpl, process_content_box_request, process_content_boxes_request, MarginPadding, Side};
+use query::{MarginRetrievingFragmentBorderBoxIterator, PositionProperty, PositionRetrievingFragmentBorderBoxIterator};
use sequential;
use wrapper::LayoutNode;
@@ -34,7 +36,7 @@ use euclid::rect::Rect;
use euclid::scale_factor::ScaleFactor;
use euclid::size::Size2D;
use gfx_traits::color;
-use gfx::display_list::{ClippingRegion, DisplayItemMetadata, DisplayList, OpaqueNode};
+use gfx::display_list::{ClippingRegion, DisplayList, OpaqueNode};
use gfx::display_list::StackingContext;
use gfx::font_cache_task::FontCacheTask;
use gfx::paint_task::{LayoutToPaintMsg, PaintLayer};
@@ -52,10 +54,10 @@ use net_traits::{load_bytes_iter, PendingAsyncLoad};
use net_traits::image_cache_task::{ImageCacheTask, ImageCacheResult, ImageCacheChan};
use script::dom::bindings::js::LayoutJS;
use script::dom::node::{LayoutData, Node};
-use script::layout_interface::{Animation, ContentBoxResponse, ContentBoxesResponse, NodeGeometryResponse};
-use script::layout_interface::{HitTestResponse, LayoutChan, LayoutRPC, MouseOverResponse, OffsetParentResponse};
+use script::layout_interface::Animation;
+use script::layout_interface::{LayoutChan, LayoutRPC, OffsetParentResponse};
use script::layout_interface::{NewLayoutTaskInfo, Msg, Reflow, ReflowGoal, ReflowQueryType};
-use script::layout_interface::{ResolvedStyleResponse, ScriptLayoutChan, ScriptReflow, TrustedNodeAddress};
+use script::layout_interface::{ScriptLayoutChan, ScriptReflow, TrustedNodeAddress};
use script_traits::{ConstellationControlMsg, LayoutControlMsg, OpaqueScriptLayoutChannel};
use script_traits::{ScriptControlChan, StylesheetLoadResponder};
use selectors::parser::PseudoElement;
@@ -76,10 +78,9 @@ use style::properties::longhands::{display, position};
use style::selector_matching::Stylist;
use style::stylesheets::{Origin, Stylesheet, CSSRuleIteratorExt};
use url::Url;
-use util::cursor::Cursor;
use util::geometry::{Au, MAX_RECT, ZERO_POINT};
use util::ipc::OptionalIpcSender;
-use util::logical_geometry::{LogicalPoint, WritingMode};
+use util::logical_geometry::LogicalPoint;
use util::mem::HeapSizeOf;
use util::opts;
use util::task::spawn_named_with_send_on_failure;
@@ -284,7 +285,7 @@ impl LayoutTaskFactory for LayoutTask {
/// The `LayoutTask` `rw_data` lock must remain locked until the first reflow,
/// as RPC calls don't make sense until then. Use this in combination with
/// `LayoutTask::lock_rw_data` and `LayoutTask::return_rw_data`.
-enum RWGuard<'a> {
+pub enum RWGuard<'a> {
/// If the lock was previously held, from when the task started.
Held(MutexGuard<'a, LayoutTaskData>),
/// If the lock was just used, and has been returned since there has been
@@ -846,33 +847,6 @@ impl LayoutTask {
fn verify_flow_tree(&self, _: &mut FlowRef) {
}
- fn process_content_box_request<'a>(&'a self,
- requested_node: TrustedNodeAddress,
- layout_root: &mut FlowRef,
- rw_data: &mut RWGuard<'a>) {
- // FIXME(pcwalton): This has not been updated to handle the stacking context relative
- // stuff. So the position is wrong in most cases.
- let requested_node: OpaqueNode = OpaqueNodeMethods::from_script_node(requested_node);
- let mut iterator = UnioningFragmentBorderBoxIterator::new(requested_node);
- sequential::iterate_through_flow_tree_fragment_border_boxes(layout_root, &mut iterator);
- rw_data.content_box_response = match iterator.rect {
- Some(rect) => rect,
- None => Rect::zero()
- };
- }
-
- fn process_content_boxes_request<'a>(&'a self,
- requested_node: TrustedNodeAddress,
- layout_root: &mut FlowRef,
- rw_data: &mut RWGuard<'a>) {
- // FIXME(pcwalton): This has not been updated to handle the stacking context relative
- // stuff. So the position is wrong in most cases.
- let requested_node: OpaqueNode = OpaqueNodeMethods::from_script_node(requested_node);
- let mut iterator = CollectingFragmentBorderBoxIterator::new(requested_node);
- sequential::iterate_through_flow_tree_fragment_border_boxes(layout_root, &mut iterator);
- rw_data.content_boxes_response = iterator.rects;
- }
-
fn process_node_geometry_request<'a>(&'a self,
requested_node: TrustedNodeAddress,
layout_root: &mut FlowRef,
@@ -1218,9 +1192,9 @@ impl LayoutTask {
let mut root_flow = (*rw_data.root_flow.as_ref().unwrap()).clone();
match data.query_type {
ReflowQueryType::ContentBoxQuery(node) =>
- self.process_content_box_request(node, &mut root_flow, &mut rw_data),
+ process_content_box_request(node, &mut root_flow, &mut rw_data),
ReflowQueryType::ContentBoxesQuery(node) =>
- self.process_content_boxes_request(node, &mut root_flow, &mut rw_data),
+ process_content_boxes_request(node, &mut root_flow, &mut rw_data),
ReflowQueryType::NodeGeometryQuery(node) =>
self.process_node_geometry_request(node, &mut root_flow, &mut rw_data),
ReflowQueryType::ResolvedStyleQuery(node, ref pseudo, ref property) =>
@@ -1452,162 +1426,6 @@ impl LayoutTask {
}
}
-struct LayoutRPCImpl(Arc<Mutex<LayoutTaskData>>);
-
-impl LayoutRPC for LayoutRPCImpl {
- // The neat thing here is that in order to answer the following two queries we only
- // need to compare nodes for equality. Thus we can safely work only with `OpaqueNode`.
- fn content_box(&self) -> ContentBoxResponse {
- let &LayoutRPCImpl(ref rw_data) = self;
- let rw_data = rw_data.lock().unwrap();
- ContentBoxResponse(rw_data.content_box_response)
- }
-
- /// Requests the dimensions of all the content boxes, as in the `getClientRects()` call.
- fn content_boxes(&self) -> ContentBoxesResponse {
- let &LayoutRPCImpl(ref rw_data) = self;
- let rw_data = rw_data.lock().unwrap();
- ContentBoxesResponse(rw_data.content_boxes_response.clone())
- }
-
- fn node_geometry(&self) -> NodeGeometryResponse {
- let &LayoutRPCImpl(ref rw_data) = self;
- let rw_data = rw_data.lock().unwrap();
- NodeGeometryResponse {
- client_rect: rw_data.client_rect_response
- }
- }
-
- /// Retrieves the resolved value for a CSS style property.
- fn resolved_style(&self) -> ResolvedStyleResponse {
- let &LayoutRPCImpl(ref rw_data) = self;
- let rw_data = rw_data.lock().unwrap();
- ResolvedStyleResponse(rw_data.resolved_style_response.clone())
- }
-
- /// Requests the node containing the point of interest.
- fn hit_test(&self, _: TrustedNodeAddress, point: Point2D<f32>) -> Result<HitTestResponse, ()> {
- let point = Point2D::new(Au::from_f32_px(point.x), Au::from_f32_px(point.y));
- let resp = {
- let &LayoutRPCImpl(ref rw_data) = self;
- let rw_data = rw_data.lock().unwrap();
- match rw_data.stacking_context {
- None => panic!("no root stacking context!"),
- Some(ref stacking_context) => {
- let mut result = Vec::new();
- stacking_context.hit_test(point, &mut result, true);
- if !result.is_empty() {
- Some(HitTestResponse(result[0].node.to_untrusted_node_address()))
- } else {
- None
- }
- }
- }
- };
-
- if resp.is_some() {
- return Ok(resp.unwrap());
- }
- Err(())
- }
-
- fn mouse_over(&self, _: TrustedNodeAddress, point: Point2D<f32>)
- -> Result<MouseOverResponse, ()> {
- let mut mouse_over_list: Vec<DisplayItemMetadata> = vec!();
- let point = Point2D::new(Au::from_f32_px(point.x), Au::from_f32_px(point.y));
- {
- let &LayoutRPCImpl(ref rw_data) = self;
- let rw_data = rw_data.lock().unwrap();
- match rw_data.stacking_context {
- None => panic!("no root stacking context!"),
- Some(ref stacking_context) => {
- stacking_context.hit_test(point, &mut mouse_over_list, false);
- }
- }
-
- // Compute the new cursor.
- let cursor = if !mouse_over_list.is_empty() {
- mouse_over_list[0].pointing.unwrap()
- } else {
- Cursor::DefaultCursor
- };
- let ConstellationChan(ref constellation_chan) = rw_data.constellation_chan;
- constellation_chan.send(ConstellationMsg::SetCursor(cursor)).unwrap();
- }
-
- if mouse_over_list.is_empty() {
- Err(())
- } else {
- let response_list =
- mouse_over_list.iter()
- .map(|metadata| metadata.node.to_untrusted_node_address())
- .collect();
- Ok(MouseOverResponse(response_list))
- }
- }
-
- fn offset_parent(&self) -> OffsetParentResponse {
- let &LayoutRPCImpl(ref rw_data) = self;
- let rw_data = rw_data.lock().unwrap();
- rw_data.offset_parent_response.clone()
- }
-}
-
-struct UnioningFragmentBorderBoxIterator {
- node_address: OpaqueNode,
- rect: Option<Rect<Au>>,
-}
-
-impl UnioningFragmentBorderBoxIterator {
- fn new(node_address: OpaqueNode) -> UnioningFragmentBorderBoxIterator {
- UnioningFragmentBorderBoxIterator {
- node_address: node_address,
- rect: None
- }
- }
-}
-
-impl FragmentBorderBoxIterator for UnioningFragmentBorderBoxIterator {
- fn process(&mut self, _: &Fragment, _: i32, border_box: &Rect<Au>) {
- self.rect = match self.rect {
- Some(rect) => {
- Some(rect.union(border_box))
- }
- None => {
- Some(*border_box)
- }
- };
- }
-
- fn should_process(&mut self, fragment: &Fragment) -> bool {
- fragment.contains_node(self.node_address)
- }
-}
-
-struct CollectingFragmentBorderBoxIterator {
- node_address: OpaqueNode,
- rects: Vec<Rect<Au>>,
-}
-
-impl CollectingFragmentBorderBoxIterator {
- fn new(node_address: OpaqueNode) -> CollectingFragmentBorderBoxIterator {
- CollectingFragmentBorderBoxIterator {
- node_address: node_address,
- rects: Vec::new(),
- }
- }
-}
-
-impl FragmentBorderBoxIterator for CollectingFragmentBorderBoxIterator {
- fn process(&mut self, _: &Fragment, _: i32, border_box: &Rect<Au>) {
- self.rects.push(*border_box);
- }
-
- fn should_process(&mut self, fragment: &Fragment) -> bool {
- fragment.contains_node(self.node_address)
- }
-}
-
struct FragmentLocatingFragmentIterator {
node_address: OpaqueNode,
client_rect: Rect<i32>,
@@ -1667,108 +1485,6 @@ impl FragmentBorderBoxIterator for FragmentLocatingFragmentIterator {
}
}
-enum Side {
- Left,
- Right,
- Bottom,
- Top
-}
-
-enum MarginPadding {
- Margin,
- Padding
-}
-
-enum PositionProperty {
- Left,
- Right,
- Top,
- Bottom,
- Width,
- Height,
-}
-
-struct PositionRetrievingFragmentBorderBoxIterator {
- node_address: OpaqueNode,
- result: Option<Au>,
- position: Point2D<Au>,
- property: PositionProperty,
-}
-
-impl PositionRetrievingFragmentBorderBoxIterator {
- fn new(node_address: OpaqueNode,
- property: PositionProperty,
- position: Point2D<Au>) -> PositionRetrievingFragmentBorderBoxIterator {
- PositionRetrievingFragmentBorderBoxIterator {
- node_address: node_address,
- position: position,
- property: property,
- result: None,
- }
- }
-}
-
-impl FragmentBorderBoxIterator for PositionRetrievingFragmentBorderBoxIterator {
- fn process(&mut self, _: &Fragment, _: i32, border_box: &Rect<Au>) {
- self.result =
- Some(match self.property {
- PositionProperty::Left => self.position.x,
- PositionProperty::Top => self.position.y,
- PositionProperty::Width => border_box.size.width,
- PositionProperty::Height => border_box.size.height,
- // TODO: the following 2 calculations are completely wrong.
- // They should return the difference between the parent's and this
- // fragment's border boxes.
- PositionProperty::Right => border_box.max_x() + self.position.x,
- PositionProperty::Bottom => border_box.max_y() + self.position.y,
- });
- }
-
- fn should_process(&mut self, fragment: &Fragment) -> bool {
- fragment.contains_node(self.node_address)
- }
-}
-
-struct MarginRetrievingFragmentBorderBoxIterator {
- node_address: OpaqueNode,
- result: Option<Au>,
- writing_mode: WritingMode,
- margin_padding: MarginPadding,
- side: Side,
-}
-
-impl MarginRetrievingFragmentBorderBoxIterator {
- fn new(node_address: OpaqueNode, side: Side, margin_padding:
- MarginPadding, writing_mode: WritingMode) -> MarginRetrievingFragmentBorderBoxIterator {
- MarginRetrievingFragmentBorderBoxIterator {
- node_address: node_address,
- side: side,
- margin_padding: margin_padding,
- result: None,
- writing_mode: writing_mode,
- }
- }
-}
-
-impl FragmentBorderBoxIterator for MarginRetrievingFragmentBorderBoxIterator {
- fn process(&mut self, fragment: &Fragment, _: i32, _: &Rect<Au>) {
- let rect = match self.margin_padding {
- MarginPadding::Margin => &fragment.margin,
- MarginPadding::Padding => &fragment.border_padding
- };
- self.result = Some(match self.side {
- Side::Left => rect.left(self.writing_mode),
- Side::Right => rect.right(self.writing_mode),
- Side::Bottom => rect.bottom(self.writing_mode),
- Side::Top => rect.top(self.writing_mode)
- });
- }
-
- fn should_process(&mut self, fragment: &Fragment) -> bool {
- fragment.contains_node(self.node_address)
- }
-}
-
// https://drafts.csswg.org/cssom-view/#extensions-to-the-htmlelement-interface
impl FragmentBorderBoxIterator for ParentOffsetBorderBoxIterator {
fn process(&mut self, fragment: &Fragment, level: i32, border_box: &Rect<Au>) {
diff --git a/components/layout/lib.rs b/components/layout/lib.rs
index c68e5f300cd..5d70db2fc6d 100644
--- a/components/layout/lib.rs
+++ b/components/layout/lib.rs
@@ -85,6 +85,7 @@ pub mod model;
pub mod multicol;
pub mod opaque_node;
pub mod parallel;
+pub mod query;
pub mod sequential;
pub mod table_wrapper;
pub mod table;
diff --git a/components/layout/query.rs b/components/layout/query.rs
new file mode 100644
index 00000000000..01f1c6065b5
--- /dev/null
+++ b/components/layout/query.rs
@@ -0,0 +1,309 @@
+/* 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/. */
+
+//! Utilities for querying the layout, as needed by the layout task.
+
+use layout_task::{LayoutTaskData, RWGuard};
+
+use euclid::point::Point2D;
+use euclid::rect::Rect;
+use flow_ref::FlowRef;
+use fragment::{Fragment, FragmentBorderBoxIterator};
+use gfx::display_list::{DisplayItemMetadata, OpaqueNode};
+use msg::constellation_msg::Msg as ConstellationMsg;
+use msg::constellation_msg::ConstellationChan;
+use opaque_node::OpaqueNodeMethods;
+use script::layout_interface::{ContentBoxResponse, ContentBoxesResponse, NodeGeometryResponse};
+use script::layout_interface::{HitTestResponse, LayoutRPC, MouseOverResponse, OffsetParentResponse};
+use script::layout_interface::{ResolvedStyleResponse, ScriptLayoutChan, TrustedNodeAddress};
+use sequential;
+
+use std::sync::{Arc, Mutex};
+use util::geometry::Au;
+use util::cursor::Cursor;
+use util::logical_geometry::WritingMode;
+
+pub struct LayoutRPCImpl(pub Arc<Mutex<LayoutTaskData>>);
+
+impl LayoutRPC for LayoutRPCImpl {
+
+ // The neat thing here is that in order to answer the following two queries we only
+ // need to compare nodes for equality. Thus we can safely work only with `OpaqueNode`.
+ fn content_box(&self) -> ContentBoxResponse {
+ let &LayoutRPCImpl(ref rw_data) = self;
+ let rw_data = rw_data.lock().unwrap();
+ ContentBoxResponse(rw_data.content_box_response)
+ }
+
+ /// Requests the dimensions of all the content boxes, as in the `getClientRects()` call.
+ fn content_boxes(&self) -> ContentBoxesResponse {
+ let &LayoutRPCImpl(ref rw_data) = self;
+ let rw_data = rw_data.lock().unwrap();
+ ContentBoxesResponse(rw_data.content_boxes_response.clone())
+ }
+
+ fn node_geometry(&self) -> NodeGeometryResponse {
+ let &LayoutRPCImpl(ref rw_data) = self;
+ let rw_data = rw_data.lock().unwrap();
+ NodeGeometryResponse {
+ client_rect: rw_data.client_rect_response
+ }
+ }
+
+ /// Retrieves the resolved value for a CSS style property.
+ fn resolved_style(&self) -> ResolvedStyleResponse {
+ let &LayoutRPCImpl(ref rw_data) = self;
+ let rw_data = rw_data.lock().unwrap();
+ ResolvedStyleResponse(rw_data.resolved_style_response.clone())
+ }
+
+ /// Requests the node containing the point of interest.
+ fn hit_test(&self, _: TrustedNodeAddress, point: Point2D<f32>) -> Result<HitTestResponse, ()> {
+ let point = Point2D::new(Au::from_f32_px(point.x), Au::from_f32_px(point.y));
+ let resp = {
+ let &LayoutRPCImpl(ref rw_data) = self;
+ let rw_data = rw_data.lock().unwrap();
+ match rw_data.stacking_context {
+ None => panic!("no root stacking context!"),
+ Some(ref stacking_context) => {
+ let mut result = Vec::new();
+ stacking_context.hit_test(point, &mut result, true);
+ if !result.is_empty() {
+ Some(HitTestResponse(result[0].node.to_untrusted_node_address()))
+ } else {
+ None
+ }
+ }
+ }
+ };
+
+ if resp.is_some() {
+ return Ok(resp.unwrap());
+ }
+ Err(())
+ }
+
+ fn mouse_over(&self, _: TrustedNodeAddress, point: Point2D<f32>)
+ -> Result<MouseOverResponse, ()> {
+ let mut mouse_over_list: Vec<DisplayItemMetadata> = vec!();
+ let point = Point2D::new(Au::from_f32_px(point.x), Au::from_f32_px(point.y));
+ {
+ let &LayoutRPCImpl(ref rw_data) = self;
+ let rw_data = rw_data.lock().unwrap();
+ match rw_data.stacking_context {
+ None => panic!("no root stacking context!"),
+ Some(ref stacking_context) => {
+ stacking_context.hit_test(point, &mut mouse_over_list, false);
+ }
+ }
+
+ // Compute the new cursor.
+ let cursor = if !mouse_over_list.is_empty() {
+ mouse_over_list[0].pointing.unwrap()
+ } else {
+ Cursor::DefaultCursor
+ };
+ let ConstellationChan(ref constellation_chan) = rw_data.constellation_chan;
+ constellation_chan.send(ConstellationMsg::SetCursor(cursor)).unwrap();
+ }
+
+ if mouse_over_list.is_empty() {
+ Err(())
+ } else {
+ let response_list =
+ mouse_over_list.iter()
+ .map(|metadata| metadata.node.to_untrusted_node_address())
+ .collect();
+ Ok(MouseOverResponse(response_list))
+ }
+ }
+
+ fn offset_parent(&self) -> OffsetParentResponse {
+ let &LayoutRPCImpl(ref rw_data) = self;
+ let rw_data = rw_data.lock().unwrap();
+ rw_data.offset_parent_response.clone()
+ }
+}
+
+pub struct UnioningFragmentBorderBoxIterator {
+ pub node_address: OpaqueNode,
+ pub rect: Option<Rect<Au>>,
+}
+
+impl UnioningFragmentBorderBoxIterator {
+ pub fn new(node_address: OpaqueNode) -> UnioningFragmentBorderBoxIterator {
+ UnioningFragmentBorderBoxIterator {
+ node_address: node_address,
+ rect: None
+ }
+ }
+}
+
+impl FragmentBorderBoxIterator for UnioningFragmentBorderBoxIterator {
+ fn process(&mut self, _: &Fragment, _: i32, border_box: &Rect<Au>) {
+ self.rect = match self.rect {
+ Some(rect) => {
+ Some(rect.union(border_box))
+ }
+ None => {
+ Some(*border_box)
+ }
+ };
+ }
+
+ fn should_process(&mut self, fragment: &Fragment) -> bool {
+ fragment.contains_node(self.node_address)
+ }
+}
+
+pub struct CollectingFragmentBorderBoxIterator {
+ pub node_address: OpaqueNode,
+ pub rects: Vec<Rect<Au>>,
+}
+
+impl CollectingFragmentBorderBoxIterator {
+ pub fn new(node_address: OpaqueNode) -> CollectingFragmentBorderBoxIterator {
+ CollectingFragmentBorderBoxIterator {
+ node_address: node_address,
+ rects: Vec::new(),
+ }
+ }
+}
+
+impl FragmentBorderBoxIterator for CollectingFragmentBorderBoxIterator {
+ fn process(&mut self, _: &Fragment, _: i32, border_box: &Rect<Au>) {
+ self.rects.push(*border_box);
+ }
+
+ fn should_process(&mut self, fragment: &Fragment) -> bool {
+ fragment.contains_node(self.node_address)
+ }
+}
+
+pub enum Side {
+ Left,
+ Right,
+ Bottom,
+ Top
+}
+
+pub enum MarginPadding {
+ Margin,
+ Padding
+}
+
+pub enum PositionProperty {
+ Left,
+ Right,
+ Top,
+ Bottom,
+ Width,
+ Height,
+}
+
+pub struct PositionRetrievingFragmentBorderBoxIterator {
+ node_address: OpaqueNode,
+ pub result: Option<Au>,
+ position: Point2D<Au>,
+ property: PositionProperty,
+}
+
+impl PositionRetrievingFragmentBorderBoxIterator {
+ pub fn new(node_address: OpaqueNode,
+ property: PositionProperty,
+ position: Point2D<Au>) -> PositionRetrievingFragmentBorderBoxIterator {
+ PositionRetrievingFragmentBorderBoxIterator {
+ node_address: node_address,
+ position: position,
+ property: property,
+ result: None,
+ }
+ }
+}
+
+impl FragmentBorderBoxIterator for PositionRetrievingFragmentBorderBoxIterator {
+ fn process(&mut self, _: &Fragment, _: i32, border_box: &Rect<Au>) {
+ self.result =
+ Some(match self.property {
+ PositionProperty::Left => self.position.x,
+ PositionProperty::Top => self.position.y,
+ PositionProperty::Width => border_box.size.width,
+ PositionProperty::Height => border_box.size.height,
+ // TODO: the following 2 calculations are completely wrong.
+ // They should return the difference between the parent's and this
+ // fragment's border boxes.
+ PositionProperty::Right => border_box.max_x() + self.position.x,
+ PositionProperty::Bottom => border_box.max_y() + self.position.y,
+ });
+ }
+
+ fn should_process(&mut self, fragment: &Fragment) -> bool {
+ fragment.contains_node(self.node_address)
+ }
+}
+
+pub struct MarginRetrievingFragmentBorderBoxIterator {
+ node_address: OpaqueNode,
+ pub result: Option<Au>,
+ writing_mode: WritingMode,
+ margin_padding: MarginPadding,
+ side: Side,
+}
+
+impl MarginRetrievingFragmentBorderBoxIterator {
+ pub fn new(node_address: OpaqueNode, side: Side, margin_padding:
+ MarginPadding, writing_mode: WritingMode) -> MarginRetrievingFragmentBorderBoxIterator {
+ MarginRetrievingFragmentBorderBoxIterator {
+ node_address: node_address,
+ side: side,
+ margin_padding: margin_padding,
+ result: None,
+ writing_mode: writing_mode,
+ }
+ }
+}
+
+impl FragmentBorderBoxIterator for MarginRetrievingFragmentBorderBoxIterator {
+ fn process(&mut self, fragment: &Fragment, _: i32, _: &Rect<Au>) {
+ let rect = match self.margin_padding {
+ MarginPadding::Margin => &fragment.margin,
+ MarginPadding::Padding => &fragment.border_padding
+ };
+ self.result = Some(match self.side {
+ Side::Left => rect.left(self.writing_mode),
+ Side::Right => rect.right(self.writing_mode),
+ Side::Bottom => rect.bottom(self.writing_mode),
+ Side::Top => rect.top(self.writing_mode)
+ });
+ }
+
+ fn should_process(&mut self, fragment: &Fragment) -> bool {
+ fragment.contains_node(self.node_address)
+ }
+}
+
+pub fn process_content_box_request<'a>(requested_node: TrustedNodeAddress,
+ layout_root: &mut FlowRef,
+ rw_data: &mut RWGuard<'a>) {
+ // FIXME(pcwalton): This has not been updated to handle the stacking context relative
+ // stuff. So the position is wrong in most cases.
+ let requested_node: OpaqueNode = OpaqueNodeMethods::from_script_node(requested_node);
+ let mut iterator = UnioningFragmentBorderBoxIterator::new(requested_node);
+ sequential::iterate_through_flow_tree_fragment_border_boxes(layout_root, &mut iterator);
+ rw_data.content_box_response = match iterator.rect {
+ Some(rect) => rect,
+ None => Rect::zero()
+ };
+}
+
+pub fn process_content_boxes_request<'a>(requested_node: TrustedNodeAddress,
+ layout_root: &mut FlowRef,
+ rw_data: &mut RWGuard<'a>) {
+ // FIXME(pcwalton): This has not been updated to handle the stacking context relative
+ // stuff. So the position is wrong in most cases.
+ let requested_node: OpaqueNode = OpaqueNodeMethods::from_script_node(requested_node);
+ let mut iterator = CollectingFragmentBorderBoxIterator::new(requested_node);
+ sequential::iterate_through_flow_tree_fragment_border_boxes(layout_root, &mut iterator);
+ rw_data.content_boxes_response = iterator.rects;
+}
diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs
index 9cfa10a5032..c9f8da05bff 100644
--- a/components/script/dom/canvasrenderingcontext2d.rs
+++ b/components/script/dom/canvasrenderingcontext2d.rs
@@ -220,16 +220,62 @@ impl CanvasRenderingContext2D {
// is copied on the rectangle (dx, dy, dh, dw) of the destination canvas
//
// https://html.spec.whatwg.org/multipage/#dom-context-2d-drawimage
+ fn draw_image(&self, image: HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D,
+ sx: f64, sy: f64, sw: Option<f64>, sh: Option<f64>,
+ dx: f64, dy: f64, dw: Option<f64>, dh: Option<f64>) -> Fallible<()> {
+ match image {
+ HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D::eHTMLCanvasElement(canvas) =>
+ self.draw_html_canvas_element(canvas.r(),
+ sx, sy, sw, sh,
+ dx, dy, dw, dh),
+ HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D::eCanvasRenderingContext2D(image) => {
+ let context = image.r();
+ let canvas = context.Canvas();
+ self.draw_html_canvas_element(canvas.r(),
+ sx, sy, sw, sh,
+ dx, dy, dw, dh)
+ }
+ HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D::eHTMLImageElement(image) => {
+ let image_element = image.r();
+ // https://html.spec.whatwg.org/multipage/#img-error
+ // If the image argument is an HTMLImageElement object that is in the broken state,
+ // then throw an InvalidStateError exception
+ let (image_data, image_size) = match self.fetch_image_data(&image_element) {
+ Some((mut data, size)) => {
+ // Pixels come from cache in BGRA order and drawImage expects RGBA so we
+ // have to swap the color values
+ byte_swap(&mut data);
+ (data, size)
+ },
+ None => return Err(InvalidState),
+ };
+ let dw = dw.unwrap_or(image_size.width);
+ let dh = dh.unwrap_or(image_size.height);
+ let sw = sw.unwrap_or(image_size.width);
+ let sh = sh.unwrap_or(image_size.height);
+ self.draw_image_data(image_data,
+ image_size,
+ sx, sy, sw, sh,
+ dx, dy, dw, dh)
+ }
+ }
+ }
+
fn draw_html_canvas_element(&self,
canvas: &HTMLCanvasElement,
- sx: f64, sy: f64, sw: f64, sh: f64,
- dx: f64, dy: f64, dw: f64, dh: f64) -> Fallible<()> {
+ sx: f64, sy: f64, sw: Option<f64>, sh: Option<f64>,
+ dx: f64, dy: f64, dw: Option<f64>, dh: Option<f64>) -> Fallible<()> {
// 1. Check the usability of the image argument
if !canvas.is_valid() {
return Err(InvalidState)
}
let canvas_size = canvas.get_size();
+ let dw = dw.unwrap_or(canvas_size.width as f64);
+ let dh = dh.unwrap_or(canvas_size.height as f64);
+ let sw = sw.unwrap_or(canvas_size.width as f64);
+ let sh = sh.unwrap_or(canvas_size.height as f64);
+
let image_size = Size2D::new(canvas_size.width as f64, canvas_size.height as f64);
// 2. Establish the source and destination rectangles
let (source_rect, dest_rect) = self.adjust_source_dest_rects(image_size, sx, sy, sw, sh, dx, dy, dw, dh);
@@ -598,61 +644,7 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
return Ok(());
}
- // From rules described in the spec:
- // If the sx, sy, sw, and sh arguments are omitted, they must default to 0, 0,
- // the image's intrinsic width in image pixels,
- // and the image's intrinsic height in image pixels, respectively
- let sx: f64 = 0f64;
- let sy: f64 = 0f64;
-
- match image {
- HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D::eHTMLCanvasElement(canvas) => {
- let canvas_size = canvas.r().get_size();
- let dw: f64 = canvas_size.width as f64;
- let dh: f64 = canvas_size.height as f64;
- let sw: f64 = dw;
- let sh: f64 = dh;
- return self.draw_html_canvas_element(canvas.r(),
- sx, sy, sw, sh,
- dx, dy, dw, dh)
- }
- HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D::eCanvasRenderingContext2D(image) => {
- let context = image.r();
- let canvas = context.Canvas();
- let canvas_size = canvas.r().get_size();
- let dw: f64 = canvas_size.width as f64;
- let dh: f64 = canvas_size.height as f64;
- let sw: f64 = dw;
- let sh: f64 = dh;
- return self.draw_html_canvas_element(canvas.r(),
- sx, sy, sw, sh,
- dx, dy, dw, dh)
- }
- HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D::eHTMLImageElement(image) => {
- let image_element = image.r();
- // https://html.spec.whatwg.org/multipage/#img-error
- // If the image argument is an HTMLImageElement object that is in the broken state,
- // then throw an InvalidStateError exception
- let (image_data, image_size) = match self.fetch_image_data(&image_element) {
- Some((mut data, size)) => {
- // Pixels come from cache in BGRA order and drawImage expects RGBA so we
- // have to swap the color values
- byte_swap(&mut data);
- (data, size)
- },
- None => return Err(InvalidState),
- };
- let dw: f64 = image_size.width as f64;
- let dh: f64 = image_size.height as f64;
- let sw: f64 = dw;
- let sh: f64 = dh;
- return self.draw_image_data(image_data,
- image_size,
- sx, sy, sw, sh,
- dx, dy, dw, dh)
- }
-
- }
+ self.draw_image(image, 0f64, 0f64, None, None, dx, dy, None, None)
}
// https://html.spec.whatwg.org/multipage/#dom-context-2d-drawimage
@@ -663,98 +655,19 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
return Ok(());
}
- // From rules described in the spec:
- // If the sx, sy, sw, and sh arguments are omitted, they must default to 0, 0,
- // the image's intrinsic width in image pixels,
- // and the image's intrinsic height in image pixels, respectively
- let sx: f64 = 0f64;
- let sy: f64 = 0f64;
-
- match image {
- HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D::eHTMLCanvasElement(canvas) => {
- let canvas_size = canvas.r().get_size();
- let sw: f64 = canvas_size.width as f64;
- let sh: f64 = canvas_size.height as f64;
- return self.draw_html_canvas_element(canvas.r(),
- sx, sy, sw, sh,
- dx, dy, dw, dh)
- }
- HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D::eCanvasRenderingContext2D(image) => {
- let context = image.r();
- let canvas = context.Canvas();
- let canvas_size = canvas.r().get_size();
- let sw: f64 = canvas_size.width as f64;
- let sh: f64 = canvas_size.height as f64;
- return self.draw_html_canvas_element(canvas.r(),
- sx, sy, sw, sh,
- dx, dy, dw, dh)
- }
- HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D::eHTMLImageElement(image) => {
- let image_element = image.r();
- // https://html.spec.whatwg.org/multipage/#img-error
- // If the image argument is an HTMLImageElement object that is in the broken state,
- // then throw an InvalidStateError exception
- let (image_data, image_size) = match self.fetch_image_data(&image_element) {
- Some((mut data, size)) => {
- // Pixels come from cache in BGRA order and drawImage expects RGBA so we
- // have to swap the color values
- byte_swap(&mut data);
- (data, size)
- },
- None => return Err(InvalidState),
- };
- let sw: f64 = image_size.width as f64;
- let sh: f64 = image_size.height as f64;
- return self.draw_image_data(image_data,
- image_size,
- sx, sy, sw, sh,
- dx, dy, dw, dh)
- }
- }
+ self.draw_image(image, 0f64, 0f64, None, None, dx, dy, Some(dw), Some(dh))
}
// https://html.spec.whatwg.org/multipage/#dom-context-2d-drawimage
fn DrawImage__(self, image: HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D,
- sx: f64, sy: f64, sw: f64, sh: f64,
- dx: f64, dy: f64, dw: f64, dh: f64) -> Fallible<()> {
+ sx: f64, sy: f64, sw: f64, sh: f64,
+ dx: f64, dy: f64, dw: f64, dh: f64) -> Fallible<()> {
if !(sx.is_finite() && sy.is_finite() && sw.is_finite() && sh.is_finite() &&
dx.is_finite() && dy.is_finite() && dw.is_finite() && dh.is_finite()) {
return Ok(());
}
- match image {
- HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D::eHTMLCanvasElement(image) => {
- return self.draw_html_canvas_element(image.r(),
- sx, sy, sw, sh,
- dx, dy, dw, dh)
- }
- HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D::eCanvasRenderingContext2D(image) => {
- let context = image.r();
- let canvas = context.Canvas();
- return self.draw_html_canvas_element(canvas.r(),
- sx, sy, sw, sh,
- dx, dy, dw, dh)
- }
- HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D::eHTMLImageElement(image) => {
- let image_element = image.r();
- // https://html.spec.whatwg.org/multipage/#img-error
- // If the image argument is an HTMLImageElement object that is in the broken state,
- // then throw an InvalidStateError exception
- let (image_data, image_size) = match self.fetch_image_data(&image_element) {
- Some((mut data, size)) => {
- // Pixels come from cache in BGRA order and drawImage expects RGBA so we
- // have to swap the color values
- byte_swap(&mut data);
- (data, size)
- },
- None => return Err(InvalidState),
- };
- return self.draw_image_data(image_data,
- image_size,
- sx, sy, sw, sh,
- dx, dy, dw, dh)
- }
- }
+ self.draw_image(image, sx, sy, Some(sw), Some(sh), dx, dy, Some(dw), Some(dh))
}
// https://html.spec.whatwg.org/multipage/#dom-context-2d-moveto
@@ -988,7 +901,18 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
self.ipc_renderer
.send(CanvasMsg::Canvas2d(Canvas2dMsg::GetImageData(dest_rect, canvas_size, sender)))
.unwrap();
- let data = receiver.recv().unwrap();
+ let mut data = receiver.recv().unwrap();
+
+ // Un-premultiply alpha
+ // TODO: may want a precomputed un-premultiply table to make this fast.
+ // https://github.com/servo/servo/issues/6969
+ for chunk in data.chunks_mut(4) {
+ let alpha = chunk[3] as f32 / 255.;
+ chunk[0] = (chunk[0] as f32 / alpha) as u8;
+ chunk[1] = (chunk[1] as f32 / alpha) as u8;
+ chunk[2] = (chunk[2] as f32 / alpha) as u8;
+ }
+
Ok(ImageData::new(self.global.root().r(), sw.abs().to_u32().unwrap(), sh.abs().to_u32().unwrap(), Some(data)))
}
diff --git a/components/script/dom/filereader.rs b/components/script/dom/filereader.rs
index 76394a32600..2e0cec633ed 100644
--- a/components/script/dom/filereader.rs
+++ b/components/script/dom/filereader.rs
@@ -423,11 +423,6 @@ fn perform_annotated_read_operation(gen_id: GenerationId, data: ReadMetaData, bl
}
};
- let blobtype = data.blobtype.clone();
- let label = data.label.clone();
-
- let read_meta_data = ReadMetaData::new(blobtype, label, data.function);
-
- let task = box FileReaderEvent::ProcessReadEOF(filereader, gen_id, read_meta_data, bytes);
+ let task = box FileReaderEvent::ProcessReadEOF(filereader, gen_id, data, bytes);
chan.send(ScriptMsg::RunnableMsg(task)).unwrap();
}
diff --git a/components/script/dom/macros.rs b/components/script/dom/macros.rs
index 6b19d3f99c0..74fae719db5 100644
--- a/components/script/dom/macros.rs
+++ b/components/script/dom/macros.rs
@@ -275,6 +275,9 @@ macro_rules! global_event_handlers(
);
(NoOnload) => (
event_handler!(click, GetOnclick, SetOnclick);
+ event_handler!(keydown, GetOnkeydown, SetOnkeydown);
+ event_handler!(keypress, GetOnkeypress, SetOnkeypress);
+ event_handler!(keyup, GetOnkeyup, SetOnkeyup);
event_handler!(input, GetOninput, SetOninput);
event_handler!(change, GetOnchange, SetOnchange);
event_handler!(submit, GetOnsubmit, SetOnsubmit);
diff --git a/components/script/dom/webidls/EventHandler.webidl b/components/script/dom/webidls/EventHandler.webidl
index ea388daad92..c1a210a06e0 100644
--- a/components/script/dom/webidls/EventHandler.webidl
+++ b/components/script/dom/webidls/EventHandler.webidl
@@ -26,6 +26,9 @@ interface GlobalEventHandlers {
attribute EventHandler onclick;
attribute EventHandler onload;
attribute EventHandler oninput;
+ attribute EventHandler onkeydown;
+ attribute EventHandler onkeypress;
+ attribute EventHandler onkeyup;
attribute EventHandler onchange;
attribute EventHandler onsubmit;
};
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index d31eb3d3527..38100d87d16 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -72,7 +72,7 @@ use std::cell::{Cell, Ref, RefMut, RefCell};
use std::collections::HashSet;
use std::default::Default;
use std::ffi::CString;
-use std::io::{stdout, Write};
+use std::io::{stdout, stderr, Write};
use std::mem as std_mem;
use std::rc::Rc;
use std::sync::Arc;
@@ -361,10 +361,15 @@ impl<'a> WindowMethods for &'a Window {
// https://html.spec.whatwg.org/#dom-alert
fn Alert(self, s: DOMString) {
// Right now, just print to the console
+ // Ensure that stderr doesn't trample through the alert() we use to
+ // communicate test results.
+ let stderr = stderr();
+ let mut stderr = stderr.lock();
let stdout = stdout();
let mut stdout = stdout.lock();
writeln!(&mut stdout, "ALERT: {}", s).unwrap();
stdout.flush().unwrap();
+ stderr.flush().unwrap();
}
// https://html.spec.whatwg.org/multipage/#dom-window-close
diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs
index eba4cc26662..1338ca49522 100644
--- a/components/script/dom/workerglobalscope.rs
+++ b/components/script/dom/workerglobalscope.rs
@@ -131,11 +131,6 @@ impl WorkerGlobalScope {
self.constellation_chan.clone()
}
- #[inline]
- pub fn eventtarget<'a>(&'a self) -> &'a EventTarget {
- &self.eventtarget
- }
-
pub fn get_cx(&self) -> *mut JSContext {
self.runtime.cx()
}
diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock
index 19e7b27de62..d5564dcc9fa 100644
--- a/components/servo/Cargo.lock
+++ b/components/servo/Cargo.lock
@@ -762,7 +762,7 @@ dependencies = [
"string_cache 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
- "unicode-bidi 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "unicode-bidi 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1",
]
@@ -1463,7 +1463,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "unicode-bidi"
-version = "0.2.0"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock
index d292fe6f558..ce462982047 100644
--- a/ports/cef/Cargo.lock
+++ b/ports/cef/Cargo.lock
@@ -760,7 +760,7 @@ dependencies = [
"string_cache 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
- "unicode-bidi 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "unicode-bidi 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1",
]
@@ -894,6 +894,8 @@ dependencies = [
"net_traits 0.0.1",
"openssl 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"png 0.1.0 (git+https://github.com/servo/rust-png)",
+ "regex 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex_macros 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1449,7 +1451,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "unicode-bidi"
-version = "0.2.0"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/ports/gonk/Cargo.lock b/ports/gonk/Cargo.lock
index 04b5e92eda8..c0bad85fbb9 100644
--- a/ports/gonk/Cargo.lock
+++ b/ports/gonk/Cargo.lock
@@ -688,7 +688,7 @@ dependencies = [
"string_cache 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
- "unicode-bidi 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "unicode-bidi 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1",
]
@@ -814,6 +814,8 @@ dependencies = [
"net_traits 0.0.1",
"openssl 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"png 0.1.0 (git+https://github.com/servo/rust-png)",
+ "regex 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex_macros 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1341,7 +1343,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "unicode-bidi"
-version = "0.2.0"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/python/tidy.py b/python/tidy.py
index 21b7c74e36c..625c3111465 100644
--- a/python/tidy.py
+++ b/python/tidy.py
@@ -153,7 +153,7 @@ def check_flake8(file_name, contents):
with stdout_redirect(output):
check_code(contents, ignore=ignore)
for error in output.getvalue().splitlines():
- _, line_num, _, message = error.split(":")
+ _, line_num, _, message = error.split(":", 3)
yield line_num, message.strip()
diff --git a/tests/ref/basic.list b/tests/ref/basic.list
index b8ec45640c5..6e6f248bbe9 100644
--- a/tests/ref/basic.list
+++ b/tests/ref/basic.list
@@ -99,6 +99,7 @@ flaky_cpu == append_style_a.html append_style_b.html
== float_under_top_margin_a.html float_under_top_margin_ref.html
== floated_generated_content_a.html floated_generated_content_b.html
== floated_list_item_a.html floated_list_item_ref.html
+== floated_negative_margins_a.html floated_negative_margins_ref.html
== floated_table_with_margin_a.html floated_table_with_margin_ref.html
== focus_selector.html focus_selector_ref.html
== font_advance.html font_advance_ref.html
diff --git a/tests/ref/floated_negative_margins_a.html b/tests/ref/floated_negative_margins_a.html
new file mode 100644
index 00000000000..49e3e9b5d6b
--- /dev/null
+++ b/tests/ref/floated_negative_margins_a.html
@@ -0,0 +1,16 @@
+<style>
+body {
+ margin: 0;
+ padding: 0;
+}
+#a {
+ float: left;
+ margin-left: -64px;
+ width: 128px;
+ height: 128px;
+ background: purple;
+}
+</style>
+<body>
+<div id=a></div>Hello
+
diff --git a/tests/ref/floated_negative_margins_ref.html b/tests/ref/floated_negative_margins_ref.html
new file mode 100644
index 00000000000..6fc5d275c6b
--- /dev/null
+++ b/tests/ref/floated_negative_margins_ref.html
@@ -0,0 +1,15 @@
+<style>
+body {
+ margin: 0;
+ padding: 0;
+}
+#a {
+ float: left;
+ width: 64px;
+ height: 128px;
+ background: purple;
+}
+</style>
+<body>
+<div id=a></div>Hello
+
diff --git a/tests/wpt/metadata-css/css21_dev/html4/counter-reset-increment-002.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/counter-reset-increment-002.htm.ini
deleted file mode 100644
index a37718f2098..00000000000
--- a/tests/wpt/metadata-css/css21_dev/html4/counter-reset-increment-002.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[counter-reset-increment-002.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css21_dev/html4/first-letter-dynamic-002.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/first-letter-dynamic-002.htm.ini
deleted file mode 100644
index 08bfcf210da..00000000000
--- a/tests/wpt/metadata-css/css21_dev/html4/first-letter-dynamic-002.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[first-letter-dynamic-002.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.copy.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.copy.html.ini
deleted file mode 100644
index 69471e48881..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.copy.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.canvas.copy.html]
- type: testharness
- [Canvas test: 2d.composite.canvas.copy]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.destination-atop.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.destination-atop.html.ini
deleted file mode 100644
index 78a31566554..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.destination-atop.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.canvas.destination-atop.html]
- type: testharness
- [Canvas test: 2d.composite.canvas.destination-atop]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.destination-in.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.destination-in.html.ini
deleted file mode 100644
index 9d21e34db4b..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.destination-in.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.canvas.destination-in.html]
- type: testharness
- [Canvas test: 2d.composite.canvas.destination-in]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.destination-out.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.destination-out.html.ini
deleted file mode 100644
index 9d5f2fb490c..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.destination-out.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.canvas.destination-out.html]
- type: testharness
- [Canvas test: 2d.composite.canvas.destination-out]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.destination-over.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.destination-over.html.ini
deleted file mode 100644
index 8277c5a8dcd..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.destination-over.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.canvas.destination-over.html]
- type: testharness
- [Canvas test: 2d.composite.canvas.destination-over]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.source-atop.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.source-atop.html.ini
deleted file mode 100644
index 83960b07b77..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.source-atop.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.canvas.source-atop.html]
- type: testharness
- [Canvas test: 2d.composite.canvas.source-atop]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.source-in.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.source-in.html.ini
deleted file mode 100644
index bfd57a3886b..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.source-in.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.canvas.source-in.html]
- type: testharness
- [Canvas test: 2d.composite.canvas.source-in]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.source-out.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.source-out.html.ini
deleted file mode 100644
index 8c919587d15..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.source-out.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.canvas.source-out.html]
- type: testharness
- [Canvas test: 2d.composite.canvas.source-out]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.source-over.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.source-over.html.ini
deleted file mode 100644
index d1af3381578..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.source-over.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.canvas.source-over.html]
- type: testharness
- [Canvas test: 2d.composite.canvas.source-over]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.xor.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.xor.html.ini
deleted file mode 100644
index d37ecc0011f..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.canvas.xor.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.canvas.xor.html]
- type: testharness
- [Canvas test: 2d.composite.canvas.xor]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.copy.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.copy.html.ini
deleted file mode 100644
index 1ca75fe16c2..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.copy.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.image.copy.html]
- type: testharness
- [Canvas test: 2d.composite.image.copy]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.destination-atop.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.destination-atop.html.ini
deleted file mode 100644
index 99a7be01aa0..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.destination-atop.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.image.destination-atop.html]
- type: testharness
- [Canvas test: 2d.composite.image.destination-atop]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.destination-in.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.destination-in.html.ini
deleted file mode 100644
index ad3d8dccc7e..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.destination-in.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.image.destination-in.html]
- type: testharness
- [Canvas test: 2d.composite.image.destination-in]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.destination-out.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.destination-out.html.ini
deleted file mode 100644
index 98625ab9687..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.destination-out.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.image.destination-out.html]
- type: testharness
- [Canvas test: 2d.composite.image.destination-out]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.destination-over.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.destination-over.html.ini
deleted file mode 100644
index fb8ad3107a8..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.destination-over.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.image.destination-over.html]
- type: testharness
- [Canvas test: 2d.composite.image.destination-over]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.source-atop.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.source-atop.html.ini
deleted file mode 100644
index fc886edca68..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.source-atop.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.image.source-atop.html]
- type: testharness
- [Canvas test: 2d.composite.image.source-atop]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.source-in.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.source-in.html.ini
deleted file mode 100644
index 334346dd9ba..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.source-in.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.image.source-in.html]
- type: testharness
- [Canvas test: 2d.composite.image.source-in]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.source-out.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.source-out.html.ini
deleted file mode 100644
index f6ccbf762a0..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.source-out.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.image.source-out.html]
- type: testharness
- [Canvas test: 2d.composite.image.source-out]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.source-over.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.source-over.html.ini
deleted file mode 100644
index 8bdfd76aeaf..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.source-over.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.image.source-over.html]
- type: testharness
- [Canvas test: 2d.composite.image.source-over]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.xor.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.xor.html.ini
deleted file mode 100644
index 6e50bc40a55..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.image.xor.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.image.xor.html]
- type: testharness
- [Canvas test: 2d.composite.image.xor]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.copy.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.copy.html.ini
deleted file mode 100644
index 9c314a870aa..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.copy.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.transparent.copy.html]
- type: testharness
- [Canvas test: 2d.composite.transparent.copy]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.destination-atop.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.destination-atop.html.ini
deleted file mode 100644
index a58fe90d76c..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.destination-atop.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.transparent.destination-atop.html]
- type: testharness
- [Canvas test: 2d.composite.transparent.destination-atop]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.destination-in.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.destination-in.html.ini
deleted file mode 100644
index b535e9cc525..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.destination-in.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.transparent.destination-in.html]
- type: testharness
- [Canvas test: 2d.composite.transparent.destination-in]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.destination-out.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.destination-out.html.ini
deleted file mode 100644
index c425dd8a7d1..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.destination-out.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.transparent.destination-out.html]
- type: testharness
- [Canvas test: 2d.composite.transparent.destination-out]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.destination-over.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.destination-over.html.ini
deleted file mode 100644
index c0178e7ff5b..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.destination-over.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.transparent.destination-over.html]
- type: testharness
- [Canvas test: 2d.composite.transparent.destination-over]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.source-atop.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.source-atop.html.ini
deleted file mode 100644
index 3b4e72a198e..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.source-atop.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.transparent.source-atop.html]
- type: testharness
- [Canvas test: 2d.composite.transparent.source-atop]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.source-in.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.source-in.html.ini
deleted file mode 100644
index 8b7fb3f6e95..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.source-in.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.transparent.source-in.html]
- type: testharness
- [Canvas test: 2d.composite.transparent.source-in]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.source-out.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.source-out.html.ini
deleted file mode 100644
index 6686231c07f..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.source-out.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.transparent.source-out.html]
- type: testharness
- [Canvas test: 2d.composite.transparent.source-out]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.source-over.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.source-over.html.ini
deleted file mode 100644
index c5732728b2c..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.source-over.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.transparent.source-over.html]
- type: testharness
- [Canvas test: 2d.composite.transparent.source-over]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.xor.html.ini b/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.xor.html.ini
deleted file mode 100644
index f0b3f066424..00000000000
--- a/tests/wpt/metadata/2dcontext/compositing/2d.composite.transparent.xor.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.composite.transparent.xor.html]
- type: testharness
- [Canvas test: 2d.composite.transparent.xor]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/fill-and-stroke-styles/2d.fillStyle.parse.hsla-1.html.ini b/tests/wpt/metadata/2dcontext/fill-and-stroke-styles/2d.fillStyle.parse.hsla-1.html.ini
deleted file mode 100644
index eaa3aab2432..00000000000
--- a/tests/wpt/metadata/2dcontext/fill-and-stroke-styles/2d.fillStyle.parse.hsla-1.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.fillStyle.parse.hsla-1.html]
- type: testharness
- [Canvas test: 2d.fillStyle.parse.hsla-1]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/fill-and-stroke-styles/2d.fillStyle.parse.rgba-num-1.html.ini b/tests/wpt/metadata/2dcontext/fill-and-stroke-styles/2d.fillStyle.parse.rgba-num-1.html.ini
deleted file mode 100644
index e625f8b7e07..00000000000
--- a/tests/wpt/metadata/2dcontext/fill-and-stroke-styles/2d.fillStyle.parse.rgba-num-1.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.fillStyle.parse.rgba-num-1.html]
- type: testharness
- [Canvas test: 2d.fillStyle.parse.rgba-num-1]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/fill-and-stroke-styles/2d.fillStyle.parse.rgba-num-2.html.ini b/tests/wpt/metadata/2dcontext/fill-and-stroke-styles/2d.fillStyle.parse.rgba-num-2.html.ini
deleted file mode 100644
index 48ebdde1034..00000000000
--- a/tests/wpt/metadata/2dcontext/fill-and-stroke-styles/2d.fillStyle.parse.rgba-num-2.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.fillStyle.parse.rgba-num-2.html]
- type: testharness
- [Canvas test: 2d.fillStyle.parse.rgba-num-2]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/fill-and-stroke-styles/2d.fillStyle.parse.rgba-percent.html.ini b/tests/wpt/metadata/2dcontext/fill-and-stroke-styles/2d.fillStyle.parse.rgba-percent.html.ini
deleted file mode 100644
index 309fc2dede9..00000000000
--- a/tests/wpt/metadata/2dcontext/fill-and-stroke-styles/2d.fillStyle.parse.rgba-percent.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.fillStyle.parse.rgba-percent.html]
- type: testharness
- [Canvas test: 2d.fillStyle.parse.rgba-percent]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/fill-and-stroke-styles/2d.gradient.interpolate.colouralpha.html.ini b/tests/wpt/metadata/2dcontext/fill-and-stroke-styles/2d.gradient.interpolate.colouralpha.html.ini
deleted file mode 100644
index c0a89137a37..00000000000
--- a/tests/wpt/metadata/2dcontext/fill-and-stroke-styles/2d.gradient.interpolate.colouralpha.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.gradient.interpolate.colouralpha.html]
- type: testharness
- [Canvas test: 2d.gradient.interpolate.colouralpha]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/2dcontext/pixel-manipulation/2d.imageData.get.nonpremul.html.ini b/tests/wpt/metadata/2dcontext/pixel-manipulation/2d.imageData.get.nonpremul.html.ini
deleted file mode 100644
index 9a25dae1b16..00000000000
--- a/tests/wpt/metadata/2dcontext/pixel-manipulation/2d.imageData.get.nonpremul.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[2d.imageData.get.nonpremul.html]
- type: testharness
- [getImageData() returns non-premultiplied colours]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/html/dom/interfaces.html.ini b/tests/wpt/metadata/html/dom/interfaces.html.ini
index d000553cacc..3fd0ad22507 100644
--- a/tests/wpt/metadata/html/dom/interfaces.html.ini
+++ b/tests/wpt/metadata/html/dom/interfaces.html.ini
@@ -156,15 +156,6 @@
[Document interface: attribute oninvalid]
expected: FAIL
- [Document interface: attribute onkeydown]
- expected: FAIL
-
- [Document interface: attribute onkeypress]
- expected: FAIL
-
- [Document interface: attribute onkeyup]
- expected: FAIL
-
[Document interface: attribute onloadeddata]
expected: FAIL
@@ -1254,15 +1245,6 @@
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "oninvalid" with the proper type (120)]
expected: FAIL
- [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onkeydown" with the proper type (121)]
- expected: FAIL
-
- [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onkeypress" with the proper type (122)]
- expected: FAIL
-
- [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onkeyup" with the proper type (123)]
- expected: FAIL
-
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "onloadeddata" with the proper type (125)]
expected: FAIL
@@ -1773,15 +1755,6 @@
[HTMLElement interface: attribute oninvalid]
expected: FAIL
- [HTMLElement interface: attribute onkeydown]
- expected: FAIL
-
- [HTMLElement interface: attribute onkeypress]
- expected: FAIL
-
- [HTMLElement interface: attribute onkeyup]
- expected: FAIL
-
[HTMLElement interface: attribute onloadeddata]
expected: FAIL
@@ -2022,15 +1995,6 @@
[HTMLElement interface: document.createElement("noscript") must inherit property "oninvalid" with the proper type (59)]
expected: FAIL
- [HTMLElement interface: document.createElement("noscript") must inherit property "onkeydown" with the proper type (60)]
- expected: FAIL
-
- [HTMLElement interface: document.createElement("noscript") must inherit property "onkeypress" with the proper type (61)]
- expected: FAIL
-
- [HTMLElement interface: document.createElement("noscript") must inherit property "onkeyup" with the proper type (62)]
- expected: FAIL
-
[HTMLElement interface: document.createElement("noscript") must inherit property "onloadeddata" with the proper type (64)]
expected: FAIL