Bug 1451289 - Part 11: Merge ServoFontFeatureValuesRule and CSSFontFeatureValuesRule r?emilio draft
authorNazım Can Altınova <canaltinova@gmail.com>
Wed, 06 Jun 2018 16:10:47 +0200
changeset 807064 c24ac356ff165cd325815a4d99e449975bdc0f3e
parent 807063 54e0929bda647bc8b8a6848025dbb555e36a88da
child 807065 d9f82abcca02b75846223b44df22e8bfb22211bd
push id113035
push userbmo:canaltinova@gmail.com
push dateWed, 13 Jun 2018 19:14:54 +0000
reviewersemilio
bugs1451289
milestone62.0a1
Bug 1451289 - Part 11: Merge ServoFontFeatureValuesRule and CSSFontFeatureValuesRule r?emilio MozReview-Commit-ID: 9aXGCHdkZwp
layout/style/CSSFontFeatureValuesRule.cpp
layout/style/CSSFontFeatureValuesRule.h
layout/style/ServoCSSRuleList.cpp
layout/style/ServoFontFeatureValuesRule.cpp
layout/style/ServoFontFeatureValuesRule.h
layout/style/moz.build
--- a/layout/style/CSSFontFeatureValuesRule.cpp
+++ b/layout/style/CSSFontFeatureValuesRule.cpp
@@ -5,26 +5,90 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/dom/CSSFontFeatureValuesRule.h"
 #include "mozilla/dom/CSSFontFeatureValuesRuleBinding.h"
 
 namespace mozilla {
 namespace dom {
 
+CSSFontFeatureValuesRule::CSSFontFeatureValuesRule(
+  RefPtr<RawServoFontFeatureValuesRule> aRawRule,
+  uint32_t aLine, uint32_t aColumn)
+  : Rule(aLine, aColumn)
+  , mRawRule(std::move(aRawRule))
+{
+}
+
+size_t
+CSSFontFeatureValuesRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
+{
+  // TODO Implement this!
+  return aMallocSizeOf(this);
+}
+
+#ifdef DEBUG
+void
+CSSFontFeatureValuesRule::List(FILE* out, int32_t aIndent) const
+{
+  nsAutoCString str;
+  for (int32_t i = 0; i < aIndent; i++) {
+    str.AppendLiteral("  ");
+  }
+  Servo_FontFeatureValuesRule_Debug(mRawRule, &str);
+  fprintf_stderr(out, "%s\n", str.get());
+}
+#endif
+
+/* CSSRule implementation */
+
+void
+CSSFontFeatureValuesRule::GetCssText(nsAString& aCssText) const
+{
+  Servo_FontFeatureValuesRule_GetCssText(mRawRule, &aCssText);
+}
+
+/* CSSFontFeatureValuesRule implementation */
+
+void
+CSSFontFeatureValuesRule::GetFontFamily(nsAString& aFamilyListStr)
+{
+  Servo_FontFeatureValuesRule_GetFontFamily(mRawRule, &aFamilyListStr);
+}
+
+void
+CSSFontFeatureValuesRule::GetValueText(nsAString& aValueText)
+{
+  Servo_FontFeatureValuesRule_GetValueText(mRawRule, &aValueText);
+}
+
+void
+CSSFontFeatureValuesRule::SetFontFamily(const nsAString& aFontFamily,
+                                        ErrorResult& aRv)
+{
+  aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
+}
+
+void
+CSSFontFeatureValuesRule::SetValueText(const nsAString& aValueText,
+                                       ErrorResult& aRv)
+{
+  aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
+}
+
 // If this ever gets its own cycle-collection bits, reevaluate our IsCCLeaf
 // implementation.
 
 bool
 CSSFontFeatureValuesRule::IsCCLeaf() const
 {
   return Rule::IsCCLeaf();
 }
 
 /* virtual */ JSObject*
 CSSFontFeatureValuesRule::WrapObject(JSContext* aCx,
-                                       JS::Handle<JSObject*> aGivenProto)
+                                     JS::Handle<JSObject*> aGivenProto)
 {
   return CSSFontFeatureValuesRuleBinding::Wrap(aCx, this, aGivenProto);
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/layout/style/CSSFontFeatureValuesRule.h
+++ b/layout/style/CSSFontFeatureValuesRule.h
@@ -3,43 +3,52 @@
 /* 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_dom_CSSFontFeatureValuesRule_h
 #define mozilla_dom_CSSFontFeatureValuesRule_h
 
 #include "mozilla/css/Rule.h"
+#include "mozilla/ServoBindingTypes.h"
 
 #include "nsICSSDeclaration.h"
 
 namespace mozilla {
 namespace dom {
 
-class CSSFontFeatureValuesRule : public css::Rule
+class CSSFontFeatureValuesRule final : public css::Rule
 {
 public:
+  CSSFontFeatureValuesRule(RefPtr<RawServoFontFeatureValuesRule> aRawRule,
+                           uint32_t aLine, uint32_t aColumn);
+
   virtual bool IsCCLeaf() const override;
 
+  RawServoFontFeatureValuesRule* Raw() const { return mRawRule; }
+
   // WebIDL interfaces
   uint16_t Type() const final { return CSSRuleBinding::FONT_FEATURE_VALUES_RULE; }
-  virtual void GetCssText(nsAString& aCssText) const override = 0;
-  virtual void GetFontFamily(nsAString& aFamily) = 0;
-  virtual void SetFontFamily(const nsAString& aFamily, mozilla::ErrorResult& aRv) = 0;
-  virtual void GetValueText(nsAString& aValueText) = 0;
-  virtual void SetValueText(const nsAString& aValueText, mozilla::ErrorResult& aRv) = 0;
+  void GetCssText(nsAString& aCssText) const override;
+  void GetFontFamily(nsAString& aFamily);
+  void SetFontFamily(const nsAString& aFamily, mozilla::ErrorResult& aRv);
+  void GetValueText(nsAString& aValueText);
+  void SetValueText(const nsAString& aValueText, mozilla::ErrorResult& aRv);
 
-  virtual size_t
-  SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override = 0;
+  size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
+
+#ifdef DEBUG
+  void List(FILE* out = stdout, int32_t aIndent = 0) const final;
+#endif
 
   JSObject*
   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
-protected:
-  using Rule::Rule;
+private:
+  ~CSSFontFeatureValuesRule() = default;
 
-  virtual ~CSSFontFeatureValuesRule() {};
+  RefPtr<RawServoFontFeatureValuesRule> mRawRule;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_CSSFontFeatureValuesRule_h
--- a/layout/style/ServoCSSRuleList.cpp
+++ b/layout/style/ServoCSSRuleList.cpp
@@ -5,27 +5,27 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* representation of CSSRuleList for stylo */
 
 #include "mozilla/ServoCSSRuleList.h"
 
 #include "mozilla/dom/CSSCounterStyleRule.h"
 #include "mozilla/dom/CSSFontFaceRule.h"
+#include "mozilla/dom/CSSFontFeatureValuesRule.h" 
 #include "mozilla/dom/CSSImportRule.h"
 #include "mozilla/dom/CSSKeyframesRule.h"
 #include "mozilla/dom/CSSMediaRule.h"
 #include "mozilla/dom/CSSMozDocumentRule.h"
 #include "mozilla/dom/CSSNamespaceRule.h"
 #include "mozilla/dom/CSSPageRule.h"
 #include "mozilla/dom/CSSStyleRule.h"
 #include "mozilla/dom/CSSSupportsRule.h"
 #include "mozilla/IntegerRange.h"
 #include "mozilla/ServoBindings.h"
-#include "mozilla/ServoFontFeatureValuesRule.h"
 #include "mozilla/StyleSheet.h"
 
 using namespace mozilla::dom;
 
 namespace mozilla {
 
 ServoCSSRuleList::ServoCSSRuleList(already_AddRefed<ServoCssRules> aRawRules,
                                    StyleSheet* aDirectOwnerStyleSheet)
@@ -107,17 +107,17 @@ ServoCSSRuleList::GetRule(uint32_t aInde
       CASE_RULE_CSS(STYLE, Style)
       CASE_RULE_CSS(KEYFRAMES, Keyframes)
       CASE_RULE_CSS(MEDIA, Media)
       CASE_RULE_CSS(NAMESPACE, Namespace)
       CASE_RULE_CSS(PAGE, Page)
       CASE_RULE_CSS(SUPPORTS, Supports)
       CASE_RULE_CSS(DOCUMENT, MozDocument)
       CASE_RULE_CSS(IMPORT, Import)
-      CASE_RULE(FONT_FEATURE_VALUES, FontFeatureValues)
+      CASE_RULE_CSS(FONT_FEATURE_VALUES, FontFeatureValues)
       CASE_RULE_CSS(FONT_FACE, FontFace)
       CASE_RULE_CSS(COUNTER_STYLE, CounterStyle)
 #undef CASE_RULE
       case CSSRuleBinding::KEYFRAME_RULE:
         MOZ_ASSERT_UNREACHABLE("keyframe rule cannot be here");
         return nullptr;
       default:
         NS_WARNING("stylo: not implemented yet");
deleted file mode 100644
--- a/layout/style/ServoFontFeatureValuesRule.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- 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/. */
-
-/* representation of CSSFontFeatureValuesRule for stylo */
-
-#include "mozilla/ServoFontFeatureValuesRule.h"
-
-#include "mozilla/ServoBindings.h"
-
-using namespace mozilla::dom;
-
-namespace mozilla {
-
-ServoFontFeatureValuesRule::ServoFontFeatureValuesRule(
-  RefPtr<RawServoFontFeatureValuesRule> aRawRule,
-  uint32_t aLine, uint32_t aColumn)
-  : CSSFontFeatureValuesRule(aLine, aColumn)
-  , mRawRule(std::move(aRawRule))
-{
-}
-
-ServoFontFeatureValuesRule::~ServoFontFeatureValuesRule()
-{
-}
-
-size_t
-ServoFontFeatureValuesRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
-{
-  // TODO Implement this!
-  return aMallocSizeOf(this);
-}
-
-#ifdef DEBUG
-void
-ServoFontFeatureValuesRule::List(FILE* out, int32_t aIndent) const
-{
-  nsAutoCString str;
-  for (int32_t i = 0; i < aIndent; i++) {
-    str.AppendLiteral("  ");
-  }
-  Servo_FontFeatureValuesRule_Debug(mRawRule, &str);
-  fprintf_stderr(out, "%s\n", str.get());
-}
-#endif
-
-/* CSSRule implementation */
-
-void
-ServoFontFeatureValuesRule::GetCssText(nsAString& aCssText) const
-{
-  Servo_FontFeatureValuesRule_GetCssText(mRawRule, &aCssText);
-}
-
-/* CSSFontFeatureValuesRule implementation */
-
-void
-ServoFontFeatureValuesRule::GetFontFamily(nsAString& aFamilyListStr)
-{
-  Servo_FontFeatureValuesRule_GetFontFamily(mRawRule, &aFamilyListStr);
-}
-
-void
-ServoFontFeatureValuesRule::GetValueText(nsAString& aValueText)
-{
-  Servo_FontFeatureValuesRule_GetValueText(mRawRule, &aValueText);
-}
-
-void
-ServoFontFeatureValuesRule::SetFontFamily(const nsAString& aFontFamily,
-                                          ErrorResult& aRv)
-{
-  aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
-}
-
-void
-ServoFontFeatureValuesRule::SetValueText(const nsAString& aValueText,
-                                         ErrorResult& aRv)
-{
-  aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
-}
-
-} // namespace mozilla
deleted file mode 100644
--- a/layout/style/ServoFontFeatureValuesRule.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- 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/. */
-
-/* representation of CSSFontFeatureValuesRule for stylo */
-
-#ifndef mozilla_ServoFontFeatureValuesRule_h
-#define mozilla_ServoFontFeatureValuesRule_h
-
-#include "mozilla/dom/CSSFontFeatureValuesRule.h"
-#include "mozilla/ServoBindingTypes.h"
-
-namespace mozilla {
-
-class ServoFontFeatureValuesRule final : public dom::CSSFontFeatureValuesRule
-{
-public:
-  ServoFontFeatureValuesRule(RefPtr<RawServoFontFeatureValuesRule> aRawRule,
-                             uint32_t aLine, uint32_t aColumn);
-
-  RawServoFontFeatureValuesRule* Raw() const { return mRawRule; }
-
-  // WebIDL interface
-  void GetCssText(nsAString& aCssText) const override;
-  void GetFontFamily(nsAString& aFamily) final;
-  void SetFontFamily(const nsAString& aFamily, mozilla::ErrorResult& aRv) final;
-  void GetValueText(nsAString& aValueText) final;
-  void SetValueText(const nsAString& aValueText, mozilla::ErrorResult& aRv) final;
-
-  // Methods of mozilla::css::Rule
-  size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
-    const final;
-
-  #ifdef DEBUG
-    void List(FILE* out = stdout, int32_t aIndent = 0) const final;
-  #endif
-
-private:
-  ~ServoFontFeatureValuesRule();
-
-  RefPtr<RawServoFontFeatureValuesRule> mRawRule;
-};
-
-} // namespace mozilla
-
-#endif // mozilla_ServoFontFeatureValuesRule_h
--- a/layout/style/moz.build
+++ b/layout/style/moz.build
@@ -81,17 +81,16 @@ EXPORTS.mozilla += [
     'ServoBindings.h',
     'ServoBindingTypes.h',
     'ServoComputedData.h',
     'ServoComputedDataInlines.h',
     'ServoCSSParser.h',
     'ServoCSSRuleList.h',
     'ServoElementSnapshot.h',
     'ServoElementSnapshotTable.h',
-    'ServoFontFeatureValuesRule.h',
     'ServoSpecifiedValues.h',
     'ServoStyleSet.h',
     'ServoStyleSetInlines.h',
     'ServoTraversalStatistics.h',
     'ServoTypes.h',
     'ServoUtils.h',
     'SheetType.h',
     'StyleAnimationValue.h',
@@ -196,17 +195,16 @@ UNIFIED_SOURCES += [
     'nsTransitionManager.cpp',
     'PostTraversalTask.cpp',
     'PreloadedStyleSheet.cpp',
     'Rule.cpp',
     'ServoBindings.cpp',
     'ServoCSSParser.cpp',
     'ServoCSSRuleList.cpp',
     'ServoElementSnapshot.cpp',
-    'ServoFontFeatureValuesRule.cpp',
     'ServoSpecifiedValues.cpp',
     'ServoStyleSet.cpp',
     'StreamLoader.cpp',
     'StyleAnimationValue.cpp',
     'StyleComplexColor.cpp',
     'StyleSheet.cpp',
     'URLExtraData.cpp',
 ]