Title: [225331] trunk/Source
Revision
225331
Author
da...@apple.com
Date
2017-11-30 10:17:07 -0800 (Thu, 30 Nov 2017)

Log Message

[Mac] remove unneeded RetainPtr use introduced in r225142
https://bugs.webkit.org/show_bug.cgi?id=180202

Reviewed by Tim Horton.

Source/WebCore:

* editing/mac/DictionaryLookup.h: Changed out arguments back to NSDictionary ** instead
of RetainPtr because these use autorelease.

* editing/mac/DictionaryLookup.mm:
(WebCore::tokenRange): Use NSDictionary **.
(WebCore::DictionaryLookup::rangeForSelection): Ditto.
(WebCore::DictionaryLookup::rangeAtHitTestResult): Ditto.
(WebCore::DictionaryLookup::stringForPDFSelection): Ditto.

Source/WebKit:

* WebProcess/Plugins/PDF/PDFPlugin.h: Got rid of unnecessary RetainPtr.
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::lookupTextAtLocation const): Ditto.
* WebProcess/WebPage/WebPage.h: Ditto.
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::performDictionaryLookupAtLocation): Ditto.
(WebKit::WebPage::performDictionaryLookupForSelection): Ditto.
(WebKit::WebPage::performImmediateActionHitTestAtLocation): Ditto.
(WebKit::WebPage::lookupTextAtLocation): Ditto.

Source/WebKitLegacy/mac:

* WebView/WebImmediateActionController.mm:
(-[WebImmediateActionController _animationControllerForText]): Got rid of unnecessary
RetainPtr.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (225330 => 225331)


--- trunk/Source/WebCore/ChangeLog	2017-11-30 18:02:48 UTC (rev 225330)
+++ trunk/Source/WebCore/ChangeLog	2017-11-30 18:17:07 UTC (rev 225331)
@@ -1,3 +1,19 @@
+2017-11-30  Darin Adler  <da...@apple.com>
+
+        [Mac] remove unneeded RetainPtr use introduced in r225142
+        https://bugs.webkit.org/show_bug.cgi?id=180202
+
+        Reviewed by Tim Horton.
+
+        * editing/mac/DictionaryLookup.h: Changed out arguments back to NSDictionary ** instead
+        of RetainPtr because these use autorelease.
+
+        * editing/mac/DictionaryLookup.mm:
+        (WebCore::tokenRange): Use NSDictionary **.
+        (WebCore::DictionaryLookup::rangeForSelection): Ditto.
+        (WebCore::DictionaryLookup::rangeAtHitTestResult): Ditto.
+        (WebCore::DictionaryLookup::stringForPDFSelection): Ditto.
+
 2017-11-30  Chris Dumez  <cdu...@apple.com>
 
         Mark ServiceWorkerGlobalScope as final

Modified: trunk/Source/WebCore/editing/mac/DictionaryLookup.h (225330 => 225331)


