Skip to content

Commit e72d1a5

Browse files
committed
Implement beginnings of joint session history
Fix backward navigation make use of history iterator Add frame iterator add different back logic cleanup navigation_info Add extra explanation for iter logic Remove forward history on full frame tree Rename navigation to traversal where appropriate check full tree for can go back/forward simplify frame iter logic remove FrameIterator cleanup history iter reduce amount of vec allocations removed extra parenthesis Remove history iterator cleanup after rebasing avoid recursive vec allocation remove full_frame_tree remove_forward_history_in_frame_tree -> clear_joint_session_future
1 parent 4ae0897 commit e72d1a5

File tree

7 files changed

+329
-203
lines changed

7 files changed

+329
-203
lines changed

components/compositing/compositor.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use layers::rendergl;
2929
use layers::rendergl::RenderContext;
3030
use layers::scene::Scene;
3131
use msg::constellation_msg::{Image, PixelFormat, Key, KeyModifiers, KeyState};
32-
use msg::constellation_msg::{LoadData, NavigationDirection, PipelineId};
32+
use msg::constellation_msg::{LoadData, TraversalDirection, PipelineId};
3333
use msg::constellation_msg::{PipelineIndex, PipelineNamespaceId, WindowSizeType};
3434
use profile_traits::mem::{self, ReportKind, Reporter, ReporterRequest};
3535
use profile_traits::time::{self, ProfilerCategory, profile};
@@ -1862,10 +1862,10 @@ impl<Window: WindowMethods> IOCompositor<Window> {
18621862

18631863
fn on_navigation_window_event(&self, direction: WindowNavigateMsg) {
18641864
let direction = match direction {
1865-
windowing::WindowNavigateMsg::Forward => NavigationDirection::Forward(1),
1866-
windowing::WindowNavigateMsg::Back => NavigationDirection::Back(1),
1865+
windowing::WindowNavigateMsg::Forward => TraversalDirection::Forward(1),
1866+
windowing::WindowNavigateMsg::Back => TraversalDirection::Back(1),
18671867
};
1868-
let msg = ConstellationMsg::Navigate(None, direction);
1868+
let msg = ConstellationMsg::TraverseHistory(None, direction);
18691869
if let Err(e) = self.constellation_chan.send(msg) {
18701870
warn!("Sending navigation to constellation failed ({}).", e);
18711871
}

components/constellation/constellation.rs

Lines changed: 308 additions & 178 deletions
Large diffs are not rendered by default.

components/msg/constellation_msg.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,12 @@ impl LoadData {
212212
}
213213

214214
#[derive(Clone, PartialEq, Eq, Copy, Hash, Debug, Deserialize, Serialize)]
215-
pub enum NavigationDirection {
215+
pub enum TraversalDirection {
216216
Forward(usize),
217217
Back(usize),
218218
}
219219

220-
#[derive(Clone, PartialEq, Eq, Copy, Hash, Debug, Deserialize, Serialize)]
220+
#[derive(Clone, PartialEq, Eq, Copy, Hash, Debug, Deserialize, Serialize, PartialOrd, Ord)]
221221
pub struct FrameId(pub u32);
222222

223223
/// Each pipeline ID needs to be unique. However, it also needs to be possible to

components/script/dom/htmliframeelement.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use dom::window::{ReflowReason, Window};
3838
use ipc_channel::ipc;
3939
use js::jsapi::{JSAutoCompartment, JSContext, MutableHandleValue};
4040
use js::jsval::{UndefinedValue, NullValue};
41-
use msg::constellation_msg::{FrameType, LoadData, NavigationDirection, PipelineId, SubpageId};
41+
use msg::constellation_msg::{FrameType, LoadData, TraversalDirection, PipelineId, SubpageId};
4242
use net_traits::response::HttpsState;
4343
use script_layout_interface::message::ReflowQueryType;
4444
use script_traits::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed};
@@ -419,15 +419,11 @@ unsafe fn build_mozbrowser_event_detail(event: MozBrowserEvent,
419419
}
420420
}
421421

422-
423-
pub fn Navigate(iframe: &HTMLIFrameElement, direction: NavigationDirection) -> ErrorResult {
422+
pub fn Navigate(iframe: &HTMLIFrameElement, direction: TraversalDirection) -> ErrorResult {
424423
if iframe.Mozbrowser() {
425424
if iframe.upcast::<Node>().is_in_doc() {
426425
let window = window_from_node(iframe);
427-
428-
let pipeline_info = Some((window.pipeline(),
429-
iframe.subpage_id().unwrap()));
430-
let msg = ConstellationMsg::Navigate(pipeline_info, direction);
426+
let msg = ConstellationMsg::TraverseHistory(iframe.pipeline(), direction);
431427
window.constellation_chan().send(msg).unwrap();
432428
}
433429

@@ -500,12 +496,12 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement {
500496

501497
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/goBack
502498
fn GoBack(&self) -> ErrorResult {
503-
Navigate(self, NavigationDirection::Back(1))
499+
Navigate(self, TraversalDirection::Back(1))
504500
}
505501

506502
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/goForward
507503
fn GoForward(&self) -> ErrorResult {
508-
Navigate(self, NavigationDirection::Forward(1))
504+
Navigate(self, TraversalDirection::Forward(1))
509505
}
510506

511507
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/reload

components/script_traits/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ use ipc_channel::ipc::{IpcReceiver, IpcSender};
5151
use layers::geometry::DevicePixel;
5252
use libc::c_void;
5353
use msg::constellation_msg::{FrameId, FrameType, Image, Key, KeyModifiers, KeyState, LoadData};
54-
use msg::constellation_msg::{NavigationDirection, PipelineId, ReferrerPolicy};
55-
use msg::constellation_msg::{PipelineNamespaceId, SubpageId, WindowSizeType};
54+
use msg::constellation_msg::{PipelineId, PipelineNamespaceId, ReferrerPolicy};
55+
use msg::constellation_msg::{SubpageId, TraversalDirection, WindowSizeType};
5656
use net_traits::bluetooth_thread::BluetoothMethodMsg;
5757
use net_traits::image_cache_thread::ImageCacheThread;
5858
use net_traits::response::HttpsState;
@@ -621,8 +621,8 @@ pub enum ConstellationMsg {
621621
KeyEvent(Option<char>, Key, KeyState, KeyModifiers),
622622
/// Request to load a page.
623623
LoadUrl(PipelineId, LoadData),
624-
/// Request to navigate a frame.
625-
Navigate(Option<(PipelineId, SubpageId)>, NavigationDirection),
624+
/// Request to traverse the joint session history.
625+
TraverseHistory(Option<PipelineId>, TraversalDirection),
626626
/// Inform the constellation of a window being resized.
627627
WindowSize(WindowSizeData, WindowSizeType),
628628
/// Requests that the constellation instruct layout to begin a new tick of the animation.

components/script_traits/script_msg.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use euclid::size::Size2D;
1717
use gfx_traits::LayerId;
1818
use ipc_channel::ipc::IpcSender;
1919
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
20-
use msg::constellation_msg::{NavigationDirection, PipelineId, SubpageId};
20+
use msg::constellation_msg::{PipelineId, SubpageId, TraversalDirection};
2121
use net_traits::CoreResourceMsg;
2222
use offscreen_gl_context::{GLContextAttributes, GLLimits};
2323
use style_traits::cursor::Cursor;
@@ -91,8 +91,8 @@ pub enum ScriptMsg {
9191
/// Dispatch a mozbrowser event to a given iframe,
9292
/// or to the window if no subpage id is provided.
9393
MozBrowserEvent(PipelineId, Option<SubpageId>, MozBrowserEvent),
94-
/// HTMLIFrameElement Forward or Back navigation.
95-
Navigate(Option<(PipelineId, SubpageId)>, NavigationDirection),
94+
/// HTMLIFrameElement Forward or Back traversal.
95+
TraverseHistory(Option<PipelineId>, TraversalDirection),
9696
/// Favicon detected
9797
NewFavicon(Url),
9898
/// Status message to be displayed in the chrome, eg. a link URL on mouseover.

components/webdriver_server/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use image::{DynamicImage, ImageFormat, RgbImage};
3232
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
3333
use keys::keycodes_to_keys;
3434
use msg::constellation_msg::{FrameId, LoadData, PipelineId};
35-
use msg::constellation_msg::{NavigationDirection, PixelFormat};
35+
use msg::constellation_msg::{TraversalDirection, PixelFormat};
3636
use regex::Captures;
3737
use rustc_serialize::base64::{CharacterSet, Config, Newline, ToBase64};
3838
use rustc_serialize::json::{Json, ToJson};
@@ -440,12 +440,12 @@ impl Handler {
440440
}
441441

442442
fn handle_go_back(&self) -> WebDriverResult<WebDriverResponse> {
443-
self.constellation_chan.send(ConstellationMsg::Navigate(None, NavigationDirection::Back(1))).unwrap();
443+
self.constellation_chan.send(ConstellationMsg::TraverseHistory(None, TraversalDirection::Back(1))).unwrap();
444444
Ok(WebDriverResponse::Void)
445445
}
446446

447447
fn handle_go_forward(&self) -> WebDriverResult<WebDriverResponse> {
448-
self.constellation_chan.send(ConstellationMsg::Navigate(None, NavigationDirection::Forward(1))).unwrap();
448+
self.constellation_chan.send(ConstellationMsg::TraverseHistory(None, TraversalDirection::Forward(1))).unwrap();
449449
Ok(WebDriverResponse::Void)
450450
}
451451

0 commit comments

Comments
 (0)