Bug 1490012 - Don't flush on the parent document if we already have a pres context. r=xidorn

I think conceptually we should flush layout instead of frames and do it
unconditionally, but everyone agrees on not doing that, and it can be really
slow, so will raise it to the CSSWG and get this spec'd.

See the test-case in bug 1458816, which tracks that.

I don't want to uplift this, but I think it's worth landing.

Differential Revision: https://phabricator.services.mozilla.com/D5562
This commit is contained in:
Emilio Cobos Álvarez 2018-09-11 19:48:44 +02:00
Родитель eaec6c788a
Коммит 494a283fa7
1 изменённых файлов: 7 добавлений и 3 удалений

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

@ -137,17 +137,21 @@ MediaQueryList::RecomputeMatches()
return;
}
if (mDocument->GetParentDocument()) {
// FIXME(emilio, bug 1490401): We shouldn't need a pres context to evaluate
// media queries.
nsPresContext* presContext = mDocument->GetPresContext();
if (!presContext && mDocument->GetParentDocument()) {
// Flush frames on the parent so our prescontext will get
// recreated as needed.
// created if needed.
mDocument->GetParentDocument()->FlushPendingNotifications(FlushType::Frames);
// That might have killed our document, so recheck that.
if (!mDocument) {
return;
}
presContext = mDocument->GetPresContext();
}
nsPresContext* presContext = mDocument->GetPresContext();
if (!presContext) {
// XXXbz What's the right behavior here? Spec doesn't say.
return;