Auto merge of #17726 - paulrouget:rm_WindowNavigateMsg, r=jdm

Remove WindowNavigateMsg

Two reasons:

- We want to be able to jump further in history from the embedder.
- We don't want to have an extra translation step in the compositor, where `WindowNavigateMsg` is translated to `TraversalDirection`

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17726)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-07-14 07:16:18 -07:00 committed by GitHub
commit 2913d65b75
4 changed files with 16 additions and 25 deletions

View file

@ -8,13 +8,14 @@ use frame::{ServoCefFrame, ServoCefFrameExtensions};
use interfaces::{CefBrowser, CefBrowserHost, CefClient, CefFrame, CefRequestContext};
use interfaces::{cef_browser_t, cef_browser_host_t, cef_client_t, cef_frame_t};
use interfaces::{cef_request_context_t};
use msg::constellation_msg::TraversalDirection;
use servo::Browser;
use servo::servo_url::ServoUrl;
use types::{cef_browser_settings_t, cef_string_t, cef_window_info_t, cef_window_handle_t};
use window;
use wrappers::CefWrap;
use compositing::windowing::{WindowNavigateMsg, WindowEvent};
use compositing::windowing::WindowEvent;
use glutin_app;
use libc::c_int;
use std::cell::{Cell, RefCell};
@ -69,11 +70,11 @@ cef_class_impl! {
}}
fn go_back(&this,) -> () {{
this.send_window_event(WindowEvent::Navigation(WindowNavigateMsg::Back));
this.send_window_event(WindowEvent::Navigation(TraversalDirection::Back(1)));
}}
fn go_forward(&this,) -> () {{
this.send_window_event(WindowEvent::Navigation(WindowNavigateMsg::Forward));
this.send_window_event(WindowEvent::Navigation(TraversalDirection::Forward(1)));
}}
// Returns the main (top-level) frame for the browser window.

View file

@ -6,7 +6,7 @@
use NestedEventLoopListener;
use compositing::compositor_thread::EventLoopWaker;
use compositing::windowing::{AnimationState, MouseWindowEvent, WindowNavigateMsg};
use compositing::windowing::{AnimationState, MouseWindowEvent};
use compositing::windowing::{WindowEvent, WindowMethods};
use euclid::{Point2D, Size2D, TypedPoint2D, TypedVector2D, TypedRect, ScaleFactor, TypedSize2D};
#[cfg(target_os = "windows")]
@ -20,7 +20,7 @@ use glutin::TouchPhase;
#[cfg(target_os = "macos")]
use glutin::os::macos::{ActivationPolicy, WindowBuilderExt};
use msg::constellation_msg::{self, Key};
use msg::constellation_msg::{ALT, CONTROL, KeyState, NONE, SHIFT, SUPER};
use msg::constellation_msg::{ALT, CONTROL, KeyState, NONE, SHIFT, SUPER, TraversalDirection};
use net_traits::net_error_list::NetError;
#[cfg(any(target_os = "linux", target_os = "macos"))]
use osmesa_sys;
@ -930,10 +930,10 @@ impl Window {
fn platform_handle_key(&self, key: Key, mods: constellation_msg::KeyModifiers) {
match (mods, key) {
(CMD_OR_CONTROL, Key::LeftBracket) => {
self.event_queue.borrow_mut().push(WindowEvent::Navigation(WindowNavigateMsg::Back));
self.event_queue.borrow_mut().push(WindowEvent::Navigation(TraversalDirection::Back(1)));
}
(CMD_OR_CONTROL, Key::RightBracket) => {
self.event_queue.borrow_mut().push(WindowEvent::Navigation(WindowNavigateMsg::Forward));
self.event_queue.borrow_mut().push(WindowEvent::Navigation(TraversalDirection::Forward(1)));
}
_ => {}
}
@ -1220,10 +1220,10 @@ impl WindowMethods for Window {
}
(NONE, None, Key::NavigateForward) => {
self.event_queue.borrow_mut().push(WindowEvent::Navigation(WindowNavigateMsg::Forward));
self.event_queue.borrow_mut().push(WindowEvent::Navigation(TraversalDirection::Forward(1)));
}
(NONE, None, Key::NavigateBackward) => {
self.event_queue.borrow_mut().push(WindowEvent::Navigation(WindowNavigateMsg::Back));
self.event_queue.borrow_mut().push(WindowEvent::Navigation(TraversalDirection::Back(1)));
}
(NONE, None, Key::Escape) => {
@ -1233,10 +1233,10 @@ impl WindowMethods for Window {
}
(CMD_OR_ALT, None, Key::Right) => {
self.event_queue.borrow_mut().push(WindowEvent::Navigation(WindowNavigateMsg::Forward));
self.event_queue.borrow_mut().push(WindowEvent::Navigation(TraversalDirection::Forward(1)));
}
(CMD_OR_ALT, None, Key::Left) => {
self.event_queue.borrow_mut().push(WindowEvent::Navigation(WindowNavigateMsg::Back));
self.event_queue.borrow_mut().push(WindowEvent::Navigation(TraversalDirection::Back(1)));
}
(NONE, None, Key::PageDown) => {