--- trunk/Source/WebCore/editing/mac/DictionaryLookup.h	2017-11-30 18:02:48 UTC (rev 225330)
+++ trunk/Source/WebCore/editing/mac/DictionaryLookup.h	2017-11-30 18:17:07 UTC (rev 225331)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -50,9 +50,9 @@
 
 class DictionaryLookup {
 public:
-    WEBCORE_EXPORT static RefPtr<Range> rangeForSelection(const VisibleSelection&, RetainPtr<NSDictionary> *options);
-    WEBCORE_EXPORT static RefPtr<Range> rangeAtHitTestResult(const HitTestResult&, RetainPtr<NSDictionary> *options);
-    WEBCORE_EXPORT static NSString *stringForPDFSelection(PDFSelection *, RetainPtr<NSDictionary> *options);
+    WEBCORE_EXPORT static RefPtr<Range> rangeForSelection(const VisibleSelection&, NSDictionary **options);
+    WEBCORE_EXPORT static RefPtr<Range> rangeAtHitTestResult(const HitTestResult&, NSDictionary **options);
+    WEBCORE_EXPORT static NSString *stringForPDFSelection(PDFSelection *, NSDictionary **options);
 
     // FIXME: Should move/unify dictionaryPopupInfoForRange here too.
 

Modified: trunk/Source/WebCore/editing/mac/DictionaryLookup.mm (225330 => 225331)


--- trunk/Source/WebCore/editing/mac/DictionaryLookup.mm	2017-11-30 18:02:48 UTC (rev 225330)
+++ trunk/Source/WebCore/editing/mac/DictionaryLookup.mm	2017-11-30 18:17:07 UTC (rev 225331)
@@ -52,7 +52,7 @@
 
 namespace WebCore {
 
-static NSRange tokenRange(const String& string, NSRange range, RetainPtr<NSDictionary>* options)
+static NSRange tokenRange(const String& string, NSRange range, NSDictionary **options)
 {
     if (!getLULookupDefinitionModuleClass())
         return NSMakeRange(NSNotFound, 0);
@@ -59,14 +59,8 @@
 
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
 
-    if (!options)
-        return [classLULookupDefinitionModule tokenRangeForString:string range:range options:nullptr];
+    return [classLULookupDefinitionModule tokenRangeForString:string range:range options:options];
 
-    NSDictionary *outOptions = nil;
-    auto result = [classLULookupDefinitionModule tokenRangeForString:string range:range options:&outOptions];
-    *options = outOptions;
-    return result;
-
     END_BLOCK_OBJC_EXCEPTIONS;
 
     return NSMakeRange(NSNotFound, 0);
@@ -84,7 +78,7 @@
     return selectedRange->contains(position);
 }
 
-RefPtr<Range> DictionaryLookup::rangeForSelection(const VisibleSelection& selection, RetainPtr<NSDictionary>* options)
+RefPtr<Range> DictionaryLookup::rangeForSelection(const VisibleSelection& selection, NSDictionary **options)
 {
     auto selectedRange = selection.toNormalizedRange();
     if (!selectedRange)
@@ -109,7 +103,7 @@
     return selectedRange;
 }
 
-RefPtr<Range> DictionaryLookup::rangeAtHitTestResult(const HitTestResult& hitTestResult, RetainPtr<NSDictionary>* options)
+RefPtr<Range> DictionaryLookup::rangeAtHitTestResult(const HitTestResult& hitTestResult, NSDictionary **options)
 {
     auto* node = hitTestResult.innerNonSharedNode();
     if (!node || !node->renderer())
@@ -168,7 +162,7 @@
     END_BLOCK_OBJC_EXCEPTIONS;
 }
 
-NSString *DictionaryLookup::stringForPDFSelection(PDFSelection *selection, RetainPtr<NSDictionary>* options)
+NSString *DictionaryLookup::stringForPDFSelection(PDFSelection *selection, NSDictionary **options)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
 

Modified: trunk/Source/WebKit/ChangeLog (225330 => 225331)


--- trunk/Source/WebKit/ChangeLog	2017-11-30 18:02:48 UTC (rev 225330)
+++ trunk/Source/WebKit/ChangeLog	2017-11-30 18:17:07 UTC (rev 225331)
@@ -1,3 +1,20 @@
+2017-11-30  Darin Adler  <da...@apple.com>
+
+        [Mac] remove unneeded RetainPtr use introduced in r225142
+        https://bugs.webkit.org/show_bug.cgi?id=180202
+
+        Reviewed by Tim Horton.
+
+        * WebProcess/Plugins/PDF/PDFPlugin.h: Got rid of unnecessary RetainPtr.
+        * WebProcess/Plugins/PDF/PDFPlugin.mm:
+        (WebKit::PDFPlugin::lookupTextAtLocation const): Ditto.
+        * WebProcess/WebPage/WebPage.h: Ditto.
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::WebPage::performDictionaryLookupAtLocation): Ditto.
+        (WebKit::WebPage::performDictionaryLookupForSelection): Ditto.
+        (WebKit::WebPage::performImmediateActionHitTestAtLocation): Ditto.
+        (WebKit::WebPage::lookupTextAtLocation): Ditto.
+
 2017-11-30  Zan Dobersek  <zdober...@igalia.com>
 
         [CoordGraphics] Move CoordinatedGraphicsLayer painting behind Nicosia::PaintingEngine

Modified: trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.h (225330 => 225331)


--- trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.h	2017-11-30 18:02:48 UTC (rev 225330)
+++ trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.h	2017-11-30 18:17:07 UTC (rev 225331)
@@ -108,7 +108,7 @@
 
     bool showContextMenuAtPoint(const WebCore::IntPoint&);
 
-    std::tuple<String, RetainPtr<PDFSelection>, RetainPtr<NSDictionary>> lookupTextAtLocation(const WebCore::FloatPoint&, WebHitTestResultData&) const;
+    std::tuple<String, PDFSelection *, NSDictionary *> lookupTextAtLocation(const WebCore::FloatPoint&, WebHitTestResultData&) const;
     WebCore::FloatRect rectForSelectionInRootView(PDFSelection *) const;
 
     CGFloat scaleFactor() const;

Modified: trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm (225330 => 225331)


--- trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm	2017-11-30 18:02:48 UTC (rev 225330)
+++ trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm	2017-11-30 18:17:07 UTC (rev 225331)
@@ -2016,7 +2016,7 @@
     return NSPointFromCGPoint(newPoint);
 }
 
