Move LayerKind and ScrollPolicy enums to gfx_traits

This also moves LayerId and LayerProperties to gfx_traits.

Fixes #8836.
This commit is contained in:
Brandon Fairchild 2015-12-20 19:21:51 -05:00
parent a900196b3f
commit 637afecec9
26 changed files with 150 additions and 115 deletions

View file

@ -14,7 +14,7 @@ use euclid::scale_factor::ScaleFactor;
use euclid::size::TypedSize2D; use euclid::size::TypedSize2D;
use euclid::{Matrix4, Point2D, Rect, Size2D}; use euclid::{Matrix4, Point2D, Rect, Size2D};
use gfx::paint_task::{ChromeToPaintMsg, PaintRequest}; use gfx::paint_task::{ChromeToPaintMsg, PaintRequest};
use gfx_traits::color; use gfx_traits::{color, LayerId, LayerKind, LayerProperties, ScrollPolicy};
use gleam::gl; use gleam::gl;
use gleam::gl::types::{GLint, GLsizei}; use gleam::gl::types::{GLint, GLsizei};
use image::{DynamicImage, ImageFormat, RgbImage}; use image::{DynamicImage, ImageFormat, RgbImage};
@ -27,8 +27,7 @@ use layers::rendergl;
use layers::rendergl::RenderContext; use layers::rendergl::RenderContext;
use layers::scene::Scene; use layers::scene::Scene;
use layout_traits::LayoutControlChan; use layout_traits::LayoutControlChan;
use msg::compositor_msg::{Epoch, FrameTreeId, LayerId, LayerKind}; use msg::compositor_msg::{Epoch, FrameTreeId};
use msg::compositor_msg::{LayerProperties, ScrollPolicy};
use msg::constellation_msg::{AnimationState, Image, PixelFormat}; use msg::constellation_msg::{AnimationState, Image, PixelFormat};
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData, MouseButton}; use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData, MouseButton};
use msg::constellation_msg::{NavigationDirection, PipelineId, WindowSizeData}; use msg::constellation_msg::{NavigationDirection, PipelineId, WindowSizeData};

View file

@ -8,10 +8,11 @@ use euclid::length::Length;
use euclid::point::{Point2D, TypedPoint2D}; use euclid::point::{Point2D, TypedPoint2D};
use euclid::rect::Rect; use euclid::rect::Rect;
use euclid::size::TypedSize2D; use euclid::size::TypedSize2D;
use gfx_traits::{LayerId, LayerProperties, ScrollPolicy};
use layers::color::Color; use layers::color::Color;
use layers::geometry::LayerPixel; use layers::geometry::LayerPixel;
use layers::layers::{Layer, LayerBufferSet}; use layers::layers::{Layer, LayerBufferSet};
use msg::compositor_msg::{Epoch, LayerId, LayerProperties, ScrollPolicy}; use msg::compositor_msg::Epoch;
use msg::constellation_msg::{MouseEventType, PipelineId}; use msg::constellation_msg::{MouseEventType, PipelineId};
use script_traits::CompositorEvent; use script_traits::CompositorEvent;
use script_traits::CompositorEvent::{MouseButtonEvent, MouseMoveEvent}; use script_traits::CompositorEvent::{MouseButtonEvent, MouseMoveEvent};

View file

@ -8,12 +8,12 @@ use CompositorMsg as ConstellationMsg;
use compositor; use compositor;
use euclid::point::Point2D; use euclid::point::Point2D;
use euclid::size::Size2D; use euclid::size::Size2D;
use gfx_traits::PaintListener; use gfx_traits::{LayerId, LayerProperties, PaintListener};
use headless; use headless;
use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use layers::layers::{BufferRequest, LayerBufferSet}; use layers::layers::{BufferRequest, LayerBufferSet};
use layers::platform::surface::{NativeDisplay, NativeSurface}; use layers::platform::surface::{NativeDisplay, NativeSurface};
use msg::compositor_msg::{Epoch, FrameTreeId, LayerId, LayerProperties}; use msg::compositor_msg::{Epoch, FrameTreeId};
use msg::constellation_msg::{AnimationState, PipelineId}; use msg::constellation_msg::{AnimationState, PipelineId};
use msg::constellation_msg::{Image, Key, KeyModifiers, KeyState}; use msg::constellation_msg::{Image, Key, KeyModifiers, KeyState};
use profile_traits::mem; use profile_traits::mem;

