Bug 1454830 part 3 - Add CAN_ANIMATE_ON_COMPOSITOR in Servo side and propagate it to ServoCSSPropList.h. r?emilio draft
authorXidorn Quan <me@upsuper.org>
Fri, 20 Apr 2018 20:32:57 +1000
changeset 785618 d1161498b74f5fd4e68a867f64129f43f8d47c53
parent 785617 5dedc67687a80df221ecbdc53a75068d98b6f813
child 785619 9aba9924491596f6ded9d4ee9a3ac1485a7ac9f9
push id107275
push userxquan@mozilla.com
push dateFri, 20 Apr 2018 13:09:38 +0000
reviewersemilio
bugs1454830
milestone61.0a1
Bug 1454830 part 3 - Add CAN_ANIMATE_ON_COMPOSITOR in Servo side and propagate it to ServoCSSPropList.h. r?emilio MozReview-Commit-ID: 2OBCliDY02g
layout/style/ServoCSSPropList.mako.py
layout/style/nsCSSProps.cpp
servo/components/style/properties/longhand/box.mako.rs
servo/components/style/properties/longhand/effects.mako.rs
servo/components/style/properties/properties.mako.rs
--- a/layout/style/ServoCSSPropList.mako.py
+++ b/layout/style/ServoCSSPropList.mako.py
@@ -34,16 +34,18 @@ def flags(prop):
     elif prop.explicitly_enabled_in_ua_sheets():
         result.append("CSS_PROPERTY_ENABLED_IN_UA_SHEETS")
     if is_internal(prop):
         result.append("CSS_PROPERTY_INTERNAL")
     if prop.enabled_in == "":
         result.append("CSS_PROPERTY_PARSE_INACCESSIBLE")
     if "GETCS_NEEDS_LAYOUT_FLUSH" in prop.flags:
         result.append("CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH")
+    if "CAN_ANIMATE_ON_COMPOSITOR" in prop.flags:
+        result.append("CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR")
     return ", ".join('"{}"'.format(flag) for flag in result)
 
 def pref(prop):
     if prop.gecko_pref:
         return '"' + prop.gecko_pref + '"'
     return '""'
 %>
 
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -180,17 +180,18 @@ CheckServoCSSPropList()
 #include "mozilla/ServoCSSPropList.h"
 #undef CSS_PROP_ALIAS
 #undef CSS_PROP_SHORTHAND
 #undef CSS_PROP_LONGHAND
   };
 
   const uint32_t kServoFlags =
     CSS_PROPERTY_ENABLED_MASK | CSS_PROPERTY_INTERNAL |
-    CSS_PROPERTY_PARSE_INACCESSIBLE | CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH;
+    CSS_PROPERTY_PARSE_INACCESSIBLE | CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH |
+    CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR;
   bool mismatch = false;
   for (size_t i = 0; i < eCSSProperty_COUNT_with_aliases; i++) {
     auto& geckoData = sGeckoProps[i];
     auto& servoData = sServoProps[i];
     const char* name = nsCSSProps::GetStringValue(geckoData.mID).get();
     if (geckoData.mID != servoData.mID) {
       printf_stderr("Order mismatches: gecko: %s, servo: %s\n",
                     name, nsCSSProps::GetStringValue(servoData.mID).get());
--- a/servo/components/style/properties/longhand/box.mako.rs
+++ b/servo/components/style/properties/longhand/box.mako.rs
@@ -405,17 +405,18 @@
 
 ${helpers.predefined_type(
     "transform",
     "Transform",
     "generics::transform::Transform::none()",
     extra_prefixes=transform_extra_prefixes,
     animation_value_type="ComputedValue",
     gecko_ffi_name="mSpecifiedTransform",
-    flags="CREATES_STACKING_CONTEXT FIXPOS_CB GETCS_NEEDS_LAYOUT_FLUSH",
+    flags="CREATES_STACKING_CONTEXT FIXPOS_CB \
+           GETCS_NEEDS_LAYOUT_FLUSH CAN_ANIMATE_ON_COMPOSITOR",
     spec="https://drafts.csswg.org/css-transforms/#propdef-transform",
     servo_restyle_damage="reflow_out_of_flow"
 )}
 
 ${helpers.predefined_type("rotate", "Rotate",
                           "generics::transform::Rotate::None",
                           animation_value_type="ComputedValue",
                           boxed=True,
--- a/servo/components/style/properties/longhand/effects.mako.rs
+++ b/servo/components/style/properties/longhand/effects.mako.rs
@@ -2,23 +2,26 @@
  * 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/. */
 
 <%namespace name="helpers" file="/helpers.mako.rs" />
 
 // Box-shadow, etc.
 <% data.new_style_struct("Effects", inherited=False) %>
 
-${helpers.predefined_type("opacity",
-                          "Opacity",
-                          "1.0",
-                          animation_value_type="ComputedValue",
-                          flags="CREATES_STACKING_CONTEXT APPLIES_TO_PLACEHOLDER",
-                          spec="https://drafts.csswg.org/css-color/#opacity",
-                          servo_restyle_damage = "reflow_out_of_flow")}
+${helpers.predefined_type(
+    "opacity",
+    "Opacity",
+    "1.0",
+    animation_value_type="ComputedValue",
+    flags="CREATES_STACKING_CONTEXT APPLIES_TO_PLACEHOLDER \
+           CAN_ANIMATE_ON_COMPOSITOR",
+    spec="https://drafts.csswg.org/css-color/#opacity",
+    servo_restyle_damage = "reflow_out_of_flow"
+)}
 
 ${helpers.predefined_type(
     "box-shadow",
     "BoxShadow",
     None,
     vector=True,
     animation_value_type="AnimatedBoxShadowList",
     extra_prefixes="webkit",
--- a/servo/components/style/properties/properties.mako.rs
+++ b/servo/components/style/properties/properties.mako.rs
@@ -783,16 +783,18 @@ bitflags! {
         const APPLIES_TO_PLACEHOLDER = 1 << 5;
 
         /* The following flags are currently not used in Rust code, they
          * only need to be listed in corresponding properties so that
          * they can be checked in the C++ side via ServoCSSPropList.h. */
         /// This property's getComputedStyle implementation requires layout
         /// to be flushed.
         const GETCS_NEEDS_LAYOUT_FLUSH = 0;
+        /// This property can be animated on the compositor.
+        const CAN_ANIMATE_ON_COMPOSITOR = 0;
     }
 }
 
 /// An identifier for a given longhand property.
 #[derive(Clone, Copy, Eq, Hash, MallocSizeOf, PartialEq)]
 #[repr(u16)]
 pub enum LonghandId {
     % for i, property in enumerate(data.longhands):