Auto merge of #8785 - mbrubeck:fixed-hit-test, r=pcwalton

Add slow path for hit testing of iframe behind positioned content layer

Fixes browser.html blocker #8759. r? @pcwalton

This adds a slow path for cases where the compositor's layer-based hit testing is incorrect.  If the script task discovers that a mouse event should have been dispatched to an iframe, it bounces the event back to the constellation to be forwarded to the correct pipeline.

This isn't terribly slow (on the slow path, it adds one extra round-trip message between script and constellation), but if we want to optimize this better we could instead replace the compositor's layer hit testing with display list hit testing in the paint task.  This would be a more complicated change that I think we should save for a follow-up.

This only fixes mouse input for now.  A basically-identical change will be needed for touch-screen input, whether we stick with this approach or switch to the paint task.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8785)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-12-04 02:54:22 +05:30
commit bc62b5aadb
15 changed files with 100 additions and 68 deletions

View file

@ -14,8 +14,7 @@ use compositing::windowing::{WindowEvent, MouseWindowEvent};
use euclid::point::Point2D;
use euclid::size::Size2D;
use libc::{c_double, c_int};
use msg::constellation_msg::{self, KeyModifiers, KeyState};
use script_traits::MouseButton;
use msg::constellation_msg::{self, KeyModifiers, KeyState, MouseButton};
use std::cell::{Cell, RefCell};
pub struct ServoCefBrowserHost {

View file

@ -253,7 +253,7 @@ impl Window {
/// Helper function to handle a click
fn handle_mouse(&self, button: glutin::MouseButton, action: glutin::ElementState, x: i32, y: i32) {
use script_traits::MouseButton;
use msg::constellation_msg::MouseButton;
// FIXME(tkuehn): max pixel dist should be based on pixel density
let max_pixel_dist = 10f64;

1
ports/gonk/Cargo.lock generated
View file

@ -17,7 +17,6 @@ dependencies = [
"net_traits 0.0.1",
"profile 0.0.1",
"script 0.0.1",
"script_traits 0.0.1",
"servo 0.0.1",
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -18,9 +18,6 @@ path = "../../components/msg"
[dependencies.script]
path = "../../components/script"
[dependencies.script_traits]
path = "../../components/script_traits"
[dependencies.net_traits]
path = "../../components/net_traits"

View file

@ -6,7 +6,7 @@ use compositing::windowing::{WindowEvent, MouseWindowEvent};
use errno::errno;
use euclid::point::Point2D;
use libc::{c_int, c_long, time_t};
use script_traits::MouseButton;
use msg::constellation_msg::MouseButton;
use std::fs::File;
use std::io::Read;
use std::mem::{size_of, transmute, zeroed};

View file

@ -33,7 +33,6 @@ extern crate layers;
extern crate libc;
extern crate msg;
extern crate net_traits;
extern crate script_traits;
extern crate servo;
extern crate time;
extern crate url;