Bug 1367904 - Part 14: stylo: Remove FFI calls for fetching style structs from ServoComputedValues; r?bholley draft
authorManish Goregaokar <manishearth@gmail.com>
Mon, 17 Jul 2017 11:42:12 -0700
changeset 610221 5f2f442588b4b88435ae442672a48baf72caea62
parent 610220 e29178fa68624d016d4b9b3c899a368ceebb95b6
child 610222 5ad948bcd4ca105845bdb3231612387a36cb9313
push id68805
push userbmo:manishearth@gmail.com
push dateTue, 18 Jul 2017 00:30:54 +0000
reviewersbholley
bugs1367904
milestone56.0a1
Bug 1367904 - Part 14: stylo: Remove FFI calls for fetching style structs from ServoComputedValues; r?bholley MozReview-Commit-ID: 2HrVZl9HZu1
dom/canvas/CanvasRenderingContext2D.cpp
layout/base/ServoRestyleManager.cpp
layout/generic/ViewportFrame.cpp
layout/style/ServoBindingList.h
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
layout/style/ServoStyleContext.h
layout/style/ServoStyleContextInlines.h
layout/style/ServoStyleSet.cpp
layout/style/ServoTypes.h
layout/style/moz.build
layout/style/nsAnimationManager.cpp
layout/style/nsStyleContext.cpp
layout/style/nsStyleContext.h
layout/style/nsStyleContextInlines.h
layout/style/nsTransitionManager.cpp
servo/components/style/gecko/generated/bindings.rs
servo/components/style/gecko/generated/structs_debug.rs
servo/components/style/gecko/generated/structs_release.rs
servo/components/style/properties/gecko.mako.rs
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -3043,17 +3043,17 @@ CanvasRenderingContext2D::ParseFilter(co
     ResolveFilterStyleForServo(aString,
                                parentStyle,
                                presShell,
                                aError);
   if (!computedValues) {
      return false;
   }
 
-  const nsStyleEffects* effects = Servo_GetStyleEffects(computedValues->ComputedValues());
+  const nsStyleEffects* effects = computedValues->ComputedValues()->GetStyleEffects();
   // XXX: This mFilters is a one shot object, we probably could avoid copying.
   aFilterChain = effects->mFilters;
   return true;
 }
 
 void
 CanvasRenderingContext2D::SetFilter(const nsAString& aFilter, ErrorResult& aError)
 {
@@ -3963,17 +3963,17 @@ CanvasRenderingContext2D::SetFontInterna
     computedValues = GetFontStyleForServo(mCanvasElement,
                                           aFont,
                                           presShell,
                                           usedFont,
                                           aError);
     if (!computedValues) {
       return false;
     }
-    fontStyle = Servo_GetStyleFont(computedValues->ComputedValues());
+    fontStyle = computedValues->ComputedValues()->GetStyleFont();
   } else {
     sc = GetFontStyleContext(mCanvasElement,
                              aFont,
                              presShell,
                              usedFont,
                              aError);
     if (!sc) {
       return false;
--- a/layout/base/ServoRestyleManager.cpp
+++ b/layout/base/ServoRestyleManager.cpp
@@ -7,16 +7,17 @@
 #include "mozilla/ServoRestyleManager.h"
 
 #include "mozilla/AutoRestyleTimelineMarker.h"
 #include "mozilla/AutoTimelineMarker.h"
 #include "mozilla/DocumentStyleRootIterator.h"
 #include "mozilla/ServoBindings.h"
 #include "mozilla/ServoStyleSet.h"
 #include "mozilla/ServoStyleContext.h"
+#include "mozilla/ServoStyleContextInlines.h"
 #include "mozilla/Unused.h"
 #include "mozilla/ViewportFrame.h"
 #include "mozilla/dom/ChildIterator.h"
 #include "mozilla/dom/ElementInlines.h"
 #include "nsBlockFrame.h"
 #include "nsBulletFrame.h"
 #include "nsPlaceholderFrame.h"
 #include "nsContentUtils.h"
--- a/layout/generic/ViewportFrame.cpp
+++ b/layout/generic/ViewportFrame.cpp
@@ -14,16 +14,17 @@
 #include "nsGkAtoms.h"
 #include "nsIScrollableFrame.h"
 #include "nsSubDocumentFrame.h"
 #include "nsCanvasFrame.h"
 #include "nsAbsoluteContainingBlock.h"
 #include "GeckoProfiler.h"
 #include "nsIMozBrowserFrame.h"
 #include "nsPlaceholderFrame.h"
+#include "mozilla/ServoStyleContextInlines.h"
 
 using namespace mozilla;
 typedef nsAbsoluteContainingBlock::AbsPosReflowFlags AbsPosReflowFlags;
 
 ViewportFrame*
 NS_NewViewportFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
 {
   return new (aPresShell) ViewportFrame(aContext);
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -582,22 +582,16 @@ SERVO_BINDING_FUNC(Servo_GetCustomProper
 
 SERVO_BINDING_FUNC(Servo_GetCustomPropertiesCount, uint32_t,
                    ServoComputedValuesBorrowed computed_values)
 
 SERVO_BINDING_FUNC(Servo_GetCustomPropertyNameAt, bool,
                    ServoComputedValuesBorrowed, uint32_t index,
                    nsAString* name)
 
-// Style-struct management.
-#define STYLE_STRUCT(name, checkdata_cb)                            \
-  struct nsStyle##name;                                             \
-  SERVO_BINDING_FUNC(Servo_GetStyle##name, const nsStyle##name*,    \
-                     ServoComputedValuesBorrowedOrNull computed_values)
-#include "nsStyleStructList.h"
-#undef STYLE_STRUCT
+SERVO_BINDING_FUNC(Servo_GetEmptyVariables, const nsStyleVariables*)
 
 // AddRef / Release functions
 #define SERVO_ARC_TYPE(name_, type_)                                \
   SERVO_BINDING_FUNC(Servo_##name_##_AddRef, void, type_##Borrowed) \
   SERVO_BINDING_FUNC(Servo_##name_##_Release, void, type_##Borrowed)
 #include "mozilla/ServoArcTypeList.h"
 #undef SERVO_ARC_TYPE
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -222,16 +222,21 @@ Gecko_ServoStyleContext_Init(ServoStyleC
   new (KnownNotNull, aContext) ServoStyleContext(parent, pres, aPseudoTag,
                                                  aPseudoType, ServoComputedValuesForgotten(aValues));
 }
 
 ServoComputedValues::ServoComputedValues(const ServoComputedValuesForgotten aValue) {
   PodAssign(this, aValue.mPtr);
 }
 
+const nsStyleVariables* ServoComputedValues::GetStyleVariables() const
+{
+  return Servo_GetEmptyVariables();
+}
+
 void
 Gecko_ServoStyleContext_Destroy(ServoStyleContext* aContext)
 {
   aContext->~ServoStyleContext();
 }
 
 void
 Gecko_ConstructStyleChildrenIterator(
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -69,16 +69,23 @@ struct nsStyleDisplay;
 class nsXBLBinding;
 
 namespace mozilla {
   #define STYLE_STRUCT(name_, checkdata_cb_) struct Gecko##name_ {nsStyle##name_ gecko;};
   #include "nsStyleStructList.h"
   #undef STYLE_STRUCT
 }
 
+#define STYLE_STRUCT(name_, checkdata_cb_) \
+  const nsStyle##name_* ServoComputedValues::GetStyle##name_() const { return &name_.mPtr->gecko; }
+#define STYLE_STRUCT_LIST_IGNORE_VARIABLES
+#include "nsStyleStructList.h"
+#undef STYLE_STRUCT
+#undef STYLE_STRUCT_LIST_IGNORE_VARIABLES
+
 #define NS_DECL_THREADSAFE_FFI_REFCOUNTING(class_, name_)                     \
   void Gecko_AddRef##name_##ArbitraryThread(class_* aPtr);                    \
   void Gecko_Release##name_##ArbitraryThread(class_* aPtr);
 #define NS_IMPL_THREADSAFE_FFI_REFCOUNTING(class_, name_)                     \
   static_assert(class_::HasThreadSafeRefCnt::value,                           \
                 "NS_DECL_THREADSAFE_FFI_REFCOUNTING can only be used with "   \
                 "classes that have thread-safe refcounting");                 \
   void Gecko_AddRef##name_##ArbitraryThread(class_* aPtr)                     \
--- a/layout/style/ServoStyleContext.h
+++ b/layout/style/ServoStyleContext.h
@@ -34,32 +34,17 @@ public:
   void Release() {
     Servo_StyleContext_Release(this);
   }
 
   /**
    * Makes this context match |aOther| in terms of which style structs have
    * been resolved.
    */
-  void ResolveSameStructsAs(nsPresContext* aPresContext, const ServoStyleContext* aOther) {
-    // Only resolve structs that are not already resolved in this struct.
-    uint64_t ourBits = mBits & NS_STYLE_INHERIT_MASK;
-    uint64_t otherBits = aOther->mBits & NS_STYLE_INHERIT_MASK;
-    uint64_t newBits = otherBits & ~ourBits & NS_STYLE_INHERIT_MASK;
-
-  #define STYLE_STRUCT(name_, checkdata_cb)                                           \
-    if (nsStyle##name_::kHasFinishStyle && newBits & NS_STYLE_INHERIT_BIT(name_)) {   \
-      const nsStyle##name_* data = Servo_GetStyle##name_(ComputedValues());           \
-      const_cast<nsStyle##name_*>(data)->FinishStyle(aPresContext);                   \
-    }
-  #include "nsStyleStructList.h"
-  #undef STYLE_STRUCT
-
-    mBits |= newBits;
-  }
+  inline void ResolveSameStructsAs(nsPresContext* aPresContext, const ServoStyleContext* aOther);
 
 private:
   nsPresContext* mPresContext;
   ServoComputedValues mSource;
 };
 
 }
 
new file mode 100644
--- /dev/null
+++ b/layout/style/ServoStyleContextInlines.h
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * 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/. */
+
+#ifndef mozilla_ContextInlines_h
+#define mozilla_ContextInlines_h
+
+
+#include "nsStyleStruct.h"
+#include "ServoBindings.h"
+#include "mozilla/ServoStyleContext.h"
+
+namespace mozilla {
+
+void
+ServoStyleContext::ResolveSameStructsAs(nsPresContext* aPresContext, const ServoStyleContext* aOther)
+{
+  // Only resolve structs that are not already resolved in this struct.
+  uint64_t ourBits = mBits & NS_STYLE_INHERIT_MASK;
+  uint64_t otherBits = aOther->mBits & NS_STYLE_INHERIT_MASK;
+  uint64_t newBits = otherBits & ~ourBits & NS_STYLE_INHERIT_MASK;
+
+#define STYLE_STRUCT(name_, checkdata_cb)                                           \
+  if (nsStyle##name_::kHasFinishStyle && newBits & NS_STYLE_INHERIT_BIT(name_)) {   \
+    const nsStyle##name_* data = ComputedValues()->GetStyle##name_();               \
+    const_cast<nsStyle##name_*>(data)->FinishStyle(aPresContext);                   \
+  }
+#include "nsStyleStructList.h"
+#undef STYLE_STRUCT
+
+  mBits |= newBits;
+}
+
+} // namespace mozilla
+
+#endif // mozilla_ContextInlines_h
\ No newline at end of file
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -869,18 +869,18 @@ ServoStyleSet::ProbePseudoElementStyle(E
   }
 
   // For :before and :after pseudo-elements, having display: none or no
   // 'content' property is equivalent to not having the pseudo-element
   // at all.
   bool isBeforeOrAfter = aType == CSSPseudoElementType::before ||
                          aType == CSSPseudoElementType::after;
   if (isBeforeOrAfter) {
-    const nsStyleDisplay* display = Servo_GetStyleDisplay(computedValues->ComputedValues());
-    const nsStyleContent* content = Servo_GetStyleContent(computedValues->ComputedValues());
+    const nsStyleDisplay* display = computedValues->ComputedValues()->GetStyleDisplay();
+    const nsStyleContent* content = computedValues->ComputedValues()->GetStyleContent();
     // XXXldb What is contentCount for |content: ""|?
     if (display->mDisplay == StyleDisplay::None ||
         content->ContentCount() == 0) {
       return nullptr;
     }
   }
 
   return GetContext(computedValues.forget(), aParentContext, pseudoTag, aType,
--- a/layout/style/ServoTypes.h
+++ b/layout/style/ServoTypes.h
@@ -182,21 +182,24 @@ struct ServoComputedValuesForgotten {
 
 /**
  * We want C++ to be abe to read the style struct fields of ComputedValues
  * so we define this type on the C++ side and use the bindgenned version
  * on the Rust side.
  *
  */
 struct ServoComputedValues {
-#define STYLE_STRUCT(name_, checkdata_cb_) mozilla::ServoRawOffsetArc<mozilla::Gecko##name_> name_;
+#define STYLE_STRUCT(name_, checkdata_cb_)                 \
+  mozilla::ServoRawOffsetArc<mozilla::Gecko##name_> name_; \
+  inline const nsStyle##name_* GetStyle##name_() const;
   #define STYLE_STRUCT_LIST_IGNORE_VARIABLES
 #include "nsStyleStructList.h"
 #undef STYLE_STRUCT
-  #undef STYLE_STRUCT_LIST_IGNORE_VARIABLES
+#undef STYLE_STRUCT_LIST_IGNORE_VARIABLES
+  const nsStyleVariables* GetStyleVariables() const;
   mozilla::ServoCustomPropertiesMap custom_properties;
   mozilla::ServoWritingMode writing_mode;
   mozilla::ServoFontComputationData font_computation_data;
   /// The rule node representing the ordered list of rules matched for this
   /// node.  Can be None for default values and text nodes.  This is
   /// essentially an optimization to avoid referencing the root rule node.
   mozilla::ServoRuleNode rules;
   /// The element's computed values if visited, only computed if there's a
--- a/layout/style/moz.build
+++ b/layout/style/moz.build
@@ -114,16 +114,17 @@ EXPORTS.mozilla += [
     'ServoKeyframesRule.h',
     'ServoMediaList.h',
     'ServoMediaRule.h',
     'ServoNamespaceRule.h',
     'ServoPageRule.h',
     'ServoPropPrefList.h',
     'ServoSpecifiedValues.h',
     'ServoStyleContext.h',
+    'ServoStyleContextInlines.h',
     'ServoStyleRule.h',
     'ServoStyleSet.h',
     'ServoStyleSheet.h',
     'ServoSupportsRule.h',
     'ServoTypes.h',
     'ServoUtils.h',
     'SheetType.h',
     'StyleAnimationValue.h',
--- a/layout/style/nsAnimationManager.cpp
+++ b/layout/style/nsAnimationManager.cpp
@@ -1030,17 +1030,17 @@ nsAnimationManager::UpdateAnimations(
     StopAnimationsForElement(aElement, aPseudoType);
     return;
   }
 
   NonOwningAnimationTarget target(aElement, aPseudoType);
   ServoCSSAnimationBuilder builder(aStyleContext);
 
   const nsStyleDisplay *disp =
-    Servo_GetStyleDisplay(aStyleContext->ComputedValues());
+      aStyleContext->ComputedValues()->GetStyleDisplay();
   DoUpdateAnimations(target, *disp, builder);
 }
 
 template<class BuilderType>
 void
 nsAnimationManager::DoUpdateAnimations(
   const NonOwningAnimationTarget& aTarget,
   const nsStyleDisplay& aStyleDisplay,
--- a/layout/style/nsStyleContext.cpp
+++ b/layout/style/nsStyleContext.cpp
@@ -246,17 +246,17 @@ nsStyleContext::CalcStyleDifferenceInter
   PR_BEGIN_MACRO                                                              \
     const nsStyle##struct_* this##struct_ = PeekStyle##struct_();             \
     bool unrequestedStruct;                                                   \
     if (this##struct_) {                                                      \
       unrequestedStruct = false;                                              \
       structsFound |= NS_STYLE_INHERIT_BIT(struct_);                          \
     } else if (checkUnrequestedServoStructs) {                                \
       this##struct_ =                                                         \
-        Servo_GetStyle##struct_(AsServo()->ComputedValues());                 \
+        AsServo()->ComputedValues()->GetStyle##struct_();                     \
       unrequestedStruct = true;                                               \
     } else {                                                                  \
       unrequestedStruct = false;                                              \
     }                                                                         \
     if (this##struct_) {                                                      \
       const nsStyle##struct_* other##struct_ = aNewContext->Style##struct_(); \
       if (this##struct_ == other##struct_) {                                  \
         /* The very same struct, so we know that there will be no */          \
@@ -492,20 +492,20 @@ public:
     // RefPtr<ServoComputedValues> visitedComputedValues =
     //   Servo_ComputedValues_GetVisitedStyle(mComputedValues).Consume();
     // But what's the best way to create the nsStyleContext?
     return nullptr;
   }
 
   #define STYLE_STRUCT(name_, checkdata_cb_)                                  \
   const nsStyle##name_ * Style##name_() {                                     \
-    return Servo_GetStyle##name_(mComputedValues);                            \
+    return mComputedValues->GetStyle##name_();                                \
   }                                                                           \
   const nsStyle##name_ * ThreadsafeStyle##name_() {                           \
-    return Servo_GetStyle##name_(mComputedValues);                            \
+    return mComputedValues->GetStyle##name_();                                \
   }
   #include "nsStyleStructList.h"
   #undef STYLE_STRUCT
 
   const ServoComputedValues* ComputedValues() { return mComputedValues; }
 
 private:
   const ServoComputedValues* MOZ_NON_OWNING_REF mComputedValues;
--- a/layout/style/nsStyleContext.h
+++ b/layout/style/nsStyleContext.h
@@ -23,22 +23,16 @@ namespace mozilla {
 enum class CSSPseudoElementType : uint8_t;
 class GeckoStyleContext;
 class ServoStyleContext;
 } // namespace mozilla
 
 extern "C" {
   void Servo_StyleContext_AddRef(mozilla::ServoStyleContext* aContext);
   void Servo_StyleContext_Release(mozilla::ServoStyleContext* aContext);
-#define STYLE_STRUCT(name_, checkdata_cb_)     \
-  struct nsStyle##name_;                       \
-  const nsStyle##name_* Servo_GetStyle##name_( \
-    ServoComputedValuesBorrowedOrNull computed_values);
-#include "nsStyleStructList.h"
-#undef STYLE_STRUCT
 }
 
 /**
  * An nsStyleContext represents the computed style data for an element.
  * The computed style data are stored in a set of structs (see
  * nsStyleStruct.h) that are cached either on the style context or in
  * the rule tree (see nsRuleNode.h for a description of this caching and
  * how the cached structs are shared).
@@ -346,28 +340,17 @@ protected:
                  nsIAtom* aPseudoTag,
                  mozilla::CSSPseudoElementType aPseudoType);
 
   // Helper post-contruct hook.
   void FinishConstruction();
 
   void SetStyleBits();
 
-  const void* StyleStructFromServoComputedValues(nsStyleStructID aSID) {
-    switch (aSID) {
-#define STYLE_STRUCT(name_, checkdata_cb_)                                    \
-      case eStyleStruct_##name_:                                              \
-        return Servo_GetStyle##name_(ComputedValues());
-#include "nsStyleStructList.h"
-#undef STYLE_STRUCT
-      default:
-        MOZ_ASSERT_UNREACHABLE("unexpected nsStyleStructID value");
-        return nullptr;
-    }
-  }
+  inline const void* StyleStructFromServoComputedValues(nsStyleStructID aSID);
 
   // Helper functions for GetStyle* and PeekStyle*
   #define STYLE_STRUCT_INHERITED(name_, checkdata_cb_)                  \
     template<bool aComputeData>                                         \
     const nsStyle##name_ * DoGetStyle##name_();
   #define STYLE_STRUCT_RESET(name_, checkdata_cb_)                      \
     template<bool aComputeData>                                         \
     const nsStyle##name_ * DoGetStyle##name_();
--- a/layout/style/nsStyleContextInlines.h
+++ b/layout/style/nsStyleContextInlines.h
@@ -13,16 +13,17 @@
 
 #ifndef nsStyleContextInlines_h
 #define nsStyleContextInlines_h
 
 #include "nsStyleContext.h"
 #include "mozilla/ServoStyleContext.h"
 #include "mozilla/GeckoStyleContext.h"
 #include "mozilla/ServoUtils.h"
+#include "mozilla/ServoBindings.h"
 
 MOZ_DEFINE_STYLO_METHODS(nsStyleContext,
                          mozilla::GeckoStyleContext,
                          mozilla::ServoStyleContext);
 
 nsRuleNode*
 nsStyleContext::RuleNode()
 {
@@ -52,17 +53,17 @@ nsStyleContext::Release()
 #define STYLE_STRUCT(name_, checkdata_cb_)                      \
 const nsStyle##name_ *                                          \
 nsStyleContext::Style##name_() {                                \
   return DoGetStyle##name_<true>();                             \
 }                                                               \
 const nsStyle##name_ *                                          \
 nsStyleContext::ThreadsafeStyle##name_() {                      \
   if (mozilla::ServoStyleSet::IsInServoTraversal()) {           \
-    return Servo_GetStyle##name_(AsServo()->ComputedValues());  \
+    return AsServo()->ComputedValues()->GetStyle##name_();      \
   }                                                             \
   return Style##name_();                                        \
 }                                                               \
 const nsStyle##name_ * nsStyleContext::PeekStyle##name_() {     \
   return DoGetStyle##name_<false>();                            \
 }
 #include "nsStyleStructList.h"
 #undef STYLE_STRUCT
@@ -125,17 +126,17 @@ const nsStyle##name_ * nsStyleContext::D
   }                                                                 \
                                                                     \
   const bool needToCompute = !(mBits & NS_STYLE_INHERIT_BIT(name_));\
   if (!aComputeData && needToCompute) {                             \
     return nullptr;                                                 \
   }                                                                 \
                                                                     \
   const nsStyle##name_* data =                                      \
-    Servo_GetStyle##name_(servo->ComputedValues());   \
+    servo->ComputedValues()->GetStyle##name_();                     \
   /* perform any remaining main thread work on the struct */        \
   if (needToCompute) {                                              \
     MOZ_ASSERT(NS_IsMainThread());                                  \
     MOZ_ASSERT(!mozilla::ServoStyleSet::IsInServoTraversal());      \
     const_cast<nsStyle##name_*>(data)->FinishStyle(PresContext());  \
     /* the ServoStyleContext owns the struct */                     \
     AddStyleBit(NS_STYLE_INHERIT_BIT(name_));                       \
   }                                                                 \
@@ -158,17 +159,17 @@ const nsStyle##name_ * nsStyleContext::D
     return gecko->RuleNode()->GetStyle##name_<aComputeData>(this->AsGecko()); \
   }                                                                           \
   auto servo = AsServo();                                                     \
   const bool needToCompute = !(mBits & NS_STYLE_INHERIT_BIT(name_));          \
   if (!aComputeData && needToCompute) {                                       \
     return nullptr;                                                           \
   }                                                                           \
   const nsStyle##name_* data =                                                \
-    Servo_GetStyle##name_(servo->ComputedValues());                           \
+    servo->ComputedValues()->GetStyle##name_();                               \
   /* perform any remaining main thread work on the struct */                  \
   if (needToCompute) {                                                        \
     const_cast<nsStyle##name_*>(data)->FinishStyle(PresContext());            \
     /* the ServoStyleContext owns the struct */                               \
     AddStyleBit(NS_STYLE_INHERIT_BIT(name_));                                 \
   }                                                                           \
   return data;                                                                \
 }
@@ -203,10 +204,25 @@ nsStyleContext::IsLinkContext() const
 
 void
 nsStyleContext::StartBackgroundImageLoads()
 {
   // Just get our background struct; that should do the trick
   StyleBackground();
 }
 
+const void*
+nsStyleContext::StyleStructFromServoComputedValues(nsStyleStructID aSID)
+{
+  switch (aSID) {
+#define STYLE_STRUCT(name_, checkdata_cb_)        \
+    case eStyleStruct_##name_:                    \
+      return ComputedValues()->GetStyle##name_();
+#include "nsStyleStructList.h"
+#undef STYLE_STRUCT
+    default:
+      MOZ_ASSERT_UNREACHABLE("unexpected nsStyleStructID value");
+      return nullptr;
+  }
+}
+
 
 #endif // nsStyleContextInlines_h
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -629,17 +629,18 @@ nsTransitionManager::UpdateTransitions(
 {
   if (!mPresContext->IsDynamic()) {
     // For print or print preview, ignore transitions.
     return false;
   }
 
   CSSTransitionCollection* collection =
     CSSTransitionCollection::GetAnimationCollection(aElement, aPseudoType);
-  const nsStyleDisplay *disp = Servo_GetStyleDisplay(aNewStyle->ComputedValues());
+  const nsStyleDisplay *disp =
+      aNewStyle->ComputedValues()->GetStyleDisplay();
   return DoUpdateTransitions(disp,
                              aElement, aPseudoType,
                              collection,
                              aOldStyle, aNewStyle);
 }
 
 template<typename StyleType>
 bool
--- a/servo/components/style/gecko/generated/bindings.rs
+++ b/servo/components/style/gecko/generated/bindings.rs
@@ -2817,134 +2817,17 @@ extern "C" {
      -> u32;
 }
 extern "C" {
     pub fn Servo_GetCustomPropertyNameAt(arg1: ServoComputedValuesBorrowed,
                                          index: u32, name: *mut nsAString)
      -> bool;
 }
 extern "C" {
-    pub fn Servo_GetStyleFont(computed_values:
-                                  ServoComputedValuesBorrowedOrNull)
-     -> *const nsStyleFont;
-}
-extern "C" {
-    pub fn Servo_GetStyleColor(computed_values:
-                                   ServoComputedValuesBorrowedOrNull)
-     -> *const nsStyleColor;
-}
-extern "C" {
-    pub fn Servo_GetStyleList(computed_values:
-                                  ServoComputedValuesBorrowedOrNull)
-     -> *const nsStyleList;
-}
-extern "C" {
-    pub fn Servo_GetStyleText(computed_values:
-                                  ServoComputedValuesBorrowedOrNull)
-     -> *const nsStyleText;
-}
-extern "C" {
-    pub fn Servo_GetStyleVisibility(computed_values:
-                                        ServoComputedValuesBorrowedOrNull)
-     -> *const nsStyleVisibility;
-}
-extern "C" {
-    pub fn Servo_GetStyleUserInterface(computed_values:
-                                           ServoComputedValuesBorrowedOrNull)
-     -> *const nsStyleUserInterface;
-}
-extern "C" {
-    pub fn Servo_GetStyleTableBorder(computed_values:
-                                         ServoComputedValuesBorrowedOrNull)
-     -> *const nsStyleTableBorder;
-}
-extern "C" {
-    pub fn Servo_GetStyleSVG(computed_values:
-                                 ServoComputedValuesBorrowedOrNull)
-     -> *const nsStyleSVG;
-}
-extern "C" {
-    pub fn Servo_GetStyleVariables(computed_values:
-                                       ServoComputedValuesBorrowedOrNull)
-     -> *const nsStyleVariables;
-}
-extern "C" {
-    pub fn Servo_GetStyleBackground(computed_values:
-                                        ServoComputedValuesBorrowedOrNull)
-     -> *const nsStyleBackground;
-}
-extern "C" {
-    pub fn Servo_GetStylePosition(computed_values:
-                                      ServoComputedValuesBorrowedOrNull)
-     -> *const nsStylePosition;
-}
-extern "C" {
-    pub fn Servo_GetStyleTextReset(computed_values:
-                                       ServoComputedValuesBorrowedOrNull)
-     -> *const nsStyleTextReset;
-}
-extern "C" {
-    pub fn Servo_GetStyleDisplay(computed_values:
-                                     ServoComputedValuesBorrowedOrNull)
-     -> *const nsStyleDisplay;
-}
-extern "C" {
-    pub fn Servo_GetStyleContent(computed_values:
-                                     ServoComputedValuesBorrowedOrNull)
-     -> *const nsStyleContent;
-}
-extern "C" {
-    pub fn Servo_GetStyleUIReset(computed_values:
-                                     ServoComputedValuesBorrowedOrNull)
-     -> *const nsStyleUIReset;
-}
-extern "C" {
-    pub fn Servo_GetStyleTable(computed_values:
-                                   ServoComputedValuesBorrowedOrNull)
-     -> *const nsStyleTable;
-}
-extern "C" {
-    pub fn Servo_GetStyleMargin(computed_values:
-                                    ServoComputedValuesBorrowedOrNull)
-     -> *const nsStyleMargin;
-}
-extern "C" {
-    pub fn Servo_GetStylePadding(computed_values:
-                                     ServoComputedValuesBorrowedOrNull)
-     -> *const nsStylePadding;
-}
-extern "C" {
-    pub fn Servo_GetStyleBorder(computed_values:
-                                    ServoComputedValuesBorrowedOrNull)
-     -> *const nsStyleBorder;
-}
-extern "C" {
-    pub fn Servo_GetStyleOutline(computed_values:
-                                     ServoComputedValuesBorrowedOrNull)
-     -> *const nsStyleOutline;
-}
-extern "C" {
-    pub fn Servo_GetStyleXUL(computed_values:
-                                 ServoComputedValuesBorrowedOrNull)
-     -> *const nsStyleXUL;
-}
-extern "C" {
-    pub fn Servo_GetStyleSVGReset(computed_values:
-                                      ServoComputedValuesBorrowedOrNull)
-     -> *const nsStyleSVGReset;
-}
-extern "C" {
-    pub fn Servo_GetStyleColumn(computed_values:
-                                    ServoComputedValuesBorrowedOrNull)
-     -> *const nsStyleColumn;
-}
-extern "C" {
-    pub fn Servo_GetStyleEffects(computed_values:
-                                     ServoComputedValuesBorrowedOrNull)
-     -> *const nsStyleEffects;
+    pub fn Servo_GetEmptyVariables() -> *const nsStyleVariables;
 }
 extern "C" {
     pub fn Gecko_CreateCSSErrorReporter(sheet: *mut ServoStyleSheet,
                                         loader: *mut Loader, uri: *mut nsIURI)
      -> *mut ErrorReporter;
 }
 extern "C" {
     pub fn Gecko_DestroyCSSErrorReporter(reporter: *mut ErrorReporter);
--- a/servo/components/style/gecko/generated/structs_debug.rs
+++ b/servo/components/style/gecko/generated/structs_debug.rs
@@ -40109,26 +40109,26 @@ pub mod root {
                    "Size of template specialization: " , stringify ! (
                    root::nsCharTraits ) ));
         assert_eq!(::std::mem::align_of::<root::nsCharTraits>() , 1usize ,
                    concat ! (
                    "Alignment of template specialization: " , stringify ! (
                    root::nsCharTraits ) ));
     }
     #[test]
-    fn __bindgen_test_layout__bindgen_ty_id_195896_instantiation_33() {
+    fn __bindgen_test_layout__bindgen_ty_id_195320_instantiation_33() {
         assert_eq!(::std::mem::size_of::<u8>() , 1usize , concat ! (
                    "Size of template specialization: " , stringify ! ( u8 )
                    ));
         assert_eq!(::std::mem::align_of::<u8>() , 1usize , concat ! (
                    "Alignment of template specialization: " , stringify ! ( u8
                    ) ));
     }
     #[test]
-    fn __bindgen_test_layout__bindgen_ty_id_195932_instantiation_34() {
+    fn __bindgen_test_layout__bindgen_ty_id_195356_instantiation_34() {
         assert_eq!(::std::mem::size_of::<u8>() , 1usize , concat ! (
                    "Size of template specialization: " , stringify ! ( u8 )
                    ));
         assert_eq!(::std::mem::align_of::<u8>() , 1usize , concat ! (
                    "Alignment of template specialization: " , stringify ! ( u8
                    ) ));
     }
     #[test]
--- a/servo/components/style/gecko/generated/structs_release.rs
+++ b/servo/components/style/gecko/generated/structs_release.rs
@@ -39457,26 +39457,26 @@ pub mod root {
                    "Size of template specialization: " , stringify ! (
                    root::nsCharTraits ) ));
         assert_eq!(::std::mem::align_of::<root::nsCharTraits>() , 1usize ,
                    concat ! (
                    "Alignment of template specialization: " , stringify ! (
                    root::nsCharTraits ) ));
     }
     #[test]
-    fn __bindgen_test_layout__bindgen_ty_id_193418_instantiation_33() {
+    fn __bindgen_test_layout__bindgen_ty_id_192842_instantiation_33() {
         assert_eq!(::std::mem::size_of::<u8>() , 1usize , concat ! (
                    "Size of template specialization: " , stringify ! ( u8 )
                    ));
         assert_eq!(::std::mem::align_of::<u8>() , 1usize , concat ! (
                    "Alignment of template specialization: " , stringify ! ( u8
                    ) ));
     }
     #[test]
-    fn __bindgen_test_layout__bindgen_ty_id_193454_instantiation_34() {
+    fn __bindgen_test_layout__bindgen_ty_id_192878_instantiation_34() {
         assert_eq!(::std::mem::size_of::<u8>() , 1usize , concat ! (
                    "Size of template specialization: " , stringify ! ( u8 )
                    ));
         assert_eq!(::std::mem::align_of::<u8>() , 1usize , concat ! (
                    "Alignment of template specialization: " , stringify ! ( u8
                    ) ));
     }
     #[test]
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -4856,17 +4856,17 @@ pub unsafe extern "C" fn Servo_GetStyle$
 ${define_ffi_struct_accessor(style_struct)}
 % endfor
 
 // This is only accessed from the Gecko main thread.
 static mut EMPTY_VARIABLES_STRUCT: Option<nsStyleVariables> = None;
 
 #[no_mangle]
 #[allow(non_snake_case)]
-pub unsafe extern "C" fn Servo_GetStyleVariables(_cv: ServoComputedValuesBorrowedOrNull)
+pub unsafe extern "C" fn Servo_GetEmptyVariables()
                                                  -> *const nsStyleVariables {
     EMPTY_VARIABLES_STRUCT.as_ref().unwrap()
 }
 
 pub fn initialize() {
     unsafe {
         EMPTY_VARIABLES_STRUCT = Some(zeroed());
         Gecko_Construct_nsStyleVariables(EMPTY_VARIABLES_STRUCT.as_mut().unwrap());