Skip to content

Commit

Permalink
Cherry-pick 273869@main (5373d9e). https://bugs.webkit.org/show_bug.c…
Browse files Browse the repository at this point in the history
…gi?id=268428

    Widget::root() should return a FrameView
    https://bugs.webkit.org/show_bug.cgi?id=268428
    rdar://121974586

    Reviewed by Alex Christensen.

    Widget::root() should return the top FrameView even if it is being hosted in another process.

    * Source/WebCore/platform/Widget.cpp:
    (WebCore::Widget::root const):
    * Source/WebCore/platform/Widget.h:

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

Canonical link: https://commits.webkit.org/266719.360@webkitglib/2.42
  • Loading branch information
charliewolfe authored and aperezdc committed Mar 14, 2024
1 parent 6d9f342 commit 3e6ec52
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions Source/WebCore/platform/Widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#include "config.h"
#include "Widget.h"

#include "FrameView.h"
#include "IntRect.h"
#include "LocalFrameView.h"
#include "NotImplemented.h"
#include <wtf/Assertions.h>

Expand Down Expand Up @@ -55,13 +55,13 @@ void Widget::setParent(ScrollView* view)
setParentVisible(true);
}

LocalFrameView* Widget::root() const
FrameView* Widget::root() const
{
const Widget* top = this;
while (top->parent())
top = top->parent();
if (is<LocalFrameView>(*top))
return const_cast<LocalFrameView*>(downcast<LocalFrameView>(top));
if (auto* frameView = dynamicDowncast<FrameView>(top))
return const_cast<FrameView*>(frameView);
return nullptr;
}

Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/platform/Widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ namespace WebCore {
class Cursor;
class Event;
class FontCascade;
class FrameView;
class GraphicsContext;
class LocalFrameView;
class PlatformMouseEvent;
class RegionContext;
class ScrollView;
Expand Down Expand Up @@ -137,7 +137,7 @@ class Widget : public RefCounted<Widget>, public CanMakeWeakPtr<Widget> {
WEBCORE_EXPORT void removeFromParent();
WEBCORE_EXPORT virtual void setParent(ScrollView* view);
WEBCORE_EXPORT ScrollView* parent() const;
LocalFrameView* root() const;
FrameView* root() const;

virtual void handleEvent(Event&) { }

Expand Down

0 comments on commit 3e6ec52

Please sign in to comment.