Bug 1408311 - Part 2: Add GetDeclarationBlock method to BindingStyleRule. r=xidorn

MozReview-Commit-ID: 5adkbeTOHQU

--HG--
extra : rebase_source : 67d196ac36b5f6daca8e20f6ec6063b3f2f8c84d
This commit is contained in:
Cameron McCormack 2017-10-19 15:55:42 +08:00
Родитель bbdc9e9e0f
Коммит 6e9ab08423
5 изменённых файлов: 17 добавлений и 0 удалений

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

@ -9,6 +9,7 @@
#include "nscore.h" #include "nscore.h"
#include "nsStringGlue.h" #include "nsStringGlue.h"
#include "mozilla/css/Rule.h" #include "mozilla/css/Rule.h"
#include "mozilla/NotNull.h"
/** /**
* Shared superclass for mozilla::css::StyleRule and mozilla::ServoStyleRule, * Shared superclass for mozilla::css::StyleRule and mozilla::ServoStyleRule,
@ -18,6 +19,7 @@
class nsICSSDeclaration; class nsICSSDeclaration;
namespace mozilla { namespace mozilla {
class DeclarationBlock;
namespace dom { namespace dom {
class Element; class Element;
} }
@ -54,6 +56,7 @@ public:
uint32_t aSelectorIndex, uint32_t aSelectorIndex,
const nsAString& aPseudo, const nsAString& aPseudo,
bool* aMatches) = 0; bool* aMatches) = 0;
virtual NotNull<DeclarationBlock*> GetDeclarationBlock() const = 0;
// WebIDL API // WebIDL API
// For GetSelectorText/SetSelectorText, we purposefully use a signature that // For GetSelectorText/SetSelectorText, we purposefully use a signature that

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

@ -298,4 +298,10 @@ ServoStyleRule::SelectorMatchesElement(Element* aElement,
return NS_OK; return NS_OK;
} }
NotNull<DeclarationBlock*>
ServoStyleRule::GetDeclarationBlock() const
{
return WrapNotNull(mDecls.mDecls);
}
} // namespace mozilla } // namespace mozilla

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

@ -80,6 +80,7 @@ public:
uint32_t aSelectorIndex, uint32_t aSelectorIndex,
const nsAString& aPseudo, const nsAString& aPseudo,
bool* aMatches) override; bool* aMatches) override;
NotNull<DeclarationBlock*> GetDeclarationBlock() const override;
// WebIDL interface // WebIDL interface
uint16_t Type() const final; uint16_t Type() const final;

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

@ -1513,5 +1513,11 @@ StyleRule::SelectorMatchesElement(Element* aElement,
return NS_OK; return NS_OK;
} }
NotNull<DeclarationBlock*>
StyleRule::GetDeclarationBlock() const
{
return WrapNotNull(mDeclaration);
}
} // namespace css } // namespace css
} // namespace mozilla } // namespace mozilla

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

@ -347,6 +347,7 @@ public:
uint32_t aSelectorIndex, uint32_t aSelectorIndex,
const nsAString& aPseudo, const nsAString& aPseudo,
bool* aMatches) override; bool* aMatches) override;
mozilla::NotNull<DeclarationBlock*> GetDeclarationBlock() const override;
// WebIDL interface // WebIDL interface
uint16_t Type() const override; uint16_t Type() const override;