Bug 1464060: Unify DoGetStyle* implementations. r?xidorn draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 25 May 2018 21:06:52 +0200
changeset 800038 bd3d8afc6cc5a8b14064c1a6154d633d6c7edca7
parent 800037 ab2a5d22c8c579660ba1780c75707faa2117a074
push id111238
push userbmo:emilio@crisal.io
push dateFri, 25 May 2018 19:10:29 +0000
reviewersxidorn
bugs1464060
milestone62.0a1
Bug 1464060: Unify DoGetStyle* implementations. r?xidorn Both branches are equal now. MozReview-Commit-ID: 2XmYvGC0ETx
layout/style/ComputedStyleInlines.h
--- a/layout/style/ComputedStyleInlines.h
+++ b/layout/style/ComputedStyleInlines.h
@@ -34,56 +34,37 @@ ComputedStyle::ThreadsafeStyle##name_() 
 }                                                           \
 const nsStyle##name_ * ComputedStyle::PeekStyle##name_() {  \
   return DoGetStyle##name_<false>();                        \
 }
 #include "nsStyleStructList.h"
 #undef STYLE_STRUCT
 
 // Helper functions for GetStyle* and PeekStyle*
-#define STYLE_STRUCT_INHERITED(name_)                                       \
+#define STYLE_STRUCT(name_)                                                 \
 template<bool aComputeData>                                                 \
-const nsStyle##name_* ComputedStyle::DoGetStyle##name_() {                 \
+const nsStyle##name_* ComputedStyle::DoGetStyle##name_() {                  \
   const auto kStructID = StyleStructID::name_;                              \
   const bool needToCompute = !HasRequestedStruct(kStructID);                \
   if (!aComputeData && needToCompute) {                                     \
     return nullptr;                                                         \
   }                                                                         \
   const nsStyle##name_* data = ComputedData()->GetStyle##name_();           \
   /* perform any remaining main thread work on the struct */                \
   if (needToCompute) {                                                      \
     MOZ_ASSERT(NS_IsMainThread());                                          \
     MOZ_ASSERT(!mozilla::IsInServoTraversal());                             \
     const_cast<nsStyle##name_*>(data)->FinishStyle(mPresContext, nullptr);  \
     /* the ComputedStyle owns the struct */                                 \
     SetRequestedStruct(kStructID);                                          \
   }                                                                         \
   return data;                                                              \
 }
-
-#define STYLE_STRUCT_RESET(name_)                                           \
-template<bool aComputeData>                                                 \
-const nsStyle##name_ * ComputedStyle::DoGetStyle##name_() {                 \
-  const auto kStructID = StyleStructID::name_;                              \
-  const bool needToCompute = !HasRequestedStruct(kStructID);                \
-  if (!aComputeData && needToCompute) {                                     \
-    return nullptr;                                                         \
-  }                                                                         \
-  const nsStyle##name_* data = ComputedData()->GetStyle##name_();           \
-  /* perform any remaining main thread work on the struct */                \
-  if (needToCompute) {                                                      \
-    const_cast<nsStyle##name_*>(data)->FinishStyle(mPresContext, nullptr);  \
-    /* the ComputedStyle owns the struct */                                 \
-    SetRequestedStruct(kStructID);                                          \
-  }                                                                         \
-  return data;                                                              \
-}
 #include "nsStyleStructList.h"
-#undef STYLE_STRUCT_RESET
-#undef STYLE_STRUCT_INHERITED
+#undef STYLE_STRUCT
 
 void
 ComputedStyle::StartBackgroundImageLoads()
 {
   // Just get our background struct; that should do the trick
   StyleBackground();
 }