Bug 978833 patch 6 - Move ImportantStyleData from StyleRule.{h,cpp} to Declaration.{h,cpp} r=heycam

This is needed for patch 7.

Note that this removes an unused "friend class StyleRule;" declaration.

--HG--
extra : commitid : Fjns3SwV7M1
This commit is contained in:
L. David Baron 2015-11-05 16:44:09 +08:00
Родитель 00351db8e0
Коммит ed0b078c21
4 изменённых файлов: 52 добавлений и 63 удалений

Просмотреть файл

@ -19,6 +19,38 @@
namespace mozilla {
namespace css {
ImportantStyleData::ImportantStyleData(Declaration* aDeclaration)
: mDeclaration(aDeclaration)
{
}
ImportantStyleData::~ImportantStyleData()
{
}
NS_IMPL_ISUPPORTS(ImportantStyleData, nsIStyleRule)
/* virtual */ void
ImportantStyleData::MapRuleInfoInto(nsRuleData* aRuleData)
{
mDeclaration->MapImportantRuleInfoInto(aRuleData);
}
#ifdef DEBUG
/* virtual */ void
ImportantStyleData::List(FILE* out, int32_t aIndent) const
{
// Indent
nsAutoCString str;
for (int32_t index = aIndent; --index >= 0; ) {
str.AppendLiteral(" ");
}
str.AppendLiteral("! important rule\n");
fprintf_stderr(out, "%s", str.get());
}
#endif
Declaration::Declaration()
: mOwningRule(nullptr)
, mImmutable(false)

Просмотреть файл

@ -37,6 +37,26 @@ namespace mozilla {
namespace css {
class Rule;
class Declaration;
class ImportantStyleData final : public nsIStyleRule
{
public:
explicit ImportantStyleData(Declaration* aDeclaration);
NS_DECL_ISUPPORTS
// nsIStyleRule interface
virtual void MapRuleInfoInto(nsRuleData* aRuleData) override;
#ifdef DEBUG
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
#endif
protected:
virtual ~ImportantStyleData();
RefPtr<Declaration> mDeclaration;
};
// Declaration objects have unusual lifetime rules. Every declaration
// begins life in an invalid state which ends when InitializeEmpty or

Просмотреть файл

@ -1038,46 +1038,6 @@ nsCSSSelectorList::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) cons
return n;
}
// -- ImportantStyleData ----------------------------------
namespace mozilla {
namespace css {
ImportantStyleData::ImportantStyleData(Declaration* aDeclaration)
: mDeclaration(aDeclaration)
{
}
ImportantStyleData::~ImportantStyleData()
{
}
NS_IMPL_ISUPPORTS(ImportantStyleData, nsIStyleRule)
/* virtual */ void
ImportantStyleData::MapRuleInfoInto(nsRuleData* aRuleData)
{
mDeclaration->MapImportantRuleInfoInto(aRuleData);
}
#ifdef DEBUG
/* virtual */ void
ImportantStyleData::List(FILE* out, int32_t aIndent) const
{
// Indent
nsAutoCString str;
for (int32_t index = aIndent; --index >= 0; ) {
str.AppendLiteral(" ");
}
str.AppendLiteral("! important rule\n");
fprintf_stderr(out, "%s", str.get());
}
#endif
} // namespace css
} // namespace mozilla
// --------------------------------------------------------
namespace mozilla {

Просмотреть файл

@ -292,29 +292,6 @@ namespace css {
class Declaration;
class DOMCSSStyleRule;
class StyleRule;
class ImportantStyleData final : public nsIStyleRule
{
public:
explicit ImportantStyleData(Declaration* aDeclaration);
NS_DECL_ISUPPORTS
// nsIStyleRule interface
virtual void MapRuleInfoInto(nsRuleData* aRuleData) override;
#ifdef DEBUG
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
#endif
protected:
virtual ~ImportantStyleData();
RefPtr<Declaration> mDeclaration;
friend class StyleRule;
};
class StyleRule final : public Rule
{
public: