зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1346256 Part 2: Define methods in ServoCSSRuleList to fill a hash of RawServoStyleRule to ServoStyleRule. r=heycam,xidorn
MozReview-Commit-ID: 4Swb9KwV0uO --HG-- extra : rebase_source : 771ac051648526b2cef59acc8f700548762b73b6
This commit is contained in:
Родитель
50b320d9d3
Коммит
7c2789c8d2
|
@ -204,6 +204,26 @@ ServoCSSRuleList::GetRuleType(uint32_t aIndex) const
|
||||||
return CastToPtr(rule)->Type();
|
return CastToPtr(rule)->Type();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ServoCSSRuleList::FillStyleRuleHashtable(StyleRuleHashtable& aTable)
|
||||||
|
{
|
||||||
|
for (uint32_t i = 0; i < mRules.Length(); i++) {
|
||||||
|
uint16_t type = GetRuleType(i);
|
||||||
|
if (type == nsIDOMCSSRule::STYLE_RULE) {
|
||||||
|
ServoStyleRule* castedRule = static_cast<ServoStyleRule*>(GetRule(i));
|
||||||
|
RawServoStyleRule* rawRule = castedRule->Raw();
|
||||||
|
aTable.Put(rawRule, castedRule);
|
||||||
|
} else if (type == nsIDOMCSSRule::MEDIA_RULE) {
|
||||||
|
ServoMediaRule* castedRule = static_cast<ServoMediaRule*>(GetRule(i));
|
||||||
|
|
||||||
|
// Call this method recursively on the ServoCSSRuleList in the rule.
|
||||||
|
ServoCSSRuleList* castedRuleList = static_cast<ServoCSSRuleList*>(
|
||||||
|
castedRule->CssRules());
|
||||||
|
castedRuleList->FillStyleRuleHashtable(aTable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ServoCSSRuleList::~ServoCSSRuleList()
|
ServoCSSRuleList::~ServoCSSRuleList()
|
||||||
{
|
{
|
||||||
DropAllRules();
|
DropAllRules();
|
||||||
|
|
|
@ -11,9 +11,11 @@
|
||||||
|
|
||||||
#include "mozilla/ServoBindingTypes.h"
|
#include "mozilla/ServoBindingTypes.h"
|
||||||
#include "mozilla/dom/CSSRuleList.h"
|
#include "mozilla/dom/CSSRuleList.h"
|
||||||
|
#include "nsDataHashtable.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
class ServoStyleRule;
|
||||||
class ServoStyleSheet;
|
class ServoStyleSheet;
|
||||||
namespace css {
|
namespace css {
|
||||||
class GroupRule;
|
class GroupRule;
|
||||||
|
@ -44,6 +46,10 @@ public:
|
||||||
|
|
||||||
uint16_t GetRuleType(uint32_t aIndex) const;
|
uint16_t GetRuleType(uint32_t aIndex) const;
|
||||||
|
|
||||||
|
typedef nsDataHashtable<nsPtrHashKey<const RawServoStyleRule>,
|
||||||
|
ServoStyleRule*> StyleRuleHashtable;
|
||||||
|
void FillStyleRuleHashtable(StyleRuleHashtable& aTable);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual ~ServoCSSRuleList();
|
virtual ~ServoCSSRuleList();
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче