diff --git a/Cargo.lock b/Cargo.lock index de94136a0a5..875a4854d15 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -283,7 +283,7 @@ dependencies = [ "num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", "offscreen_gl_context 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "servo_config 0.0.1", - "webrender_traits 0.22.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.23.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -297,7 +297,7 @@ dependencies = [ "ipc-channel 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.7 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.7 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.22.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.23.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -418,8 +418,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.21.0 (git+https://github.com/servo/webrender)", - "webrender_traits 0.22.0 (git+https://github.com/servo/webrender)", + "webrender 0.22.1 (git+https://github.com/servo/webrender)", + "webrender_traits 0.23.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -452,7 +452,7 @@ dependencies = [ "servo_remutex 0.0.1", "servo_url 0.0.1", "style_traits 0.0.1", - "webrender_traits 0.22.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.23.1 (git+https://github.com/servo/webrender)", "webvr_traits 0.0.1", ] @@ -707,7 +707,7 @@ dependencies = [ "servo_geometry 0.0.1", "servo_url 0.0.1", "style_traits 0.0.1", - "webrender_traits 0.22.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.23.1 (git+https://github.com/servo/webrender)", "x11 2.12.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -994,7 +994,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.22.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.23.1 (git+https://github.com/servo/webrender)", "xi-unicode 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1073,7 +1073,7 @@ dependencies = [ "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.22.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.23.1 (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)", ] @@ -1375,7 +1375,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.22.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.23.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1415,7 +1415,7 @@ dependencies = [ "servo_geometry 0.0.1", "servo_url 0.0.1", "style 0.0.1", - "webrender_traits 0.22.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.23.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1429,7 +1429,7 @@ dependencies = [ "profile_traits 0.0.1", "script_traits 0.0.1", "servo_url 0.0.1", - "webrender_traits 0.22.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.23.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1514,8 +1514,8 @@ dependencies = [ "style 0.0.1", "style_traits 0.0.1", "webdriver_server 0.0.1", - "webrender 0.21.0 (git+https://github.com/servo/webrender)", - "webrender_traits 0.22.0 (git+https://github.com/servo/webrender)", + "webrender 0.22.1 (git+https://github.com/servo/webrender)", + "webrender_traits 0.23.1 (git+https://github.com/servo/webrender)", "webvr 0.0.1", "webvr_traits 0.0.1", ] @@ -1662,7 +1662,7 @@ dependencies = [ "heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.7 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.7 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.22.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.23.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1701,7 +1701,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.22.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.23.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1760,7 +1760,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.22.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.23.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -2298,7 +2298,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.22.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.23.1 (git+https://github.com/servo/webrender)", "webvr 0.0.1", "webvr_traits 0.0.1", "xml5ever 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3175,8 +3175,8 @@ dependencies = [ [[package]] name = "webrender" -version = "0.21.0" -source = "git+https://github.com/servo/webrender#040805f31650527311c0a0d58ccf9620b0f3eca9" +version = "0.22.1" +source = "git+https://github.com/servo/webrender#68f5b72fb3f871f6930c772c7e2705412512dde2" 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,13 +3198,13 @@ dependencies = [ "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.22.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.23.1 (git+https://github.com/servo/webrender)", ] [[package]] name = "webrender_traits" -version = "0.22.0" -source = "git+https://github.com/servo/webrender#040805f31650527311c0a0d58ccf9620b0f3eca9" +version = "0.23.1" +source = "git+https://github.com/servo/webrender#68f5b72fb3f871f6930c772c7e2705412512dde2" 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)", @@ -3228,7 +3228,7 @@ dependencies = [ "msg 0.0.1", "script_traits 0.0.1", "servo_config 0.0.1", - "webrender_traits 0.22.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.23.1 (git+https://github.com/servo/webrender)", "webvr_traits 0.0.1", ] @@ -3568,8 +3568,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.21.0 (git+https://github.com/servo/webrender)" = "" -"checksum webrender_traits 0.22.0 (git+https://github.com/servo/webrender)" = "" +"checksum webrender 0.22.1 (git+https://github.com/servo/webrender)" = "" +"checksum webrender_traits 0.23.1 (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/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs index d75e46dd382..ac2ad50e1a2 100644 --- a/components/gfx/display_list/mod.rs +++ b/components/gfx/display_list/mod.rs @@ -182,17 +182,25 @@ impl DisplayList { *client_point } else { let point = *translated_point - stacking_context.bounds.origin; - let inv_transform = match stacking_context.transform.inverse() { - Some(transform) => transform, - None => { - // If a transform function causes the current transformation matrix of an object - // to be non-invertible, the object and its content do not get displayed. - return; + + match stacking_context.transform { + Some(transform) => { + let inv_transform = match transform.inverse() { + Some(transform) => transform, + None => { + // If a transform function causes the current transformation matrix of an object + // to be non-invertible, the object and its content do not get displayed. + return; + } + }; + let frac_point = inv_transform.transform_point(&Point2D::new(point.x.to_f32_px(), + point.y.to_f32_px())); + Point2D::new(Au::from_f32_px(frac_point.x), Au::from_f32_px(frac_point.y)) } - }; - let frac_point = inv_transform.transform_point(&Point2D::new(point.x.to_f32_px(), - point.y.to_f32_px())); - Point2D::new(Au::from_f32_px(frac_point.x), Au::from_f32_px(frac_point.y)) + None => { + point + } + } }; } @@ -360,10 +368,10 @@ pub struct StackingContext { pub blend_mode: mix_blend_mode::T, /// A transform to be applied to this stacking context. - pub transform: Matrix4D, + pub transform: Option>, /// The perspective matrix to be applied to children. - pub perspective: Matrix4D, + pub perspective: Option>, /// Whether this stacking context creates a new 3d rendering context. pub establishes_3d_context: bool, @@ -385,8 +393,8 @@ impl StackingContext { z_index: i32, filters: filter::T, blend_mode: mix_blend_mode::T, - transform: Matrix4D, - perspective: Matrix4D, + transform: Option>, + perspective: Option>, establishes_3d_context: bool, scroll_policy: ScrollPolicy, parent_scroll_id: ScrollRootId) @@ -416,8 +424,8 @@ impl StackingContext { 0, filter::T::new(Vec::new()), mix_blend_mode::T::normal, - Matrix4D::identity(), - Matrix4D::identity(), + None, + None, true, ScrollPolicy::Scrollable, ScrollRootId::root()) diff --git a/components/layout/block.rs b/components/layout/block.rs index 5f526e3c09f..e2818e1a7fd 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -31,7 +31,7 @@ use app_units::{Au, MAX_AU}; use context::LayoutContext; use display_list_builder::{BorderPaintingMode, DisplayListBuildState, FragmentDisplayListBuilding}; use display_list_builder::BlockFlowDisplayListBuilding; -use euclid::{Point2D, Rect, Size2D}; +use euclid::{Matrix4D, Point2D, Rect, Size2D}; use floats::{ClearType, FloatKind, Floats, PlacementInfo}; use flow::{self, BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, ForceNonfloatedFlag}; use flow::{BLOCK_POSITION_IS_STATIC, CLEARS_LEFT, CLEARS_RIGHT}; @@ -1811,6 +1811,7 @@ impl BlockFlow { } let transform = match self.fragment .transform_matrix(&stacking_relative_border_box) + .unwrap_or(Matrix4D::identity()) .inverse() { Some(transform) => transform, None => { diff --git a/components/layout/flow.rs b/components/layout/flow.rs index 0ad6540724b..945943a27c5 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -29,7 +29,7 @@ use app_units::Au; use block::{BlockFlow, FormattingContextType}; use context::LayoutContext; use display_list_builder::DisplayListBuildState; -use euclid::{Point2D, Size2D}; +use euclid::{Matrix4D, Point2D, Size2D}; use flex::FlexFlow; use floats::{Floats, SpeculatedFloatPlacement}; use flow_list::{FlowList, MutFlowListIterator}; @@ -272,7 +272,11 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static { // TODO: Take into account 3d transforms, even though it's a fairly // uncommon case. - let transform_2d = self.as_block().fragment.transform_matrix(&position).to_2d(); + let transform_2d = self.as_block() + .fragment + .transform_matrix(&position) + .unwrap_or(Matrix4D::identity()) + .to_2d(); let transformed_overflow = Overflow { paint: f32_rect_to_au_rect(transform_2d.transform_rect( &au_rect_to_f32_rect(overflow.paint))), diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index 9cc0efbce6e..b8d6e12d75d 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -2873,13 +2873,13 @@ impl Fragment { } /// Returns the 4D matrix representing this fragment's transform. - pub fn transform_matrix(&self, stacking_relative_border_box: &Rect) -> Matrix4D { - let mut transform = Matrix4D::identity(); + pub fn transform_matrix(&self, stacking_relative_border_box: &Rect) -> Option> { let operations = match self.style.get_box().transform.0 { - None => return transform, + None => return None, Some(ref operations) => operations, }; + let mut transform = Matrix4D::identity(); let transform_origin = &self.style.get_box().transform_origin; let transform_origin_x = model::specified(transform_origin.horizontal, stacking_relative_border_box.size @@ -2928,11 +2928,11 @@ impl Fragment { transform = transform.pre_mul(&matrix); } - pre_transform.pre_mul(&transform).pre_mul(&post_transform) + Some(pre_transform.pre_mul(&transform).pre_mul(&post_transform)) } /// Returns the 4D matrix representing this fragment's perspective. - pub fn perspective_matrix(&self, stacking_relative_border_box: &Rect) -> Matrix4D { + pub fn perspective_matrix(&self, stacking_relative_border_box: &Rect) -> Option> { match self.style().get_box().perspective { Either::First(length) => { let perspective_origin = self.style().get_box().perspective_origin; @@ -2951,10 +2951,10 @@ impl Fragment { let perspective_matrix = create_perspective_matrix(length); - pre_transform.pre_mul(&perspective_matrix).pre_mul(&post_transform) + Some(pre_transform.pre_mul(&perspective_matrix).pre_mul(&post_transform)) } Either::Second(values::None_) => { - Matrix4D::identity() + None } } } diff --git a/components/layout/webrender_helpers.rs b/components/layout/webrender_helpers.rs index cc32efe0039..d7a3d8c8710 100644 --- a/components/layout/webrender_helpers.rs +++ b/components/layout/webrender_helpers.rs @@ -381,12 +381,19 @@ impl WebRenderDisplayItemConverter for DisplayItem { vec![], None); + let transform = stacking_context.transform.map(|transform| { + LayoutTransform::from_untyped(&transform).into() + }); + let perspective = stacking_context.perspective.map(|perspective| { + LayoutTransform::from_untyped(&perspective) + }); + builder.push_stacking_context(stacking_context.scroll_policy, stacking_context.bounds.to_rectf(), clip, stacking_context.z_index, - LayoutTransform::from_untyped(&stacking_context.transform).into(), - LayoutTransform::from_untyped(&stacking_context.perspective), + transform, + perspective, stacking_context.blend_mode.to_blend_mode(), stacking_context.filters.to_filter_ops()); } diff --git a/tests/wpt/metadata-css/compositing-1_dev/html/mix-blend-mode-parent-element-overflow-scroll.htm.ini b/tests/wpt/metadata-css/compositing-1_dev/html/mix-blend-mode-parent-element-overflow-scroll.htm.ini deleted file mode 100644 index 978aa0d6dea..00000000000 --- a/tests/wpt/metadata-css/compositing-1_dev/html/mix-blend-mode-parent-element-overflow-scroll.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[mix-blend-mode-parent-element-overflow-scroll.htm] - type: reftest - expected: FAIL