mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:08:11 +00:00
LibHTML: Mark image bitmaps outside the visible viewport as volatile
When the visible viewport rect changes, we walk the layout tree and check where each LayoutImage is in relation to the viewport rect. Images outside have their bitmaps marked as volatile. Note that the bitmaps are managed by ImageDecoder objects. If a bitmap is purged by the kernel while volatile, we construct a new ImageDecoder next time we need pixels for the image.
This commit is contained in:
parent
7e068565bc
commit
54bd322881
5 changed files with 38 additions and 2 deletions
|
@ -4,6 +4,8 @@
|
|||
#include <LibDraw/ImageDecoder.h>
|
||||
#include <LibHTML/DOM/HTMLElement.h>
|
||||
|
||||
class LayoutDocument;
|
||||
|
||||
class HTMLImageElement : public HTMLElement {
|
||||
public:
|
||||
HTMLImageElement(Document&, const String& tag_name);
|
||||
|
@ -19,12 +21,13 @@ public:
|
|||
const GraphicsBitmap* bitmap() const;
|
||||
const ImageDecoder* image_decoder() const { return m_image_decoder; }
|
||||
|
||||
void set_volatile(Badge<LayoutDocument>, bool);
|
||||
|
||||
private:
|
||||
void load_image(const String& src);
|
||||
|
||||
virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) const override;
|
||||
|
||||
RefPtr<ImageDecoder> m_image_decoder;
|
||||
mutable RefPtr<GraphicsBitmap> m_bitmap;
|
||||
ByteBuffer m_encoded_data;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue