Bug 1554777 - Call SchedulePaint() rather than MarkNeedsDisplayItemRebuild() when we get the size available notification for a style image. r=mattwoodrow,tnikkel

So the issue here is that this test-case has a zero-sized border, but still with
a border-image (which we should paint).

So the first time we get here, the image is not loaded, and thus we don't get
here:

  https://searchfox.org/mozilla-central/rev/e0b0c38ee83f99d3cf868bad525ace4a395039f1/layout/painting/nsDisplayList.h#4254

Which means that we end up with zero bounds and thus we don't even get to the
border painting code.

However, when the image loads, we get to MarkNeedsDisplayItemRebuild(), but that
doesn't schedule any paint, only marks the frames as modified in order for
display items to be rebuilt _eventually_.

Thus eventually, where we force a repaint by other means, we paint correctly.

This only works in more general cases because we get to the nsImageRenderer code
which does vastly different stuff.

InvalidateFrame() seems to do the right thing and schedule a paint, so use it.
It's not clear to me which one of nsIFrame::InvalidateFrame() or
nsIFrame::SchedulePaint() we should use...

If I understand correctly, InvalidateFrame() will only do something iff there
are display items for the frame, so that should make the IsVisible() check
redundant.

Note however that I think there's still a race condition, if we get to paint in
between the SIZE_AVAILABLE notification (the one where we actually invalidate
the display items), and the LOAD notification (the one the border-image code
checks).

I'll send a separate patch for that, I think SIZE_AVAILABLE should be a
strong-enough hint and that allows us to remove nsStyleImage::IsLoaded()...

The RequestReflow stuff also looks highly suspicious... shape-outside
sync-decodes, and it seems we could end up invalidating reflow from the reflow
code...

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-08-15 19:03:18 +00:00
Родитель 224f4402d4
Коммит 4b2cd8f291
1 изменённых файлов: 3 добавлений и 4 удалений

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

@ -696,10 +696,9 @@ nsresult ImageLoader::OnSizeAvailable(imgIRequest* aRequest,
return NS_OK;
}
for (FrameWithFlags& fwf : *frameSet) {
nsIFrame* frame = fwf.mFrame;
if (frame->StyleVisibility()->IsVisible()) {
frame->MarkNeedsDisplayItemRebuild();
for (const FrameWithFlags& fwf : *frameSet) {
if (fwf.mFrame->StyleVisibility()->IsVisible()) {
fwf.mFrame->SchedulePaint();
}
}