mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:28:12 +00:00
LibWeb: Dispatch DOM "load" event on <iframe> elements
This commit is contained in:
parent
86a4eaca38
commit
618dcbe405
4 changed files with 15 additions and 0 deletions
|
@ -135,6 +135,7 @@ class ImageData;
|
|||
namespace Web {
|
||||
class EventHandler;
|
||||
class Frame;
|
||||
class FrameLoader;
|
||||
class LayoutBlock;
|
||||
class LayoutButton;
|
||||
class LayoutCheckBox;
|
||||
|
|
|
@ -86,4 +86,9 @@ const DOM::Document* HTMLIFrameElement::content_document() const
|
|||
return m_content_frame ? m_content_frame->document() : nullptr;
|
||||
}
|
||||
|
||||
void HTMLIFrameElement::content_frame_did_load(Badge<FrameLoader>)
|
||||
{
|
||||
dispatch_event(DOM::Event::create("load"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -44,6 +44,8 @@ public:
|
|||
|
||||
const DOM::Document* content_document() const;
|
||||
|
||||
void content_frame_did_load(Badge<FrameLoader>);
|
||||
|
||||
private:
|
||||
virtual void document_did_attach_to_frame(Frame&) override;
|
||||
virtual void document_will_detach_from_frame(Frame&) override;
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/ElementFactory.h>
|
||||
#include <LibWeb/DOM/Text.h>
|
||||
#include <LibWeb/HTML/HTMLIFrameElement.h>
|
||||
#include <LibWeb/HTML/Parser/HTMLDocumentParser.h>
|
||||
#include <LibWeb/Loader/FrameLoader.h>
|
||||
#include <LibWeb/Loader/ResourceLoader.h>
|
||||
|
@ -230,6 +231,12 @@ void FrameLoader::resource_did_load()
|
|||
|
||||
if (!url.fragment().is_empty())
|
||||
frame().scroll_to_anchor(url.fragment());
|
||||
|
||||
if (auto* host_element = frame().host_element()) {
|
||||
// FIXME: Perhaps in the future we'll have a better common base class for <frame> and <iframe>
|
||||
ASSERT(is<HTML::HTMLIFrameElement>(*host_element));
|
||||
downcast<HTML::HTMLIFrameElement>(*host_element).content_frame_did_load({});
|
||||
}
|
||||
}
|
||||
|
||||
void FrameLoader::resource_did_fail()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue