mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 17:55:06 +00:00
LibWeb: Make HTML::SharedImageRequest GC allocated
This allows to partially solve the problem of cyclic dependency between HTMLImageElement and SharedImageRequest that prevents all image elements from being deallocated.
This commit is contained in:
parent
bbfedf2e5a
commit
934afcb9d5
9 changed files with 46 additions and 18 deletions
|
@ -394,7 +394,7 @@ ErrorOr<void> HTMLImageElement::update_the_image_data(bool restart_animations, b
|
|||
restart_the_animation();
|
||||
|
||||
// 2. Set current request's current URL to urlString.
|
||||
m_current_request->set_current_url(url_string);
|
||||
m_current_request->set_current_url(realm(), url_string);
|
||||
|
||||
// 3. If maybe omit events is not set or previousURL is not equal to urlString, then fire an event named load at the img element.
|
||||
if (!maybe_omit_events || previous_url != url_string)
|
||||
|
@ -433,7 +433,7 @@ after_step_7:
|
|||
// 2. Queue an element task on the DOM manipulation task source given the img element and the following steps:
|
||||
queue_an_element_task(HTML::Task::Source::DOMManipulation, [this, maybe_omit_events, previous_url] {
|
||||
// 1. Change the current request's current URL to the empty string.
|
||||
m_current_request->set_current_url(""sv);
|
||||
m_current_request->set_current_url(realm(), ""sv);
|
||||
|
||||
// 2. If all of the following conditions are true:
|
||||
// - the element has a src attribute or it uses srcset or picture; and
|
||||
|
@ -466,7 +466,7 @@ after_step_7:
|
|||
// 4. Queue an element task on the DOM manipulation task source given the img element and the following steps:
|
||||
queue_an_element_task(HTML::Task::Source::DOMManipulation, [this, selected_source, maybe_omit_events, previous_url] {
|
||||
// 1. Change the current request's current URL to selected source.
|
||||
m_current_request->set_current_url(selected_source.value().url);
|
||||
m_current_request->set_current_url(realm(), selected_source.value().url);
|
||||
|
||||
// 2. If maybe omit events is not set or previousURL is not equal to selected source, then fire an event named error at the img element.
|
||||
if (!maybe_omit_events || previous_url != selected_source.value().url)
|
||||
|
@ -503,7 +503,7 @@ after_step_7:
|
|||
|
||||
// 16. Set image request to a new image request whose current URL is urlString.
|
||||
auto image_request = ImageRequest::create(realm(), *document().page());
|
||||
image_request->set_current_url(url_string);
|
||||
image_request->set_current_url(realm(), url_string);
|
||||
|
||||
// 17. If current request's state is unavailable or broken, then set the current request to image request.
|
||||
// Otherwise, set the pending request to image request.
|
||||
|
@ -698,7 +698,7 @@ void HTMLImageElement::react_to_changes_in_the_environment()
|
|||
|
||||
// 11. ⌛ Let image request be a new image request whose current URL is urlString
|
||||
auto image_request = ImageRequest::create(realm(), *document().page());
|
||||
image_request->set_current_url(url_string);
|
||||
image_request->set_current_url(realm(), url_string);
|
||||
|
||||
// 12. ⌛ Let the element's pending request be image request.
|
||||
m_pending_request = image_request;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue