Bug 1298588 part 3, gecko piece. Add a default ComputedValues member to PerDocumentStyleData. r=bholley
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 04 Jan 2017 14:52:26 -0500
changeset 327951 94daa42ee46f90dab44b0b986e81e921fad2c8de
parent 327950 f230c3fb62f5d4635ef5ccafaaf5258932a587fa
child 327952 6d4f963d3655c76ea32a2c90c27a2e2209e135f1
push id85332
push userbzbarsky@mozilla.com
push dateWed, 04 Jan 2017 19:52:46 +0000
treeherdermozilla-inbound@e743dff9dca1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1298588
milestone53.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 1298588 part 3, gecko piece. Add a default ComputedValues member to PerDocumentStyleData. r=bholley
layout/base/nsPresContext.h
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
layout/style/StyleStructContext.h
--- a/layout/base/nsPresContext.h
+++ b/layout/base/nsPresContext.h
@@ -227,17 +227,17 @@ public:
   {
       NS_ASSERTION(!mShell || !mShell->GetDocument() ||
                    mShell->GetDocument() == mDocument,
                    "nsPresContext doesn't have the same document as nsPresShell!");
       return mDocument;
   }
 
 #ifdef MOZILLA_INTERNAL_API
-  mozilla::StyleSetHandle StyleSet() { return GetPresShell()->StyleSet(); }
+  mozilla::StyleSetHandle StyleSet() const { return GetPresShell()->StyleSet(); }
 
   nsFrameManager* FrameManager()
     { return PresShell()->FrameManager(); }
 
   nsCSSFrameConstructor* FrameConstructor()
     { return PresShell()->FrameConstructor(); }
 
   mozilla::EffectCompositor* EffectCompositor() { return mEffectCompositor; }
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -1075,16 +1075,23 @@ NS_IMPL_THREADSAFE_FFI_REFCOUNTING(nsCSS
                                                                               \
 void                                                                          \
 Gecko_Construct_nsStyle##name(nsStyle##name* ptr)                             \
 {                                                                             \
   new (ptr) nsStyle##name(StyleStructContext::ServoContext());                \
 }                                                                             \
                                                                               \
 void                                                                          \
+Gecko_Construct_Default_nsStyle##name(nsStyle##name* ptr,                     \
+                                      const nsPresContext* pres_context)      \
+{                                                                             \
+  new (ptr) nsStyle##name(pres_context);                                      \
+}                                                                             \
+                                                                              \
+void                                                                          \
 Gecko_CopyConstruct_nsStyle##name(nsStyle##name* ptr,                         \
                                   const nsStyle##name* other)                 \
 {                                                                             \
   new (ptr) nsStyle##name(*other);                                            \
 }                                                                             \
                                                                               \
 void                                                                          \
 Gecko_Destroy_nsStyle##name(nsStyle##name* ptr)                               \
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -288,16 +288,19 @@ void Gecko_CSSValue_SetAngle(nsCSSValueB
 void Gecko_CSSValue_SetCalc(nsCSSValueBorrowedMut css_value, nsStyleCoord::CalcValue calc);
 void Gecko_CSSValue_SetFunction(nsCSSValueBorrowedMut css_value, int32_t len);
 nsCSSValueBorrowedMut Gecko_CSSValue_GetArrayItem(nsCSSValueBorrowedMut css_value, int32_t index);
 NS_DECL_THREADSAFE_FFI_REFCOUNTING(nsCSSValueSharedList, CSSValueSharedList);
 
 // Style-struct management.
 #define STYLE_STRUCT(name, checkdata_cb)                                       \
   void Gecko_Construct_nsStyle##name(nsStyle##name* ptr);                      \
+  void Gecko_Construct_Default_nsStyle##name(                                  \
+    nsStyle##name* ptr,                                                        \
+    RawGeckoPresContextBorrowed pres_context);                                 \
   void Gecko_CopyConstruct_nsStyle##name(nsStyle##name* ptr,                   \
                                          const nsStyle##name* other);          \
   void Gecko_Destroy_nsStyle##name(nsStyle##name* ptr);
 #include "nsStyleStructList.h"
 #undef STYLE_STRUCT
 
 #define SERVO_BINDING_FUNC(name_, return_, ...) return_ name_(__VA_ARGS__);
 #include "mozilla/ServoBindingList.h"
--- a/layout/style/StyleStructContext.h
+++ b/layout/style/StyleStructContext.h
@@ -4,16 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_StyleStructContext_h
 #define mozilla_StyleStructContext_h
 
 #include "CounterStyleManager.h"
 #include "mozilla/LookAndFeel.h"
 #include "nsPresContext.h"
+#include "mozilla/StyleSetHandle.h"
 
 class nsDeviceContext;
 
 /**
  * Construction context for style structs.
  *
  * Certain Gecko style structs have historically taken an nsPresContext
  * argument in their constructor, which is used to compute various things. This
@@ -83,16 +84,22 @@ public:
     // Workaround Bug 1323404
     SERVO_DEFAULT(NS_RGB(0x00, 0x00, 0x00));
     return mPresContext->DefaultColor();
   }
 
   mozilla::CounterStyle* BuildCounterStyle(const nsSubstring& aName)
   {
     SERVO_DEFAULT(mozilla::CounterStyleManager::GetBuiltinStyle(NS_STYLE_LIST_STYLE_DISC));
+    // For the servo case we want to keep not calling into the counter style
+    // manager even if we have a prescontext, because we haven't made that work
+    // with servo yet.
+    if (mPresContext->StyleSet()->IsServo()) {
+      return mozilla::CounterStyleManager::GetBuiltinStyle(NS_STYLE_LIST_STYLE_DISC);
+    }
     return mPresContext->CounterStyleManager()->BuildCounterStyle(aName);
   }
 
   nsIAtom* GetLanguageFromCharset() const
   {
     SERVO_DEFAULT(nsGkAtoms::x_western);
     return mPresContext->GetLanguageFromCharset();
   }