Skip to content

Commit

Permalink
LocalFrameView::frame() should return a LocalFrame
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=260437
rdar://114145180

Reviewed by Tim Nguyen.

Make LocalFrameView::frame() return a LocalFrame instead of Frame.

The FIXME comment was made when Frame was named AbstractFrame and LocalFrame was named Frame, so the
FIXME on LocalFrameView::frame() is referring to LocalFrame, not Frame.

* Source/WebCore/accessibility/AccessibilityObject.cpp:
(WebCore::appendAccessibilityObject):
(WebCore::AccessibilityObject::visiblePositionForPoint const):
(WebCore::AccessibilityObject::document const):
* Source/WebCore/accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::remoteSVGRootElement const):
* Source/WebCore/accessibility/AccessibilityScrollView.cpp:
(WebCore::AccessibilityScrollView::document const):
* Source/WebCore/display/DisplayView.cpp:
(WebCore::Display::View::frame const):
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::resolveStyle):
(WebCore::Document::attachToCachedFrame):
* Source/WebCore/editing/FrameSelection.cpp:
(WebCore::CaretBase::shouldRepaintCaret const):
* Source/WebCore/history/CachedFrame.cpp:
(WebCore::CachedFrameBase::restore):
(WebCore::CachedFrame::open):
(WebCore::CachedFrame::destroy):
* Source/WebCore/history/CachedPage.cpp:
(WebCore::CachedPage::restore):
* Source/WebCore/inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didAddOrRemoveScrollbarsImpl):
* Source/WebCore/inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::didAddOrRemoveScrollbars):
* Source/WebCore/inspector/agents/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::buildObjectForNode):
* Source/WebCore/inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::didPaint):
* Source/WebCore/page/EventHandler.cpp:
(WebCore::EventHandler::subframeForTargetNode):
* Source/WebCore/page/IntersectionObserver.cpp:
(WebCore::IntersectionObserver::computeIntersectionState const):
* Source/WebCore/page/LocalFrame.cpp:
(WebCore::LocalFrame::frameForWidget):
(WebCore::LocalFrame::clearTimers):
* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::scrollPositionChangeOptionsForElement):
(WebCore::shouldEnableSpeculativeTilingDuringLoading):
(WebCore::LocalFrameView::frame const):
(WebCore::LocalFrameView::writeRenderTreeAsText):
* Source/WebCore/page/LocalFrameView.h:
* Source/WebCore/page/LocalFrameViewLayoutContext.cpp:
(WebCore::LocalFrameViewLayoutContext::performLayout):
(WebCore::LocalFrameViewLayoutContext::frame const):
* Source/WebCore/page/PageColorSampler.cpp:
(WebCore::sampleColor):
* Source/WebCore/page/mac/EventHandlerMac.mm:
(WebCore::EventHandler::passWheelEventToWidget):
* Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::frameViewEventTrackingRegionsChanged):
(WebCore::AsyncScrollingCoordinator::requestScrollToPosition):
(WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
(WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView):
(WebCore::AsyncScrollingCoordinator::setFrameScrollingNodeState):
* Source/WebCore/page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::coordinatesScrollingForFrameView const):
(WebCore::ScrollingCoordinator::scrollContainerLayerForFrameView):
(WebCore::ScrollingCoordinator::scrolledContentsLayerForFrameView):
(WebCore::ScrollingCoordinator::headerLayerForFrameView):
(WebCore::ScrollingCoordinator::footerLayerForFrameView):
(WebCore::ScrollingCoordinator::counterScrollingLayerForFrameView):
(WebCore::ScrollingCoordinator::insetClipLayerForFrameView):
(WebCore::ScrollingCoordinator::contentShadowLayerForFrameView):
(WebCore::ScrollingCoordinator::rootContentsLayerForFrameView):
(WebCore::ScrollingCoordinator::updateSynchronousScrollingReasons):
* Source/WebCore/rendering/RenderElement.cpp:
(WebCore::RenderElement::adjustComputedFontSizesOnBlocks):
(WebCore::RenderElement::resetTextAutosizing):
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::hitTest):
* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::ensureRootLayer):
(WebCore::RenderLayerCompositor::attachRootLayer):
(WebCore::RenderLayerCompositor::detachRootLayer):
(WebCore::RenderLayerCompositor::rootLayerAttachmentChanged):
* Source/WebCore/rendering/RenderView.cpp:
(WebCore::RenderView::clientLogicalWidthForFixedPosition const):
(WebCore::RenderView::clientLogicalHeightForFixedPosition const):
(WebCore::RenderView::shouldUsePrintingLayout const):
(WebCore::RenderView::zoomFactor const):
* Source/WebCore/rendering/RenderWidget.cpp:
(WebCore::RenderWidget::updateWidgetPosition):
(WebCore::RenderWidget::nodeAtPoint):
* Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp:
(WebKit::convertRectFromFrameClientToRootView):
(WebKit::convertPointFromFrameClientToRootView):
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::dynamicViewportSizeUpdate):
(WebKit::WebPage::updateVisibleContentRects):
* Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::shouldUseTiledBackingForFrameView const):
* Source/WebKit/WebProcess/WebPage/wc/DrawingAreaWC.cpp:
(WebKit::DrawingAreaWC::shouldUseTiledBackingForFrameView const):
* Source/WebKitLegacy/mac/WebCoreSupport/PopupMenuMac.mm:
(PopupMenuMac::show):
* Source/WebKitLegacy/mac/WebCoreSupport/WebContextMenuClient.mm:
(WebContextMenuClient::imageForCurrentSharingServicePickerItem):

Canonical link: https://commits.webkit.org/267074@main
  • Loading branch information
charliewolfe committed Aug 20, 2023
1 parent d88653e commit ec7f821
Show file tree
Hide file tree
Showing 33 changed files with 81 additions and 175 deletions.
16 changes: 3 additions & 13 deletions Source/WebCore/accessibility/AccessibilityObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,10 +572,7 @@ static void appendAccessibilityObject(RefPtr<AXCoreObject> object, Accessibility
auto* frameView = dynamicDowncast<LocalFrameView>(widget);
if (!frameView)
return;
auto* localFrame = dynamicDowncast<LocalFrame>(frameView->frame());
if (!localFrame)
return;
auto* document = localFrame->document();
auto* document = frameView->frame().document();
if (!document || !document->hasLivingRenderTree())
return;

Expand Down Expand Up @@ -1410,10 +1407,7 @@ VisiblePosition AccessibilityObject::visiblePositionForPoint(const IntPoint& poi
auto* frameView = dynamicDowncast<LocalFrameView>(widget);
if (!frameView)
break;
auto* localFrame = dynamicDowncast<LocalFrame>(frameView->frame());
if (!localFrame)
break;
auto* document = localFrame->document();
auto* document = frameView->frame().document();
if (!document)
break;

Expand Down Expand Up @@ -2044,11 +2038,7 @@ Document* AccessibilityObject::document() const
if (!frameView)
return nullptr;

auto* localFrame = dynamicDowncast<LocalFrame>(frameView->frame());
if (!localFrame)
return nullptr;

return localFrame->document();
return frameView->frame().document();
}

Page* AccessibilityObject::page() const
Expand Down
6 changes: 1 addition & 5 deletions Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2222,11 +2222,7 @@ AccessibilitySVGRoot* AccessibilityRenderObject::remoteSVGRootElement(CreationCh
if (!frameView)
return nullptr;

auto* localFrame = dynamicDowncast<LocalFrame>(frameView->frame());
if (!localFrame)
return nullptr;

auto* document = localFrame->document();
auto* document = frameView->frame().document();
if (!is<SVGDocument>(document))
return nullptr;

Expand Down
3 changes: 1 addition & 2 deletions Source/WebCore/accessibility/AccessibilityScrollView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,7 @@ LayoutRect AccessibilityScrollView::elementRect() const
Document* AccessibilityScrollView::document() const
{
if (auto* frameView = dynamicDowncast<LocalFrameView>(m_scrollView.get())) {
if (auto* localFrame = dynamicDowncast<LocalFrame>(frameView->frame()))
return localFrame->document();
return frameView->frame().document();
}
return AccessibilityObject::document();
}
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/display/DisplayView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ View::~View()

LocalFrame& View::frame() const
{
return downcast<LocalFrame>(m_frameView.frame());
return m_frameView.frame();
}

Page* View::page() const
Expand Down
7 changes: 4 additions & 3 deletions Source/WebCore/dom/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2187,9 +2187,10 @@ void Document::resolveStyle(ResolveStyleType type)
// As a result of the style recalculation, the currently hovered element might have been
// detached (for example, by setting display:none in the :hover style), schedule another mouseMove event
// to check if any other elements ended up under the mouse pointer due to re-layout.
if (m_hoveredElement && !m_hoveredElement->renderer() && is<LocalFrame>(frameView.frame()))
if (auto* localMainFrame = dynamicDowncast<LocalFrame>(downcast<LocalFrame>(frameView.frame()).mainFrame()))
if (m_hoveredElement && !m_hoveredElement->renderer()) {
if (auto* localMainFrame = dynamicDowncast<LocalFrame>(frameView.frame().mainFrame()))
localMainFrame->eventHandler().dispatchFakeMouseMoveEventSoon();
}

++m_styleRecalcCount;
// FIXME: Assert ASSERT(!needsStyleRecalc()) here. fast/events/media-element-focus-tab.html hits this assertion.
Expand Down Expand Up @@ -2627,7 +2628,7 @@ void Document::attachToCachedFrame(CachedFrameBase& cachedFrame)
RELEASE_ASSERT(cachedFrame.document() == this);
ASSERT(cachedFrame.view());
ASSERT(m_backForwardCacheState == Document::InBackForwardCache);
observeFrame(dynamicDowncast<LocalFrame>(cachedFrame.view()->frame()));
observeFrame(&cachedFrame.view()->frame());
}

void Document::detachFromCachedFrame(CachedFrameBase& cachedFrame)
Expand Down
3 changes: 1 addition & 2 deletions Source/WebCore/editing/FrameSelection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1855,8 +1855,7 @@ bool FrameSelection::recomputeCaretRect()
bool CaretBase::shouldRepaintCaret(const RenderView* view, bool isContentEditable) const
{
ASSERT(view);
auto* frame = dynamicDowncast<LocalFrame>(view->frameView().frame()); // The frame where the selection started.
bool caretBrowsing = frame && frame->settings().caretBrowsingEnabled();
bool caretBrowsing = view->frameView().frame().settings().caretBrowsingEnabled(); // The frame where the selection started.
return (caretBrowsing || isContentEditable);
}

Expand Down
15 changes: 6 additions & 9 deletions Source/WebCore/history/CachedFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,13 @@ void CachedFrameBase::restore()
if (m_isMainFrame)
m_view->setParentVisible(true);

RefPtr frame = dynamicDowncast<LocalFrame>(m_view->frame());
if (!frame)
return;
Ref frame = m_view->frame();
{
Style::PostResolutionCallbackDisabler disabler(*m_document);
WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
NavigationDisabler disableNavigation { nullptr }; // Disable navigation globally.

m_cachedFrameScriptData->restore(*frame);
m_cachedFrameScriptData->restore(frame);

if (m_document->svgExtensions())
m_document->accessSVGExtensions().unpauseAnimations();
Expand Down Expand Up @@ -131,7 +129,7 @@ void CachedFrameBase::restore()
if (auto* domWindow = m_document->domWindow()) {
// FIXME: Use Document::hasListenerType(). See <rdar://problem/9615482>.
if (domWindow->scrollEventListenerCount() && frame->page())
frame->page()->chrome().client().setNeedsScrollNotifications(*frame, true);
frame->page()->chrome().client().setNeedsScrollNotifications(frame, true);
}
}
#endif
Expand Down Expand Up @@ -217,8 +215,7 @@ void CachedFrame::open()
ASSERT(m_view);
ASSERT(m_document);

if (auto* localFrame = dynamicDowncast<LocalFrame>(m_view->frame()))
localFrame->loader().open(*this);
m_view->frame().loader().open(*this);
}

void CachedFrame::clear()
Expand Down Expand Up @@ -257,8 +254,8 @@ void CachedFrame::destroy()

m_document->domWindow()->willDestroyCachedFrame();

auto* localFrame = dynamicDowncast<LocalFrame>(m_view->frame());
if (!m_isMainFrame && m_view->frame().page() && localFrame) {
Ref localFrame = m_view->frame();
if (!m_isMainFrame && m_view->frame().page()) {
localFrame->loader().detachViewsAndDocumentLoader();
localFrame->detachFromPage();
}
Expand Down
5 changes: 1 addition & 4 deletions Source/WebCore/history/CachedPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,7 @@ void CachedPage::restore(Page& page)
{
ASSERT(m_cachedMainFrame);
ASSERT(m_cachedMainFrame->view());
#if ASSERT_ENABLED
auto* localFrame = dynamicDowncast<LocalFrame>(m_cachedMainFrame->view()->frame());
#endif
ASSERT(localFrame && localFrame->isMainFrame());
ASSERT(m_cachedMainFrame->view()->frame().isMainFrame());
ASSERT(!page.subframeCount());

auto* localMainFrame = dynamicDowncast<LocalFrame>(page.mainFrame());
Expand Down
5 changes: 1 addition & 4 deletions Source/WebCore/inspector/InspectorInstrumentation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,10 @@ void InspectorInstrumentation::didChangeRendererForDOMNodeImpl(InstrumentingAgen

void InspectorInstrumentation::didAddOrRemoveScrollbarsImpl(InstrumentingAgents& instrumentingAgents, LocalFrameView& frameView)
{
auto* localFrame = dynamicDowncast<LocalFrame>(frameView.frame());
if (!localFrame)
return;
auto* cssAgent = instrumentingAgents.enabledCSSAgent();
if (!cssAgent)
return;
auto* document = localFrame->document();
auto* document = frameView.frame().document();
if (!document)
return;
auto* documentElement = document->documentElement();
Expand Down
3 changes: 1 addition & 2 deletions Source/WebCore/inspector/InspectorInstrumentation.h
Original file line number Diff line number Diff line change
Expand Up @@ -621,8 +621,7 @@ inline void InspectorInstrumentation::didChangeRendererForDOMNode(Node& node)
inline void InspectorInstrumentation::didAddOrRemoveScrollbars(LocalFrameView& frameView)
{
FAST_RETURN_IF_NO_FRONTENDS(void());
auto* localFrame = dynamicDowncast<LocalFrame>(frameView.frame());
if (auto* agents = localFrame ? instrumentingAgents(localFrame->document()) : nullptr)
if (auto* agents = instrumentingAgents(frameView.frame().document()))
didAddOrRemoveScrollbarsImpl(*agents, frameView);
}

Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1957,7 +1957,7 @@ Ref<Protocol::DOM::Node> InspectorDOMAgent::buildObjectForNode(Node* node, int d
auto* pageAgent = m_instrumentingAgents.enabledPageAgent();
if (pageAgent) {
if (auto* frameView = node->document().view())
value->setFrameId(pageAgent->frameId(dynamicDowncast<LocalFrame>(frameView->frame())));
value->setFrameId(pageAgent->frameId(&frameView->frame()));
}

if (is<Element>(*node)) {
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/inspector/agents/InspectorPageAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1050,8 +1050,8 @@ void InspectorPageAgent::didPaint(RenderObject& renderer, const LayoutRect& rect
auto* view = renderer.document().view();

LayoutRect rootRect = absoluteRect;
auto* localFrame = dynamicDowncast<LocalFrame>(view->frame());
if (localFrame && !localFrame->isMainFrame()) {
Ref localFrame = view->frame();
if (!localFrame->isMainFrame()) {
IntRect rootViewRect = view->contentsToRootView(snappedIntRect(absoluteRect));
auto* localMainFrame = dynamicDowncast<LocalFrame>(localFrame->mainFrame());
if (!localMainFrame)
Expand Down
7 changes: 2 additions & 5 deletions Source/WebCore/page/EventHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1405,7 +1405,7 @@ RefPtr<LocalFrame> EventHandler::subframeForTargetNode(Node* node)
if (!is<LocalFrameView>(widget))
return nullptr;

return dynamicDowncast<LocalFrame>(downcast<LocalFrameView>(*widget).frame());
return &downcast<LocalFrameView>(*widget).frame();
}

static bool isSubmitImage(Node* node)
Expand Down Expand Up @@ -5074,11 +5074,8 @@ bool EventHandler::passWheelEventToWidget(const PlatformWheelEvent& event, Widge
auto* frameView = dynamicDowncast<LocalFrameView>(widget);
if (!frameView)
return false;
RefPtr localFrame = dynamicDowncast<LocalFrame>(frameView->frame());
if (!localFrame)
return false;

return localFrame->eventHandler().handleWheelEvent(event, processingSteps);
return frameView->frame().eventHandler().handleWheelEvent(event, processingSteps);
}

bool EventHandler::tabsToAllFormControls(KeyboardEvent*) const
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/page/IntersectionObserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ auto IntersectionObserver::computeIntersectionState(const IntersectionObserverRe
return;
}

ASSERT(is<LocalFrame>(frameView.frame()) && downcast<LocalFrame>(frameView.frame()).isMainFrame());
ASSERT(frameView.frame().isMainFrame());
// FIXME: Handle the case of an implicit-root observer that has a target in a different frame tree.
if (dynamicDowncast<LocalFrame>(targetRenderer->frame().mainFrame()) != &frameView.frame())
return;
Expand Down
5 changes: 2 additions & 3 deletions Source/WebCore/page/LocalFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ LocalFrame* LocalFrame::frameForWidget(const Widget& widget)

// Assume all widgets are either a FrameView or owned by a RenderWidget.
// FIXME: That assumption is not right for scroll bars!
return dynamicDowncast<LocalFrame>(downcast<LocalFrameView>(widget).frame());
return &downcast<LocalFrameView>(widget).frame();
}

void LocalFrame::clearTimers(LocalFrameView *view, Document *document)
Expand All @@ -759,8 +759,7 @@ void LocalFrame::clearTimers(LocalFrameView *view, Document *document)
view->layoutContext().unscheduleLayout();
if (auto* timelines = document->timelinesController())
timelines->suspendAnimations();
if (auto* localFrame = dynamicDowncast<LocalFrame>(view->frame()))
localFrame->eventHandler().stopAutoscrollTimer();
view->frame().eventHandler().stopAutoscrollTimer();
}

void LocalFrame::clearTimers()
Expand Down
13 changes: 4 additions & 9 deletions Source/WebCore/page/LocalFrameView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2664,8 +2664,7 @@ bool LocalFrameView::scrollRectToVisible(const LayoutRect& absoluteRect, const R
static ScrollPositionChangeOptions scrollPositionChangeOptionsForElement(const LocalFrameView& frameView, Element* element, const ScrollRectToVisibleOptions& options)
{
auto scrollPositionOptions = ScrollPositionChangeOptions::createProgrammatic();
if (is<LocalFrame>(frameView.frame())
&& !downcast<LocalFrame>(frameView.frame()).eventHandler().autoscrollInProgress()
if (!frameView.frame().eventHandler().autoscrollInProgress()
&& element
&& useSmoothScrolling(options.behavior, element))
scrollPositionOptions.animated = ScrollIsAnimated::Yes;
Expand Down Expand Up @@ -3319,8 +3318,7 @@ void LocalFrameView::adjustTiledBackingCoverage()

static bool shouldEnableSpeculativeTilingDuringLoading(const LocalFrameView& view)
{
auto* localFrame = dynamicDowncast<LocalFrame>(view.frame());
auto* page = localFrame ? localFrame->page() : nullptr;
auto* page = view.frame().page();
return page && view.isVisuallyNonEmpty() && !page->progress().isMainLoadProgressing();
}

Expand Down Expand Up @@ -5966,7 +5964,7 @@ ScrollBehaviorForFixedElements LocalFrameView::scrollBehaviorForFixedElements()
return m_frame->settings().backgroundShouldExtendBeyondPage() ? StickToViewportBounds : StickToDocumentBounds;
}

Frame& LocalFrameView::frame() const
LocalFrame& LocalFrameView::frame() const
{
return m_frame;
}
Expand Down Expand Up @@ -6383,10 +6381,7 @@ float LocalFrameView::deviceScaleFactor() const

void LocalFrameView::writeRenderTreeAsText(TextStream& ts, OptionSet<RenderAsTextFlag> behavior)
{
auto* localFrame = dynamicDowncast<LocalFrame>(frame());
if (!localFrame)
return;
externalRepresentationForLocalFrame(ts, *localFrame, behavior);
externalRepresentationForLocalFrame(ts, frame(), behavior);
}

} // namespace WebCore
Expand Down
3 changes: 1 addition & 2 deletions Source/WebCore/page/LocalFrameView.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ class LocalFrameView final : public FrameView {
Type viewType() const final { return Type::Local; }
void writeRenderTreeAsText(TextStream&, OptionSet<RenderAsTextFlag>) override;

// FIXME: This should return Frame. If it were a RemoteFrame, we would have a RemoteFrameView.
WEBCORE_EXPORT Frame& frame() const;
WEBCORE_EXPORT LocalFrame& frame() const;

WEBCORE_EXPORT RenderView* renderView() const;

Expand Down
8 changes: 4 additions & 4 deletions Source/WebCore/page/LocalFrameViewLayoutContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ void LocalFrameViewLayoutContext::performLayout()
LayoutScope layoutScope(*this);
TraceScope tracingScope(PerformLayoutStart, PerformLayoutEnd);
ScriptDisallowedScope::InMainThread scriptDisallowedScope;
InspectorInstrumentation::willLayout(downcast<LocalFrame>(view().frame()));
InspectorInstrumentation::willLayout(view().frame());
WeakPtr<RenderElement> layoutRoot;

m_layoutTimer.stop();
Expand Down Expand Up @@ -269,8 +269,8 @@ void LocalFrameViewLayoutContext::performLayout()
view().didLayout(layoutRoot);
runOrScheduleAsynchronousTasks();
}
InspectorInstrumentation::didLayout(downcast<LocalFrame>(view().frame()), *layoutRoot);
DebugPageOverlays::didLayout(downcast<LocalFrame>(view().frame()));
InspectorInstrumentation::didLayout(view().frame(), *layoutRoot);
DebugPageOverlays::didLayout(view().frame());
}

void LocalFrameViewLayoutContext::runOrScheduleAsynchronousTasks()
Expand Down Expand Up @@ -637,7 +637,7 @@ void LocalFrameViewLayoutContext::checkLayoutState()

LocalFrame& LocalFrameViewLayoutContext::frame() const
{
return downcast<LocalFrame>(view().frame());
return view().frame();
}

LocalFrameView& LocalFrameViewLayoutContext::view() const
Expand Down
6 changes: 1 addition & 5 deletions Source/WebCore/page/PageColorSampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,7 @@ static std::optional<Lab<float>> sampleColor(Document& document, IntPoint&& loca
auto colorSpace = DestinationColorSpace::SRGB();

ASSERT(document.view());
auto* localFrame = dynamicDowncast<LocalFrame>(document.view()->frame());
if (!localFrame)
return std::nullopt;

auto snapshot = snapshotFrameRect(*localFrame, IntRect(location, IntSize(1, 1)), { { SnapshotFlags::ExcludeSelectionHighlighting, SnapshotFlags::PaintEverythingExcludingSelection }, PixelFormat::BGRA8, colorSpace });
auto snapshot = snapshotFrameRect(document.view()->frame(), IntRect(location, IntSize(1, 1)), { { SnapshotFlags::ExcludeSelectionHighlighting, SnapshotFlags::PaintEverythingExcludingSelection }, PixelFormat::BGRA8, colorSpace });
if (!snapshot)
return std::nullopt;

Expand Down
5 changes: 1 addition & 4 deletions Source/WebCore/page/mac/EventHandlerMac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,7 @@ static void selfRetainingNSScrollViewScrollWheel(NSScrollView *self, SEL selecto
auto* frameView = dynamicDowncast<LocalFrameView>(widget);
if (!frameView)
return false;
auto* localFrame = dynamicDowncast<LocalFrame>(frameView->frame());
if (!localFrame)
return false;
return localFrame->eventHandler().handleWheelEvent(wheelEvent, processingSteps);
return frameView->frame().eventHandler().handleWheelEvent(wheelEvent, processingSteps);
}

if ([currentNSEvent() type] != NSEventTypeScrollWheel || m_sendingEventToSubview)
Expand Down

0 comments on commit ec7f821

Please sign in to comment.