Bug 1250377 - Part 2: Stub out enough ServoStyleSet methods to be able to create one for a document. r=bholley
authorCameron McCormack <cam@mcc.id.au>
Wed, 24 Feb 2016 18:01:12 +1100
changeset 321698 008aa54d8df6a986840a0ac87753de6c5779ff8f
parent 321697 18a340cceaf3e17849346aa30d7d836377b1140e
child 321699 5b9d0ccdf0dd75ff81681a69ae22801b7ada3b44
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1250377
milestone47.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 1250377 - Part 2: Stub out enough ServoStyleSet methods to be able to create one for a document. r=bholley
layout/style/ServoStyleSet.cpp
layout/style/ServoStyleSet.h
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -6,56 +6,64 @@
 
 #include "mozilla/ServoStyleSet.h"
 
 #include "nsCSSAnonBoxes.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
+ServoStyleSet::ServoStyleSet()
+  : mBatching(0)
+{
+}
+
 void
 ServoStyleSet::Init(nsPresContext* aPresContext)
 {
-  MOZ_CRASH("stylo: not implemented");
 }
 
 void
 ServoStyleSet::BeginShutdown()
 {
-  MOZ_CRASH("stylo: not implemented");
 }
 
 void
 ServoStyleSet::Shutdown()
 {
-  MOZ_CRASH("stylo: not implemented");
 }
 
 bool
 ServoStyleSet::GetAuthorStyleDisabled() const
 {
-  MOZ_CRASH("stylo: not implemented");
+  return false;
 }
 
 nsresult
 ServoStyleSet::SetAuthorStyleDisabled(bool aStyleDisabled)
 {
   MOZ_CRASH("stylo: not implemented");
 }
 
 void
 ServoStyleSet::BeginUpdate()
 {
-  MOZ_CRASH("stylo: not implemented");
+  ++mBatching;
 }
 
 nsresult
 ServoStyleSet::EndUpdate()
 {
-  MOZ_CRASH("stylo: not implemented");
+  MOZ_ASSERT(mBatching > 0);
+  if (--mBatching > 0) {
+    return NS_OK;
+  }
+
+  // ... do something ...
+  return NS_OK;
 }
 
 // resolve a style context
 already_AddRefed<nsStyleContext>
 ServoStyleSet::ResolveStyleFor(Element* aElement,
                                nsStyleContext* aParentContext)
 {
   MOZ_CRASH("stylo: not implemented");
--- a/layout/style/ServoStyleSet.h
+++ b/layout/style/ServoStyleSet.h
@@ -17,29 +17,32 @@
 
 namespace mozilla {
 namespace dom {
 class Element;
 } // namespace dom
 class CSSStyleSheet;
 class ServoStyleSheet;
 } // namespace mozilla
+class nsIDocument;
 class nsStyleContext;
 class nsPresContext;
 struct TreeMatchContext;
 
 namespace mozilla {
 
 /**
  * The set of style sheets that apply to a document, backed by a Servo
  * Stylist.  A ServoStyleSet contains ServoStyleSheets.
  */
 class ServoStyleSet
 {
 public:
+  ServoStyleSet();
+
   void Init(nsPresContext* aPresContext);
   void BeginShutdown();
   void Shutdown();
 
   bool GetAuthorStyleDisabled() const;
   nsresult SetAuthorStyleDisabled(bool aStyleDisabled);
 
   void BeginUpdate();
@@ -100,13 +103,16 @@ public:
 
   // Test if style is dependent on content state
   nsRestyleHint HasStateDependentStyle(dom::Element* aElement,
                                        EventStates aStateMask);
   nsRestyleHint HasStateDependentStyle(dom::Element* aElement,
                                        mozilla::CSSPseudoElementType aPseudoType,
                                        dom::Element* aPseudoElement,
                                        EventStates aStateMask);
+
+private:
+  int32_t mBatching;
 };
 
 } // namespace mozilla
 
 #endif // mozilla_ServoStyleSet_h