mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:27:34 +00:00
LibWeb: Extract shared lazy-loading behavior into a base class
`<iframe>` and `<img>` tags share the same spec for several aspects of lazy-loading: how the `loading` attribute works, the "will lazy load element" steps, and a member for storing the lazy-load resumption steps. So let's share the implementation by using a base class. This mostly involves moving things around. However, we also change the `start_intersection_observing_a_lazy_loading_element()` method to take a LazyLoadingElement, and operate on one, instead of always casting to HTMLImageElement. We do unfortunately have to do some shenanigans to make the cast work, by adding a virtual function stub in DOM::Element.
This commit is contained in:
parent
cc2008ea0d
commit
cc633123ca
7 changed files with 111 additions and 56 deletions
|
@ -27,6 +27,7 @@
|
|||
#include <LibWeb/HTML/DocumentReadyState.h>
|
||||
#include <LibWeb/HTML/HTMLScriptElement.h>
|
||||
#include <LibWeb/HTML/History.h>
|
||||
#include <LibWeb/HTML/LazyLoadingElement.h>
|
||||
#include <LibWeb/HTML/Origin.h>
|
||||
#include <LibWeb/HTML/SandboxingFlagSet.h>
|
||||
#include <LibWeb/HTML/Scripting/Environments.h>
|
||||
|
@ -519,7 +520,7 @@ public:
|
|||
|
||||
void run_the_update_intersection_observations_steps(HighResolutionTime::DOMHighResTimeStamp time);
|
||||
|
||||
void start_intersection_observing_a_lazy_loading_element(Element& element);
|
||||
void start_intersection_observing_a_lazy_loading_element(Element&);
|
||||
|
||||
void shared_declarative_refresh_steps(StringView input, JS::GCPtr<HTML::HTMLMetaElement const> meta_element = nullptr);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue