@@ -155,7 +155,7 @@ - (BOOL)_hostsLayersInWindowServer;
155155
156156NSView *PageClientImpl::activeView () const
157157{
158- return (m_impl && m_impl->thumbnailView ()) ? (NSView *)m_impl->thumbnailView () : m_view;
158+ return (m_impl && m_impl->thumbnailView ()) ? (NSView *)m_impl->thumbnailView () : m_view. getAutoreleased () ;
159159}
160160
161161NSWindow *PageClientImpl::activeWindow () const
@@ -164,7 +164,7 @@ - (BOOL)_hostsLayersInWindowServer;
164164 return [m_impl->thumbnailView () window ];
165165 if (m_impl && m_impl->targetWindowForMovePreparation ())
166166 return m_impl->targetWindowForMovePreparation ();
167- return m_view. window ;
167+ return [ m_view window ] ;
168168}
169169
170170bool PageClientImpl::isViewWindowActive ()
@@ -186,15 +186,15 @@ - (BOOL)_hostsLayersInWindowServer;
186186
187187void PageClientImpl::assistiveTechnologyMakeFirstResponder ()
188188{
189- [[m_view window ] makeFirstResponder: m_view];
189+ [[m_view window ] makeFirstResponder: m_view. get (). get () ];
190190}
191191
192192void PageClientImpl::makeFirstResponder ()
193193{
194194 if (m_shouldSuppressFirstResponderChanges)
195195 return ;
196196
197- [[m_view window ] makeFirstResponder: m_view];
197+ [[m_view window ] makeFirstResponder: m_view. get (). get () ];
198198}
199199
200200bool PageClientImpl::isViewVisible ()
@@ -323,10 +323,11 @@ - (BOOL)_hostsLayersInWindowServer;
323323 if ([NSApp _cursorRectCursor ])
324324 return ;
325325
326- if (!m_view)
326+ RetainPtr view = m_view.get ();
327+ if (!view)
327328 return ;
328329
329- NSWindow *window = [m_view window ];
330+ NSWindow *window = [view window ];
330331 if (!window)
331332 return ;
332333
@@ -338,7 +339,7 @@ - (BOOL)_hostsLayersInWindowServer;
338339 if ([NSCursor currentCursor ] == platformCursor)
339340 return ;
340341
341- if (m_impl->imageAnalysisOverlayViewHasCursorAtPoint ([m_view convertPoint: mouseLocationInScreen fromView: nil ]))
342+ if (m_impl->imageAnalysisOverlayViewHasCursorAtPoint ([view convertPoint: mouseLocationInScreen fromView: nil ]))
342343 return ;
343344
344345 [platformCursor set ];
@@ -453,20 +454,20 @@ - (BOOL)_hostsLayersInWindowServer;
453454
454455IntPoint PageClientImpl::screenToRootView (const IntPoint& point)
455456{
456- NSPoint windowCoord = [m_view. window convertPointFromScreen: point];
457+ NSPoint windowCoord = [[ m_view window ] convertPointFromScreen: point];
457458 return IntPoint ([m_view convertPoint: windowCoord fromView: nil ]);
458459}
459460
460461IntPoint PageClientImpl::rootViewToScreen (const IntPoint& point)
461462{
462- return IntPoint ([m_view. window convertPointToScreen: [m_view convertPoint: point toView: nil ]]);
463+ return IntPoint ([[ m_view window ] convertPointToScreen: [m_view convertPoint: point toView: nil ]]);
463464}
464465
465466IntRect PageClientImpl::rootViewToScreen (const IntRect& rect)
466467{
467468 NSRect tempRect = rect;
468469 tempRect = [m_view convertRect: tempRect toView: nil ];
469- tempRect.origin = [m_view. window convertPointToScreen: tempRect.origin];
470+ tempRect.origin = [[ m_view window ] convertPointToScreen: tempRect.origin];
470471 return enclosingIntRect (tempRect);
471472}
472473
@@ -508,14 +509,14 @@ - (BOOL)_hostsLayersInWindowServer;
508509
509510RefPtr<WebPopupMenuProxy> PageClientImpl::createPopupMenuProxy (WebPageProxy& page)
510511{
511- return WebPopupMenuProxyMac::create (m_view, page.popupMenuClient ());
512+ return WebPopupMenuProxyMac::create (m_view. get (). get () , page.popupMenuClient ());
512513}
513514
514515#if ENABLE(CONTEXT_MENUS)
515516
516517Ref<WebContextMenuProxy> PageClientImpl::createContextMenuProxy (WebPageProxy& page, FrameInfoData&& frameInfo, ContextMenuContextData&& context, const UserData& userData)
517518{
518- return WebContextMenuProxyMac::create (m_view, page, WTFMove (frameInfo), WTFMove (context), userData);
519+ return WebContextMenuProxyMac::create (m_view. get (). get () , page, WTFMove (frameInfo), WTFMove (context), userData);
519520}
520521
521522void PageClientImpl::didShowContextMenu ()
@@ -532,22 +533,22 @@ - (BOOL)_hostsLayersInWindowServer;
532533
533534RefPtr<WebColorPicker> PageClientImpl::createColorPicker (WebPageProxy& page, const WebCore::Color& initialColor, const WebCore::IntRect& rect, ColorControlSupportsAlpha supportsAlpha, Vector<WebCore::Color>&& suggestions)
534535{
535- return WebColorPickerMac::create (&page.colorPickerClient (), initialColor, rect, supportsAlpha, WTFMove (suggestions), m_view);
536+ return WebColorPickerMac::create (&page.colorPickerClient (), initialColor, rect, supportsAlpha, WTFMove (suggestions), m_view. get (). get () );
536537}
537538
538539RefPtr<WebDataListSuggestionsDropdown> PageClientImpl::createDataListSuggestionsDropdown (WebPageProxy& page)
539540{
540- return WebDataListSuggestionsDropdownMac::create (page, m_view);
541+ return WebDataListSuggestionsDropdownMac::create (page, m_view. get (). get () );
541542}
542543
543544RefPtr<WebDateTimePicker> PageClientImpl::createDateTimePicker (WebPageProxy& page)
544545{
545- return WebDateTimePickerMac::create (page, m_view);
546+ return WebDateTimePickerMac::create (page, m_view. get (). get () );
546547}
547548
548549Ref<ValidationBubble> PageClientImpl::createValidationBubble (const String& message, const ValidationBubble::Settings& settings)
549550{
550- return ValidationBubble::create (m_view, message, settings);
551+ return ValidationBubble::create (m_view. get (). get () , message, settings);
551552}
552553
553554void PageClientImpl::showBrowsingWarning (const BrowsingWarning& warning, CompletionHandler<void (std::variant<WebKit::ContinueUnsafeLoad, URL>&&)>&& completionHandler)
@@ -693,7 +694,7 @@ - (BOOL)_hostsLayersInWindowServer;
693694{
694695 m_impl->prepareForDictionaryLookup ();
695696
696- DictionaryLookup::showPopup (dictionaryPopupInfo, m_view, [this](TextIndicator& textIndicator) {
697+ DictionaryLookup::showPopup (dictionaryPopupInfo, m_view. get (). get () , [this](TextIndicator& textIndicator) {
697698 m_impl->setTextIndicator (textIndicator, WebCore::TextIndicatorLifetime::Permanent);
698699 }, nullptr , [this]() {
699700 m_impl->clearTextIndicatorWithAnimation (WebCore::TextIndicatorDismissalAnimation::None);
@@ -705,7 +706,7 @@ - (BOOL)_hostsLayersInWindowServer;
705706#if USE(AUTOCORRECTION_PANEL)
706707 if (!isViewVisible () || !isViewInWindow ())
707708 return ;
708- m_correctionPanel.show (m_view, *m_impl, type, boundingBoxOfReplacedString, replacedString, replacementString, alternativeReplacementStrings);
709+ m_correctionPanel.show (m_view. get (). get () , *m_impl, type, boundingBoxOfReplacedString, replacedString, replacementString, alternativeReplacementStrings);
709710#endif
710711}
711712
@@ -771,7 +772,7 @@ static inline NSCorrectionResponse toCorrectionResponse(AutocorrectionResponse r
771772{
772773 if (!isViewVisible () || !isViewInWindow ())
773774 return ;
774- m_alternativeTextUIController->showAlternatives (m_view, boundingBoxOfDictatedText, dictationContext, ^(NSString *acceptedAlternative) {
775+ m_alternativeTextUIController->showAlternatives (m_view. get (). get () , boundingBoxOfDictatedText, dictationContext, ^(NSString *acceptedAlternative) {
775776 m_impl->handleAcceptedAlternativeText (acceptedAlternative);
776777 });
777778}
@@ -921,15 +922,15 @@ static inline NSCorrectionResponse toCorrectionResponse(AutocorrectionResponse r
921922 if (RefPtr gestureController = m_impl->gestureController ())
922923 gestureController->didFinishNavigation (navigation);
923924
924- NSAccessibilityPostNotification (NSAccessibilityUnignoredAncestor (m_view), kAXLoadCompleteNotification);
925+ NSAccessibilityPostNotification (NSAccessibilityUnignoredAncestor (m_view.get().get() ), kAXLoadCompleteNotification);
925926}
926927
927928void PageClientImpl::didFailNavigation (API::Navigation* navigation)
928929{
929930 if (RefPtr gestureController = m_impl->gestureController ())
930931 gestureController->didFailNavigation (navigation);
931932
932- NSAccessibilityPostNotification (NSAccessibilityUnignoredAncestor (m_view), kAXLoadCompleteNotification);
933+ NSAccessibilityPostNotification (NSAccessibilityUnignoredAncestor (m_view.get().get() ), kAXLoadCompleteNotification);
933934}
934935
935936void PageClientImpl::didSameDocumentNavigationForMainFrame (SameDocumentNavigationType type)
@@ -950,7 +951,7 @@ static inline NSCorrectionResponse toCorrectionResponse(AutocorrectionResponse r
950951
951952CGRect PageClientImpl::boundsOfLayerInLayerBackedWindowCoordinates (CALayer *layer) const
952953{
953- CALayer *windowContentLayer = static_cast <NSView *>(m_view. window .contentView ).layer ;
954+ CALayer *windowContentLayer = static_cast <NSView *>([ m_view window ] .contentView ).layer ;
954955 ASSERT (windowContentLayer);
955956
956957 return [windowContentLayer convertRect: layer.bounds fromLayer: layer];
@@ -974,7 +975,7 @@ static inline NSCorrectionResponse toCorrectionResponse(AutocorrectionResponse r
974975
975976void PageClientImpl::showPlatformContextMenu (NSMenu *menu, IntPoint location)
976977{
977- [menu popUpMenuPositioningItem: nil atLocation: location inView: m_view];
978+ [menu popUpMenuPositioningItem: nil atLocation: location inView: m_view. get (). get () ];
978979}
979980
980981#if ENABLE(WIRELESS_PLAYBACK_TARGET)
@@ -986,12 +987,14 @@ static inline NSCorrectionResponse toCorrectionResponse(AutocorrectionResponse r
986987
987988void PageClientImpl::refView ()
988989{
989- CFRetain ((__bridge CFTypeRef)m_view);
990+ if (RetainPtr view = m_view.get ())
991+ CFRetain ((__bridge CFTypeRef)view.get ());
990992}
991993
992994void PageClientImpl::derefView ()
993995{
994- CFRelease ((__bridge CFTypeRef)m_view);
996+ if (RetainPtr view = m_view.get ())
997+ CFRelease ((__bridge CFTypeRef)view.get ());
995998}
996999
9971000void PageClientImpl::startWindowDrag ()
@@ -1053,9 +1056,10 @@ static inline NSCorrectionResponse toCorrectionResponse(AutocorrectionResponse r
10531056
10541057WebCore::UserInterfaceLayoutDirection PageClientImpl::userInterfaceLayoutDirection ()
10551058{
1056- if (!m_view)
1059+ RetainPtr view = m_view.get ();
1060+ if (!view)
10571061 return WebCore::UserInterfaceLayoutDirection::LTR;
1058- return (m_view. userInterfaceLayoutDirection == NSUserInterfaceLayoutDirectionLeftToRight) ? WebCore::UserInterfaceLayoutDirection::LTR : WebCore::UserInterfaceLayoutDirection::RTL;
1062+ return ([view userInterfaceLayoutDirection ] == NSUserInterfaceLayoutDirectionLeftToRight) ? WebCore::UserInterfaceLayoutDirection::LTR : WebCore::UserInterfaceLayoutDirection::RTL;
10591063}
10601064
10611065bool PageClientImpl::effectiveAppearanceIsDark () const
@@ -1143,7 +1147,7 @@ static inline NSCorrectionResponse toCorrectionResponse(AutocorrectionResponse r
11431147{
11441148 RetainPtr webView = this ->webView ();
11451149ALLOW_DEPRECATED_DECLARATIONS_BEGIN
1146- [[PAL::getWTWritingToolsClass () sharedInstance ] showTool: WebKit: :convertToPlatformRequestedTool (tool) forSelectionRect: selectionRect ofView: m_view forDelegate: webView.get ()];
1150+ [[PAL::getWTWritingToolsClass () sharedInstance ] showTool: WebKit: :convertToPlatformRequestedTool (tool) forSelectionRect: selectionRect ofView: m_view. get (). get () forDelegate: webView.get ()];
11471151ALLOW_DEPRECATED_DECLARATIONS_END
11481152}
11491153
0 commit comments