LibWeb: Rename HTMLIFrameElement::hosted_frame() => content_frame()

This matches the standard API names contentWindow and contentDocument.
This commit is contained in:
Andreas Kling 2020-09-22 17:48:04 +02:00
parent 69bbf0285b
commit 86a4eaca38
Notes: sideshowbarker 2024-07-19 02:16:30 +09:00
4 changed files with 15 additions and 15 deletions

View file

@ -57,8 +57,8 @@ RefPtr<LayoutNode> HTMLIFrameElement::create_layout_node(const CSS::StylePropert
void HTMLIFrameElement::document_did_attach_to_frame(Frame& frame)
{
ASSERT(!m_hosted_frame);
m_hosted_frame = Frame::create_subframe(*this, frame.main_frame());
ASSERT(!m_content_frame);
m_content_frame = Frame::create_subframe(*this, frame.main_frame());
auto src = attribute(HTML::AttributeNames::src);
if (src.is_null())
return;
@ -78,12 +78,12 @@ void HTMLIFrameElement::load_src(const String& value)
return;
}
m_hosted_frame->loader().load(url, FrameLoader::Type::IFrame);
m_content_frame->loader().load(url, FrameLoader::Type::IFrame);
}
const DOM::Document* HTMLIFrameElement::content_document() const
{
return m_hosted_frame ? m_hosted_frame->document() : nullptr;
return m_content_frame ? m_content_frame->document() : nullptr;
}
}

View file

@ -39,8 +39,8 @@ public:
virtual RefPtr<LayoutNode> create_layout_node(const CSS::StyleProperties* parent_style) override;
Frame* hosted_frame() { return m_hosted_frame; }
const Frame* hosted_frame() const { return m_hosted_frame; }
Frame* content_frame() { return m_content_frame; }
const Frame* content_frame() const { return m_content_frame; }
const DOM::Document* content_document() const;
@ -50,7 +50,7 @@ private:
void load_src(const String&);
RefPtr<Frame> m_hosted_frame;
RefPtr<Frame> m_content_frame;
};
}

View file

@ -50,7 +50,7 @@ LayoutFrame::~LayoutFrame()
void LayoutFrame::layout(LayoutMode layout_mode)
{
ASSERT(node().hosted_frame());
ASSERT(node().content_frame());
set_has_intrinsic_width(true);
set_has_intrinsic_height(true);
@ -79,14 +79,14 @@ void LayoutFrame::paint(PaintContext& context, PaintPhase phase)
context.painter().add_clip_rect(enclosing_int_rect(absolute_rect()));
context.painter().translate(absolute_x(), absolute_y());
context.set_viewport_rect({ {}, node().hosted_frame()->size() });
context.set_viewport_rect({ {}, node().content_frame()->size() });
const_cast<LayoutDocument*>(hosted_layout_tree)->paint_all_phases(context);
context.set_viewport_rect(old_viewport_rect);
context.painter().restore();
#ifdef DEBUG_HIGHLIGHT_FOCUSED_FRAME
if (node().hosted_frame()->is_focused_frame()) {
if (node().content_frame()->is_focused_frame()) {
context.painter().draw_rect(absolute_rect().to<int>(), Color::Cyan);
}
#endif
@ -97,8 +97,8 @@ void LayoutFrame::did_set_rect()
{
LayoutReplaced::did_set_rect();
ASSERT(node().hosted_frame());
node().hosted_frame()->set_size(size().to_type<int>());
ASSERT(node().content_frame());
node().content_frame()->set_size(size().to_type<int>());
}
}

View file

@ -97,7 +97,7 @@ bool EventHandler::handle_mouseup(const Gfx::IntPoint& position, unsigned button
if (result.layout_node && result.layout_node->node()) {
RefPtr<DOM::Node> node = result.layout_node->node();
if (is<HTML::HTMLIFrameElement>(*node)) {
if (auto* subframe = downcast<HTML::HTMLIFrameElement>(*node).hosted_frame())
if (auto* subframe = downcast<HTML::HTMLIFrameElement>(*node).content_frame())
return subframe->event_handler().handle_mouseup(position.translated(compute_mouse_event_offset({}, *result.layout_node)), button, modifiers);
return false;
}
@ -142,7 +142,7 @@ bool EventHandler::handle_mousedown(const Gfx::IntPoint& position, unsigned butt
return false;
if (is<HTML::HTMLIFrameElement>(*node)) {
if (auto* subframe = downcast<HTML::HTMLIFrameElement>(*node).hosted_frame())
if (auto* subframe = downcast<HTML::HTMLIFrameElement>(*node).content_frame())
return subframe->event_handler().handle_mousedown(position.translated(compute_mouse_event_offset({}, *result.layout_node)), button, modifiers);
return false;
}
@ -226,7 +226,7 @@ bool EventHandler::handle_mousemove(const Gfx::IntPoint& position, unsigned butt
RefPtr<DOM::Node> node = result.layout_node->node();
if (node && is<HTML::HTMLIFrameElement>(*node)) {
if (auto* subframe = downcast<HTML::HTMLIFrameElement>(*node).hosted_frame())
if (auto* subframe = downcast<HTML::HTMLIFrameElement>(*node).content_frame())
return subframe->event_handler().handle_mousemove(position.translated(compute_mouse_event_offset({}, *result.layout_node)), buttons, modifiers);
return false;
}