View file

@ -21,9 +21,8 @@ use display_list::optimizer::DisplayListOptimizer;
use euclid::approxeq::ApproxEq; use euclid::approxeq::ApproxEq;
use euclid::num::Zero; use euclid::num::Zero;
use euclid::{Matrix2D, Matrix4, Point2D, Rect, SideOffsets2D, Size2D}; use euclid::{Matrix2D, Matrix4, Point2D, Rect, SideOffsets2D, Size2D};
use gfx_traits::color; use gfx_traits::{color, LayerId, LayerKind, ScrollPolicy};
use libc::uintptr_t; use libc::uintptr_t;
use msg::compositor_msg::{LayerId, LayerKind, ScrollPolicy};
use msg::constellation_msg::PipelineId; use msg::constellation_msg::PipelineId;
use net_traits::image::base::Image; use net_traits::image::base::Image;
use paint_context::PaintContext; use paint_context::PaintContext;

View file

@ -26,8 +26,7 @@ use euclid::side_offsets::SideOffsets2D;
use euclid::size::Size2D; use euclid::size::Size2D;
use filters; use filters;
use font_context::FontContext; use font_context::FontContext;
use gfx_traits::color; use gfx_traits::{color, LayerKind};
use msg::compositor_msg::LayerKind;
use net_traits::image::base::{Image, PixelFormat}; use net_traits::image::base::{Image, PixelFormat};
use std::default::Default; use std::default::Default;
use std::sync::Arc; use std::sync::Arc;

View file

@ -15,11 +15,11 @@ use euclid::rect::Rect;
use euclid::size::Size2D; use euclid::size::Size2D;
use font_cache_task::FontCacheTask; use font_cache_task::FontCacheTask;
use font_context::FontContext; use font_context::FontContext;
use gfx_traits::{color, PaintListener, PaintMsg as ConstellationMsg}; use gfx_traits::{color, LayerId, LayerKind, LayerProperties, PaintListener, PaintMsg as ConstellationMsg, ScrollPolicy};
use ipc_channel::ipc::IpcSender; use ipc_channel::ipc::IpcSender;
use layers::layers::{BufferRequest, LayerBuffer, LayerBufferSet}; use layers::layers::{BufferRequest, LayerBuffer, LayerBufferSet};
use layers::platform::surface::{NativeDisplay, NativeSurface}; use layers::platform::surface::{NativeDisplay, NativeSurface};
use msg::compositor_msg::{Epoch, FrameTreeId, LayerId, LayerKind, LayerProperties, ScrollPolicy}; use msg::compositor_msg::{Epoch, FrameTreeId};
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId}; use msg::constellation_msg::{ConstellationChan, Failure, PipelineId};
use paint_context::PaintContext; use paint_context::PaintContext;
use profile_traits::mem::{self, ReportsChan}; use profile_traits::mem::{self, ReportsChan};

View file

@ -18,6 +18,13 @@ features = ["plugins"]
[dependencies.msg] [dependencies.msg]
path = "../msg" path = "../msg"
[dependencies.plugins]
path = "../plugins"
[dependencies.util]
path = "../util"
[dependencies] [dependencies]
euclid = {version = "0.4", features = ["plugins"]}
serde = "0.6" serde = "0.6"
serde_macros = "0.6" serde_macros = "0.6"

View file

