Bug 1357583: Tidy the PostRestyleEventForCSSRuleChanges API. r=heycam

MozReview-Commit-ID: BtOWWC5knsi
This commit is contained in:
Emilio Cobos Álvarez 2017-05-26 17:46:31 +02:00
Родитель 3793cca046
Коммит 0eea23decf
7 изменённых файлов: 14 добавлений и 45 удалений

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

@ -273,12 +273,6 @@ public:
nsChangeHint aMinChangeHint,
const RestyleHintData* aRestyleHintData = nullptr);
void PostRestyleEventForCSSRuleChanges(Element* aElement,
nsRestyleHint aRestyleHint,
nsChangeHint aMinChangeHint) {
PostRestyleEvent(aElement, aRestyleHint, aMinChangeHint);
}
public:
/**
* Asynchronously clear style data from the root frame downwards and ensure

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

@ -166,9 +166,6 @@ public:
inline void PostRestyleEvent(dom::Element* aElement,
nsRestyleHint aRestyleHint,
nsChangeHint aMinChangeHint);
inline void PostRestyleEventForCSSRuleChanges(dom::Element* aElement,
nsRestyleHint aRestyleHint,
nsChangeHint aMinChangeHint);
inline void RebuildAllStyleData(nsChangeHint aExtraHint,
nsRestyleHint aRestyleHint);
inline void PostRebuildAllStyleDataEvent(nsChangeHint aExtraHint,

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

@ -24,15 +24,6 @@ RestyleManager::PostRestyleEvent(dom::Element* aElement,
MOZ_STYLO_FORWARD(PostRestyleEvent, (aElement, aRestyleHint, aMinChangeHint));
}
void
RestyleManager::PostRestyleEventForCSSRuleChanges(dom::Element* aElement,
nsRestyleHint aRestyleHint,
nsChangeHint aMinChangeHint)
{
MOZ_STYLO_FORWARD(PostRestyleEventForCSSRuleChanges,
(aElement, aRestyleHint, aMinChangeHint));
}
void
RestyleManager::RebuildAllStyleData(nsChangeHint aExtraHint,
nsRestyleHint aRestyleHint)

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

@ -67,14 +67,10 @@ ServoRestyleManager::PostRestyleEvent(Element* aElement,
}
void
ServoRestyleManager::PostRestyleEventForCSSRuleChanges(
Element* aElement,
nsRestyleHint aRestyleHint,
nsChangeHint aMinChangeHint)
ServoRestyleManager::PostRestyleEventForCSSRuleChanges()
{
mRestyleForCSSRuleChanges = true;
PostRestyleEvent(aElement, aRestyleHint, aMinChangeHint);
mPresContext->PresShell()->EnsureStyleFlush();
}
/* static */ void

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

@ -43,10 +43,7 @@ public:
void PostRestyleEvent(dom::Element* aElement,
nsRestyleHint aRestyleHint,
nsChangeHint aMinChangeHint);
void PostRestyleEventForLazyConstruction();
void PostRestyleEventForCSSRuleChanges(dom::Element* aElement,
nsRestyleHint aRestyleHint,
nsChangeHint aMinChangeHint);
void PostRestyleEventForCSSRuleChanges();
void RebuildAllStyleData(nsChangeHint aExtraHint,
nsRestyleHint aRestyleHint);
void PostRebuildAllStyleDataEvent(nsChangeHint aExtraHint,

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

@ -131,13 +131,7 @@ void
ServoStyleSet::InvalidateStyleForCSSRuleChanges()
{
MOZ_ASSERT(StylistNeedsUpdate());
if (Element* root = mPresContext->Document()->GetDocumentElement()) {
// FIXME(emilio): Add a nicer API for this.
mPresContext->RestyleManager()->PostRestyleEventForCSSRuleChanges(
root, nsRestyleHint(0), nsChangeHint(0));
}
// Do nothing, we've recorded the invalidation, and we'll invalidate stuff
// async when styling something.
mPresContext->RestyleManager()->AsServo()->PostRestyleEventForCSSRuleChanges();
}
size_t
@ -985,13 +979,13 @@ ServoStyleSet::RecordStyleSheetChange(
case StyleSheet::ChangeType::RuleAdded:
case StyleSheet::ChangeType::RuleRemoved:
case StyleSheet::ChangeType::RuleChanged:
case StyleSheet::ChangeType::ApplicableStateChanged:
// FIXME(emilio): We can presumably do better in a bunch of these.
return ForceAllStyleDirty();
case StyleSheet::ChangeType::ApplicableStateChanged:
case StyleSheet::ChangeType::Added:
case StyleSheet::ChangeType::Removed:
// Do nothing, we've already recorded the change in the AppendFoo methods,
// etc, and will act consequently.
// Do nothing, we've already recorded the change in the
// Append/Remove/Replace methods, etc, and will act consequently.
return;
}
}

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

@ -2409,7 +2409,7 @@ nsStyleSet::InvalidateStyleForCSSRuleChanges()
mStylesHaveChanged = false;
nsPresContext* presContext = PresContext();
RestyleManager* restyleManager = presContext->RestyleManager();
RestyleManager* restyleManager = presContext->RestyleManager()->AsGecko();
Element* root = presContext->Document()->GetRootElement();
if (!root) {
// No content to restyle
@ -2420,14 +2420,14 @@ nsStyleSet::InvalidateStyleForCSSRuleChanges()
// If scopeRoots is empty, we know that mStylesHaveChanged was true at
// the beginning of this function, and that we need to restyle the whole
// document.
restyleManager->PostRestyleEventForCSSRuleChanges(root,
eRestyle_Subtree,
nsChangeHint(0));
restyleManager->PostRestyleEvent(root,
eRestyle_Subtree,
nsChangeHint(0));
} else {
for (Element* scopeRoot : scopeRoots) {
restyleManager->PostRestyleEventForCSSRuleChanges(scopeRoot,
eRestyle_Subtree,
nsChangeHint(0));
restyleManager->PostRestyleEvent(scopeRoot,
eRestyle_Subtree,
nsChangeHint(0));
}
}
}