Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

History API #11220

Closed
wants to merge 10 commits into from
Next

Implement history API

window ref

push state

forward nav

more history api work

Added popstate event usage

more stuff

Added delta to NavigationDirection enum variants

Added history length and full delta nav

Added constellation - script communication for active history entry

Quick fixes to finish of proof of concept

Switched to use StructuredCloneData when possible

Use Heap<JS> instead of MutHeapJSVal

pushState and replaceState should be marked as Throw

Added FrameEntry

added interleaved session history

Cleanup

tidy fixes

cleaned up

clear forward browsing context session history

updated test expectations

enabled history interface tests

Added popstate event handler
fixed forward history not being cleared

Fix conditions on when popstate should be fired

push/replace state url handling

remove changing of hash as it causes a page reload

Updated test expectations

Added active document check
  • Loading branch information
cbrewster committed May 28, 2016
commit fe91d54d6a813e85cab663bfe65b1aef804d86d3
@@ -1784,10 +1784,10 @@ impl<Window: WindowMethods> IOCompositor<Window> {

fn on_navigation_window_event(&self, direction: WindowNavigateMsg) {
let direction = match direction {
windowing::WindowNavigateMsg::Forward => NavigationDirection::Forward,
windowing::WindowNavigateMsg::Back => NavigationDirection::Back,
windowing::WindowNavigateMsg::Forward => NavigationDirection::Forward(1),
windowing::WindowNavigateMsg::Back => NavigationDirection::Back(1),
};
let msg = ConstellationMsg::Navigate(None, direction);
let msg = ConstellationMsg::Navigate(direction);
if let Err(e) = self.constellation_chan.send(msg) {
warn!("Sending navigation to constellation failed ({}).", e);
}
@@ -42,7 +42,9 @@ use euclid::size::TypedSize2D;
use gfx::paint_thread::ChromeToPaintMsg;
use ipc_channel::ipc::IpcSender;
use layout_traits::LayoutControlChan;
use msg::constellation_msg::PipelineId;
use msg::constellation_msg::{FrameId, Key, KeyState, KeyModifiers, LoadData};
use msg::constellation_msg::{NavigationDirection, PipelineId};
use msg::constellation_msg::{WebDriverCommandMsg, WindowSizeData, WindowSizeType};
use script_traits::ConstellationControlMsg;
use std::sync::mpsc::Sender;
use util::geometry::PagePx;
@@ -55,6 +57,41 @@ mod surface_map;
mod touch;
pub mod windowing;

/// Specifies whether the script or layout thread needs to be ticked for animation.
#[derive(Deserialize, Serialize)]
pub enum AnimationTickType {
Script,
Layout,
}

/// Messages from the compositor to the constellation.
#[derive(Deserialize, Serialize)]
pub enum CompositorMsg {
Exit,
FrameSize(PipelineId, Size2D<f32>),
/// Request that the constellation send the FrameId corresponding to the document
/// with the provided pipeline id
GetFrame(PipelineId, IpcSender<Option<FrameId>>),
/// Request that the constellation send the current pipeline id for the provided frame
/// id, or for the root frame if this is None, over a provided channel.
/// Also returns a boolean saying whether the document has finished loading or not.
GetPipeline(Option<FrameId>, IpcSender<Option<(PipelineId, bool)>>),
/// Requests that the constellation inform the compositor of the title of the pipeline
/// immediately.
GetPipelineTitle(PipelineId),
InitLoadUrl(Url),
/// Query the constellation to see if the current compositor output is stable
IsReadyToSaveImage(HashMap<PipelineId, Epoch>),
KeyEvent(Key, KeyState, KeyModifiers),
LoadUrl(PipelineId, LoadData),
Navigate(NavigationDirection),
WindowSize(WindowSizeData, WindowSizeType),
/// Requests that the constellation instruct layout to begin a new tick of the animation.
TickAnimation(PipelineId, AnimationTickType),
/// Dispatch a webdriver command
WebDriverCommand(WebDriverCommandMsg),
}

pub struct SendableFrameTree {
pub pipeline: CompositionPipeline,
pub size: Option<TypedSize2D<PagePx, f32>>,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.