From 9d72e89ce3502cb58147375c8ecc4e9e9356b1ee Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Mon, 20 Mar 2017 11:29:46 +0100 Subject: [PATCH 1/2] Stop splitting scroll roots Now that WebRender can handle splitting scrolling layers on its own, we don't need to do any work to split up scroll roots. This should also make it possible to handle overflow:scroll and containing block scroll roots in the future. --- components/compositing/compositor.rs | 23 +- components/gfx/display_list/mod.rs | 1 + components/layout/block.rs | 5 +- components/layout/display_list_builder.rs | 259 ++++++++++------------ components/layout/webrender_helpers.rs | 48 ++-- 5 files changed, 173 insertions(+), 163 deletions(-) diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index dc2a44fc082..30abae50c50 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -40,7 +40,7 @@ use style_traits::viewport::ViewportConstraints; use time::{precise_time_ns, precise_time_s}; use touch::{TouchHandler, TouchAction}; use webrender; -use webrender_traits::{self, ScrollEventPhase, ServoScrollRootId, LayoutPoint, ScrollLocation}; +use webrender_traits::{self, LayoutPoint, ScrollEventPhase, ScrollLayerId, ScrollLocation}; use windowing::{self, MouseWindowEvent, WindowEvent, WindowMethods, WindowNavigateMsg}; #[derive(Debug, PartialEq)] @@ -77,9 +77,9 @@ trait ConvertScrollRootIdFromWebRender { fn from_webrender(&self) -> ScrollRootId; } -impl ConvertScrollRootIdFromWebRender for webrender_traits::ServoScrollRootId { +impl ConvertScrollRootIdFromWebRender for usize { fn from_webrender(&self) -> ScrollRootId { - ScrollRootId(self.0) + ScrollRootId(*self) } } @@ -791,10 +791,8 @@ impl IOCompositor { pipeline_id: PipelineId, scroll_root_id: ScrollRootId, point: Point2D) { - self.webrender_api.scroll_layers_with_scroll_root_id( - LayoutPoint::from_untyped(&point), - pipeline_id.to_webrender(), - ServoScrollRootId(scroll_root_id.0)); + let id = ScrollLayerId::new(scroll_root_id.0, pipeline_id.to_webrender()); + self.webrender_api.scroll_layer_with_id(LayoutPoint::from_untyped(&point), id); } fn handle_window_message(&mut self, event: WindowEvent) { @@ -1386,13 +1384,18 @@ impl IOCompositor { fn send_viewport_rects(&self) { let mut stacking_context_scroll_states_per_pipeline = HashMap::new(); for scroll_layer_state in self.webrender_api.get_scroll_layer_state() { + let external_id = match scroll_layer_state.id.external_id() { + Some(id) => id, + None => continue, + }; + let stacking_context_scroll_state = StackingContextScrollState { - scroll_root_id: scroll_layer_state.scroll_root_id.from_webrender(), + scroll_root_id: external_id.from_webrender(), scroll_offset: scroll_layer_state.scroll_offset.to_untyped(), }; - let pipeline_id = scroll_layer_state.pipeline_id; + stacking_context_scroll_states_per_pipeline - .entry(pipeline_id) + .entry(scroll_layer_state.id.pipeline_id()) .or_insert(vec![]) .push(stacking_context_scroll_state); } diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs index 04fcf7b367c..78d50530168 100644 --- a/components/gfx/display_list/mod.rs +++ b/components/gfx/display_list/mod.rs @@ -434,6 +434,7 @@ impl StackingContext { pub fn to_display_list_items(self) -> (DisplayItem, DisplayItem) { let mut base_item = BaseDisplayItem::empty(); base_item.stacking_context_id = self.id; + base_item.scroll_root_id = self.parent_scroll_id; let pop_item = DisplayItem::PopStackingContext(Box::new( PopStackingContextItem { diff --git a/components/layout/block.rs b/components/layout/block.rs index 31f44f0ec0e..5504f0fc412 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -2233,10 +2233,11 @@ impl Flow for BlockFlow { fn compute_overflow(&self) -> Overflow { let flow_size = self.base.position.size.to_physical(self.base.writing_mode); - self.fragment.compute_overflow(&flow_size, + let overflow = self.fragment.compute_overflow(&flow_size, &self.base .early_absolute_position_info - .relative_containing_block_size) + .relative_containing_block_size); + overflow } fn iterate_through_fragment_border_boxes(&self, diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index 2ee9985cf0e..26814351429 100644 --- a/components/layout/display_list_builder.rs +++ b/components/layout/display_list_builder.rs @@ -120,12 +120,31 @@ fn get_cyclic(arr: &[T], index: usize) -> &T { &arr[index % arr.len()] } +#[derive(Debug)] +struct StackingContextInfo { + children: Vec, + scroll_roots: Vec, +} + +impl StackingContextInfo { + fn new() -> StackingContextInfo { + StackingContextInfo { + children: Vec::new(), + scroll_roots: Vec::new(), + } + } + + fn take_children(&mut self) -> Vec { + mem::replace(&mut self.children, Vec::new()) + } +} + pub struct DisplayListBuildState<'a> { pub layout_context: &'a LayoutContext<'a>, pub root_stacking_context: StackingContext, pub items: HashMap>, - pub stacking_context_children: HashMap>, - pub scroll_roots: HashMap, + stacking_context_info: HashMap, + pub scroll_root_parents: HashMap, pub processing_scroll_root_element: bool, /// The current stacking context id, used to keep track of state when building. @@ -147,8 +166,8 @@ impl<'a> DisplayListBuildState<'a> { layout_context: layout_context, root_stacking_context: StackingContext::root(), items: HashMap::new(), - stacking_context_children: HashMap::new(), - scroll_roots: HashMap::new(), + stacking_context_info: HashMap::new(), + scroll_root_parents: HashMap::new(), processing_scroll_root_element: false, current_stacking_context_id: StackingContextId::root(), current_scroll_root_id: ScrollRootId::root(), @@ -164,13 +183,18 @@ impl<'a> DisplayListBuildState<'a> { fn add_stacking_context(&mut self, parent_id: StackingContextId, stacking_context: StackingContext) { - let contexts = self.stacking_context_children.entry(parent_id).or_insert(Vec::new()); - contexts.push(stacking_context); + let info = self.stacking_context_info + .entry(parent_id) + .or_insert(StackingContextInfo::new()); + info.children.push(stacking_context); } - fn add_scroll_root(&mut self, scroll_root: ScrollRoot) { - debug_assert!(!self.scroll_roots.contains_key(&scroll_root.id)); - self.scroll_roots.insert(scroll_root.id, scroll_root); + fn add_scroll_root(&mut self, scroll_root: ScrollRoot, stacking_context_id: StackingContextId) { + self.scroll_root_parents.insert(scroll_root.id, scroll_root.parent_id); + let info = self.stacking_context_info + .entry(stacking_context_id) + .or_insert(StackingContextInfo::new()); + info.scroll_roots.push(scroll_root); } fn parent_scroll_root_id(&self, scroll_root_id: ScrollRootId) -> ScrollRootId { @@ -178,8 +202,8 @@ impl<'a> DisplayListBuildState<'a> { return ScrollRootId::root() } - debug_assert!(self.scroll_roots.contains_key(&scroll_root_id)); - self.scroll_roots.get(&scroll_root_id).unwrap().parent_id + debug_assert!(self.scroll_root_parents.contains_key(&scroll_root_id)); + *self.scroll_root_parents.get(&scroll_root_id).unwrap() } fn create_base_display_item(&self, @@ -209,13 +233,10 @@ impl<'a> DisplayListBuildState<'a> { } pub fn to_display_list(mut self) -> DisplayList { - let mut scroll_root_stack = Vec::new(); - scroll_root_stack.push(ScrollRootId::root()); - let mut list = Vec::new(); let root_context = mem::replace(&mut self.root_stacking_context, StackingContext::root()); - self.to_display_list_for_stacking_context(&mut list, root_context, &mut scroll_root_stack); + self.to_display_list_for_stacking_context(&mut list, root_context); DisplayList { list: list, @@ -224,128 +245,75 @@ impl<'a> DisplayListBuildState<'a> { fn to_display_list_for_stacking_context(&mut self, list: &mut Vec, - stacking_context: StackingContext, - scroll_root_stack: &mut Vec) { + stacking_context: StackingContext) { let mut child_items = self.items.remove(&stacking_context.id).unwrap_or(Vec::new()); child_items.sort_by(|a, b| a.base().section.cmp(&b.base().section)); child_items.reverse(); - let mut child_stacking_contexts = - self.stacking_context_children.remove(&stacking_context.id).unwrap_or_else(Vec::new); - child_stacking_contexts.sort(); + let mut info = self.stacking_context_info.remove(&stacking_context.id) + .unwrap_or_else(StackingContextInfo::new); - let real_stacking_context = stacking_context.context_type == StackingContextType::Real; - if !real_stacking_context { - self.to_display_list_for_items(list, - child_items, - child_stacking_contexts, - scroll_root_stack); - return; + info.children.sort(); + + if stacking_context.context_type != StackingContextType::Real { + list.extend(info.scroll_roots.into_iter().map(|root| root.to_push())); + self.to_display_list_for_items(list, child_items, info.children); + } else { + let (push_item, pop_item) = stacking_context.to_display_list_items(); + list.push(push_item); + list.extend(info.scroll_roots.into_iter().map(|root| root.to_push())); + self.to_display_list_for_items(list, child_items, info.children); + list.push(pop_item); } - - let mut scroll_root_stack = Vec::new(); - scroll_root_stack.push(stacking_context.parent_scroll_id); - - let (push_item, pop_item) = stacking_context.to_display_list_items(); - list.push(push_item); - self.to_display_list_for_items(list, - child_items, - child_stacking_contexts, - &mut scroll_root_stack); - list.push(pop_item); } fn to_display_list_for_items(&mut self, list: &mut Vec, mut child_items: Vec, - child_stacking_contexts: Vec, - scroll_root_stack: &mut Vec) { + child_stacking_contexts: Vec) { // Properly order display items that make up a stacking context. "Steps" here // refer to the steps in CSS 2.1 Appendix E. // Steps 1 and 2: Borders and background for the root. while child_items.last().map_or(false, |child| child.section() == DisplayListSection::BackgroundAndBorders) { - let item = child_items.pop().unwrap(); - self.switch_scroll_roots(list, item.scroll_root_id(), scroll_root_stack); - list.push(item); + list.push(child_items.pop().unwrap()); } // Step 3: Positioned descendants with negative z-indices. let mut child_stacking_contexts = child_stacking_contexts.into_iter().peekable(); while child_stacking_contexts.peek().map_or(false, |child| child.z_index < 0) { let context = child_stacking_contexts.next().unwrap(); - self.switch_scroll_roots(list, context.parent_scroll_id, scroll_root_stack); - self.to_display_list_for_stacking_context(list, context, scroll_root_stack); + self.to_display_list_for_stacking_context(list, context); } // Step 4: Block backgrounds and borders. while child_items.last().map_or(false, |child| child.section() == DisplayListSection::BlockBackgroundsAndBorders) { - let item = child_items.pop().unwrap(); - self.switch_scroll_roots(list, item.scroll_root_id(), scroll_root_stack); - list.push(item); + list.push(child_items.pop().unwrap()); } // Step 5: Floats. while child_stacking_contexts.peek().map_or(false, |child| child.context_type == StackingContextType::PseudoFloat) { let context = child_stacking_contexts.next().unwrap(); - self.switch_scroll_roots(list, context.parent_scroll_id, scroll_root_stack); - self.to_display_list_for_stacking_context(list, context, scroll_root_stack); + self.to_display_list_for_stacking_context(list, context); } // Step 6 & 7: Content and inlines that generate stacking contexts. while child_items.last().map_or(false, |child| child.section() == DisplayListSection::Content) { - let item = child_items.pop().unwrap(); - self.switch_scroll_roots(list, item.scroll_root_id(), scroll_root_stack); - list.push(item); + list.push(child_items.pop().unwrap()); } // Step 8 & 9: Positioned descendants with nonnegative, numeric z-indices. for child in child_stacking_contexts { - self.switch_scroll_roots(list, child.parent_scroll_id, scroll_root_stack); - self.to_display_list_for_stacking_context(list, child, scroll_root_stack); + self.to_display_list_for_stacking_context(list, child); } // Step 10: Outlines. for item in child_items.drain(..) { - self.switch_scroll_roots(list, item.scroll_root_id(), scroll_root_stack); list.push(item); } - - for _ in scroll_root_stack.drain(1..) { - list.push(DisplayItem::PopScrollRoot(Box::new(BaseDisplayItem::empty()))); - } - } - - fn switch_scroll_roots(&self, - list: &mut Vec, - new_id: ScrollRootId, - scroll_root_stack: &mut Vec) { - if new_id == *scroll_root_stack.last().unwrap() { - return; - } - - if new_id == *scroll_root_stack.first().unwrap() { - for _ in scroll_root_stack.drain(1..) { - list.push(DisplayItem::PopScrollRoot(Box::new(BaseDisplayItem::empty()))); - } - return; - } - - // We never want to reach the root of the ScrollRoot tree without encountering the - // containing scroll root of this StackingContext. If this does happen we've tried to - // switch to a ScrollRoot that does not contain our current stacking context or isn't - // itself a direct child of our current stacking context. This should never happen - // due to CSS stacking rules. - debug_assert!(new_id != ScrollRootId::root()); - - let scroll_root = self.scroll_roots.get(&new_id).unwrap(); - self.switch_scroll_roots(list, scroll_root.parent_id, scroll_root_stack); - - scroll_root_stack.push(new_id); - list.push(scroll_root.to_push()); } } @@ -507,6 +475,10 @@ pub trait FragmentDisplayListBuilding { mode: StackingContextCreationMode, parent_scroll_id: ScrollRootId) -> StackingContext; + + + /// The id of stacking context this fragment would create. + fn stacking_context_id(&self) -> StackingContextId; } fn handle_overlapping_radii(size: &Size2D, radii: &BorderRadii) -> BorderRadii { @@ -1612,6 +1584,10 @@ impl FragmentDisplayListBuilding for Fragment { } } + fn stacking_context_id(&self) -> StackingContextId { + StackingContextId::new_of_type(self.node.id() as usize, self.fragment_type()) + } + fn create_stacking_context(&self, id: StackingContextId, base_flow: &BaseFlow, @@ -1858,14 +1834,12 @@ impl FragmentDisplayListBuilding for Fragment { pub trait BlockFlowDisplayListBuilding { fn collect_stacking_contexts_for_block(&mut self, state: &mut DisplayListBuildState); - fn collect_scroll_root_for_block(&mut self, state: &mut DisplayListBuildState) -> ScrollRootId; + fn setup_scroll_root_for_block(&mut self, state: &mut DisplayListBuildState) -> ScrollRootId; fn create_pseudo_stacking_context_for_block(&mut self, - stacking_context_id: StackingContextId, parent_stacking_context_id: StackingContextId, parent_scroll_root_id: ScrollRootId, state: &mut DisplayListBuildState); fn create_real_stacking_context_for_block(&mut self, - stacking_context_id: StackingContextId, parent_stacking_context_id: StackingContextId, parent_scroll_root_id: ScrollRootId, state: &mut DisplayListBuildState); @@ -1876,43 +1850,49 @@ pub trait BlockFlowDisplayListBuilding { impl BlockFlowDisplayListBuilding for BlockFlow { fn collect_stacking_contexts_for_block(&mut self, state: &mut DisplayListBuildState) { - let parent_scroll_root_id = state.current_scroll_root_id; - self.base.scroll_root_id = self.collect_scroll_root_for_block(state); - state.current_scroll_root_id = self.base.scroll_root_id; - + let parent_stacking_context_id = state.current_stacking_context_id; let block_stacking_context_type = self.block_stacking_context_type(); - if block_stacking_context_type == BlockStackingContextType::NonstackingContext { - self.base.stacking_context_id = state.current_stacking_context_id; - self.base.collect_stacking_contexts_for_children(state); - } else { - let parent_stacking_context_id = state.current_stacking_context_id; - let stacking_context_id = - StackingContextId::new_of_type(self.fragment.node.id() as usize, - self.fragment.fragment_type()); - state.current_stacking_context_id = stacking_context_id; - self.base.stacking_context_id = stacking_context_id; + self.base.stacking_context_id = match block_stacking_context_type { + BlockStackingContextType::NonstackingContext => state.current_stacking_context_id, + BlockStackingContextType::PseudoStackingContext | + BlockStackingContextType::StackingContext => self.fragment.stacking_context_id(), + }; + state.current_stacking_context_id = self.base.stacking_context_id; - if block_stacking_context_type == BlockStackingContextType::PseudoStackingContext { - self.create_pseudo_stacking_context_for_block(stacking_context_id, - parent_stacking_context_id, - parent_scroll_root_id, + let original_scroll_root_id = state.current_scroll_root_id; + + // We are getting the id of the scroll root that contains us here, not the id of + // any scroll root that we create. If we create a scroll root, its id will be + // stored in state.current_scroll_root_id. If we should create a stacking context, + // we don't want it to be clipped by its own scroll root. + let containing_scroll_root_id = self.setup_scroll_root_for_block(state); + + match block_stacking_context_type { + BlockStackingContextType::NonstackingContext => { + self.base.collect_stacking_contexts_for_children(state); + } + BlockStackingContextType::PseudoStackingContext => { + self.create_pseudo_stacking_context_for_block(parent_stacking_context_id, + containing_scroll_root_id, state); - } else { - self.create_real_stacking_context_for_block(stacking_context_id, - parent_stacking_context_id, - parent_scroll_root_id, + } + BlockStackingContextType::StackingContext => { + self.create_real_stacking_context_for_block(parent_stacking_context_id, + containing_scroll_root_id, state); } - - state.current_stacking_context_id = parent_stacking_context_id; } - state.current_scroll_root_id = parent_scroll_root_id; + state.current_scroll_root_id = original_scroll_root_id; + state.current_stacking_context_id = parent_stacking_context_id; } - fn collect_scroll_root_for_block(&mut self, state: &mut DisplayListBuildState) -> ScrollRootId { + fn setup_scroll_root_for_block(&mut self, state: &mut DisplayListBuildState) -> ScrollRootId { + let containing_scroll_root_id = state.current_scroll_root_id; + self.base.scroll_root_id = containing_scroll_root_id; + if !self.style_permits_scrolling_overflow() { - return state.current_scroll_root_id; + return containing_scroll_root_id; } let coordinate_system = if self.fragment.establishes_stacking_context() { @@ -1933,25 +1913,27 @@ impl BlockFlowDisplayListBuilding for BlockFlow { self.base.overflow.scroll.size.height > clip.size.height; self.mark_scrolling_overflow(has_scrolling_overflow); if !has_scrolling_overflow { - return state.current_scroll_root_id; + return containing_scroll_root_id; } - let scroll_root_id = ScrollRootId::new_of_type(self.fragment.node.id() as usize, - self.fragment.fragment_type()); - let parent_scroll_root_id = state.current_scroll_root_id; + let new_scroll_root_id = ScrollRootId::new_of_type(self.fragment.node.id() as usize, + self.fragment.fragment_type()); state.add_scroll_root( ScrollRoot { - id: scroll_root_id, - parent_id: parent_scroll_root_id, + id: new_scroll_root_id, + parent_id: containing_scroll_root_id, clip: clip, size: self.base.overflow.scroll.size, - } + }, + self.base.stacking_context_id ); - scroll_root_id + + self.base.scroll_root_id = new_scroll_root_id; + state.current_scroll_root_id = new_scroll_root_id; + containing_scroll_root_id } fn create_pseudo_stacking_context_for_block(&mut self, - stacking_context_id: StackingContextId, parent_stacking_context_id: StackingContextId, parent_scroll_root_id: ScrollRootId, state: &mut DisplayListBuildState) { @@ -1963,7 +1945,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow { StackingContextCreationMode::PseudoFloat }; - let new_context = self.fragment.create_stacking_context(stacking_context_id, + let new_context = self.fragment.create_stacking_context(self.base.stacking_context_id, &self.base, ScrollPolicy::Scrollable, creation_mode, @@ -1972,19 +1954,20 @@ impl BlockFlowDisplayListBuilding for BlockFlow { self.base.collect_stacking_contexts_for_children(state); - let new_children = - state.stacking_context_children.remove(&stacking_context_id).unwrap_or_else(Vec::new); - for child in new_children { - if child.context_type == StackingContextType::PseudoFloat { - state.add_stacking_context(stacking_context_id, child); - } else { - state.add_stacking_context(parent_stacking_context_id, child); + let children = state.stacking_context_info.get_mut(&self.base.stacking_context_id) + .map(|info| info.take_children()); + if let Some(children) = children { + for child in children { + if child.context_type == StackingContextType::PseudoFloat { + state.add_stacking_context(self.base.stacking_context_id, child); + } else { + state.add_stacking_context(parent_stacking_context_id, child); + } } } } fn create_real_stacking_context_for_block(&mut self, - stacking_context_id: StackingContextId, parent_stacking_context_id: StackingContextId, parent_scroll_root_id: ScrollRootId, state: &mut DisplayListBuildState) { @@ -1995,7 +1978,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow { }; let stacking_context = self.fragment.create_stacking_context( - stacking_context_id, + self.base.stacking_context_id, &self.base, scroll_policy, StackingContextCreationMode::Normal, diff --git a/components/layout/webrender_helpers.rs b/components/layout/webrender_helpers.rs index 63814f6f5ed..2e94b79adaa 100644 --- a/components/layout/webrender_helpers.rs +++ b/components/layout/webrender_helpers.rs @@ -16,14 +16,16 @@ use msg::constellation_msg::PipelineId; use style::computed_values::{image_rendering, mix_blend_mode}; use style::computed_values::filter::{self, Filter}; use style::values::computed::BorderStyle; -use webrender_traits::{self, DisplayListBuilder, ExtendMode, LayoutTransform}; +use webrender_traits::{self, DisplayListBuilder, ExtendMode, LayoutTransform, ScrollLayerId}; pub trait WebRenderDisplayListConverter { fn convert_to_webrender(&self, pipeline_id: PipelineId) -> DisplayListBuilder; } trait WebRenderDisplayItemConverter { - fn convert_to_webrender(&self, builder: &mut DisplayListBuilder); + fn convert_to_webrender(&self, + builder: &mut DisplayListBuilder, + current_scroll_root_id: &mut ScrollRootId); } trait ToBorderStyle { @@ -212,16 +214,31 @@ impl ToFilterOps for filter::T { impl WebRenderDisplayListConverter for DisplayList { fn convert_to_webrender(&self, pipeline_id: PipelineId) -> DisplayListBuilder { let traversal = DisplayListTraversal::new(self); - let mut builder = DisplayListBuilder::new(pipeline_id.to_webrender()); + let webrender_pipeline_id = pipeline_id.to_webrender(); + let mut builder = DisplayListBuilder::new(webrender_pipeline_id); + + let mut current_scroll_root_id = ScrollRootId::root(); + builder.push_clip_id(current_scroll_root_id.convert_to_webrender(webrender_pipeline_id)); + for item in traversal { - item.convert_to_webrender(&mut builder); + item.convert_to_webrender(&mut builder, &mut current_scroll_root_id); } builder } } impl WebRenderDisplayItemConverter for DisplayItem { - fn convert_to_webrender(&self, builder: &mut DisplayListBuilder) { + fn convert_to_webrender(&self, + builder: &mut DisplayListBuilder, + current_scroll_root_id: &mut ScrollRootId) { + let scroll_root_id = self.base().scroll_root_id; + if scroll_root_id != *current_scroll_root_id { + let pipeline_id = builder.pipeline_id; + builder.pop_clip_id(); + builder.push_clip_id(scroll_root_id.convert_to_webrender(pipeline_id)); + *current_scroll_root_id = scroll_root_id; + } + match *self { DisplayItem::SolidColor(ref item) => { let color = item.color; @@ -403,21 +420,26 @@ impl WebRenderDisplayItemConverter for DisplayItem { vec![], None); - builder.push_scroll_layer(clip, - item.scroll_root.size.to_sizef(), - Some(item.scroll_root.id.convert_to_webrender())); + let provided_id = ScrollLayerId::new(item.scroll_root.id.0, builder.pipeline_id); + let id = builder.define_clip(clip, + item.scroll_root.size.to_sizef(), + Some(provided_id)); + debug_assert!(provided_id == id); } - DisplayItem::PopScrollRoot(_) => builder.pop_scroll_layer(), + DisplayItem::PopScrollRoot(_) => {} //builder.pop_scroll_layer(), } } } - trait WebRenderScrollRootIdConverter { - fn convert_to_webrender(&self) -> webrender_traits::ServoScrollRootId; + fn convert_to_webrender(&self, pipeline_id: webrender_traits::PipelineId) -> ScrollLayerId; } impl WebRenderScrollRootIdConverter for ScrollRootId { - fn convert_to_webrender(&self) -> webrender_traits::ServoScrollRootId { - webrender_traits::ServoScrollRootId(self.0) + fn convert_to_webrender(&self, pipeline_id: webrender_traits::PipelineId) -> ScrollLayerId { + if *self == ScrollRootId::root() { + ScrollLayerId::root_scroll_layer(pipeline_id) + } else { + ScrollLayerId::new(self.0, pipeline_id) + } } } From fe75382bcbb20efe43e650d144fa3bde7160f853 Mon Sep 17 00:00:00 2001 From: Glenn Watson Date: Wed, 22 Mar 2017 11:07:44 +1000 Subject: [PATCH 2/2] Update WR (gl/es runtime table, scroll roots). --- Cargo.lock | 146 +++++++++--------- components/canvas/Cargo.toml | 4 +- components/canvas/webgl_paint_thread.rs | 41 +++-- components/compositing/Cargo.toml | 2 +- components/compositing/compositor.rs | 67 ++++---- components/compositing/windowing.rs | 5 + components/constellation/Cargo.toml | 2 +- components/script/Cargo.toml | 2 +- components/script_traits/Cargo.toml | 2 +- components/servo/Cargo.toml | 2 +- components/servo/lib.rs | 2 +- ports/cef/Cargo.toml | 2 +- ports/cef/window.rs | 32 ++-- ports/glutin/Cargo.toml | 4 +- ports/glutin/window.rs | 59 ++++--- ...-overflow-hidden-and-border-radius.htm.ini | 5 + .../html/css-rotate-2d-3d-001.htm.ini | 3 - .../html/regions-transforms-005.htm.ini | 3 +- ...ansform-3d-rotateY-stair-above-001.htm.ini | 3 - 19 files changed, 212 insertions(+), 174 deletions(-) create mode 100644 tests/wpt/metadata-css/compositing-1_dev/html/mix-blend-mode-intermediate-element-overflow-hidden-and-border-radius.htm.ini delete mode 100644 tests/wpt/metadata-css/css-transforms-1_dev/html/css-rotate-2d-3d-001.htm.ini delete mode 100644 tests/wpt/metadata-css/css-transforms-1_dev/html/transform-3d-rotateY-stair-above-001.htm.ini diff --git a/Cargo.lock b/Cargo.lock index 96ab041bec4..d27d2d9b568 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -29,13 +29,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "android_glue" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "android_injected_glue" -version = "0.2.1" -source = "git+https://github.com/mmatyas/android-rs-injected-glue#d3223d1273d0dafcf06d6a6405fedfffbf257300" +version = "0.2.2" +source = "git+https://github.com/mmatyas/android-rs-injected-glue#1995be2c692d8d1f4c82d387c06c56451721cc38" [[package]] name = "angle" @@ -96,8 +96,8 @@ dependencies = [ [[package]] name = "azure" -version = "0.14.0" -source = "git+https://github.com/servo/rust-azure#07a57c4b32cd111cbc4ee1ff80a98a3f3ec3fbec" +version = "0.15.0" +source = "git+https://github.com/servo/rust-azure#4e65796956dc1f144a966b972ab601b3315ac833" dependencies = [ "cmake 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -108,7 +108,7 @@ dependencies = [ "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "servo-freetype-sys 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "servo-skia 0.30000003.0 (registry+https://github.com/rust-lang/crates.io-index)", + "servo-skia 0.30000004.1 (registry+https://github.com/rust-lang/crates.io-index)", "x11 2.12.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -274,17 +274,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "canvas" version = "0.0.1" dependencies = [ - "azure 0.14.0 (git+https://github.com/servo/rust-azure)", + "azure 0.15.0 (git+https://github.com/servo/rust-azure)", "canvas_traits 0.0.1", "cssparser 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gleam 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", "servo_config 0.0.1", - "webrender_traits 0.25.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.26.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -298,7 +298,7 @@ dependencies = [ "ipc-channel 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.25.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.26.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -325,10 +325,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cgl" -version = "0.1.5" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gleam 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -406,7 +406,7 @@ version = "0.0.1" dependencies = [ "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", - "gleam 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -419,8 +419,8 @@ dependencies = [ "servo_url 0.0.1", "style_traits 0.0.1", "time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender 0.24.0 (git+https://github.com/servo/webrender)", - "webrender_traits 0.25.0 (git+https://github.com/servo/webrender)", + "webrender 0.25.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.26.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -443,7 +443,7 @@ dependencies = [ "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", - "offscreen_gl_context 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", "profile_traits 0.0.1", "script_traits 0.0.1", "serde 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -453,7 +453,7 @@ dependencies = [ "servo_remutex 0.0.1", "servo_url 0.0.1", "style_traits 0.0.1", - "webrender_traits 0.25.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.26.0 (git+https://github.com/servo/webrender)", "webvr_traits 0.0.1", ] @@ -685,7 +685,7 @@ dependencies = [ "compositing 0.0.1", "devtools 0.0.1", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gleam 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "glutin_app 0.0.1", "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libservo 0.0.1", @@ -698,7 +698,7 @@ dependencies = [ "servo_geometry 0.0.1", "servo_url 0.0.1", "style_traits 0.0.1", - "webrender_traits 0.25.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.26.0 (git+https://github.com/servo/webrender)", "x11 2.12.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -981,7 +981,7 @@ dependencies = [ "time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", "truetype 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.25.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.26.0 (git+https://github.com/servo/webrender)", "xi-unicode 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1026,7 +1026,7 @@ dependencies = [ [[package]] name = "gleam" -version = "0.2.32" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gl_generator 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1046,7 +1046,7 @@ dependencies = [ "compositing 0.0.1", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gleam 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", @@ -1054,13 +1054,13 @@ dependencies = [ "osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "script_traits 0.0.1", "servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "servo-glutin 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "servo-glutin 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "servo_config 0.0.1", "servo_geometry 0.0.1", "servo_url 0.0.1", "style_traits 0.0.1", "user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.25.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.26.0 (git+https://github.com/servo/webrender)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "x11 2.12.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1242,12 +1242,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "io-surface" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cgl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "cgl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gleam 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "leaky-cow 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1371,7 +1371,7 @@ dependencies = [ "style_traits 0.0.1", "unicode-bidi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.25.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.26.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1411,7 +1411,7 @@ dependencies = [ "servo_geometry 0.0.1", "servo_url 0.0.1", "style 0.0.1", - "webrender_traits 0.25.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.26.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1425,7 +1425,7 @@ dependencies = [ "profile_traits 0.0.1", "script_traits 0.0.1", "servo_url 0.0.1", - "webrender_traits 0.25.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.26.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1492,7 +1492,7 @@ dependencies = [ "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "gaol 0.0.1 (git+https://github.com/servo/gaol)", "gfx 0.0.1", - "gleam 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "layout_thread 0.0.1", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1510,8 +1510,8 @@ dependencies = [ "style 0.0.1", "style_traits 0.0.1", "webdriver_server 0.0.1", - "webrender 0.24.0 (git+https://github.com/servo/webrender)", - "webrender_traits 0.25.0 (git+https://github.com/servo/webrender)", + "webrender 0.25.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.26.0 (git+https://github.com/servo/webrender)", "webvr 0.0.1", "webvr_traits 0.0.1", ] @@ -1660,7 +1660,7 @@ dependencies = [ "heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.25.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.26.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1702,7 +1702,7 @@ dependencies = [ "unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.25.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.26.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1761,7 +1761,7 @@ dependencies = [ "servo_url 0.0.1", "url 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.25.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.26.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1842,15 +1842,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "offscreen_gl_context" -version = "0.6.1" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cgl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "cgl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "gl_generator 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "gleam 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2276,7 +2276,7 @@ dependencies = [ "msg 0.0.1", "net_traits 0.0.1", "num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", "open 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2307,7 +2307,7 @@ dependencies = [ "tinyfiledialogs 2.5.9 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.25.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.26.0 (git+https://github.com/servo/webrender)", "webvr 0.0.1", "webvr_traits 0.0.1", "xml5ever 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2372,7 +2372,7 @@ dependencies = [ "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", - "offscreen_gl_context 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", "profile_traits 0.0.1", "rustc-serialize 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2437,7 +2437,7 @@ dependencies = [ name = "servo" version = "0.0.1" dependencies = [ - "android_injected_glue 0.2.1 (git+https://github.com/mmatyas/android-rs-injected-glue)", + "android_injected_glue 0.2.2 (git+https://github.com/mmatyas/android-rs-injected-glue)", "backtrace 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "browserhtml 0.1.17 (git+https://github.com/browserhtml/browserhtml?branch=crate)", "compiletest_helper 0.0.1", @@ -2495,11 +2495,11 @@ dependencies = [ [[package]] name = "servo-glutin" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "android_glue 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cgl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "android_glue 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cgl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "cocoa 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2521,21 +2521,21 @@ dependencies = [ [[package]] name = "servo-skia" -version = "0.30000003.0" +version = "0.30000004.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cgl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "cgl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "cmake 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "expat-sys 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gleam 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "glx 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "io-surface 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "io-surface 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "servo-fontconfig-sys 4.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "servo-freetype-sys 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "servo-glutin 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "servo-glutin 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "x11 2.12.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3183,8 +3183,8 @@ dependencies = [ [[package]] name = "webrender" -version = "0.24.0" -source = "git+https://github.com/servo/webrender#e30fb2914928c0e596d8632ed234647c0fd1492e" +version = "0.25.0" +source = "git+https://github.com/servo/webrender#0794911f97cae92496fca992d7430da696fa24eb" dependencies = [ "app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "bincode 1.0.0-alpha2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3198,31 +3198,31 @@ dependencies = [ "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "freetype 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "gamma-lut 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "gleam 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", "thread_profiler 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "threadpool 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.25.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.26.0 (git+https://github.com/servo/webrender)", ] [[package]] name = "webrender_traits" -version = "0.25.0" -source = "git+https://github.com/servo/webrender#e30fb2914928c0e596d8632ed234647c0fd1492e" +version = "0.26.0" +source = "git+https://github.com/servo/webrender#0794911f97cae92496fca992d7430da696fa24eb" dependencies = [ "app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "dwrote 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gleam 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3236,7 +3236,7 @@ dependencies = [ "msg 0.0.1", "script_traits 0.0.1", "servo_config 0.0.1", - "webrender_traits 0.25.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.26.0 (git+https://github.com/servo/webrender)", "webvr_traits 0.0.1", ] @@ -3330,8 +3330,8 @@ dependencies = [ "checksum adler32 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "57be033eb4100070a93a9400a725839cda9c415244f808b0357e72b9e003d5ba" "checksum aho-corasick 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0638fd549427caa90c499814196d1b9e3725eb4d15d7339d6de073a680ed0ca2" "checksum alloc-no-stdlib 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b21f6ad9c9957eb5d70c3dee16d31c092b3cab339628f821766b05e6833d72b8" -"checksum android_glue 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e2b80445d331077679dfc6f3014f3e9ab7083e588423d35041d3fc017198189" -"checksum android_injected_glue 0.2.1 (git+https://github.com/mmatyas/android-rs-injected-glue)" = "" +"checksum android_glue 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d8289e9637439939cc92b1995b0972117905be88bc28116c86b64d6e589bcd38" +"checksum android_injected_glue 0.2.2 (git+https://github.com/mmatyas/android-rs-injected-glue)" = "" "checksum angle 0.1.2 (git+https://github.com/servo/angle?branch=servo)" = "" "checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6" "checksum app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5a0c3b5be4ed53affe3e1a162b2e7ef9979bcaac80daa9026e9d7988c41e0e83" @@ -3339,7 +3339,7 @@ dependencies = [ "checksum aster 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2c9b49e42a449c0b79d8acb91db37621de0978064dca7d3288ddcf030123e5b3" "checksum atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fb2dcb6e6d35f20276943cc04bb98e538b348d525a04ac79c10021561d202f21" "checksum audio-video-metadata 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3b6ef29ee98ad95a37f34547fd7fb40724772294110ed6ca0445fc2e964c29d1" -"checksum azure 0.14.0 (git+https://github.com/servo/rust-azure)" = "" +"checksum azure 0.15.0 (git+https://github.com/servo/rust-azure)" = "" "checksum backtrace 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f551bc2ddd53aea015d453ef0b635af89444afa5ed2405dd0b2062ad5d600d80" "checksum backtrace-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d192fd129132fbc97497c1f2ec2c2c5174e376b95f535199ef4fe0a293d33842" "checksum bincode 1.0.0-alpha2 (registry+https://github.com/rust-lang/crates.io-index)" = "62650bb5651ba8f0580cebf4ef255d791b8b0ef53800322661e1bb5791d42966" @@ -3359,7 +3359,7 @@ dependencies = [ "checksum caseless 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8950b075cff75cdabadee97148a8b5816c7cf62e5948a6005b5255d564b42fe7" "checksum cexpr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "393a5f0088efbe41f9d1fcd062f24e83c278608420e62109feb2c8abee07de7d" "checksum cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de1e760d7b6535af4241fca8bd8adf68e2e7edacc6b29f5d399050c5e48cf88c" -"checksum cgl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8bdd78cca65a739cb5475dbf6b6bbb49373e327f4a6f2b499c0f98632df38c10" +"checksum cgl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "86765cb42c2a2c497e142af72517c1b4d7ae5bb2f25dfa77a5c69642f2342d89" "checksum clang-sys 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4f98f0715ff67f27ca6a2f8f0ffc2a56f8edbc7acd57489c29eadc3a15c4eafe" "checksum clap 2.20.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7db281b0520e97fbd15cd615dcd8f8bcad0c26f5f7d5effe705f090f39e9a758" "checksum cmake 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)" = "e1acc68a3f714627af38f9f5d09706a28584ba60dfe2cca68f40bf779f941b25" @@ -3411,7 +3411,7 @@ dependencies = [ "checksum getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9047cfbd08a437050b363d35ef160452c5fe8ea5187ae0a624708c91581d685" "checksum gif 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "01c7c19a035de94bd7afbaa62c241aadfbdf1a70f560b348d2312eafa566ca16" "checksum gl_generator 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1d8edc81c5ae84605a62f5dac661a2313003b26d59839f81d47d46cf0f16a55" -"checksum gleam 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)" = "9590e0e578d528a080c5abac678e7efbe349a73c7316faafd4073edf5f462d01" +"checksum gleam 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2958396a0a358d2de747b31329f5ae2229070602b0f51edd5d682f92c307c332" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" "checksum glx 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b280007fa9c7442cfd1e0b1addb8d1a59240267110e8705f8f7e2c7bfb7e2f72" "checksum harfbuzz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6b76113246f5c089dcf272cf89c3f61168a4d77b50ec5b2c1fab8c628c9ea762" @@ -3429,7 +3429,7 @@ dependencies = [ "checksum image 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "979bad0502082fd60053a490282e87d6c89650942e3a270e0d4c83569c7f5899" "checksum immeta 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0b9260463a221bfe3f02100c56e2d14c050d5ffe7e44a43d0a1b2b1f2b523502" "checksum inflate 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e7e0062d2dc2f17d2f13750d95316ae8a2ff909af0fda957084f5defd87c43bb" -"checksum io-surface 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "10d25285115b9d34be1328fdc5af15d34174472a9f23d1994d2d14a7ec8c537a" +"checksum io-surface 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c35a3278fa52fb070fdc874dfd057163e6c21e0a9295f87f54daee9dd5530b43" "checksum iovec 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "29d062ee61fccdf25be172e70f34c9f6efc597e1fb8f6526e8437b2046ab26be" "checksum ipc-channel 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dc12beb3f43e226410d7f26a77aec73efbf0c11875a8131adc09f30a8219f22e" "checksum itoa 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eb2f404fbc66fd9aac13e998248505e7ecb2ad8e44ab6388684c5fb11c6c251c" @@ -3472,7 +3472,7 @@ dependencies = [ "checksum num_cpus 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a18c392466409c50b87369414a2680c93e739aedeb498eb2bff7d7eb569744e2" "checksum objc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "877f30f37acef6749b1841cceab289707f211aecfc756553cd63976190e6cc2e" "checksum odds 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)" = "c3df9b730298cea3a1c3faa90b7e2f9df3a9c400d0936d6015e6165734eefcba" -"checksum offscreen_gl_context 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ac875ea951d7d695a1cc8c370777d6a0e2b7355ca49506034683df09b24b1bc" +"checksum offscreen_gl_context 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)" = "21ae15594e1c0b39fd4c79d0062b437904a274bed8b5e363e3e3c89312fd50fd" "checksum ogg 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "013b78ceb7fb82555a2f8a95d8e40866fe64a5d15b83c51b3e1fdd40cd903ed3" "checksum ogg_metadata 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1753e64956b3afd900f788bf6d2e9d0986df39168be86f4b47ec2058d0c2f7" "checksum open 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3478ed1686bd1300c8a981a940abc92b06fac9cbef747f4c668d4e032ff7b842" @@ -3521,8 +3521,8 @@ dependencies = [ "checksum servo-fontconfig 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "93f799b649b4a2bf362398910eca35240704c7e765e780349b2bb1070d892262" "checksum servo-fontconfig-sys 4.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a0af4a4d7746467921486e5c5420f815cc016a6bf5574210d8e9c00f4afae224" "checksum servo-freetype-sys 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9232032c2e85118c0282c6562c84cab12316e655491ba0a5d1905b2320060d1b" -"checksum servo-glutin 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "51b682e1eef598db6048b64face7ea79fd55fe70d171cb92d2a44a89db7bdf34" -"checksum servo-skia 0.30000003.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e7107296909e71f69a7e8b95becf3efe3e1838e556430b3efc9dc91aea65ddf2" +"checksum servo-glutin 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17f541bd4b5a709d5133349e731379c6d74c3946f3b509d4fa8204f1833f9067" +"checksum servo-skia 0.30000004.1 (registry+https://github.com/rust-lang/crates.io-index)" = "22ba980da523e91b9d2f7da9fb35f721138a1e604b8d8191e56f403e4760a9e4" "checksum servo-websocket 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a7445fde9aacb9a1f493652ab02ac0fb7a8bfe1e6cd762f7bd44b839a5d5e4c" "checksum sha1 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cc30b1e1e8c40c121ca33b86c23308a090d19974ef001b4bf6e61fd1a0fb095c" "checksum shared_library 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fb04126b6fcfd2710fb5b6d18f4207b6c535f2850a7e1a43bcd526d44f30a79a" @@ -3578,8 +3578,8 @@ dependencies = [ "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "bb08f9e670fab86099470b97cd2b252d6527f0b3cc1401acdb595ffc9dd288ff" "checksum webdriver 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cdc28802daddee94267a657ffeac2593a33881fb7a3a44fedd320b1319efcaf6" -"checksum webrender 0.24.0 (git+https://github.com/servo/webrender)" = "" -"checksum webrender_traits 0.25.0 (git+https://github.com/servo/webrender)" = "" +"checksum webrender 0.25.0 (git+https://github.com/servo/webrender)" = "" +"checksum webrender_traits 0.26.0 (git+https://github.com/servo/webrender)" = "" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum ws 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "04614a58714f3fd4a8b1da4bcae9f031c532d35988c3d39627619248113f8be8" diff --git a/components/canvas/Cargo.toml b/components/canvas/Cargo.toml index bce8baa679c..e905c8fbd14 100644 --- a/components/canvas/Cargo.toml +++ b/components/canvas/Cargo.toml @@ -14,10 +14,10 @@ azure = {git = "https://github.com/servo/rust-azure"} canvas_traits = {path = "../canvas_traits"} cssparser = "0.12" euclid = "0.11" -gleam = "0.2.8" +gleam = "0.4" ipc-channel = "0.7" log = "0.3.5" num-traits = "0.1.32" -offscreen_gl_context = "0.6" +offscreen_gl_context = "0.8" servo_config = {path = "../config"} webrender_traits = {git = "https://github.com/servo/webrender", features = ["ipc"]} diff --git a/components/canvas/webgl_paint_thread.rs b/components/canvas/webgl_paint_thread.rs index 53a3732889f..2894df71a06 100644 --- a/components/canvas/webgl_paint_thread.rs +++ b/components/canvas/webgl_paint_thread.rs @@ -22,17 +22,20 @@ enum GLContextWrapper { impl GLContextWrapper { fn new(size: Size2D, - attributes: GLContextAttributes) -> Result { + attributes: GLContextAttributes, + gl_type: gl::GlType) -> Result { if opts::get().should_use_osmesa() { let ctx = GLContext::::new(size, attributes, ColorAttachmentType::Texture, + gl_type, None); ctx.map(GLContextWrapper::OSMesa) } else { let ctx = GLContext::::new(size, attributes, ColorAttachmentType::Texture, + gl_type, None); ctx.map(GLContextWrapper::Native) } @@ -62,6 +65,17 @@ impl GLContextWrapper { } } + fn gl(&self) -> &gl::Gl { + match *self { + GLContextWrapper::Native(ref ctx) => { + ctx.gl() + } + GLContextWrapper::OSMesa(ref ctx) => { + ctx.gl() + } + } + } + pub fn make_current(&self) { match *self { GLContextWrapper::Native(ref ctx) => { @@ -97,9 +111,10 @@ pub struct WebGLPaintThread { fn create_readback_painter(size: Size2D, attrs: GLContextAttributes, - webrender_api: webrender_traits::RenderApi) + webrender_api: webrender_traits::RenderApi, + gl_type: gl::GlType) -> Result<(WebGLPaintThread, GLLimits), String> { - let context = try!(GLContextWrapper::new(size, attrs)); + let context = try!(GLContextWrapper::new(size, attrs, gl_type)); let limits = context.get_limits(); let image_key = webrender_api.generate_image_key(); let painter = WebGLPaintThread { @@ -113,7 +128,8 @@ fn create_readback_painter(size: Size2D, impl WebGLPaintThread { fn new(size: Size2D, attrs: GLContextAttributes, - webrender_api_sender: webrender_traits::RenderApiSender) + webrender_api_sender: webrender_traits::RenderApiSender, + gl_type: gl::GlType) -> Result<(WebGLPaintThread, GLLimits), String> { let wr_api = webrender_api_sender.create_api(); let device_size = webrender_traits::DeviceIntSize::from_untyped(&size); @@ -127,7 +143,7 @@ impl WebGLPaintThread { }, Err(msg) => { warn!("Initial context creation failed, falling back to readback: {}", msg); - create_readback_painter(size, attrs, wr_api) + create_readback_painter(size, attrs, wr_api, gl_type) } } } @@ -165,7 +181,8 @@ impl WebGLPaintThread { let (sender, receiver) = ipc::channel::().unwrap(); let (result_chan, result_port) = channel(); thread::Builder::new().name("WebGLThread".to_owned()).spawn(move || { - let mut painter = match WebGLPaintThread::new(size, attrs, webrender_api_sender) { + let gl_type = gl::GlType::default(); + let mut painter = match WebGLPaintThread::new(size, attrs, webrender_api_sender, gl_type) { Ok((thread, limits)) => { result_chan.send(Ok(limits)).unwrap(); thread @@ -212,14 +229,14 @@ impl WebGLPaintThread { fn send_data(&mut self, chan: IpcSender) { match self.data { - WebGLPaintTaskData::Readback(_, ref webrender_api, image_key) => { + WebGLPaintTaskData::Readback(ref ctx, ref webrender_api, image_key) => { let width = self.size.width as usize; let height = self.size.height as usize; - let mut pixels = gl::read_pixels(0, 0, - self.size.width as gl::GLsizei, - self.size.height as gl::GLsizei, - gl::RGBA, gl::UNSIGNED_BYTE); + let mut pixels = ctx.gl().read_pixels(0, 0, + self.size.width as gl::GLsizei, + self.size.height as gl::GLsizei, + gl::RGBA, gl::UNSIGNED_BYTE); // flip image vertically (texture is upside down) let orig_pixels = pixels.clone(); let stride = width * 4; @@ -267,7 +284,7 @@ impl WebGLPaintThread { self.size = try!(context.resize(size)); } else { self.size = size; - unsafe { gl::Scissor(0, 0, size.width, size.height); } + context.gl().scissor(0, 0, size.width, size.height); } } WebGLPaintTaskData::WebRender(ref api, id) => { diff --git a/components/compositing/Cargo.toml b/components/compositing/Cargo.toml index 773e92cd0e7..72f31657636 100644 --- a/components/compositing/Cargo.toml +++ b/components/compositing/Cargo.toml @@ -12,7 +12,7 @@ path = "lib.rs" [dependencies] euclid = "0.11" gfx_traits = {path = "../gfx_traits"} -gleam = "0.2.8" +gleam = "0.4" image = "0.12" ipc-channel = "0.7" log = "0.3.5" diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 30abae50c50..f679e3ee1b3 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -14,7 +14,6 @@ use euclid::scale_factor::ScaleFactor; use euclid::size::TypedSize2D; use gfx_traits::{Epoch, ScrollRootId}; use gleam::gl; -use gleam::gl::types::{GLint, GLsizei}; use image::{DynamicImage, ImageFormat, RgbImage}; use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory}; use msg::constellation_msg::{Key, KeyModifiers, KeyState, CONTROL}; @@ -208,6 +207,9 @@ pub struct IOCompositor { /// The webrender interface, if enabled. webrender_api: webrender_traits::RenderApi, + + /// GL functions interface (may be GL or GLES) + gl: Rc, } #[derive(Copy, Clone)] @@ -291,34 +293,34 @@ impl RenderTargetInfo { } } -fn initialize_png(width: usize, height: usize) -> RenderTargetInfo { - let framebuffer_ids = gl::gen_framebuffers(1); - gl::bind_framebuffer(gl::FRAMEBUFFER, framebuffer_ids[0]); +fn initialize_png(gl: &gl::Gl, width: usize, height: usize) -> RenderTargetInfo { + let framebuffer_ids = gl.gen_framebuffers(1); + gl.bind_framebuffer(gl::FRAMEBUFFER, framebuffer_ids[0]); - let texture_ids = gl::gen_textures(1); - gl::bind_texture(gl::TEXTURE_2D, texture_ids[0]); + let texture_ids = gl.gen_textures(1); + gl.bind_texture(gl::TEXTURE_2D, texture_ids[0]); - gl::tex_image_2d(gl::TEXTURE_2D, 0, gl::RGB as GLint, width as GLsizei, - height as GLsizei, 0, gl::RGB, gl::UNSIGNED_BYTE, None); - gl::tex_parameter_i(gl::TEXTURE_2D, gl::TEXTURE_MAG_FILTER, gl::NEAREST as GLint); - gl::tex_parameter_i(gl::TEXTURE_2D, gl::TEXTURE_MIN_FILTER, gl::NEAREST as GLint); + gl.tex_image_2d(gl::TEXTURE_2D, 0, gl::RGB as gl::GLint, width as gl::GLsizei, + height as gl::GLsizei, 0, gl::RGB, gl::UNSIGNED_BYTE, None); + gl.tex_parameter_i(gl::TEXTURE_2D, gl::TEXTURE_MAG_FILTER, gl::NEAREST as gl::GLint); + gl.tex_parameter_i(gl::TEXTURE_2D, gl::TEXTURE_MIN_FILTER, gl::NEAREST as gl::GLint); - gl::framebuffer_texture_2d(gl::FRAMEBUFFER, gl::COLOR_ATTACHMENT0, gl::TEXTURE_2D, - texture_ids[0], 0); + gl.framebuffer_texture_2d(gl::FRAMEBUFFER, gl::COLOR_ATTACHMENT0, gl::TEXTURE_2D, + texture_ids[0], 0); - gl::bind_texture(gl::TEXTURE_2D, 0); + gl.bind_texture(gl::TEXTURE_2D, 0); - let renderbuffer_ids = gl::gen_renderbuffers(1); + let renderbuffer_ids = gl.gen_renderbuffers(1); let depth_rb = renderbuffer_ids[0]; - gl::bind_renderbuffer(gl::RENDERBUFFER, depth_rb); - gl::renderbuffer_storage(gl::RENDERBUFFER, - gl::DEPTH_COMPONENT24, - width as gl::GLsizei, - height as gl::GLsizei); - gl::framebuffer_renderbuffer(gl::FRAMEBUFFER, - gl::DEPTH_ATTACHMENT, - gl::RENDERBUFFER, - depth_rb); + gl.bind_renderbuffer(gl::RENDERBUFFER, depth_rb); + gl.renderbuffer_storage(gl::RENDERBUFFER, + gl::DEPTH_COMPONENT24, + width as gl::GLsizei, + height as gl::GLsizei); + gl.framebuffer_renderbuffer(gl::FRAMEBUFFER, + gl::DEPTH_ATTACHMENT, + gl::RENDERBUFFER, + depth_rb); RenderTargetInfo { framebuffer_ids: framebuffer_ids, @@ -373,6 +375,7 @@ impl IOCompositor { }; IOCompositor { + gl: window.gl(), window: window, port: state.receiver, root_pipeline: None, @@ -1532,7 +1535,7 @@ impl IOCompositor { let render_target_info = match target { CompositeTarget::Window => RenderTargetInfo::empty(), - _ => initialize_png(width, height) + _ => initialize_png(&*self.gl, width, height) }; profile(ProfilerCategory::Compositing, None, self.time_profiler_chan.clone(), || { @@ -1596,16 +1599,16 @@ impl IOCompositor { width: usize, height: usize) -> RgbImage { - let mut pixels = gl::read_pixels(0, 0, - width as gl::GLsizei, - height as gl::GLsizei, - gl::RGB, gl::UNSIGNED_BYTE); + let mut pixels = self.gl.read_pixels(0, 0, + width as gl::GLsizei, + height as gl::GLsizei, + gl::RGB, gl::UNSIGNED_BYTE); - gl::bind_framebuffer(gl::FRAMEBUFFER, 0); + self.gl.bind_framebuffer(gl::FRAMEBUFFER, 0); - gl::delete_buffers(&render_target_info.texture_ids); - gl::delete_renderbuffers(&render_target_info.renderbuffer_ids); - gl::delete_frame_buffers(&render_target_info.framebuffer_ids); + self.gl.delete_buffers(&render_target_info.texture_ids); + self.gl.delete_renderbuffers(&render_target_info.renderbuffer_ids); + self.gl.delete_framebuffers(&render_target_info.framebuffer_ids); // flip image vertically (texture is upside down) let orig_pixels = pixels.clone(); diff --git a/components/compositing/windowing.rs b/components/compositing/windowing.rs index 8c0c3b922eb..08d78e48453 100644 --- a/components/compositing/windowing.rs +++ b/components/compositing/windowing.rs @@ -10,12 +10,14 @@ use euclid::point::TypedPoint2D; use euclid::rect::TypedRect; use euclid::scale_factor::ScaleFactor; use euclid::size::TypedSize2D; +use gleam::gl; use msg::constellation_msg::{Key, KeyModifiers, KeyState}; use net_traits::net_error_list::NetError; use script_traits::{DevicePixel, MouseButton, TouchEventType, TouchId, TouchpadPressurePhase}; use servo_geometry::DeviceIndependentPixel; use servo_url::ServoUrl; use std::fmt::{Debug, Error, Formatter}; +use std::rc::Rc; use style_traits::cursor::Cursor; use webrender_traits::ScrollLocation; @@ -168,4 +170,7 @@ pub trait WindowMethods { /// Add a favicon fn set_favicon(&self, url: ServoUrl); + + /// Return the GL function pointer trait. + fn gl(&self) -> Rc; } diff --git a/components/constellation/Cargo.toml b/components/constellation/Cargo.toml index e694998403a..f20f12f6aae 100644 --- a/components/constellation/Cargo.toml +++ b/components/constellation/Cargo.toml @@ -25,7 +25,7 @@ layout_traits = {path = "../layout_traits"} log = "0.3.5" msg = {path = "../msg"} net_traits = {path = "../net_traits"} -offscreen_gl_context = "0.6" +offscreen_gl_context = "0.8" profile_traits = {path = "../profile_traits"} script_traits = {path = "../script_traits"} serde = "0.9" diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index 88aeef2e5e0..1191723c1ac 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -60,7 +60,7 @@ mime_guess = "1.8.0" msg = {path = "../msg"} net_traits = {path = "../net_traits"} num-traits = "0.1.32" -offscreen_gl_context = "0.6" +offscreen_gl_context = "0.8" open = "1.1.1" parking_lot = "0.3" phf = "0.7.18" diff --git a/components/script_traits/Cargo.toml b/components/script_traits/Cargo.toml index 3986d56c120..60c8e82a5cb 100644 --- a/components/script_traits/Cargo.toml +++ b/components/script_traits/Cargo.toml @@ -25,7 +25,7 @@ ipc-channel = "0.7" libc = "0.2" msg = {path = "../msg"} net_traits = {path = "../net_traits"} -offscreen_gl_context = "0.6" +offscreen_gl_context = "0.8" profile_traits = {path = "../profile_traits"} rustc-serialize = "0.3.4" serde = "0.9" diff --git a/components/servo/Cargo.toml b/components/servo/Cargo.toml index b857b2a3935..33f091c2a43 100644 --- a/components/servo/Cargo.toml +++ b/components/servo/Cargo.toml @@ -32,7 +32,7 @@ devtools_traits = {path = "../devtools_traits"} env_logger = "0.4" euclid = "0.11" gfx = {path = "../gfx"} -gleam = "0.2" +gleam = "0.4" ipc-channel = "0.7" layout_thread = {path = "../layout_thread"} log = "0.3" diff --git a/components/servo/lib.rs b/components/servo/lib.rs index 0b94ed696b2..a493c62fdb6 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -177,7 +177,7 @@ impl Browser where Window: WindowMethods + 'static { let framebuffer_size = webrender_traits::DeviceUintSize::new(framebuffer_size.width, framebuffer_size.height); - webrender::Renderer::new(webrender::RendererOptions { + webrender::Renderer::new(window.gl(), webrender::RendererOptions { device_pixel_ratio: device_pixel_ratio, resource_override_path: Some(resource_path), enable_aa: opts.enable_text_antialiasing, diff --git a/ports/cef/Cargo.toml b/ports/cef/Cargo.toml index 68c565a2a37..97329e847dd 100644 --- a/ports/cef/Cargo.toml +++ b/ports/cef/Cargo.toml @@ -21,7 +21,7 @@ debugmozjs = ["libservo/debugmozjs"] compositing = {path = "../../components/compositing"} devtools = {path = "../../components/devtools"} euclid = "0.11" -gleam = "0.2.8" +gleam = "0.4" glutin_app = {path = "../glutin"} libc = "0.2" libservo = {path = "../../components/servo"} diff --git a/ports/cef/window.rs b/ports/cef/window.rs index 1e96b828c24..1e31df25a8e 100644 --- a/ports/cef/window.rs +++ b/ports/cef/window.rs @@ -48,47 +48,49 @@ pub static mut DISPLAY: *mut c_void = 0 as *mut c_void; #[derive(Clone)] pub struct Window { cef_browser: RefCell>, - size: TypedSize2D + size: TypedSize2D, + gl: Rc, } #[cfg(target_os="macos")] -fn load_gl() { +fn load_gl() -> Rc { const RTLD_DEFAULT: *mut c_void = (-2isize) as usize as *mut c_void; extern { fn dlsym(handle: *mut c_void, symbol: *const c_char) -> *mut c_void; } - gl::load_with(|s| { - unsafe { + unsafe { + gl::GlFns::load_with(|s| { let c_str = CString::new(s).unwrap(); dlsym(RTLD_DEFAULT, c_str.as_ptr()) as *const c_void - } - }); + }) + } } #[cfg(target_os="linux")] -fn load_gl() { +fn load_gl() -> Rc { extern { fn glXGetProcAddress(symbol: *const c_char) -> *mut c_void; } - gl::load_with(|s| { - unsafe { + unsafe { + gl::GlFns::load_with(|s| { let c_str = CString::new(s).unwrap(); glXGetProcAddress(c_str.as_ptr()) as *const c_void - } - }); + }) + } } impl Window { /// Creates a new window. pub fn new(width: u32, height: u32) -> Rc { - load_gl(); + let gl = load_gl(); Rc::new(Window { cef_browser: RefCell::new(None), - size: TypedSize2D::new(width, height) + size: TypedSize2D::new(width, height), + gl: gl, }) } @@ -170,6 +172,10 @@ impl Window { } impl WindowMethods for Window { + fn gl(&self) -> Rc { + self.gl.clone() + } + fn framebuffer_size(&self) -> TypedSize2D { let browser = self.cef_browser.borrow(); match *browser { diff --git a/ports/glutin/Cargo.toml b/ports/glutin/Cargo.toml index 2f1a8d6cc0d..19b27bf478f 100644 --- a/ports/glutin/Cargo.toml +++ b/ports/glutin/Cargo.toml @@ -12,12 +12,12 @@ path = "lib.rs" bitflags = "0.7" compositing = {path = "../../components/compositing"} euclid = "0.11" -gleam = "0.2.8" +gleam = "0.4" log = "0.3.5" msg = {path = "../../components/msg"} net_traits = {path = "../../components/net_traits"} script_traits = {path = "../../components/script_traits"} -servo-glutin = "0.9" +servo-glutin = "0.10" servo_geometry = {path = "../../components/geometry"} servo_config = {path = "../../components/config"} servo_url = {path = "../../components/url"} diff --git a/ports/glutin/window.rs b/ports/glutin/window.rs index 5f48abef1cd..102c0146a9e 100644 --- a/ports/glutin/window.rs +++ b/ports/glutin/window.rs @@ -191,6 +191,8 @@ pub struct Window { /// The list of keys that have been pressed but not yet released, to allow providing /// the equivalent ReceivedCharacter data as was received for the press event. pressed_key_map: RefCell>, + + gl: Rc, } #[cfg(not(target_os = "windows"))] @@ -259,14 +261,34 @@ impl Window { WindowKind::Window(glutin_window) }; - Window::load_gl_functions(&window_kind); + let gl = match window_kind { + WindowKind::Window(ref window) => { + match gl::GlType::default() { + gl::GlType::Gl => { + unsafe { + gl::GlFns::load_with(|s| window.get_proc_address(s) as *const _) + } + } + gl::GlType::Gles => { + unsafe { + gl::GlesFns::load_with(|s| window.get_proc_address(s) as *const _) + } + } + } + } + WindowKind::Headless(..) => { + unsafe { + gl::GlFns::load_with(|s| HeadlessContext::get_proc_address(s)) + } + } + }; if opts::get().headless { // Print some information about the headless renderer that // can be useful in diagnosing CI failures on build machines. - println!("{}", gl::get_string(gl::VENDOR)); - println!("{}", gl::get_string(gl::RENDERER)); - println!("{}", gl::get_string(gl::VERSION)); + println!("{}", gl.get_string(gl::VENDOR)); + println!("{}", gl.get_string(gl::RENDERER)); + println!("{}", gl.get_string(gl::VERSION)); } let window = Window { @@ -281,11 +303,12 @@ impl Window { pending_key_event_char: Cell::new(None), pressed_key_map: RefCell::new(vec![]), + gl: gl.clone(), }; - gl::clear_color(0.6, 0.6, 0.6, 1.0); - gl::clear(gl::COLOR_BUFFER_BIT); - gl::finish(); + gl.clear_color(0.6, 0.6, 0.6, 1.0); + gl.clear(gl::COLOR_BUFFER_BIT); + gl.finish(); window.present(); Rc::new(window) @@ -321,24 +344,6 @@ impl Window { GlRequest::Specific(Api::OpenGlEs, (3, 0)) } - #[cfg(not(target_os = "android"))] - fn load_gl_functions(window_kind: &WindowKind) { - match window_kind { - &WindowKind::Window(ref window) => { - gl::load_with(|s| window.get_proc_address(s) as *const c_void); - } - &WindowKind::Headless(..) => { - gl::load_with(|s| { - HeadlessContext::get_proc_address(s) - }); - } - } - } - - #[cfg(target_os = "android")] - fn load_gl_functions(_: &WindowKind) { - } - fn handle_window_event(&self, event: glutin::Event) -> bool { match event { Event::ReceivedCharacter(ch) => { @@ -784,6 +789,10 @@ fn create_window_proxy(window: &Window) -> Option { } impl WindowMethods for Window { + fn gl(&self) -> Rc { + self.gl.clone() + } + fn framebuffer_size(&self) -> TypedSize2D { match self.kind { WindowKind::Window(ref window) => { diff --git a/tests/wpt/metadata-css/compositing-1_dev/html/mix-blend-mode-intermediate-element-overflow-hidden-and-border-radius.htm.ini b/tests/wpt/metadata-css/compositing-1_dev/html/mix-blend-mode-intermediate-element-overflow-hidden-and-border-radius.htm.ini new file mode 100644 index 00000000000..e81798facf7 --- /dev/null +++ b/tests/wpt/metadata-css/compositing-1_dev/html/mix-blend-mode-intermediate-element-overflow-hidden-and-border-radius.htm.ini @@ -0,0 +1,5 @@ +[mix-blend-mode-intermediate-element-overflow-hidden-and-border-radius.htm] + type: reftest + expected: + if os == "linux": FAIL + diff --git a/tests/wpt/metadata-css/css-transforms-1_dev/html/css-rotate-2d-3d-001.htm.ini b/tests/wpt/metadata-css/css-transforms-1_dev/html/css-rotate-2d-3d-001.htm.ini deleted file mode 100644 index 3802e1ecaf9..00000000000 --- a/tests/wpt/metadata-css/css-transforms-1_dev/html/css-rotate-2d-3d-001.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[css-rotate-2d-3d-001.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-transforms-1_dev/html/regions-transforms-005.htm.ini b/tests/wpt/metadata-css/css-transforms-1_dev/html/regions-transforms-005.htm.ini index a098dab2c84..434053996e6 100644 --- a/tests/wpt/metadata-css/css-transforms-1_dev/html/regions-transforms-005.htm.ini +++ b/tests/wpt/metadata-css/css-transforms-1_dev/html/regions-transforms-005.htm.ini @@ -1,4 +1,3 @@ [regions-transforms-005.htm] type: reftest - expected: - if os == "linux": FAIL + expected: FAIL diff --git a/tests/wpt/metadata-css/css-transforms-1_dev/html/transform-3d-rotateY-stair-above-001.htm.ini b/tests/wpt/metadata-css/css-transforms-1_dev/html/transform-3d-rotateY-stair-above-001.htm.ini deleted file mode 100644 index ee3382ef48c..00000000000 --- a/tests/wpt/metadata-css/css-transforms-1_dev/html/transform-3d-rotateY-stair-above-001.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[transform-3d-rotateY-stair-above-001.htm] - type: reftest - expected: FAIL