mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
auto merge of #5400 : pcwalton/servo/transitions-redux, r=glennw
Transition events are not yet supported, and the only animatable properties are `top`, `right`, `bottom`, and `left`. However, all other features of transitions are supported. There are no automated tests at present because I'm not sure how best to test it, but three manual tests are included. r? @glennw
This commit is contained in:
commit
ebdf1d494b
31 changed files with 1603 additions and 224 deletions
|
@ -186,4 +186,10 @@ partial interface CSSStyleDeclaration {
|
|||
[TreatNullAs=EmptyString] attribute DOMString zIndex;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString imageRendering;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString transition;
|
||||
[TreatNullAs=EmptyString] attribute DOMString transitionDuration;
|
||||
[TreatNullAs=EmptyString] attribute DOMString transitionTimingFunction;
|
||||
[TreatNullAs=EmptyString] attribute DOMString transitionProperty;
|
||||
[TreatNullAs=EmptyString] attribute DOMString transitionDelay;
|
||||
};
|
||||
|
|
|
@ -27,7 +27,7 @@ use dom::performance::Performance;
|
|||
use dom::screen::Screen;
|
||||
use dom::storage::Storage;
|
||||
use layout_interface::{ReflowGoal, ReflowQueryType, LayoutRPC, LayoutChan, Reflow, Msg};
|
||||
use layout_interface::{ContentBoxResponse, ContentBoxesResponse};
|
||||
use layout_interface::{ContentBoxResponse, ContentBoxesResponse, ScriptReflow};
|
||||
use page::Page;
|
||||
use script_task::{TimerSource, ScriptChan};
|
||||
use script_task::ScriptMsg;
|
||||
|
@ -564,17 +564,19 @@ impl<'a> WindowHelpers for JSRef<'a, Window> {
|
|||
}
|
||||
|
||||
// Send new document and relevant styles to layout.
|
||||
let reflow = box Reflow {
|
||||
let reflow = box ScriptReflow {
|
||||
reflow_info: Reflow {
|
||||
goal: goal,
|
||||
url: self.get_url(),
|
||||
iframe: self.parent_info.is_some(),
|
||||
page_clip_rect: self.page_clip_rect.get(),
|
||||
},
|
||||
document_root: root.to_trusted_node_address(),
|
||||
url: self.get_url(),
|
||||
iframe: self.parent_info.is_some(),
|
||||
goal: goal,
|
||||
window_size: window_size,
|
||||
script_chan: self.control_chan.clone(),
|
||||
script_join_chan: join_chan,
|
||||
id: last_reflow_id.get(),
|
||||
query_type: query_type,
|
||||
page_clip_rect: self.page_clip_rect.get(),
|
||||
};
|
||||
|
||||
let LayoutChan(ref chan) = self.layout_chan;
|
||||
|
|
|
@ -10,14 +10,16 @@ use dom::node::LayoutData;
|
|||
|
||||
use geom::point::Point2D;
|
||||
use geom::rect::Rect;
|
||||
use libc::uintptr_t;
|
||||
use msg::constellation_msg::{PipelineExitType, WindowSizeData};
|
||||
use profile::mem::{Reporter, ReportsChan};
|
||||
use script_traits::{ScriptControlChan, OpaqueScriptLayoutChannel, UntrustedNodeAddress};
|
||||
use std::any::Any;
|
||||
use std::sync::mpsc::{channel, Receiver, Sender};
|
||||
use std::boxed::BoxAny;
|
||||
use style::stylesheets::Stylesheet;
|
||||
use style::animation::PropertyAnimation;
|
||||
use style::media_queries::MediaQueryList;
|
||||
use style::stylesheets::Stylesheet;
|
||||
use url::Url;
|
||||
use util::geometry::Au;
|
||||
|
||||
|
@ -35,11 +37,14 @@ pub enum Msg {
|
|||
SetQuirksMode,
|
||||
|
||||
/// Requests a reflow.
|
||||
Reflow(Box<Reflow>),
|
||||
Reflow(Box<ScriptReflow>),
|
||||
|
||||
/// Get an RPC interface.
|
||||
GetRPC(Sender<Box<LayoutRPC + Send>>),
|
||||
|
||||
/// Requests that the layout task render the next frame of all animations.
|
||||
TickAnimations,
|
||||
|
||||
/// Destroys layout data associated with a DOM node.
|
||||
///
|
||||
/// TODO(pcwalton): Maybe think about batching to avoid message traffic.
|
||||
|
@ -100,14 +105,22 @@ pub enum ReflowQueryType {
|
|||
|
||||
/// Information needed for a reflow.
|
||||
pub struct Reflow {
|
||||
/// The document node.
|
||||
pub document_root: TrustedNodeAddress,
|
||||
/// The goal of reflow: either to render to the screen or to flush layout info for script.
|
||||
pub goal: ReflowGoal,
|
||||
/// The URL of the page.
|
||||
pub url: Url,
|
||||
/// Is the current reflow of an iframe, as opposed to a root window?
|
||||
pub iframe: bool,
|
||||
/// A clipping rectangle for the page, an enlarged rectangle containing the viewport.
|
||||
pub page_clip_rect: Rect<Au>,
|
||||
}
|
||||
|
||||
/// Information needed for a script-initiated reflow.
|
||||
pub struct ScriptReflow {
|
||||
/// General reflow data.
|
||||
pub reflow_info: Reflow,
|
||||
/// The document node.
|
||||
pub document_root: TrustedNodeAddress,
|
||||
/// The channel through which messages can be sent back to the script task.
|
||||
pub script_chan: ScriptControlChan,
|
||||
/// The current window size.
|
||||
|
@ -118,8 +131,6 @@ pub struct Reflow {
|
|||
pub id: u32,
|
||||
/// The type of query if any to perform during this reflow.
|
||||
pub query_type: ReflowQueryType,
|
||||
/// A clipping rectangle for the page, an enlarged rectangle containing the viewport.
|
||||
pub page_clip_rect: Rect<Au>,
|
||||
}
|
||||
|
||||
/// Encapsulates a channel to the layout task.
|
||||
|
@ -165,3 +176,28 @@ impl ScriptLayoutChan for OpaqueScriptLayoutChannel {
|
|||
*receiver.downcast::<Receiver<Msg>>().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
/// Type of an opaque node.
|
||||
pub type OpaqueNode = uintptr_t;
|
||||
|
||||
/// State relating to an animation.
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct Animation {
|
||||
/// An opaque reference to the DOM node participating in the animation.
|
||||
pub node: OpaqueNode,
|
||||
/// A description of the property animation that is occurring.
|
||||
pub property_animation: PropertyAnimation,
|
||||
/// The start time of the animation, as returned by `time::precise_time_s()`.
|
||||
pub start_time: f64,
|
||||
/// The end time of the animation, as returned by `time::precise_time_s()`.
|
||||
pub end_time: f64,
|
||||
}
|
||||
|
||||
impl Animation {
|
||||
/// Returns the duration of this animation in seconds.
|
||||
#[inline]
|
||||
pub fn duration(&self) -> f64 {
|
||||
self.end_time - self.start_time
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue