Replace gfx_traits::ScrollPolicy by webrender_traits::ScrollPolicy.

This commit is contained in:
Ms2ger 2017-01-04 12:22:20 +01:00
parent 8e12a11da9
commit 5d2a68033a
4 changed files with 8 additions and 22 deletions

View file

@ -19,7 +19,7 @@ use euclid::{Matrix4D, Point2D, Rect, Size2D};
use euclid::num::{One, Zero};
use euclid::rect::TypedRect;
use euclid::side_offsets::SideOffsets2D;
use gfx_traits::{ScrollPolicy, ScrollRootId, StackingContextId};
use gfx_traits::{ScrollRootId, StackingContextId};
use gfx_traits::print_tree::PrintTree;
use ipc_channel::ipc::IpcSharedMemory;
use msg::constellation_msg::PipelineId;
@ -34,7 +34,7 @@ use style::computed_values::{border_style, filter, image_rendering, mix_blend_mo
use style_traits::cursor::Cursor;
use text::TextRun;
use text::glyph::ByteIndex;
use webrender_traits::{self, ColorF, GradientStop, WebGLContextId};
use webrender_traits::{self, ColorF, GradientStop, ScrollPolicy, WebGLContextId};
pub use style::dom::OpaqueNode;
@ -129,7 +129,7 @@ impl DisplayList {
// Convert the parent translated point into stacking context local transform space if the
// stacking context isn't fixed. If it's fixed, we need to use the client point anyway.
debug_assert!(stacking_context.context_type == StackingContextType::Real);
let is_fixed = stacking_context.scroll_policy == ScrollPolicy::FixedPosition;
let is_fixed = stacking_context.scroll_policy == ScrollPolicy::Fixed;
let translated_point = if is_fixed {
*client_point
} else {

View file

@ -44,15 +44,6 @@ const SPECIAL_STACKING_CONTEXT_ID_MASK: usize = 0xffff;
#[derive(Copy, Clone, RustcEncodable, Debug)]
pub enum DevicePixel {}
/// 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,
}
/// A newtype struct for denoting the age of messages; prevents race conditions.
#[derive(PartialEq, Eq, Debug, Copy, Clone, PartialOrd, Ord, Deserialize, Serialize)]
pub struct Epoch(pub u32);

View file

@ -27,7 +27,7 @@ use gfx::display_list::{GradientDisplayItem, IframeDisplayItem, ImageDisplayItem
use gfx::display_list::{LineDisplayItem, OpaqueNode};
use gfx::display_list::{SolidColorDisplayItem, ScrollRoot, StackingContext, StackingContextType};
use gfx::display_list::{TextDisplayItem, TextOrientation, WebGLDisplayItem, WebRenderImageInfo};
use gfx_traits::{ScrollPolicy, ScrollRootId, StackingContextId};
use gfx_traits::{ScrollRootId, StackingContextId};
use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFlow, LAST_FRAGMENT_OF_ELEMENT};
use ipc_channel::ipc;
use list_item::ListItemFlow;
@ -58,7 +58,7 @@ use style::values::computed::{AngleOrCorner, Gradient, GradientKind, LengthOrPer
use style::values::specified::{HorizontalDirection, VerticalDirection};
use style_traits::cursor::Cursor;
use table_cell::CollapsedBordersForCell;
use webrender_traits::{ColorF, GradientStop};
use webrender_traits::{ColorF, GradientStop, ScrollPolicy};
trait RgbColor {
fn rgb(r: u8, g: u8, b: u8) -> Self;
@ -1835,7 +1835,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
}
let scroll_policy = if self.is_fixed() {
ScrollPolicy::FixedPosition
ScrollPolicy::Fixed
} else {
ScrollPolicy::Scrollable
};

View file

@ -11,7 +11,7 @@ use app_units::Au;
use euclid::{Point2D, Rect, Size2D};
use gfx::display_list::{BorderRadii, BoxShadowClipMode, ClippingRegion};
use gfx::display_list::{DisplayItem, DisplayList, DisplayListTraversal, StackingContextType};
use gfx_traits::{FragmentType, ScrollPolicy, ScrollRootId};
use gfx_traits::{FragmentType, ScrollRootId};
use msg::constellation_msg::PipelineId;
use style::computed_values::{image_rendering, mix_blend_mode};
use style::computed_values::filter::{self, Filter};
@ -337,16 +337,11 @@ impl WebRenderDisplayItemConverter for DisplayItem {
let stacking_context = &item.stacking_context;
debug_assert!(stacking_context.context_type == StackingContextType::Real);
let webrender_scroll_policy = match stacking_context.scroll_policy {
ScrollPolicy::Scrollable => webrender_traits::ScrollPolicy::Scrollable,
ScrollPolicy::FixedPosition => webrender_traits::ScrollPolicy::Fixed,
};
let clip = builder.new_clip_region(&stacking_context.overflow.to_rectf(),
vec![],
None);
builder.push_stacking_context(webrender_scroll_policy,
builder.push_stacking_context(stacking_context.scroll_policy,
stacking_context.bounds.to_rectf(),
clip,
stacking_context.z_index,