Bug 1529422 - Part 3: Make sure the callers of ActivityTracker takes individual transforms into account. r=mstange
authorBoris Chiou <boris.chiou@gmail.com>
Fri, 22 Feb 2019 23:36:19 +0000
changeset 518639 4bbab76b6ec81298f40dc08e07d60197e9f26171
parent 518638 a92c6acc3a946e43d935d6dffc4cf4314667706b
child 518640 2a82b9a67559d93cd57ff9738b782fb43717afd1
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1529422
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1529422 - Part 3: Make sure the callers of ActivityTracker takes individual transforms into account. r=mstange Add comments and property check for the caller of ActivityTracker. Depends on D19525 Differential Revision: https://phabricator.services.mozilla.com/D19632
layout/base/RestyleManager.cpp
layout/style/nsDOMCSSAttrDeclaration.cpp
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -1078,16 +1078,19 @@ static void DoApplyRenderingChangeToTree
       if (nsSVGIntegrationUtils::UsingEffectsForFrame(aFrame)) {
         // SVG effects paints the opacity without using
         // nsDisplayOpacity. We need to invalidate manually.
         aFrame->InvalidateFrameSubtree();
       }
     }
     if ((aChange & nsChangeHint_UpdateTransformLayer) &&
         aFrame->IsTransformed()) {
+      // Note: All the transform-like properties should map to the same
+      // layer activity index, so does the restyle count. Therefore, using
+      // eCSSProperty_transform should be fine.
       ActiveLayerTracker::NotifyRestyle(aFrame, eCSSProperty_transform);
       // If we're not already going to do an invalidating paint, see
       // if we can get away with only updating the transform on a
       // layer for this frame, and not scheduling an invalidating
       // paint.
       if (!needInvalidatingPaint) {
         nsDisplayItem::Layer* layer;
         needInvalidatingPaint |= !aFrame->TryUpdateTransformOnly(&layer);
@@ -1102,16 +1105,19 @@ static void DoApplyRenderingChangeToTree
       }
     }
     if (aChange & nsChangeHint_ChildrenOnlyTransform) {
       needInvalidatingPaint = true;
       nsIFrame* childFrame = GetFrameForChildrenOnlyTransformHint(aFrame)
                                  ->PrincipalChildList()
                                  .FirstChild();
       for (; childFrame; childFrame = childFrame->GetNextSibling()) {
+        // Note: All the transform-like properties should map to the same
+        // layer activity index, so does the restyle count. Therefore, using
+        // eCSSProperty_transform should be fine.
         ActiveLayerTracker::NotifyRestyle(childFrame, eCSSProperty_transform);
       }
     }
     if (aChange & nsChangeHint_SchedulePaint) {
       needInvalidatingPaint = true;
     }
     aFrame->SchedulePaint(needInvalidatingPaint
                               ? nsIFrame::PAINT_DEFAULT
--- a/layout/style/nsDOMCSSAttrDeclaration.cpp
+++ b/layout/style/nsDOMCSSAttrDeclaration.cpp
@@ -153,24 +153,27 @@ nsresult nsDOMCSSAttributeDeclaration::S
     SetCSSDeclaration(decl, nullptr);
   }
   return NS_OK;
 }
 
 nsresult nsDOMCSSAttributeDeclaration::SetPropertyValue(
     const nsCSSPropertyID aPropID, const nsAString& aValue,
     nsIPrincipal* aSubjectPrincipal) {
-  // Scripted modifications to style.opacity or style.transform
+  // Scripted modifications to style.opacity or style.transform (or other
+  // transform-like properties, e.g. style.translate, style.rotate, style.scale)
   // could immediately force us into the animated state if heuristics suggest
   // this is scripted animation.
   // FIXME: This is missing the margin shorthand and the logical versions of
   // the margin properties, see bug 1266287.
   if (aPropID == eCSSProperty_opacity || aPropID == eCSSProperty_transform ||
-      aPropID == eCSSProperty_left || aPropID == eCSSProperty_top ||
-      aPropID == eCSSProperty_right || aPropID == eCSSProperty_bottom ||
+      aPropID == eCSSProperty_translate || aPropID == eCSSProperty_rotate ||
+      aPropID == eCSSProperty_scale || aPropID == eCSSProperty_left ||
+      aPropID == eCSSProperty_top || aPropID == eCSSProperty_right ||
+      aPropID == eCSSProperty_bottom ||
       aPropID == eCSSProperty_background_position_x ||
       aPropID == eCSSProperty_background_position_y ||
       aPropID == eCSSProperty_background_position) {
     nsIFrame* frame = mElement->GetPrimaryFrame();
     if (frame) {
       ActiveLayerTracker::NotifyInlineStyleRuleModified(frame, aPropID, aValue,
                                                         this);
     }