Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 63eb54f1aee4398784db80b00a80669cd679ef70
      
https://github.com/WebKit/WebKit/commit/63eb54f1aee4398784db80b00a80669cd679ef70
  Author: Alex Christensen <[email protected]>
  Date:   2024-04-29 (Mon, 29 Apr 2024)

  Changed paths:
    M Source/WebCore/page/Frame.cpp
    M Source/WebCore/page/Frame.h
    M Source/WebCore/page/LocalFrame.cpp
    M Source/WebCore/page/LocalFrame.h

  Log Message:
  -----------
  Add some root frame utility functions
https://bugs.webkit.org/show_bug.cgi?id=273348
rdar://127142451

Reviewed by Simon Fraser.

Frame has the ability to query if it is the main frame and the ability to 
quickly
get the main frame without traversing the frame tree to find it.  It does this 
by
storing a WeakRef of the main frame and comparing or dereferencing it.  This has
been useful for many years.

LocalFrame already had the ability to quickly query if it is a root frame.  With
site isolation off and all the frames in the same process, this is the same as
being the main frame.  With site isolation on, though, frames can be in 
different
processes so a root frame is the root of a subtree of LocalFrames with either no
parent (if it is also the main frame) or a RemoteFrame parent if its parent's
contents are in another process.

With https://github.com/WebKit/WebKit/pull/27300 we introduce the need to 
quickly
get the root frame of a particular LocalFrame.  We implement that in this PR the
same way we have long ago with the main frame: by storing a WeakRef.

In that same PR, we will benefit by having the ability to assert that a 
particular
FrameIdentifier is from a root frame to prevent future developers from 
forgetting
a call to rootFrame and messing up the scroll tree.  For that purpose we 
introduce
Frame::isRootFrameIdentifier which requires some extra bookkeeping that isn't
necessary in release builds with ASSERT_ENABLED set to false.

* Source/WebCore/page/Frame.cpp:
(WebCore::allFrames):
(WebCore::Frame::Frame):
(WebCore::Frame::~Frame):
(WebCore::Frame::isRootFrameIdentifier):
* Source/WebCore/page/Frame.h:
* Source/WebCore/page/LocalFrame.cpp:
(WebCore::rootFrame):
(WebCore::LocalFrame::LocalFrame):
(WebCore::isRootFrame): Deleted.
(WebCore::LocalFrame::isRootFrame const): Deleted.
* Source/WebCore/page/LocalFrame.h:

Canonical link: https://commits.webkit.org/278133@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to