mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:48:11 +00:00
LibHTML: Use ImageLoader for <img> elements to defer bitmap decoding
We now wait until the pixels are actually needed before fully decoding images in <img> elements. This needs some more work and is currently a bit memory-wasteful since we'll hang on to the raw image data forever.
This commit is contained in:
parent
b4c0ea89d5
commit
18fa662eb2
3 changed files with 18 additions and 7 deletions
|
@ -37,6 +37,10 @@ void LayoutImage::render(RenderingContext& context)
|
|||
if (!is_visible())
|
||||
return;
|
||||
|
||||
// FIXME: This should be done at a different level. Also rect() does not include padding etc!
|
||||
if (!context.viewport_rect().intersects(rect()))
|
||||
return;
|
||||
|
||||
if (renders_as_alt_text()) {
|
||||
context.painter().set_font(Font::default_font());
|
||||
StylePainter::paint_frame(context.painter(), rect(), FrameShape::Container, FrameShadow::Sunken, 2);
|
||||
|
@ -52,5 +56,5 @@ void LayoutImage::render(RenderingContext& context)
|
|||
|
||||
bool LayoutImage::renders_as_alt_text() const
|
||||
{
|
||||
return !node().bitmap();
|
||||
return !node().image_loader();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue