зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1451289 - Part 7: Merge ServoPageRule and CSSPageRule r=emilio
MozReview-Commit-ID: 5kqMLZWXFN5 --HG-- extra : rebase_source : 1ef8e31634b1be81c0df3c36bb56d13f7be9a9a2
This commit is contained in:
Родитель
7849dbc1a0
Коммит
77fad93235
|
@ -5,12 +5,180 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/CSSPageRule.h"
|
||||
|
||||
#include "mozilla/dom/CSSPageRuleBinding.h"
|
||||
|
||||
#include "mozilla/DeclarationBlock.h"
|
||||
#include "mozilla/ServoBindings.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
// -- CSSPageRuleDeclaration ---------------------------------------
|
||||
|
||||
CSSPageRuleDeclaration::CSSPageRuleDeclaration(
|
||||
already_AddRefed<RawServoDeclarationBlock> aDecls)
|
||||
: mDecls(new DeclarationBlock(std::move(aDecls)))
|
||||
{
|
||||
}
|
||||
|
||||
CSSPageRuleDeclaration::~CSSPageRuleDeclaration()
|
||||
{
|
||||
mDecls->SetOwningRule(nullptr);
|
||||
}
|
||||
|
||||
// QueryInterface implementation for CSSPageRuleDeclaration
|
||||
NS_INTERFACE_MAP_BEGIN(CSSPageRuleDeclaration)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
// We forward the cycle collection interfaces to Rule(), which is
|
||||
// never null (in fact, we're part of that object!)
|
||||
if (aIID.Equals(NS_GET_IID(nsCycleCollectionISupports)) ||
|
||||
aIID.Equals(NS_GET_IID(nsXPCOMCycleCollectionParticipant))) {
|
||||
return Rule()->QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
else
|
||||
NS_IMPL_QUERY_TAIL_INHERITING(nsDOMCSSDeclaration)
|
||||
|
||||
NS_IMPL_ADDREF_USING_AGGREGATOR(CSSPageRuleDeclaration, Rule())
|
||||
NS_IMPL_RELEASE_USING_AGGREGATOR(CSSPageRuleDeclaration, Rule())
|
||||
|
||||
/* nsDOMCSSDeclaration implementation */
|
||||
|
||||
css::Rule*
|
||||
CSSPageRuleDeclaration::GetParentRule()
|
||||
{
|
||||
return Rule();
|
||||
}
|
||||
|
||||
nsINode*
|
||||
CSSPageRuleDeclaration::GetParentObject()
|
||||
{
|
||||
return Rule()->GetParentObject();
|
||||
}
|
||||
|
||||
DeclarationBlock*
|
||||
CSSPageRuleDeclaration::GetCSSDeclaration(Operation aOperation)
|
||||
{
|
||||
return mDecls;
|
||||
}
|
||||
|
||||
nsresult
|
||||
CSSPageRuleDeclaration::SetCSSDeclaration(DeclarationBlock* aDecl)
|
||||
{
|
||||
MOZ_ASSERT(aDecl, "must be non-null");
|
||||
CSSPageRule* rule = Rule();
|
||||
|
||||
if (aDecl != mDecls) {
|
||||
mDecls->SetOwningRule(nullptr);
|
||||
RefPtr<DeclarationBlock> decls = aDecl;
|
||||
Servo_PageRule_SetStyle(rule->Raw(), decls->Raw());
|
||||
mDecls = decls.forget();
|
||||
mDecls->SetOwningRule(rule);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIDocument*
|
||||
CSSPageRuleDeclaration::DocToUpdate()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsDOMCSSDeclaration::ParsingEnvironment
|
||||
CSSPageRuleDeclaration::GetParsingEnvironment(
|
||||
nsIPrincipal* aSubjectPrincipal) const
|
||||
{
|
||||
return GetParsingEnvironmentForRule(Rule());
|
||||
}
|
||||
|
||||
// -- CSSPageRule --------------------------------------------------
|
||||
|
||||
CSSPageRule::CSSPageRule(RefPtr<RawServoPageRule> aRawRule,
|
||||
uint32_t aLine, uint32_t aColumn)
|
||||
: Rule(aLine, aColumn)
|
||||
, mRawRule(std::move(aRawRule))
|
||||
, mDecls(Servo_PageRule_GetStyle(mRawRule).Consume())
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(CSSPageRule, css::Rule)
|
||||
NS_IMPL_RELEASE_INHERITED(CSSPageRule, css::Rule)
|
||||
|
||||
// QueryInterface implementation for PageRule
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CSSPageRule)
|
||||
NS_INTERFACE_MAP_END_INHERITING(css::Rule)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(CSSPageRule)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(CSSPageRule, css::Rule)
|
||||
// Keep this in sync with IsCCLeaf.
|
||||
|
||||
// Trace the wrapper for our declaration. This just expands out
|
||||
// NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER which we can't use
|
||||
// directly because the wrapper is on the declaration, not on us.
|
||||
tmp->mDecls.TraceWrapper(aCallbacks, aClosure);
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(CSSPageRule, css::Rule)
|
||||
// Keep this in sync with IsCCLeaf.
|
||||
|
||||
// Unlink the wrapper for our declaraton. This just expands out
|
||||
// NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER which we can't use
|
||||
// directly because the wrapper is on the declaration, not on us.
|
||||
tmp->mDecls.ReleaseWrapper(static_cast<nsISupports*>(p));
|
||||
tmp->mDecls.mDecls->SetOwningRule(nullptr);
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(CSSPageRule, css::Rule)
|
||||
// Keep this in sync with IsCCLeaf.
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
bool
|
||||
CSSPageRule::IsCCLeaf() const
|
||||
{
|
||||
if (!Rule::IsCCLeaf()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !mDecls.PreservingWrapper();
|
||||
}
|
||||
|
||||
size_t
|
||||
CSSPageRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
// TODO Implement this!
|
||||
return aMallocSizeOf(this);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
CSSPageRule::List(FILE* out, int32_t aIndent) const
|
||||
{
|
||||
nsAutoCString str;
|
||||
for (int32_t i = 0; i < aIndent; i++) {
|
||||
str.AppendLiteral(" ");
|
||||
}
|
||||
Servo_PageRule_Debug(mRawRule, &str);
|
||||
fprintf_stderr(out, "%s\n", str.get());
|
||||
}
|
||||
#endif
|
||||
|
||||
/* CSSRule implementation */
|
||||
|
||||
void
|
||||
CSSPageRule::GetCssText(nsAString& aCssText) const
|
||||
{
|
||||
Servo_PageRule_GetCssText(mRawRule, &aCssText);
|
||||
}
|
||||
|
||||
/* CSSPageRule implementation */
|
||||
|
||||
nsICSSDeclaration*
|
||||
CSSPageRule::Style()
|
||||
{
|
||||
return &mDecls;
|
||||
}
|
||||
|
||||
JSObject*
|
||||
CSSPageRule::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
{
|
||||
|
|
|
@ -8,33 +8,101 @@
|
|||
#define mozilla_dom_CSSPageRule_h
|
||||
|
||||
#include "mozilla/css/Rule.h"
|
||||
#include "mozilla/ServoBindingTypes.h"
|
||||
|
||||
#include "nsDOMCSSDeclaration.h"
|
||||
#include "nsICSSDeclaration.h"
|
||||
|
||||
namespace mozilla {
|
||||
class DeclarationBlock;
|
||||
|
||||
namespace dom {
|
||||
class DocGroup;
|
||||
class CSSPageRule;
|
||||
|
||||
class CSSPageRule : public css::Rule
|
||||
class CSSPageRuleDeclaration final : public nsDOMCSSDeclaration
|
||||
{
|
||||
protected:
|
||||
using Rule::Rule;
|
||||
virtual ~CSSPageRule() {};
|
||||
|
||||
public:
|
||||
virtual bool IsCCLeaf() const override = 0;
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
css::Rule* GetParentRule() final;
|
||||
nsINode* GetParentObject() final;
|
||||
|
||||
protected:
|
||||
DeclarationBlock* GetCSSDeclaration(Operation aOperation) final;
|
||||
nsresult SetCSSDeclaration(DeclarationBlock* aDecl) final;
|
||||
nsIDocument* DocToUpdate() final;
|
||||
nsDOMCSSDeclaration::ParsingEnvironment
|
||||
GetParsingEnvironment(nsIPrincipal* aSubjectPrincipal) const final;
|
||||
|
||||
private:
|
||||
// For accessing the constructor.
|
||||
friend class CSSPageRule;
|
||||
|
||||
explicit CSSPageRuleDeclaration(
|
||||
already_AddRefed<RawServoDeclarationBlock> aDecls);
|
||||
~CSSPageRuleDeclaration();
|
||||
|
||||
inline CSSPageRule* Rule();
|
||||
inline const CSSPageRule* Rule() const;
|
||||
|
||||
RefPtr<DeclarationBlock> mDecls;
|
||||
};
|
||||
|
||||
class CSSPageRule final : public css::Rule
|
||||
{
|
||||
public:
|
||||
CSSPageRule(RefPtr<RawServoPageRule> aRawRule,
|
||||
uint32_t aLine, uint32_t aColumn);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
|
||||
CSSPageRule, css::Rule
|
||||
)
|
||||
|
||||
bool IsCCLeaf() const final;
|
||||
|
||||
RawServoPageRule* Raw() const { return mRawRule; }
|
||||
|
||||
// WebIDL interfaces
|
||||
uint16_t Type() const final { return CSSRuleBinding::PAGE_RULE; }
|
||||
virtual void GetCssText(nsAString& aCssText) const override = 0;
|
||||
virtual nsICSSDeclaration* Style() = 0;
|
||||
void GetCssText(nsAString& aCssText) const final;
|
||||
nsICSSDeclaration* Style();
|
||||
|
||||
virtual size_t
|
||||
SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override = 0;
|
||||
size_t
|
||||
SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const final;
|
||||
|
||||
#ifdef DEBUG
|
||||
void List(FILE* out = stdout, int32_t aIndent = 0) const final;
|
||||
#endif
|
||||
|
||||
JSObject*
|
||||
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final;
|
||||
|
||||
private:
|
||||
~CSSPageRule() = default;
|
||||
|
||||
// For computing the offset of mDecls.
|
||||
friend class CSSPageRuleDeclaration;
|
||||
|
||||
RefPtr<RawServoPageRule> mRawRule;
|
||||
CSSPageRuleDeclaration mDecls;
|
||||
};
|
||||
|
||||
CSSPageRule*
|
||||
CSSPageRuleDeclaration::Rule()
|
||||
{
|
||||
return reinterpret_cast<CSSPageRule*>(
|
||||
reinterpret_cast<uint8_t*>(this) - offsetof(CSSPageRule, mDecls));
|
||||
}
|
||||
|
||||
const CSSPageRule*
|
||||
CSSPageRuleDeclaration::Rule() const
|
||||
{
|
||||
return reinterpret_cast<const CSSPageRule*>(
|
||||
reinterpret_cast<const uint8_t*>(this) - offsetof(CSSPageRule, mDecls));
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
#include "mozilla/dom/CSSKeyframesRule.h"
|
||||
#include "mozilla/dom/CSSMediaRule.h"
|
||||
#include "mozilla/dom/CSSNamespaceRule.h"
|
||||
#include "mozilla/dom/CSSPageRule.h"
|
||||
#include "mozilla/dom/CSSStyleRule.h"
|
||||
#include "mozilla/IntegerRange.h"
|
||||
#include "mozilla/ServoBindings.h"
|
||||
#include "mozilla/ServoDocumentRule.h"
|
||||
#include "mozilla/ServoImportRule.h"
|
||||
#include "mozilla/ServoFontFeatureValuesRule.h"
|
||||
#include "mozilla/ServoPageRule.h"
|
||||
#include "mozilla/ServoSupportsRule.h"
|
||||
#include "mozilla/StyleSheet.h"
|
||||
|
||||
|
@ -108,7 +108,7 @@ ServoCSSRuleList::GetRule(uint32_t aIndex)
|
|||
CASE_RULE_CSS(KEYFRAMES, Keyframes)
|
||||
CASE_RULE_CSS(MEDIA, Media)
|
||||
CASE_RULE_CSS(NAMESPACE, Namespace)
|
||||
CASE_RULE(PAGE, Page)
|
||||
CASE_RULE_CSS(PAGE, Page)
|
||||
CASE_RULE(SUPPORTS, Supports)
|
||||
CASE_RULE(DOCUMENT, Document)
|
||||
CASE_RULE(IMPORT, Import)
|
||||
|
|
|
@ -1,188 +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 CSSPageRule for stylo */
|
||||
|
||||
#include "mozilla/ServoPageRule.h"
|
||||
|
||||
#include "mozilla/DeclarationBlock.h"
|
||||
#include "mozilla/ServoBindings.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
// -- ServoPageRuleDeclaration ---------------------------------------
|
||||
|
||||
ServoPageRuleDeclaration::ServoPageRuleDeclaration(
|
||||
already_AddRefed<RawServoDeclarationBlock> aDecls)
|
||||
: mDecls(new DeclarationBlock(std::move(aDecls)))
|
||||
{
|
||||
}
|
||||
|
||||
ServoPageRuleDeclaration::~ServoPageRuleDeclaration()
|
||||
{
|
||||
mDecls->SetOwningRule(nullptr);
|
||||
}
|
||||
|
||||
// QueryInterface implementation for ServoPageRuleDeclaration
|
||||
NS_INTERFACE_MAP_BEGIN(ServoPageRuleDeclaration)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
// We forward the cycle collection interfaces to Rule(), which is
|
||||
// never null (in fact, we're part of that object!)
|
||||
if (aIID.Equals(NS_GET_IID(nsCycleCollectionISupports)) ||
|
||||
aIID.Equals(NS_GET_IID(nsXPCOMCycleCollectionParticipant))) {
|
||||
return Rule()->QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
else
|
||||
NS_IMPL_QUERY_TAIL_INHERITING(nsDOMCSSDeclaration)
|
||||
|
||||
NS_IMPL_ADDREF_USING_AGGREGATOR(ServoPageRuleDeclaration, Rule())
|
||||
NS_IMPL_RELEASE_USING_AGGREGATOR(ServoPageRuleDeclaration, Rule())
|
||||
|
||||
/* nsDOMCSSDeclaration implementation */
|
||||
|
||||
css::Rule*
|
||||
ServoPageRuleDeclaration::GetParentRule()
|
||||
{
|
||||
return Rule();
|
||||
}
|
||||
|
||||
nsINode*
|
||||
ServoPageRuleDeclaration::GetParentObject()
|
||||
{
|
||||
return Rule()->GetParentObject();
|
||||
}
|
||||
|
||||
DeclarationBlock*
|
||||
ServoPageRuleDeclaration::GetCSSDeclaration(Operation aOperation)
|
||||
{
|
||||
return mDecls;
|
||||
}
|
||||
|
||||
nsresult
|
||||
ServoPageRuleDeclaration::SetCSSDeclaration(DeclarationBlock* aDecl)
|
||||
{
|
||||
MOZ_ASSERT(aDecl, "must be non-null");
|
||||
ServoPageRule* rule = Rule();
|
||||
|
||||
if (aDecl != mDecls) {
|
||||
mDecls->SetOwningRule(nullptr);
|
||||
RefPtr<DeclarationBlock> decls = aDecl;
|
||||
Servo_PageRule_SetStyle(rule->Raw(), decls->Raw());
|
||||
mDecls = decls.forget();
|
||||
mDecls->SetOwningRule(rule);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIDocument*
|
||||
ServoPageRuleDeclaration::DocToUpdate()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsDOMCSSDeclaration::ParsingEnvironment
|
||||
ServoPageRuleDeclaration::GetParsingEnvironment(
|
||||
nsIPrincipal* aSubjectPrincipal) const
|
||||
{
|
||||
return GetParsingEnvironmentForRule(Rule());
|
||||
}
|
||||
|
||||
// -- ServoPageRule --------------------------------------------------
|
||||
|
||||
ServoPageRule::ServoPageRule(RefPtr<RawServoPageRule> aRawRule,
|
||||
uint32_t aLine, uint32_t aColumn)
|
||||
: CSSPageRule(aLine, aColumn)
|
||||
, mRawRule(std::move(aRawRule))
|
||||
, mDecls(Servo_PageRule_GetStyle(mRawRule).Consume())
|
||||
{
|
||||
}
|
||||
|
||||
ServoPageRule::~ServoPageRule()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(ServoPageRule, CSSPageRule)
|
||||
NS_IMPL_RELEASE_INHERITED(ServoPageRule, CSSPageRule)
|
||||
|
||||
// QueryInterface implementation for PageRule
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ServoPageRule)
|
||||
NS_INTERFACE_MAP_END_INHERITING(CSSPageRule)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(ServoPageRule)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(ServoPageRule, CSSPageRule)
|
||||
// Keep this in sync with IsCCLeaf.
|
||||
|
||||
// Trace the wrapper for our declaration. This just expands out
|
||||
// NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER which we can't use
|
||||
// directly because the wrapper is on the declaration, not on us.
|
||||
tmp->mDecls.TraceWrapper(aCallbacks, aClosure);
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(ServoPageRule, CSSPageRule)
|
||||
// Keep this in sync with IsCCLeaf.
|
||||
|
||||
// Unlink the wrapper for our declaraton. This just expands out
|
||||
// NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER which we can't use
|
||||
// directly because the wrapper is on the declaration, not on us.
|
||||
tmp->mDecls.ReleaseWrapper(static_cast<nsISupports*>(p));
|
||||
tmp->mDecls.mDecls->SetOwningRule(nullptr);
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(ServoPageRule, CSSPageRule)
|
||||
// Keep this in sync with IsCCLeaf.
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
bool
|
||||
ServoPageRule::IsCCLeaf() const
|
||||
{
|
||||
if (!Rule::IsCCLeaf()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !mDecls.PreservingWrapper();
|
||||
}
|
||||
|
||||
size_t
|
||||
ServoPageRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
// TODO Implement this!
|
||||
return aMallocSizeOf(this);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
ServoPageRule::List(FILE* out, int32_t aIndent) const
|
||||
{
|
||||
nsAutoCString str;
|
||||
for (int32_t i = 0; i < aIndent; i++) {
|
||||
str.AppendLiteral(" ");
|
||||
}
|
||||
Servo_PageRule_Debug(mRawRule, &str);
|
||||
fprintf_stderr(out, "%s\n", str.get());
|
||||
}
|
||||
#endif
|
||||
|
||||
/* CSSRule implementation */
|
||||
|
||||
void
|
||||
ServoPageRule::GetCssText(nsAString& aCssText) const
|
||||
{
|
||||
Servo_PageRule_GetCssText(mRawRule, &aCssText);
|
||||
}
|
||||
|
||||
/* CSSPageRule implementation */
|
||||
|
||||
nsICSSDeclaration*
|
||||
ServoPageRule::Style()
|
||||
{
|
||||
return &mDecls;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
|
@ -1,107 +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 CSSPageRule for stylo */
|
||||
|
||||
#ifndef mozilla_ServoPageRule_h
|
||||
#define mozilla_ServoPageRule_h
|
||||
|
||||
#include "mozilla/dom/CSSPageRule.h"
|
||||
#include "mozilla/ServoBindingTypes.h"
|
||||
|
||||
#include "nsDOMCSSDeclaration.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace dom {
|
||||
class DocGroup;
|
||||
} // namespace dom
|
||||
|
||||
class DeclarationBlock;
|
||||
class ServoPageRule;
|
||||
|
||||
class ServoPageRuleDeclaration final : public nsDOMCSSDeclaration
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
css::Rule* GetParentRule() final;
|
||||
nsINode* GetParentObject() final;
|
||||
|
||||
protected:
|
||||
DeclarationBlock* GetCSSDeclaration(Operation aOperation) final;
|
||||
nsresult SetCSSDeclaration(DeclarationBlock* aDecl) final;
|
||||
nsIDocument* DocToUpdate() final;
|
||||
nsDOMCSSDeclaration::ParsingEnvironment
|
||||
GetParsingEnvironment(nsIPrincipal* aSubjectPrincipal) const final;
|
||||
|
||||
private:
|
||||
// For accessing the constructor.
|
||||
friend class ServoPageRule;
|
||||
|
||||
explicit ServoPageRuleDeclaration(
|
||||
already_AddRefed<RawServoDeclarationBlock> aDecls);
|
||||
~ServoPageRuleDeclaration();
|
||||
|
||||
inline ServoPageRule* Rule();
|
||||
inline const ServoPageRule* Rule() const;
|
||||
|
||||
RefPtr<DeclarationBlock> mDecls;
|
||||
};
|
||||
|
||||
class ServoPageRule final : public dom::CSSPageRule
|
||||
{
|
||||
public:
|
||||
ServoPageRule(RefPtr<RawServoPageRule> aRawRule,
|
||||
uint32_t aLine, uint32_t aColumn);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
|
||||
ServoPageRule, dom::CSSPageRule
|
||||
)
|
||||
bool IsCCLeaf() const final;
|
||||
|
||||
RawServoPageRule* Raw() const { return mRawRule; }
|
||||
|
||||
// WebIDL interface
|
||||
void GetCssText(nsAString& aCssText) const final;
|
||||
nsICSSDeclaration* Style() 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:
|
||||
virtual ~ServoPageRule();
|
||||
|
||||
// For computing the offset of mDecls.
|
||||
friend class ServoPageRuleDeclaration;
|
||||
|
||||
RefPtr<RawServoPageRule> mRawRule;
|
||||
ServoPageRuleDeclaration mDecls;
|
||||
};
|
||||
|
||||
ServoPageRule*
|
||||
ServoPageRuleDeclaration::Rule()
|
||||
{
|
||||
return reinterpret_cast<ServoPageRule*>(
|
||||
reinterpret_cast<uint8_t*>(this) - offsetof(ServoPageRule, mDecls));
|
||||
}
|
||||
|
||||
const ServoPageRule*
|
||||
ServoPageRuleDeclaration::Rule() const
|
||||
{
|
||||
return reinterpret_cast<const ServoPageRule*>(
|
||||
reinterpret_cast<const uint8_t*>(this) - offsetof(ServoPageRule, mDecls));
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_ServoPageRule_h
|
|
@ -89,7 +89,6 @@ EXPORTS.mozilla += [
|
|||
'ServoElementSnapshotTable.h',
|
||||
'ServoFontFeatureValuesRule.h',
|
||||
'ServoImportRule.h',
|
||||
'ServoPageRule.h',
|
||||
'ServoSpecifiedValues.h',
|
||||
'ServoStyleSet.h',
|
||||
'ServoStyleSetInlines.h',
|
||||
|
@ -208,7 +207,6 @@ UNIFIED_SOURCES += [
|
|||
'ServoElementSnapshot.cpp',
|
||||
'ServoFontFeatureValuesRule.cpp',
|
||||
'ServoImportRule.cpp',
|
||||
'ServoPageRule.cpp',
|
||||
'ServoSpecifiedValues.cpp',
|
||||
'ServoStyleSet.cpp',
|
||||
'ServoSupportsRule.cpp',
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "nsHashKeys.h"
|
||||
#include "mozilla/OperatorNewExtensions.h"
|
||||
#include "mozilla/RestyleManager.h"
|
||||
#include "mozilla/ServoBindings.h"
|
||||
#include "mozilla/ServoStyleSet.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
|
Загрузка…
Ссылка в новой задаче