Skip to content

Commit

Permalink
setContentFrame() should be moved to the Frame constructor
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=259697
rdar://113217067

Reviewed by Alex Christensen.

* Source/WebCore/page/Frame.cpp:
(WebCore::Frame::Frame):
* Source/WebCore/page/LocalFrame.cpp:
(WebCore::LocalFrame::LocalFrame):
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::didCommitLoadInAnotherProcess):

Canonical link: https://commits.webkit.org/266491@main
  • Loading branch information
charliewolfe committed Aug 1, 2023
1 parent 724fb20 commit a255055
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
3 changes: 3 additions & 0 deletions Source/WebCore/page/Frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ Frame::Frame(Page& page, FrameIdentifier frameID, FrameType frameType, HTMLFrame
{
if (parent)
parent->tree().appendChild(*this);

if (ownerElement)
ownerElement->setContentFrame(*this);
}

Frame::~Frame()
Expand Down
7 changes: 2 additions & 5 deletions Source/WebCore/page/LocalFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,8 @@ LocalFrame::LocalFrame(Page& page, UniqueRef<LocalFrameLoaderClient>&& frameLoad
ProcessWarming::initializeNames();
StaticCSSValuePool::init();

if (ownerElement) {
if (auto* localMainFrame = dynamicDowncast<LocalFrame>(mainFrame()))
localMainFrame->selfOnlyRef();
ownerElement->setContentFrame(*this);
}
if (auto* localMainFrame = dynamicDowncast<LocalFrame>(mainFrame()); localMainFrame && ownerElement)
localMainFrame->selfOnlyRef();

#ifndef NDEBUG
frameCounter.increment();
Expand Down
5 changes: 1 addition & 4 deletions Source/WebKit/WebProcess/WebPage/WebFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,8 @@ void WebFrame::didCommitLoadInAnotherProcess(std::optional<WebCore::LayerHosting

m_coreFrame = newFrame.get();

// FIXME: This is also done in the WebCore::Frame constructor. Move one to make this more symmetric.
if (ownerElement) {
ownerElement->setContentFrame(*m_coreFrame);
if (ownerElement)
ownerElement->scheduleInvalidateStyleAndLayerComposition();
}
}

void WebFrame::removeFromTree()
Expand Down

0 comments on commit a255055

Please sign in to comment.