зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1451289 - Part 1: Merge ServoNamespaceRule and css::CSSNamespaceRule r=emilio
MozReview-Commit-ID: D5kU7f0hluL --HG-- rename : layout/style/ServoNamespaceRule.cpp => layout/style/CSSNamespaceRule.cpp extra : rebase_source : 9fd5cb862b6f606b056e935c75655415f40c9b64
This commit is contained in:
Родитель
13565e21f4
Коммит
6cdcd1d100
|
@ -4,7 +4,7 @@
|
|||
* 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/. */
|
||||
|
||||
#include "mozilla/ServoNamespaceRule.h"
|
||||
#include "mozilla/dom/CSSNamespaceRule.h"
|
||||
|
||||
#include "mozilla/ServoBindings.h"
|
||||
|
||||
|
@ -12,13 +12,13 @@ using namespace mozilla::dom;
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
ServoNamespaceRule::~ServoNamespaceRule()
|
||||
CSSNamespaceRule::~CSSNamespaceRule()
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
ServoNamespaceRule::List(FILE* out, int32_t aIndent) const
|
||||
CSSNamespaceRule::List(FILE* out, int32_t aIndent) const
|
||||
{
|
||||
nsAutoCString str;
|
||||
for (int32_t i = 0; i < aIndent; i++) {
|
||||
|
@ -30,26 +30,26 @@ ServoNamespaceRule::List(FILE* out, int32_t aIndent) const
|
|||
#endif
|
||||
|
||||
nsAtom*
|
||||
ServoNamespaceRule::GetPrefix() const
|
||||
CSSNamespaceRule::GetPrefix() const
|
||||
{
|
||||
return Servo_NamespaceRule_GetPrefix(mRawRule);
|
||||
}
|
||||
|
||||
void
|
||||
ServoNamespaceRule::GetURLSpec(nsString& aURLSpec) const
|
||||
CSSNamespaceRule::GetURLSpec(nsString& aURLSpec) const
|
||||
{
|
||||
nsAtom* atom = Servo_NamespaceRule_GetURI(mRawRule);
|
||||
atom->ToString(aURLSpec);
|
||||
}
|
||||
|
||||
void
|
||||
ServoNamespaceRule::GetCssText(nsAString& aCssText) const
|
||||
CSSNamespaceRule::GetCssText(nsAString& aCssText) const
|
||||
{
|
||||
Servo_NamespaceRule_GetCssText(mRawRule, &aCssText);
|
||||
}
|
||||
|
||||
size_t
|
||||
ServoNamespaceRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
CSSNamespaceRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
return aMallocSizeOf(this);
|
||||
}
|
|
@ -9,40 +9,58 @@
|
|||
|
||||
#include "mozilla/css/Rule.h"
|
||||
#include "mozilla/dom/CSSNamespaceRuleBinding.h"
|
||||
#include "mozilla/ServoBindingTypes.h"
|
||||
|
||||
class nsAtom;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class CSSNamespaceRule : public css::Rule
|
||||
class CSSNamespaceRule final : public css::Rule
|
||||
{
|
||||
protected:
|
||||
using Rule::Rule;
|
||||
|
||||
public:
|
||||
CSSNamespaceRule(already_AddRefed<RawServoNamespaceRule> aRule,
|
||||
uint32_t aLine, uint32_t aColumn)
|
||||
: css::Rule(aLine, aColumn)
|
||||
, mRawRule(std::move(aRule))
|
||||
{
|
||||
}
|
||||
|
||||
bool IsCCLeaf() const final {
|
||||
return Rule::IsCCLeaf();
|
||||
}
|
||||
|
||||
virtual nsAtom* GetPrefix() const = 0;
|
||||
virtual void GetURLSpec(nsString& aURLSpec) const = 0;
|
||||
#ifdef DEBUG
|
||||
void List(FILE* out = stdout, int32_t aIndent = 0) const final;
|
||||
#endif
|
||||
|
||||
nsAtom* GetPrefix() const;
|
||||
void GetURLSpec(nsString& aURLSpec) const;
|
||||
|
||||
// WebIDL interface
|
||||
void GetCssText(nsAString& aCssText) const final;
|
||||
|
||||
// WebIDL interfaces
|
||||
uint16_t Type() const final { return CSSRuleBinding::NAMESPACE_RULE; }
|
||||
|
||||
void GetNamespaceURI(nsString& aNamespaceURI) {
|
||||
GetURLSpec(aNamespaceURI);
|
||||
}
|
||||
|
||||
void GetPrefix(DOMString& aPrefix) {
|
||||
aPrefix.SetKnownLiveAtom(GetPrefix(), DOMString::eTreatNullAsEmpty);
|
||||
}
|
||||
|
||||
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override = 0;
|
||||
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const final;
|
||||
|
||||
JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) final {
|
||||
return CSSNamespaceRuleBinding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
private:
|
||||
~CSSNamespaceRule();
|
||||
RefPtr<RawServoNamespaceRule> mRawRule;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -264,6 +264,7 @@ SERVO_BINDING_FUNC(Servo_CssRules_DeleteRule, nsresult,
|
|||
BASIC_RULE_FUNCS(type_) \
|
||||
SERVO_BINDING_FUNC(Servo_##type_##Rule_GetRules, ServoCssRulesStrong, \
|
||||
RawServo##type_##RuleBorrowed rule)
|
||||
|
||||
BASIC_RULE_FUNCS(Style)
|
||||
BASIC_RULE_FUNCS(Import)
|
||||
BASIC_RULE_FUNCS_WITHOUT_GETTER(Keyframe)
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "mozilla/ServoCSSRuleList.h"
|
||||
|
||||
#include "mozilla/dom/CSSNamespaceRule.h"
|
||||
#include "mozilla/IntegerRange.h"
|
||||
#include "mozilla/ServoBindings.h"
|
||||
#include "mozilla/ServoCounterStyleRule.h"
|
||||
|
@ -17,7 +18,6 @@
|
|||
#include "mozilla/ServoFontFeatureValuesRule.h"
|
||||
#include "mozilla/ServoKeyframesRule.h"
|
||||
#include "mozilla/ServoMediaRule.h"
|
||||
#include "mozilla/ServoNamespaceRule.h"
|
||||
#include "mozilla/ServoPageRule.h"
|
||||
#include "mozilla/ServoStyleRule.h"
|
||||
#include "mozilla/ServoSupportsRule.h"
|
||||
|
@ -93,10 +93,21 @@ ServoCSSRuleList::GetRule(uint32_t aIndex)
|
|||
ruleObj = new Servo##name_##Rule(rule.forget(), line, column); \
|
||||
break; \
|
||||
}
|
||||
#define CASE_RULE_CSS(const_, name_) \
|
||||
case CSSRuleBinding::const_##_RULE: { \
|
||||
uint32_t line = 0, column = 0; \
|
||||
RefPtr<RawServo##name_##Rule> rule = \
|
||||
Servo_CssRules_Get##name_##RuleAt( \
|
||||
mRawRules, aIndex, &line, &column \
|
||||
).Consume(); \
|
||||
MOZ_ASSERT(rule); \
|
||||
ruleObj = new CSS##name_##Rule(rule.forget(), line, column); \
|
||||
break; \
|
||||
}
|
||||
CASE_RULE(STYLE, Style)
|
||||
CASE_RULE(KEYFRAMES, Keyframes)
|
||||
CASE_RULE(MEDIA, Media)
|
||||
CASE_RULE(NAMESPACE, Namespace)
|
||||
CASE_RULE_CSS(NAMESPACE, Namespace)
|
||||
CASE_RULE(PAGE, Page)
|
||||
CASE_RULE(SUPPORTS, Supports)
|
||||
CASE_RULE(DOCUMENT, Document)
|
||||
|
|
|
@ -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/. */
|
||||
|
||||
#ifndef mozilla_ServoNamespaceRule_h
|
||||
#define mozilla_ServoNamespaceRule_h
|
||||
|
||||
#include "mozilla/ServoBindingTypes.h"
|
||||
#include "mozilla/dom/CSSNamespaceRule.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class ServoNamespaceRule : public dom::CSSNamespaceRule
|
||||
{
|
||||
public:
|
||||
ServoNamespaceRule(already_AddRefed<RawServoNamespaceRule> aRule,
|
||||
uint32_t aLine, uint32_t aColumn)
|
||||
: CSSNamespaceRule(aLine, aColumn)
|
||||
, mRawRule(std::move(aRule))
|
||||
{
|
||||
}
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING_INHERITED(ServoNamespaceRule,
|
||||
dom::CSSNamespaceRule)
|
||||
|
||||
#ifdef DEBUG
|
||||
void List(FILE* out = stdout, int32_t aIndent = 0) const final;
|
||||
#endif
|
||||
|
||||
nsAtom* GetPrefix() const final;
|
||||
void GetURLSpec(nsString& aURLSpec) const final;
|
||||
|
||||
// WebIDL interface
|
||||
void GetCssText(nsAString& aCssText) const final;
|
||||
|
||||
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const final;
|
||||
|
||||
private:
|
||||
~ServoNamespaceRule();
|
||||
|
||||
RefPtr<RawServoNamespaceRule> mRawRule;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_ServoNamespaceRule_h
|
|
@ -94,7 +94,6 @@ EXPORTS.mozilla += [
|
|||
'ServoKeyframeRule.h',
|
||||
'ServoKeyframesRule.h',
|
||||
'ServoMediaRule.h',
|
||||
'ServoNamespaceRule.h',
|
||||
'ServoPageRule.h',
|
||||
'ServoSpecifiedValues.h',
|
||||
'ServoStyleRule.h',
|
||||
|
@ -160,6 +159,7 @@ UNIFIED_SOURCES += [
|
|||
'CSSLexer.cpp',
|
||||
'CSSMediaRule.cpp',
|
||||
'CSSMozDocumentRule.cpp',
|
||||
'CSSNamespaceRule.cpp',
|
||||
'CSSPageRule.cpp',
|
||||
'CSSRuleList.cpp',
|
||||
'CSSSupportsRule.cpp',
|
||||
|
@ -213,7 +213,6 @@ UNIFIED_SOURCES += [
|
|||
'ServoKeyframeRule.cpp',
|
||||
'ServoKeyframesRule.cpp',
|
||||
'ServoMediaRule.cpp',
|
||||
'ServoNamespaceRule.cpp',
|
||||
'ServoPageRule.cpp',
|
||||
'ServoSpecifiedValues.cpp',
|
||||
'ServoStyleRule.cpp',
|
||||
|
|
Загрузка…
Ссылка в новой задаче