Bug 1390694 - Part 3: Add nsBindingManager function to check for document state dependencies. r=emilio

MozReview-Commit-ID: Aw04MrVHyIz

--HG--
extra : rebase_source : dd1e15f0589ec532111711e14348c6d2ee590314
This commit is contained in:
Cameron McCormack 2017-10-18 17:26:41 +08:00
Родитель 2ceac13254
Коммит 0a31e73ee0
2 изменённых файлов: 20 добавлений и 0 удалений

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

@ -1169,3 +1169,20 @@ nsBindingManager::FindNestedSingleInsertionPoint(nsIContent* aContainer,
return parent;
}
bool
nsBindingManager::AnyBindingHasDocumentStateDependency(EventStates aStateMask)
{
MOZ_ASSERT(mDocument->IsStyledByServo());
bool result = false;
EnumerateBoundContentBindings([&](nsXBLBinding* aBinding) {
ServoStyleSet* styleSet = aBinding->PrototypeBinding()->GetServoStyleSet();
if (styleSet && styleSet->HasDocumentStateDependency(aStateMask)) {
result = true;
return false;
}
return true;
});
return result;
}

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

@ -19,6 +19,7 @@
#include "nsTArray.h"
#include "nsThreadUtils.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/EventStates.h"
struct ElementDependentRuleProcessorData;
class nsIXPConnectWrappedJS;
@ -175,6 +176,8 @@ public:
nsIContent* FindNestedSingleInsertionPoint(nsIContent* aContainer, bool* aMulti);
bool AnyBindingHasDocumentStateDependency(mozilla::EventStates aStateMask);
protected:
nsIXPConnectWrappedJS* GetWrappedJS(nsIContent* aContent);
nsresult SetWrappedJS(nsIContent* aContent, nsIXPConnectWrappedJS* aResult);