@ -3,23 +3,114 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![feature(custom_derive, plugin)] #![feature(custom_derive, plugin)]
#![plugin(serde_macros)] #![plugin(plugins, serde_macros)]
#![crate_name = "gfx_traits"] #![crate_name = "gfx_traits"]
#![crate_type = "rlib"] #![crate_type = "rlib"]
extern crate azure; extern crate azure;
extern crate euclid;
extern crate layers; extern crate layers;
extern crate msg; extern crate msg;
extern crate serde; extern crate serde;
extern crate util;
pub mod color; pub mod color;
mod paint_listener; mod paint_listener;
pub use paint_listener::PaintListener; pub use paint_listener::PaintListener;
use msg::constellation_msg::Failure; use azure::azure_hl::Color;
use euclid::matrix::Matrix4;
use euclid::rect::Rect;
use msg::compositor_msg::LayerType;
use msg::constellation_msg::{Failure, PipelineId};
use std::fmt::{self, Debug, Formatter};
/// Messages from the paint task to the constellation. /// Messages from the paint task to the constellation.
#[derive(Deserialize, Serialize)] #[derive(Deserialize, Serialize)]
pub enum PaintMsg { pub enum PaintMsg {
Failure(Failure), Failure(Failure),
} }
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LayerKind {
NoTransform,
HasTransform,
}
/// The scrolling policy of a layer.
#[derive(Clone, PartialEq, Eq, Copy, Deserialize, Serialize, Debug, HeapSizeOf)]
pub enum ScrollPolicy {
/// These layers scroll when the parent receives a scrolling message.
Scrollable,
/// These layers do not scroll when the parent receives a scrolling message.
FixedPosition,
}
#[derive(Clone, PartialEq, Eq, Copy, Hash, Deserialize, Serialize, HeapSizeOf)]
pub struct LayerId(
/// The type of the layer. This serves to differentiate layers that share fragments.
LayerType,
/// The identifier for this layer's fragment, derived from the fragment memory address.
usize,
/// An index for identifying companion layers, synthesized to ensure that
/// content on top of this layer's fragment has the proper rendering order.
usize
);
impl Debug for LayerId {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
let LayerId(layer_type, id, companion) = *self;
let type_string = match layer_type {
LayerType::FragmentBody => "-FragmentBody",
LayerType::OverflowScroll => "-OverflowScroll",
LayerType::BeforePseudoContent => "-BeforePseudoContent",
LayerType::AfterPseudoContent => "-AfterPseudoContent",
};
write!(f, "{}{}-{}", id, type_string, companion)
}
}
impl LayerId {
/// FIXME(#2011, pcwalton): This is unfortunate. Maybe remove this in the future.
pub fn null() -> LayerId {
LayerId(LayerType::FragmentBody, 0, 0)
}
pub fn new_of_type(layer_type: LayerType, fragment_id: usize) -> LayerId {
LayerId(layer_type, fragment_id, 0)
}
pub fn companion_layer_id(&self) -> LayerId {
let LayerId(layer_type, id, companion) = *self;
LayerId(layer_type, id, companion + 1)
}
}
/// All layer-specific information that the painting task sends to the compositor other than the
/// buffer contents of the layer itself.
#[derive(Copy, Clone)]
pub struct LayerProperties {
/// An opaque ID. This is usually the address of the flow and index of the box within it.
pub id: LayerId,
/// The id of the parent layer.
pub parent_id: Option<LayerId>,
/// The position and size of the layer in pixels.
pub rect: Rect<f32>,
/// The background color of the layer.
pub background_color: Color,
/// The scrolling policy of this layer.
pub scroll_policy: ScrollPolicy,
/// The transform for this layer
pub transform: Matrix4,
/// The perspective transform for this layer
pub perspective: Matrix4,
/// The subpage that this layer represents. If this is `Some`, this layer represents an
/// iframe.
pub subpage_pipeline_id: Option<PipelineId>,
/// Whether this layer establishes a new 3d rendering context.
pub establishes_3d_context: bool,
/// Whether this layer scrolls its overflow area.
pub scrolls_overflow_area: bool,
}

View file

@ -2,9 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use LayerId;
use LayerProperties;
use layers::layers::{BufferRequest, LayerBufferSet}; use layers::layers::{BufferRequest, LayerBufferSet};
use layers::platform::surface::NativeDisplay; use layers::platform::surface::NativeDisplay;
use msg::compositor_msg::{Epoch, FrameTreeId, LayerId, LayerProperties}; use msg::compositor_msg::{Epoch, FrameTreeId};
use msg::constellation_msg::PipelineId; use msg::constellation_msg::PipelineId;
/// The interface used by the painter to acquire draw targets for each paint frame and /// The interface used by the painter to acquire draw targets for each paint frame and

View file

@ -44,12 +44,12 @@ use flow::{self, BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, ForceNonf
use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, HAS_LAYER}; use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, HAS_LAYER};
use fragment::{SpecificFragmentInfo}; use fragment::{SpecificFragmentInfo};
use gfx::display_list::{ClippingRegion, DisplayList}; use gfx::display_list::{ClippingRegion, DisplayList};
use gfx_traits::LayerId;
use incremental::{REFLOW, REFLOW_OUT_OF_FLOW}; use incremental::{REFLOW, REFLOW_OUT_OF_FLOW};
use layout_debug; use layout_debug;
use layout_task::DISPLAY_PORT_SIZE_FACTOR; use layout_task::DISPLAY_PORT_SIZE_FACTOR;
use model::{CollapsibleMargins, MaybeAuto, specified, specified_or_none}; use model::{CollapsibleMargins, MaybeAuto, specified, specified_or_none};
use model::{IntrinsicISizes, MarginCollapseInfo}; use model::{IntrinsicISizes, MarginCollapseInfo};
use msg::compositor_msg::LayerId;
use rustc_serialize::{Encodable, Encoder}; use rustc_serialize::{Encodable, Encoder};
use std::cmp::{max, min}; use std::cmp::{max, min};
use std::fmt; use std::fmt;

View file

@ -14,9 +14,9 @@ use fnv::FnvHasher;
use gfx::display_list::OpaqueNode; use gfx::display_list::OpaqueNode;
use gfx::font_cache_task::FontCacheTask; use gfx::font_cache_task::FontCacheTask;
use gfx::font_context::FontContext; use gfx::font_context::FontContext;
use gfx_traits::LayerId;
use ipc_channel::ipc::{self, IpcSender}; use ipc_channel::ipc::{self, IpcSender};
use msg::ParseErrorReporter; use msg::ParseErrorReporter;
use msg::compositor_msg::LayerId;
use net_traits::image::base::Image; use net_traits::image::base::Image;
use net_traits::image_cache_task::{ImageCacheChan, ImageCacheTask, ImageResponse, ImageState}; use net_traits::image_cache_task::{ImageCacheChan, ImageCacheTask, ImageResponse, ImageState};
use net_traits::image_cache_task::{UsePlaceholder}; use net_traits::image_cache_task::{UsePlaceholder};

View file

@ -31,12 +31,11 @@ use gfx::display_list::{LineDisplayItem, OpaqueNode, SolidColorDisplayItem};
use gfx::display_list::{StackingContext, TextDisplayItem, TextOrientation}; use gfx::display_list::{StackingContext, TextDisplayItem, TextOrientation};
use gfx::paint_task::THREAD_TINT_COLORS; use gfx::paint_task::THREAD_TINT_COLORS;
use gfx::text::glyph::CharIndex; use gfx::text::glyph::CharIndex;
use gfx_traits::color; use gfx_traits::{color, ScrollPolicy};
use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFlow, LAST_FRAGMENT_OF_ELEMENT}; use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFlow, LAST_FRAGMENT_OF_ELEMENT};
use ipc_channel::ipc::{self, IpcSharedMemory}; use ipc_channel::ipc::{self, IpcSharedMemory};
use list_item::ListItemFlow; use list_item::ListItemFlow;
use model::{self, MaybeAuto, ToGfxMatrix}; use model::{self, MaybeAuto, ToGfxMatrix};
use msg::compositor_msg::ScrollPolicy;
use net_traits::image::base::{Image, PixelFormat}; use net_traits::image::base::{Image, PixelFormat};
use net_traits::image_cache_task::UsePlaceholder; use net_traits::image_cache_task::UsePlaceholder;
use std::default::Default; use std::default::Default;

View file

@ -34,10 +34,11 @@ use flow_list::{FlowList, FlowListIterator, MutFlowListIterator};
use flow_ref::{self, FlowRef, WeakFlowRef}; use flow_ref::{self, FlowRef, WeakFlowRef};
use fragment::{Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo}; use fragment::{Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo};
use gfx::display_list::{ClippingRegion, DisplayList}; use gfx::display_list::{ClippingRegion, DisplayList};
use gfx_traits::LayerId;
use incremental::{self, RECONSTRUCT_FLOW, REFLOW, REFLOW_OUT_OF_FLOW, RestyleDamage}; use incremental::{self, RECONSTRUCT_FLOW, REFLOW, REFLOW_OUT_OF_FLOW, RestyleDamage};
use inline::InlineFlow; use inline::InlineFlow;
use model::{CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo}; use model::{CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo};
use msg::compositor_msg::{LayerId, LayerType}; use msg::compositor_msg::LayerType;
use multicol::MulticolFlow; use multicol::MulticolFlow;
use parallel::FlowParallelInfo; use parallel::FlowParallelInfo;
use rustc_serialize::{Encodable, Encoder}; use rustc_serialize::{Encodable, Encoder};

View file

@ -17,13 +17,14 @@ use gfx;
use gfx::display_list::{BLUR_INFLATION_FACTOR, OpaqueNode}; use gfx::display_list::{BLUR_INFLATION_FACTOR, OpaqueNode};
use gfx::text::glyph::CharIndex; use gfx::text::glyph::CharIndex;
use gfx::text::text_run::{TextRun, TextRunSlice}; use gfx::text::text_run::{TextRun, TextRunSlice};
use gfx_traits::LayerId;
use incremental::{self, RECONSTRUCT_FLOW, RestyleDamage}; use incremental::{self, RECONSTRUCT_FLOW, RestyleDamage};
use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFragmentContext, InlineFragmentNodeInfo}; use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFragmentContext, InlineFragmentNodeInfo};
use inline::{InlineMetrics, LAST_FRAGMENT_OF_ELEMENT}; use inline::{InlineMetrics, LAST_FRAGMENT_OF_ELEMENT};
use ipc_channel::ipc::IpcSender; use ipc_channel::ipc::IpcSender;
use layout_debug; use layout_debug;
use model::{self, IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto, specified}; use model::{self, IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto, specified};
use msg::compositor_msg::{LayerId, LayerType}; use msg::compositor_msg::LayerType;
use msg::constellation_msg::PipelineId; use msg::constellation_msg::PipelineId;
use net_traits::image::base::Image; use net_traits::image::base::Image;
use net_traits::image_cache_task::UsePlaceholder; use net_traits::image_cache_task::UsePlaceholder;

View file

@ -28,7 +28,7 @@ use gfx::font;
use gfx::font_cache_task::FontCacheTask; use gfx::font_cache_task::FontCacheTask;
use gfx::font_context; use gfx::font_context;
use gfx::paint_task::{LayoutToPaintMsg, PaintLayer}; use gfx::paint_task::{LayoutToPaintMsg, PaintLayer};
use gfx_traits::color; use gfx_traits::{color, LayerId, ScrollPolicy};
use incremental::{LayoutDamageComputation, REFLOW, REFLOW_ENTIRE_DOCUMENT, REPAINT}; use incremental::{LayoutDamageComputation, REFLOW, REFLOW_ENTIRE_DOCUMENT, REPAINT};
use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER; use ipc_channel::router::ROUTER;
@ -36,7 +36,7 @@ use layout_debug;
use layout_traits::LayoutTaskFactory; use layout_traits::LayoutTaskFactory;
use log; use log;
use msg::ParseErrorReporter; use msg::ParseErrorReporter;
use msg::compositor_msg::{Epoch, LayerId, ScrollPolicy}; use msg::compositor_msg::Epoch;
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId}; use msg::constellation_msg::{ConstellationChan, Failure, PipelineId};
use net_traits::image_cache_task::{ImageCacheChan, ImageCacheResult, ImageCacheTask}; use net_traits::image_cache_task::{ImageCacheChan, ImageCacheResult, ImageCacheTask};
use parallel::{self, WorkQueueData}; use parallel::{self, WorkQueueData};

View file

@ -2,11 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use azure::azure_hl::Color;
use constellation_msg::PipelineId;
use euclid::{Matrix4, Rect};
use std::fmt::{self, Debug, Formatter};
/// A newtype struct for denoting the age of messages; prevents race conditions. /// A newtype struct for denoting the age of messages; prevents race conditions.
#[derive(PartialEq, Eq, Debug, Copy, Clone, PartialOrd, Ord, Deserialize, Serialize)] #[derive(PartialEq, Eq, Debug, Copy, Clone, PartialOrd, Ord, Deserialize, Serialize)]
pub struct Epoch(pub u32); pub struct Epoch(pub u32);
@ -39,86 +34,3 @@ pub enum LayerType {
/// A layer created to contain ::after pseudo-element content. /// A layer created to contain ::after pseudo-element content.
AfterPseudoContent, AfterPseudoContent,
} }
#[derive(Clone, PartialEq, Eq, Copy, Hash, Deserialize, Serialize, HeapSizeOf)]
pub struct LayerId(
/// The type of the layer. This serves to differentiate layers that share fragments.
LayerType,
/// The identifier for this layer's fragment, derived from the fragment memory address.
usize,
/// An index for identifying companion layers, synthesized to ensure that
/// content on top of this layer's fragment has the proper rendering order.
usize
);
impl Debug for LayerId {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
let LayerId(layer_type, id, companion) = *self;
let type_string = match layer_type {
LayerType::FragmentBody => "-FragmentBody",
LayerType::OverflowScroll => "-OverflowScroll",
LayerType::BeforePseudoContent => "-BeforePseudoContent",
LayerType::AfterPseudoContent => "-AfterPseudoContent",
};
write!(f, "{}{}-{}", id, type_string, companion)
}
}
impl LayerId {
/// FIXME(#2011, pcwalton): This is unfortunate. Maybe remove this in the future.
pub fn null() -> LayerId {
LayerId(LayerType::FragmentBody, 0, 0)
}
pub fn new_of_type(layer_type: LayerType, fragment_id: usize) -> LayerId {
LayerId(layer_type, fragment_id, 0)
}
pub fn companion_layer_id(&self) -> LayerId {
let LayerId(layer_type, id, companion) = *self;
LayerId(layer_type, id, companion + 1)
}
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LayerKind {
NoTransform,
HasTransform,
}
/// The scrolling policy of a layer.
#[derive(Clone, PartialEq, Eq, Copy, Deserialize, Serialize, Debug, HeapSizeOf)]
pub enum ScrollPolicy {
/// These layers scroll when the parent receives a scrolling message.
Scrollable,
/// These layers do not scroll when the parent receives a scrolling message.
FixedPosition,
}
/// All layer-specific information that the painting task sends to the compositor other than the
/// buffer contents of the layer itself.
#[derive(Copy, Clone)]
pub struct LayerProperties {
/// An opaque ID. This is usually the address of the flow and index of the box within it.
pub id: LayerId,
/// The id of the parent layer.
pub parent_id: Option<LayerId>,
/// The position and size of the layer in pixels.
pub rect: Rect<f32>,
/// The background color of the layer.
pub background_color: Color,
/// The scrolling policy of this layer.
pub scroll_policy: ScrollPolicy,
/// The transform for this layer
pub transform: Matrix4,
/// The perspective transform for this layer
pub perspective: Matrix4,
/// The subpage that this layer represents. If this is `Some`, this layer represents an
/// iframe.
pub subpage_pipeline_id: Option<PipelineId>,
/// Whether this layer establishes a new 3d rendering context.
pub establishes_3d_context: bool,
/// Whether this layer scrolls its overflow area.
pub scrolls_overflow_area: bool,
}

View file

@ -62,6 +62,9 @@ git = "https://github.com/servo/ipc-channel"
git = "https://github.com/Ygg01/xml5ever" git = "https://github.com/Ygg01/xml5ever"
features = ["unstable"] features = ["unstable"]
[dependencies.gfx_traits]
path = "../gfx_traits"
[dependencies] [dependencies]
app_units = {version = "0.1", features = ["plugins"]} app_units = {version = "0.1", features = ["plugins"]}
cssparser = { version = "0.4", features = [ "serde-serialization" ] } cssparser = { version = "0.4", features = [ "serde-serialization" ] }

View file

@ -33,6 +33,7 @@ use dom::performance::Performance;
use dom::screen::Screen; use dom::screen::Screen;
use dom::storage::Storage; use dom::storage::Storage;
use euclid::{Point2D, Rect, Size2D}; use euclid::{Point2D, Rect, Size2D};
use gfx_traits::LayerId;
use ipc_channel::ipc::{self, IpcSender}; use ipc_channel::ipc::{self, IpcSender};
use js::jsapi::{Evaluate2, MutableHandleValue}; use js::jsapi::{Evaluate2, MutableHandleValue};
use js::jsapi::{HandleValue, JSContext}; use js::jsapi::{HandleValue, JSContext};
@ -43,7 +44,6 @@ use layout_interface::{ContentBoxResponse, ContentBoxesResponse, ResolvedStyleRe
use layout_interface::{LayoutChan, LayoutRPC, Msg, Reflow, ReflowGoal, ReflowQueryType}; use layout_interface::{LayoutChan, LayoutRPC, Msg, Reflow, ReflowGoal, ReflowQueryType};
use libc; use libc;
use msg::ParseErrorReporter; use msg::ParseErrorReporter;
use msg::compositor_msg::LayerId;
use msg::constellation_msg::{ConstellationChan, DocumentState, LoadData}; use msg::constellation_msg::{ConstellationChan, DocumentState, LoadData};
use msg::constellation_msg::{MozBrowserEvent, PipelineId, SubpageId, WindowSizeData}; use msg::constellation_msg::{MozBrowserEvent, PipelineId, SubpageId, WindowSizeData};
use msg::webdriver_msg::{WebDriverJSError, WebDriverJSResult}; use msg::webdriver_msg::{WebDriverJSError, WebDriverJSResult};

View file

@ -10,10 +10,10 @@ use app_units::Au;
use dom::node::LayoutData; use dom::node::LayoutData;
use euclid::point::Point2D; use euclid::point::Point2D;
use euclid::rect::Rect; use euclid::rect::Rect;
use gfx_traits::LayerId;
use ipc_channel::ipc::{IpcReceiver, IpcSender}; use ipc_channel::ipc::{IpcReceiver, IpcSender};
use libc::uintptr_t; use libc::uintptr_t;
use msg::compositor_msg::Epoch; use msg::compositor_msg::Epoch;
use msg::compositor_msg::LayerId;
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId}; use msg::constellation_msg::{ConstellationChan, Failure, PipelineId};
use msg::constellation_msg::{WindowSizeData}; use msg::constellation_msg::{WindowSizeData};
use net_traits::image_cache_task::ImageCacheTask; use net_traits::image_cache_task::ImageCacheTask;

View file

@ -43,6 +43,7 @@ extern crate devtools_traits;
extern crate encoding; extern crate encoding;
extern crate euclid; extern crate euclid;
extern crate fnv; extern crate fnv;
extern crate gfx_traits;
extern crate html5ever; extern crate html5ever;
extern crate hyper; extern crate hyper;
extern crate image; extern crate image;

View file

@ -42,6 +42,7 @@ use dom::window::{ReflowReason, ScriptHelpers, Window};
use dom::worker::TrustedWorkerAddress; use dom::worker::TrustedWorkerAddress;
use euclid::Rect; use euclid::Rect;
use euclid::point::Point2D; use euclid::point::Point2D;
use gfx_traits::LayerId;
use hyper::header::{ContentType, HttpDate}; use hyper::header::{ContentType, HttpDate};
use hyper::header::{Headers, LastModified}; use hyper::header::{Headers, LastModified};
use hyper::method::Method; use hyper::method::Method;
@ -61,7 +62,6 @@ use layout_interface::{ReflowQueryType};
use layout_interface::{self, LayoutChan, NewLayoutTaskInfo, ReflowGoal, ScriptLayoutChan}; use layout_interface::{self, LayoutChan, NewLayoutTaskInfo, ReflowGoal, ScriptLayoutChan};
use libc; use libc;
use mem::heap_size_of_self_and_children; use mem::heap_size_of_self_and_children;
use msg::compositor_msg::LayerId;
use msg::constellation_msg::{ConstellationChan, LoadData}; use msg::constellation_msg::{ConstellationChan, LoadData};
use msg::constellation_msg::{MouseButton, MouseEventType, MozBrowserEvent, PipelineId}; use msg::constellation_msg::{MouseButton, MouseEventType, MozBrowserEvent, PipelineId};
use msg::constellation_msg::{PipelineNamespace}; use msg::constellation_msg::{PipelineNamespace};

View file

@ -10,6 +10,9 @@ path = "lib.rs"
[dependencies.canvas_traits] [dependencies.canvas_traits]
path = "../canvas_traits" path = "../canvas_traits"
[dependencies.gfx_traits]
path = "../gfx_traits"
[dependencies.msg] [dependencies.msg]
path = "../msg" path = "../msg"

View file

@ -14,6 +14,7 @@ extern crate app_units;
extern crate canvas_traits; extern crate canvas_traits;
extern crate devtools_traits; extern crate devtools_traits;
extern crate euclid; extern crate euclid;
extern crate gfx_traits;
extern crate ipc_channel; extern crate ipc_channel;
extern crate libc; extern crate libc;
extern crate msg; extern crate msg;
@ -34,9 +35,10 @@ use euclid::Size2D;
use euclid::length::Length; use euclid::length::Length;
use euclid::point::Point2D; use euclid::point::Point2D;
use euclid::rect::Rect; use euclid::rect::Rect;
use gfx_traits::LayerId;
use ipc_channel::ipc::{IpcReceiver, IpcSender}; use ipc_channel::ipc::{IpcReceiver, IpcSender};
use libc::c_void; use libc::c_void;
use msg::compositor_msg::{Epoch, LayerId}; use msg::compositor_msg::Epoch;
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId, WindowSizeData}; use msg::constellation_msg::{ConstellationChan, Failure, PipelineId, WindowSizeData};
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData, SubpageId}; use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData, SubpageId};
use msg::constellation_msg::{MouseButton, MouseEventType}; use msg::constellation_msg::{MouseButton, MouseEventType};

