Bug 1610059 - Rename Document::SetStyleSheetApplicableState. r=nordzilla

It doesn't set anything, it is just a notification callback.

Differential Revision: https://phabricator.services.mozilla.com/D60336

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2020-01-22 01:14:42 +00:00
Родитель cd1bb80f98
Коммит cf6728cdd2
5 изменённых файлов: 11 добавлений и 12 удалений

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

@ -6570,11 +6570,11 @@ void Document::InsertSheetAt(size_t aIndex, StyleSheet& aSheet) {
}
}
void Document::SetStyleSheetApplicableState(StyleSheet& aSheet,
bool aApplicable) {
void Document::StyleSheetApplicableStateChanged(StyleSheet& aSheet) {
const bool applicable = aSheet.IsApplicable();
// If we're actually in the document style sheet list
if (mStyleSheets.IndexOf(&aSheet) != mStyleSheets.NoIndex) {
if (aApplicable) {
if (applicable) {
AddStyleSheetToStyleSets(&aSheet);
} else {
RemoveStyleSheetFromStyleSets(&aSheet);
@ -6586,7 +6586,7 @@ void Document::SetStyleSheetApplicableState(StyleSheet& aSheet,
init.mBubbles = true;
init.mCancelable = true;
init.mStylesheet = &aSheet;
init.mApplicable = aApplicable;
init.mApplicable = applicable;
RefPtr<StyleSheetApplicableStateChangeEvent> event =
StyleSheetApplicableStateChangeEvent::Constructor(

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

@ -2026,13 +2026,13 @@ class Document : public nsINode,
/**
* Remove a stylesheet from the document
*/
void RemoveStyleSheet(StyleSheet* aSheet);
void RemoveStyleSheet(StyleSheet*);
/**
* Notify the document that the applicable state of the sheet changed
* and that observers should be notified and style sets updated
*/
void SetStyleSheetApplicableState(StyleSheet&, bool aApplicable);
void StyleSheetApplicableStateChanged(StyleSheet&);
enum additionalSheetType {
eAgentSheet,

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

@ -400,8 +400,7 @@ void ShadowRoot::InsertSheetIntoAuthorData(size_t aIndex, StyleSheet& aSheet) {
// FIXME(emilio): This needs to notify document observers and such,
// presumably.
void ShadowRoot::StyleSheetApplicableStateChanged(StyleSheet& aSheet,
bool aApplicable) {
void ShadowRoot::StyleSheetApplicableStateChanged(StyleSheet& aSheet) {
int32_t index = IndexOfSheet(aSheet);
if (index < 0) {
// NOTE(emilio): @import sheets are handled in the relevant RuleAdded
@ -413,7 +412,7 @@ void ShadowRoot::StyleSheetApplicableStateChanged(StyleSheet& aSheet,
"It'd better be an @import sheet");
return;
}
if (aApplicable) {
if (aSheet.IsApplicable()) {
InsertSheetIntoAuthorData(size_t(index), aSheet);
} else {
MOZ_ASSERT(mServoStyles);

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

@ -78,7 +78,7 @@ class ShadowRoot final : public DocumentFragment,
void RuleChanged(StyleSheet&, css::Rule*);
void ImportRuleLoaded(CSSImportRule&, StyleSheet&);
void SheetCloned(StyleSheet&);
void StyleSheetApplicableStateChanged(StyleSheet&, bool aApplicable);
void StyleSheetApplicableStateChanged(StyleSheet&);
/**
* Clones internal state, for example stylesheets, of aOther to 'this'.

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

@ -277,9 +277,9 @@ void StyleSheet::ApplicableStateChanged(bool aApplicable) {
nsINode& node = mDocumentOrShadowRoot->AsNode();
if (auto* shadow = ShadowRoot::FromNode(node)) {
shadow->StyleSheetApplicableStateChanged(*this, aApplicable);
shadow->StyleSheetApplicableStateChanged(*this);
} else {
node.AsDocument()->SetStyleSheetApplicableState(*this, aApplicable);
node.AsDocument()->StyleSheetApplicableStateChanged(*this);
}
}