diff options
author | Liam Zdenek <liamzdenek@gmail.com> | 2015-02-25 06:25:20 +0900 |
---|---|---|
committer | Tetsuharu OHZEKI <saneyuki.snyk@gmail.com> | 2015-03-01 01:08:52 +0900 |
commit | 3e13dc7913e8a8d2dbaad57ea292d7673854827f (patch) | |
tree | 1e419949bb377391a35ee7e869586a004105b297 /components/script/dom | |
parent | bf60477e955ff8997b8dffd2b4e6da76ad6b3346 (diff) | |
download | servo-3e13dc7913e8a8d2dbaad57ea292d7673854827f.tar.gz servo-3e13dc7913e8a8d2dbaad57ea292d7673854827f.zip |
Click event is now a MouseEvent.
This original commit is https://github.com/servo/servo/pull/4718.
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/document.rs | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 6673d14fe9a..de2ce3a4bc4 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -435,14 +435,25 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> { let doc = window.r().Document().root(); doc.r().begin_focus_transaction(); - let event = Event::new(GlobalRef::Window(window.r()), - "click".to_owned(), - EventBubbles::Bubbles, - EventCancelable::Cancelable).root(); + // https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#event-type-click + let x = point.x as i32; + let y = point.y as i32; + let event = MouseEvent::new(window.r(), + "click".to_owned(), + true, + true, + Some(window.r()), + 0i32, + x, y, x, y, + false, false, false, false, + 0i16, + None).root(); + let event: JSRef<Event> = EventCast::from_ref(event.r()); + // https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#trusted-events - event.r().set_trusted(true); + event.set_trusted(true); // https://html.spec.whatwg.org/multipage/interaction.html#run-authentic-click-activation-steps - el.authentic_click_activation(event.r()); + el.authentic_click_activation(event); doc.r().commit_focus_transaction(); window.r().flush_layout(ReflowGoal::ForDisplay, ReflowQueryType::NoQuery); |