Closed Bug 1612649 Opened 5 years ago Closed 5 years ago

Consider generating nsImageFrame for lazy-load image elements in the first place

Categories

(Core :: Layout: Images, Video, and HTML Frames, task, P3)

task

Tracking

()

RESOLVED FIXED
mozilla75
Tracking Status
firefox75 --- fixed

People

(Reporter: hiro, Assigned: hiro)

References

Details

Attachments

(2 files)

This will be a follow-up issue on lazy-loading (bug 1542784).

In the initial implementation for the lazy-loading, I am not going to do any specific things for frame construction of the lazy-loading images, but Jamie told me an interesting case that is that with both of alt text and loading="lazy" we create inline frame for the alt text first then after the element gets visible we re-create nsImageFrame.

FWIW, there is an example of the frame change.

frames for alt

        line 7fbbb0ba2f40: count=1 state=inline,clean,prevmarginclean,not-impacted,not-wrapped,before:nobr,after:nobr[0x100] (0,600000,6896,1440) <
          Inline(img)(2)@7fbbb0ba2d10 parent=7fbbb0ba2b40 (0,600000,6896,1440) [state=0000000000000200] [content=7fbbb0b68200] [cs=7fbbb32a77a8]<
            Inline(_moz_generated_content_before)(-1)@7fbbb0ba2db0 parent=7fbbb0ba2d10 (0,0,6896,1440) [state=0000000000000240] [content=7fbbb0bb8160] [cs=7fbbb32a7898:before]<
              Text(0)"this is an image"@7fbbb0ba2e50 parent=7fbbb0ba2db0 (0,0,6896,1440) [state=00000000b0600040] [content=7fbbb1fc66a0] [cs=7fbbb32a7a78:-moz-text] [run=7fbbb41fed40][0,16,T] 
            >
          >
        >

frames for image

        line 7fbbb0ba2f40: count=3 state=inline,clean,prevmarginclean,not-impacted,not-wrapped,before:nobr,after:nobr[0x100] (0,600000,1200,1500) <
          Text(1)"\n"@7fbbb0ba2e50 parent=7fbbb0ba2b40 next=7fbbb0ba3588 (0,601200,0,0) [state=4000000028200000] [content=7fbbb0866e00] [cs=7fbbb32a7988:-moz-text] [run=7fbbb0906200][0,1,T] 
          ImageFrame(img)(2)@7fbbb0ba3588 parent=7fbbb0ba2b40 next=7fbbb0ba3678 (0,600000,1200,1200) [state=0010404000000210] [content=7fbbb0b68200] [cs=7fbbb32a81f8] [src=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAAG0lEQVR42mP8z0A%2BYKJA76jmUc2jmkc1U0EzACKcASfOgGoMAAAAAElFTkSuQmCC]
          Text(3)"\n"@7fbbb0ba3678 parent=7fbbb0ba2b40 (1200,600060,0,1440) [state=40000000a0400000] [content=7fbbb0884b80] [cs=7fbbb32a7988:-moz-text] [run=7fbbb0906600][0,1,T] 
        >

I guess we can set nsImageLoadingContent::mSuppressed flag to generate nsImageFrame in the first place.

Yeah we should only generate nsImageFrame for now.

Assignee: nobody → hikezoe.birchill
Status: NEW → ASSIGNED

So that we can generate nsImageFrame for lazy load image elements in the first
place.

Note that we don't need to reset the state to broken in UnsetDeferredLoad
because once after the image started loading and got responses the state will
be broken if necessary.

Attachment #9124911 - Attachment description: Bug 1612649 - Start with `not broken` state for lazy load images. r?emilio → Bug 1612649 - Call UpdateImageState in SetDeferredLoad to start with `not broken` state for lazy load images. r?emilio
Pushed by hikezoe.birchill@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1af9e5b7d1a8
Call UpdateImageState in SetDeferredLoad to start with `not broken` state for lazy load images. r=emilio
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla75
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: