Bug 1395227: Stop the cascade when only reset structs change. r=heycam
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 04 Sep 2017 14:50:13 +0200
changeset 428677 adba302ab807e36ee451eb944496b83de55ca053
parent 428676 1e12a866239c8ab6d5ee68c31731d66a54733d81
child 428678 378fb92460390fd280fbac4afdb7b3d91a027d7c
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1395227
milestone57.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 1395227: Stop the cascade when only reset structs change. r=heycam MozReview-Commit-ID: JCZJl2fmtJ9 Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
layout/style/ServoTypes.h
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -381,33 +381,39 @@ CSSPseudoElementType
 Gecko_GetImplementedPseudo(RawGeckoElementBorrowed aElement)
 {
   return aElement->GetPseudoElementType();
 }
 
 uint32_t
 Gecko_CalcStyleDifference(ServoStyleContextBorrowed aOldStyle,
                           ServoStyleContextBorrowed aNewStyle,
-                          uint64_t aOldStyleBits,
-                          bool* aAnyStyleChanged)
+                          bool* aAnyStyleChanged,
+                          bool* aOnlyResetStructsChanged)
 {
   MOZ_ASSERT(aOldStyle);
   MOZ_ASSERT(aNewStyle);
 
-  uint32_t relevantStructs = aOldStyleBits & NS_STYLE_INHERIT_MASK;
-
   uint32_t equalStructs;
   uint32_t samePointerStructs;  // unused
   nsChangeHint result = const_cast<ServoStyleContext*>(aOldStyle)->
     CalcStyleDifference(
       const_cast<ServoStyleContext*>(aNewStyle),
       &equalStructs,
       &samePointerStructs,
-      relevantStructs);
+      NS_STYLE_INHERIT_MASK);
+
   *aAnyStyleChanged = equalStructs != NS_STYLE_INHERIT_MASK;
+
+  const uint32_t kInheritStructsMask =
+    NS_STYLE_INHERIT_MASK & ~NS_STYLE_RESET_STRUCT_MASK;
+
+  *aOnlyResetStructsChanged =
+    (equalStructs & kInheritStructsMask) == kInheritStructsMask;
+
   return result;
 }
 
 const ServoElementSnapshot*
 Gecko_GetElementSnapshot(const ServoElementSnapshotTable* aTable,
                          const Element* aElement)
 {
   MOZ_ASSERT(aTable);
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -388,18 +388,18 @@ void Gecko_NoteAnimationOnlyDirtyElement
 
 // Incremental restyle.
 mozilla::CSSPseudoElementType Gecko_GetImplementedPseudo(RawGeckoElementBorrowed element);
 // We'd like to return `nsChangeHint` here, but bindgen bitfield enums don't
 // work as return values with the Linux 32-bit ABI at the moment because
 // they wrap the value in a struct.
 uint32_t Gecko_CalcStyleDifference(ServoStyleContextBorrowed old_style,
                                    ServoStyleContextBorrowed new_style,
-                                   uint64_t old_style_bits,
-                                   bool* any_style_changed);
+                                   bool* any_style_changed,
+                                   bool* reset_only_changed);
 
 // Get an element snapshot for a given element from the table.
 const ServoElementSnapshot*
 Gecko_GetElementSnapshot(const mozilla::ServoElementSnapshotTable* table,
                          RawGeckoElementBorrowed element);
 
 void Gecko_DropElementSnapshot(ServoElementSnapshotOwned snapshot);
 
--- a/layout/style/ServoTypes.h
+++ b/layout/style/ServoTypes.h
@@ -184,17 +184,17 @@ struct ServoVisitedStyle {
 template <typename T>
 struct ServoRawOffsetArc {
   // Again, a strong reference, but
   // managed by the Rust code
   T* mPtr;
 };
 
 struct ServoComputedValueFlags {
-  uint8_t mFlags;
+  uint16_t mFlags;
 };
 
 #define STYLE_STRUCT(name_, checkdata_cb_) struct Gecko##name_;
 #define STYLE_STRUCT_LIST_IGNORE_VARIABLES
 #include "nsStyleStructList.h"
 #undef STYLE_STRUCT
 #undef STYLE_STRUCT_LIST_IGNORE_VARIABLES