View file

@ -656,10 +656,13 @@ name = "gfx_traits"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"azure 0.2.1 (git+https://github.com/servo/rust-azure)", "azure 0.2.1 (git+https://github.com/servo/rust-azure)",
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"layers 0.2.0 (git+https://github.com/servo/rust-layers)", "layers 0.2.0 (git+https://github.com/servo/rust-layers)",
"msg 0.0.1", "msg 0.0.1",
"plugins 0.0.1",
"serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1",
] ]
[[package]] [[package]]
@ -1507,6 +1510,7 @@ dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"html5ever 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1557,6 +1561,7 @@ dependencies = [
"canvas_traits 0.0.1", "canvas_traits 0.0.1",
"devtools_traits 0.0.1", "devtools_traits 0.0.1",
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1", "msg 0.0.1",

5
ports/cef/Cargo.lock generated
View file

@ -616,10 +616,13 @@ name = "gfx_traits"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"azure 0.2.1 (git+https://github.com/servo/rust-azure)", "azure 0.2.1 (git+https://github.com/servo/rust-azure)",
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"layers 0.2.0 (git+https://github.com/servo/rust-layers)", "layers 0.2.0 (git+https://github.com/servo/rust-layers)",
"msg 0.0.1", "msg 0.0.1",
"plugins 0.0.1",
"serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1",
] ]
[[package]] [[package]]
@ -1432,6 +1435,7 @@ dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"html5ever 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1473,6 +1477,7 @@ dependencies = [
"canvas_traits 0.0.1", "canvas_traits 0.0.1",
"devtools_traits 0.0.1", "devtools_traits 0.0.1",
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1", "msg 0.0.1",

5
ports/gonk/Cargo.lock generated
View file

@ -606,10 +606,13 @@ name = "gfx_traits"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"azure 0.2.1 (git+https://github.com/servo/rust-azure)", "azure 0.2.1 (git+https://github.com/servo/rust-azure)",
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"layers 0.2.0 (git+https://github.com/servo/rust-layers)", "layers 0.2.0 (git+https://github.com/servo/rust-layers)",
"msg 0.0.1", "msg 0.0.1",
"plugins 0.0.1",
"serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1",
] ]
[[package]] [[package]]
@ -1400,6 +1403,7 @@ dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"html5ever 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1441,6 +1445,7 @@ dependencies = [
"canvas_traits 0.0.1", "canvas_traits 0.0.1",
"devtools_traits 0.0.1", "devtools_traits 0.0.1",
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1", "msg 0.0.1",