mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #10678 - mrobinson:remove-stackinglevel-from-webrender, r=pcwalton
WebRender no longer needs StackingLevel information Since the display list is already sorted before it is passed to WebRender, we don't need to pass the stacking level information any longer. Update webrender, webrender_traits, and gleam. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10678) <!-- Reviewable:end -->
This commit is contained in:
commit
062d933e4f
4 changed files with 57 additions and 102 deletions
|
@ -12,7 +12,7 @@ use azure::azure_hl::Color;
|
|||
use euclid::num::Zero;
|
||||
use euclid::{Point2D, Rect, Size2D};
|
||||
use gfx::display_list::{BorderRadii, BoxShadowClipMode, ClippingRegion};
|
||||
use gfx::display_list::{DisplayItem, DisplayList, DisplayListEntry, DisplayListSection};
|
||||
use gfx::display_list::{DisplayItem, DisplayList};
|
||||
use gfx::display_list::{DisplayListTraversal, GradientStop, StackingContext, StackingContextType};
|
||||
use gfx_traits::ScrollPolicy;
|
||||
use msg::constellation_msg::ConvertPipelineIdToWebRender;
|
||||
|
@ -42,8 +42,6 @@ trait WebRenderStackingContextConverter {
|
|||
builder: &mut webrender_traits::DisplayListBuilder,
|
||||
frame_builder: &mut WebRenderFrameBuilder,
|
||||
force_positioned_stacking_level: bool);
|
||||
|
||||
fn web_render_stacking_level(&self) -> webrender_traits::StackingLevel;
|
||||
}
|
||||
|
||||
pub trait WebRenderDisplayListConverter {
|
||||
|
@ -58,28 +56,10 @@ pub trait WebRenderDisplayListConverter {
|
|||
|
||||
trait WebRenderDisplayItemConverter {
|
||||
fn convert_to_webrender(&self,
|
||||
level: webrender_traits::StackingLevel,
|
||||
builder: &mut webrender_traits::DisplayListBuilder,
|
||||
frame_builder: &mut WebRenderFrameBuilder);
|
||||
}
|
||||
|
||||
trait WebRenderDisplayListEntryConverter {
|
||||
fn web_render_stacking_level(&self) -> webrender_traits::StackingLevel;
|
||||
}
|
||||
|
||||
impl WebRenderDisplayListEntryConverter for DisplayListEntry {
|
||||
fn web_render_stacking_level(&self) -> webrender_traits::StackingLevel {
|
||||
match self.section {
|
||||
DisplayListSection::BackgroundAndBorders =>
|
||||
webrender_traits::StackingLevel::BackgroundAndBorders,
|
||||
DisplayListSection::BlockBackgroundsAndBorders =>
|
||||
webrender_traits::StackingLevel::BlockBackgroundAndBorders,
|
||||
DisplayListSection::Content => webrender_traits::StackingLevel::Content,
|
||||
DisplayListSection::Outlines => webrender_traits::StackingLevel::Outlines,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
trait ToBorderStyle {
|
||||
fn to_border_style(&self) -> webrender_traits::BorderStyle;
|
||||
}
|
||||
|
@ -281,17 +261,12 @@ impl WebRenderStackingContextConverter for StackingContext {
|
|||
scroll_policy: ScrollPolicy,
|
||||
builder: &mut webrender_traits::DisplayListBuilder,
|
||||
frame_builder: &mut WebRenderFrameBuilder,
|
||||
force_positioned_stacking_level: bool) {
|
||||
_force_positioned_stacking_level: bool) {
|
||||
for child in self.children.iter() {
|
||||
while let Some(item) = traversal.advance(self) {
|
||||
let stacking_level = if force_positioned_stacking_level {
|
||||
webrender_traits::StackingLevel::PositionedContent
|
||||
} else {
|
||||
item.web_render_stacking_level()
|
||||
};
|
||||
item.item.convert_to_webrender(stacking_level, builder, frame_builder);
|
||||
|
||||
item.item.convert_to_webrender(builder, frame_builder);
|
||||
}
|
||||
|
||||
if child.context_type == StackingContextType::Real {
|
||||
let stacking_context_id = child.convert_to_webrender(traversal,
|
||||
api,
|
||||
|
@ -300,8 +275,7 @@ impl WebRenderStackingContextConverter for StackingContext {
|
|||
None,
|
||||
scroll_policy,
|
||||
frame_builder);
|
||||
builder.push_stacking_context(child.web_render_stacking_level(),
|
||||
stacking_context_id);
|
||||
builder.push_stacking_context(stacking_context_id);
|
||||
} else {
|
||||
child.convert_children_to_webrender(traversal,
|
||||
api,
|
||||
|
@ -316,9 +290,7 @@ impl WebRenderStackingContextConverter for StackingContext {
|
|||
}
|
||||
|
||||
while let Some(item) = traversal.advance(self) {
|
||||
item.item.convert_to_webrender(webrender_traits::StackingLevel::PositionedContent,
|
||||
builder,
|
||||
frame_builder);
|
||||
item.item.convert_to_webrender(builder, frame_builder);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -365,14 +337,6 @@ impl WebRenderStackingContextConverter for StackingContext {
|
|||
frame_builder.add_display_list(api, builder.finalize(), &mut sc);
|
||||
frame_builder.add_stacking_context(api, pipeline_id, sc)
|
||||
}
|
||||
|
||||
fn web_render_stacking_level(&self) -> webrender_traits::StackingLevel {
|
||||
match self.context_type {
|
||||
StackingContextType::Real | StackingContextType::PseudoPositioned =>
|
||||
webrender_traits::StackingLevel::PositionedContent,
|
||||
StackingContextType::PseudoFloat => webrender_traits::StackingLevel::Floats,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl WebRenderDisplayListConverter for DisplayList {
|
||||
|
@ -401,15 +365,13 @@ impl WebRenderDisplayListConverter for DisplayList {
|
|||
|
||||
impl WebRenderDisplayItemConverter for DisplayItem {
|
||||
fn convert_to_webrender(&self,
|
||||
level: webrender_traits::StackingLevel,
|
||||
builder: &mut webrender_traits::DisplayListBuilder,
|
||||
frame_builder: &mut WebRenderFrameBuilder) {
|
||||
match *self {
|
||||
DisplayItem::SolidColorClass(ref item) => {
|
||||
let color = item.color.to_colorf();
|
||||
if color.a > 0.0 {
|
||||
builder.push_rect(level,
|
||||
item.base.bounds.to_rectf(),
|
||||
builder.push_rect(item.base.bounds.to_rectf(),
|
||||
item.base.clip.to_clip_region(frame_builder),
|
||||
color);
|
||||
}
|
||||
|
@ -433,8 +395,7 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
|||
}
|
||||
|
||||
if glyphs.len() > 0 {
|
||||
builder.push_text(level,
|
||||
item.base.bounds.to_rectf(),
|
||||
builder.push_text(item.base.bounds.to_rectf(),
|
||||
item.base.clip.to_clip_region(frame_builder),
|
||||
glyphs,
|
||||
item.text_run.font_key.expect("Font not added to webrender!"),
|
||||
|
@ -448,8 +409,7 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
|||
if let Some(id) = item.webrender_image.key {
|
||||
if item.stretch_size.width > Au(0) &&
|
||||
item.stretch_size.height > Au(0) {
|
||||
builder.push_image(level,
|
||||
item.base.bounds.to_rectf(),
|
||||
builder.push_image(item.base.bounds.to_rectf(),
|
||||
item.base.clip.to_clip_region(frame_builder),
|
||||
item.stretch_size.to_sizef(),
|
||||
item.image_rendering.to_image_rendering(),
|
||||
|
@ -458,8 +418,7 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
|||
}
|
||||
}
|
||||
DisplayItem::WebGLClass(ref item) => {
|
||||
builder.push_webgl_canvas(level,
|
||||
item.base.bounds.to_rectf(),
|
||||
builder.push_webgl_canvas(item.base.bounds.to_rectf(),
|
||||
item.base.clip.to_clip_region(frame_builder),
|
||||
item.context_id);
|
||||
}
|
||||
|
@ -486,8 +445,7 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
|||
style: item.style.bottom.to_border_style(),
|
||||
};
|
||||
let radius = item.radius.to_border_radius();
|
||||
builder.push_border(level,
|
||||
rect,
|
||||
builder.push_border(rect,
|
||||
item.base.clip.to_clip_region(frame_builder),
|
||||
left,
|
||||
top,
|
||||
|
@ -503,8 +461,7 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
|||
for stop in &item.stops {
|
||||
stops.push(stop.to_gradient_stop());
|
||||
}
|
||||
builder.push_gradient(level,
|
||||
rect,
|
||||
builder.push_gradient(rect,
|
||||
item.base.clip.to_clip_region(frame_builder),
|
||||
start_point,
|
||||
end_point,
|
||||
|
@ -520,8 +477,7 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
|||
DisplayItem::BoxShadowClass(ref item) => {
|
||||
let rect = item.base.bounds.to_rectf();
|
||||
let box_bounds = item.box_bounds.to_rectf();
|
||||
builder.push_box_shadow(level,
|
||||
rect,
|
||||
builder.push_box_shadow(rect,
|
||||
item.base.clip.to_clip_region(frame_builder),
|
||||
box_bounds,
|
||||
item.offset.to_pointf(),
|
||||
|
@ -534,8 +490,7 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
|||
DisplayItem::IframeClass(ref item) => {
|
||||
let rect = item.base.bounds.to_rectf();
|
||||
let pipeline_id = item.iframe.to_webrender();
|
||||
builder.push_iframe(level,
|
||||
rect,
|
||||
builder.push_iframe(rect,
|
||||
item.base.clip.to_clip_region(frame_builder),
|
||||
pipeline_id);
|
||||
}
|
||||
|
|
28
components/servo/Cargo.lock
generated
28
components/servo/Cargo.lock
generated
|
@ -16,7 +16,7 @@ dependencies = [
|
|||
"gaol 0.0.1 (git+https://github.com/servo/gaol)",
|
||||
"gfx 0.0.1",
|
||||
"gfx_tests 0.0.1",
|
||||
"gleam 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glutin_app 0.0.1",
|
||||
"image 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
|
@ -165,7 +165,7 @@ dependencies = [
|
|||
"canvas_traits 0.0.1",
|
||||
"euclid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gfx_traits 0.0.1",
|
||||
"gleam 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
"layers 0.2.4 (git+https://github.com/servo/rust-layers)",
|
||||
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -214,7 +214,7 @@ name = "cgl"
|
|||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"gleam 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -295,7 +295,7 @@ dependencies = [
|
|||
"gaol 0.0.1 (git+https://github.com/servo/gaol)",
|
||||
"gfx 0.0.1",
|
||||
"gfx_traits 0.0.1",
|
||||
"gleam 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"image 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
"layers 0.2.4 (git+https://github.com/servo/rust-layers)",
|
||||
|
@ -760,7 +760,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gleam"
|
||||
version = "0.2.14"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"gl_generator 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -779,7 +779,7 @@ dependencies = [
|
|||
"cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"compositing 0.0.1",
|
||||
"euclid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"layers 0.2.4 (git+https://github.com/servo/rust-layers)",
|
||||
"msg 0.0.1",
|
||||
"net_traits 0.0.1",
|
||||
|
@ -949,7 +949,7 @@ dependencies = [
|
|||
"cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.2.15 (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.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -1021,7 +1021,7 @@ dependencies = [
|
|||
"cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glx 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1420,7 +1420,7 @@ dependencies = [
|
|||
"core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gl_generator 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1905,7 +1905,7 @@ dependencies = [
|
|||
"cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"expat-sys 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.2.15 (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.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2320,7 +2320,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "webrender"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/webrender#5c5dacdf3a15de92d984e431b5050df0c87224a7"
|
||||
source = "git+https://github.com/servo/webrender#46dd3f0ffe2e3a650171fd651b522ed072ccf799"
|
||||
dependencies = [
|
||||
"app_units 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2329,7 +2329,7 @@ dependencies = [
|
|||
"euclid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"freetype 0.1.0 (git+https://github.com/servo/rust-freetype)",
|
||||
"gleam 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
"lazy_static 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2343,13 +2343,13 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "webrender_traits"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/webrender_traits#227867554a07769ed10ce7cdb7b6dddda4a0a445"
|
||||
source = "git+https://github.com/servo/webrender_traits#69125172bcea93fd79be48d846eae63d50ddc8ea"
|
||||
dependencies = [
|
||||
"app_units 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
"offscreen_gl_context 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue