Bug 1404789: When the shadow tree distribution changes, post a restyle + reframe. r=bz

MozReview-Commit-ID: DvRb22UfnJ4

--HG--
extra : rebase_source : 5e1d76f7e1c28c6d2117c3fe358a90778933f03c
This commit is contained in:
Emilio Cobos Álvarez 2017-10-18 15:24:53 +02:00
Родитель 317ab8e505
Коммит 737044cfd3
2 изменённых файлов: 30 добавлений и 0 удалений

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

@ -250,6 +250,24 @@ ShadowRoot::RemoveDestInsertionPoint(nsIContent* aInsertionPoint,
}
}
void
ShadowRoot::DistributionChanged()
{
// FIXME(emilio): We could be more granular in a bunch of cases.
auto* host = GetHost();
if (!host) {
return;
}
auto* shell = OwnerDoc()->GetShell();
if (!shell) {
return;
}
// FIXME(emilio): Rename this to DestroyFramesForAndRestyle?
shell->DestroyFramesFor(host);
}
void
ShadowRoot::DistributeSingleNode(nsIContent* aContent)
{
@ -311,6 +329,8 @@ ShadowRoot::DistributeSingleNode(nsIContent* aContent)
if (auto* parentShadow = foundInsertionPoint->GetParent()->GetShadowRoot()) {
parentShadow->DistributeSingleNode(aContent);
}
DistributionChanged();
}
void
@ -340,6 +360,8 @@ ShadowRoot::RemoveDistributedNode(nsIContent* aContent)
if (auto* parentShadow = insertionPoint->GetParent()->GetShadowRoot()) {
parentShadow->RemoveDistributedNode(aContent);
}
DistributionChanged();
return;
}
}
@ -386,6 +408,8 @@ ShadowRoot::DistributeAllNodes()
for (ShadowRoot* shadow : shadowsToUpdate) {
shadow->DistributeAllNodes();
}
DistributionChanged();
}
void

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

@ -72,6 +72,12 @@ private:
*/
void RemoveDistributedNode(nsIContent* aContent);
/**
* Called when we redistribute content in such a way that new insertion points
* come into existence, or elements are moved between insertion points.
*/
void DistributionChanged();
static bool IsPooledNode(nsIContent* aChild, nsIContent* aContainer,
nsIContent* aHost);