From 396fb62ca89273352caed6d595478bbefac5682a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 11 Mar 2017 02:40:47 +0100 Subject: [PATCH] Bug 1303229: Get the proper viewport size for animations. r=hiro,heycam MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While we're here, don't re-recompute the default computed values, just grab them from the device. MozReview-Commit-ID: GqqnPLIwN2F Signed-off-by: Emilio Cobos Álvarez --- components/style/gecko_bindings/bindings.rs | 3 +-- ports/geckolib/glue.rs | 18 ++++++++---------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/components/style/gecko_bindings/bindings.rs b/components/style/gecko_bindings/bindings.rs index f468ec94ab8..8a38318de01 100644 --- a/components/style/gecko_bindings/bindings.rs +++ b/components/style/gecko_bindings/bindings.rs @@ -1373,8 +1373,7 @@ extern "C" { style: ServoComputedValuesBorrowed, parent_style: ServoComputedValuesBorrowedOrNull, - pres_context: - RawGeckoPresContextBorrowed, + set: RawServoStyleSetBorrowed, result: RawGeckoComputedKeyframeValuesListBorrowedMut); } diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 1326c8d2959..0c85b8a45a7 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -2,12 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use app_units::Au; use atomic_refcell::AtomicRefMut; use cssparser::Parser; use cssparser::ToCss as ParserToCss; use env_logger::LogBuilder; -use euclid::Size2D; use num_cpus; use parking_lot::RwLock; use rayon; @@ -43,7 +41,6 @@ use style::gecko_bindings::bindings::{nsACString, nsAString}; use style::gecko_bindings::bindings::Gecko_AnimationAppendKeyframe; use style::gecko_bindings::bindings::RawGeckoComputedKeyframeValuesListBorrowedMut; use style::gecko_bindings::bindings::RawGeckoElementBorrowed; -use style::gecko_bindings::bindings::RawGeckoPresContextBorrowed; use style::gecko_bindings::bindings::RawServoAnimationValueBorrowed; use style::gecko_bindings::bindings::RawServoAnimationValueStrong; use style::gecko_bindings::bindings::RawServoImportRuleBorrowed; @@ -1333,23 +1330,24 @@ pub extern "C" fn Servo_ResolveStyleLazily(element: RawGeckoElementBorrowed, pub extern "C" fn Servo_GetComputedKeyframeValues(keyframes: RawGeckoKeyframeListBorrowed, style: ServoComputedValuesBorrowed, parent_style: ServoComputedValuesBorrowedOrNull, - pres_context: RawGeckoPresContextBorrowed, + raw_data: RawServoStyleSetBorrowed, computed_keyframes: RawGeckoComputedKeyframeValuesListBorrowedMut) { use style::properties::LonghandIdSet; use style::properties::declaration_block::Importance; use style::values::computed::Context; + let data = PerDocumentStyleData::from_ffi(raw_data).borrow(); let style = ComputedValues::as_arc(&style); let parent_style = parent_style.as_ref().map(|r| &**ComputedValues::as_arc(&r)); - let init = ComputedValues::default_values(pres_context); + + let default_values = data.stylist.device.default_values(); let context = Context { is_root_element: false, - // FIXME (bug 1303229): Use the actual viewport size here. - viewport_size: Size2D::new(Au(0), Au(0)), - inherited_style: parent_style.unwrap_or(&init), - layout_parent_style: parent_style.unwrap_or(&init), + viewport_size: data.stylist.device.au_viewport_size(), + inherited_style: parent_style.unwrap_or(default_values), + layout_parent_style: parent_style.unwrap_or(default_values), style: (**style).clone(), font_metrics_provider: None, }; @@ -1372,7 +1370,7 @@ pub extern "C" fn Servo_GetComputedKeyframeValues(keyframes: RawGeckoKeyframeLis .filter_map(|&(ref decl, imp)| { if imp == Importance::Normal { let property = TransitionProperty::from_declaration(decl); - let animation = AnimationValue::from_declaration(decl, &context, &init); + let animation = AnimationValue::from_declaration(decl, &context, default_values); debug_assert!(property.is_none() == animation.is_none(), "The failure condition of TransitionProperty::from_declaration \ and AnimationValue::from_declaration should be the same");