-std::tuple<String, RetainPtr<PDFSelection>, RetainPtr<NSDictionary>> PDFPlugin::lookupTextAtLocation(const WebCore::FloatPoint& locationInViewCoordinates, WebHitTestResultData& data) const
+std::tuple<String, PDFSelection *, NSDictionary *> PDFPlugin::lookupTextAtLocation(const WebCore::FloatPoint& locationInViewCoordinates, WebHitTestResultData& data) const
 {
     auto selection = [m_pdfLayerController currentSelection];
     if (existingSelectionContainsPoint(locationInViewCoordinates))
@@ -2052,13 +2052,13 @@
         return { selection.string, selection, nil };
     }
 
-    RetainPtr<NSDictionary> options;
+    NSDictionary *options = nil;
     NSString *lookupText = DictionaryLookup::stringForPDFSelection(selection, &options);
     if (!lookupText.length)
         return { emptyString(), selection, nil };
 
     [m_pdfLayerController setCurrentSelection:selection];
-    return { lookupText, selection, WTFMove(options) };
+    return { lookupText, selection, options };
 }
 
 static NSRect rectInViewSpaceForRectInLayoutSpace(PDFLayerController* pdfLayerController, NSRect layoutSpaceRect)

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (225330 => 225331)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2017-11-30 18:02:48 UTC (rev 225330)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2017-11-30 18:17:07 UTC (rev 225331)
@@ -1275,7 +1275,7 @@
 
 #if PLATFORM(MAC)
     void performImmediateActionHitTestAtLocation(WebCore::FloatPoint);
-    std::tuple<RefPtr<WebCore::Range>, RetainPtr<NSDictionary>> lookupTextAtLocation(WebCore::FloatPoint);
+    std::tuple<RefPtr<WebCore::Range>, NSDictionary *> lookupTextAtLocation(WebCore::FloatPoint);
     void immediateActionDidUpdate();
     void immediateActionDidCancel();
     void immediateActionDidComplete();

Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm (225330 => 225331)


--- trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm	2017-11-30 18:02:48 UTC (rev 225330)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm	2017-11-30 18:17:07 UTC (rev 225331)
@@ -400,7 +400,7 @@
 
     // Find the frame the point is over.
     HitTestResult result = m_page->mainFrame().eventHandler().hitTestResultAtPoint(m_page->mainFrame().view()->windowToContents(roundedIntPoint(floatPoint)));
-    RetainPtr<NSDictionary> options;
+    NSDictionary *options = nil;
     auto range = DictionaryLookup::rangeAtHitTestResult(result, &options);
     if (!range)
         return;
@@ -409,14 +409,14 @@
     if (!frame)
         return;
 
-    performDictionaryLookupForRange(*frame, *range, options.get(), TextIndicatorPresentationTransition::Bounce);
+    performDictionaryLookupForRange(*frame, *range, options, TextIndicatorPresentationTransition::Bounce);
 }
 
 void WebPage::performDictionaryLookupForSelection(Frame& frame, const VisibleSelection& selection, TextIndicatorPresentationTransition presentationTransition)
 {
-    RetainPtr<NSDictionary> options;
+    NSDictionary *options = nil;
     if (auto selectedRange = DictionaryLookup::rangeForSelection(selection, &options))
-        performDictionaryLookupForRange(frame, *selectedRange, options.get(), presentationTransition);
+        performDictionaryLookupForRange(frame, *selectedRange, options, presentationTransition);
 }
 
 void WebPage::performDictionaryLookupOfCurrentSelection()
@@ -1007,7 +1007,7 @@
         immediateActionResult.lookupText = lookupRange->text();
         if (auto* node = hitTestResult.innerNode()) {
             if (auto* frame = node->document().frame()) {
-                auto options = std::get<RetainPtr<NSDictionary>>(lookupResult).get();
+                auto options = std::get<NSDictionary *>(lookupResult);
                 immediateActionResult.dictionaryPopupInfo = dictionaryPopupInfoForRange(*frame, *lookupRange, options, TextIndicatorPresentationTransition::FadeIn);
             }
         }
@@ -1066,8 +1066,8 @@
                     if (is<PluginDocument>(document))
                         downcast<PluginDocument>(document).setFocusedElement(element);
 
-                    auto selection = std::get<RetainPtr<PDFSelection>>(lookupResult).get();
-                    auto options = std::get<RetainPtr<NSDictionary>>(lookupResult).get();
+                    auto selection = std::get<PDFSelection *>(lookupResult);
+                    auto options = std::get<NSDictionary *>(lookupResult);
 
                     immediateActionResult.lookupText = lookupText;
                     immediateActionResult.isTextNode = true;
@@ -1085,7 +1085,7 @@
     send(Messages::WebPageProxy::DidPerformImmediateActionHitTest(immediateActionResult, immediateActionHitTestPreventsDefault, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
 }
 
-std::tuple<RefPtr<WebCore::Range>, RetainPtr<NSDictionary>> WebPage::lookupTextAtLocation(FloatPoint locationInViewCoordinates)
+std::tuple<RefPtr<WebCore::Range>, NSDictionary *> WebPage::lookupTextAtLocation(FloatPoint locationInViewCoordinates)
 {
     auto& mainFrame = corePage()->mainFrame();
     if (!mainFrame.view() || !mainFrame.view()->renderView())
@@ -1093,7 +1093,7 @@
 
     auto point = roundedIntPoint(locationInViewCoordinates);
     auto result = mainFrame.eventHandler().hitTestResultAtPoint(m_page->mainFrame().view()->windowToContents(point));
-    RetainPtr<NSDictionary> options;
+    NSDictionary *options = nil;
     auto range = DictionaryLookup::rangeAtHitTestResult(result, &options);
     return { WTFMove(range), WTFMove(options) };
 }

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (225330 => 225331)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2017-11-30 18:02:48 UTC (rev 225330)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2017-11-30 18:17:07 UTC (rev 225331)
@@ -1,3 +1,14 @@
+2017-11-30  Darin Adler  <da...@apple.com>
+
+        [Mac] remove unneeded RetainPtr use introduced in r225142
+        https://bugs.webkit.org/show_bug.cgi?id=180202
+
+        Reviewed by Tim Horton.
+
+        * WebView/WebImmediateActionController.mm:
+        (-[WebImmediateActionController _animationControllerForText]): Got rid of unnecessary
+        RetainPtr.
+
 2017-11-29  Said Abou-Hallawa  <sabouhall...@apple.com>
 
         Remove the ImageSource from the class hierarchy that connects BitmapImage to ImageFrame

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm (225330 => 225331)


--- trunk/Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm	2017-11-30 18:02:48 UTC (rev 225330)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm	2017-11-30 18:17:07 UTC (rev 225331)
@@ -564,12 +564,12 @@
     if (!frame)
         return nil;
 
-    RetainPtr<NSDictionary> options;
+    NSDictionary *options = nil;
     auto dictionaryRange = DictionaryLookup::rangeAtHitTestResult(_hitTestResult, &options);
     if (!dictionaryRange)
         return nil;
 
-    auto dictionaryPopupInfo = [WebImmediateActionController _dictionaryPopupInfoForRange:*dictionaryRange inFrame:frame withLookupOptions:options.get() indicatorOptions:TextIndicatorOptionDefault transition: TextIndicatorPresentationTransition::FadeIn];
+    auto dictionaryPopupInfo = [WebImmediateActionController _dictionaryPopupInfoForRange:*dictionaryRange inFrame:frame withLookupOptions:options indicatorOptions:TextIndicatorOptionDefault transition: TextIndicatorPresentationTransition::FadeIn];
     if (!dictionaryPopupInfo.attributedString)
         return nil;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to