Title: [235478] trunk/Source/WebKit
Revision
235478
Author
[email protected]
Date
2018-08-29 14:09:43 -0700 (Wed, 29 Aug 2018)

Log Message

Followup (r235427): Use the null string instead of std::nullopt when no suggestion is selected
https://bugs.webkit.org/show_bug.cgi?id=189095

Reviewed by Tim Horton.

Followup to r235427 as per Darin's comment.

We can avoid unnecessary use of std::optional by taking advantage of the fact that
WTF::String already has a null value distinct from the empty value.

No change in behavior.

* UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
(WebKit::WebDataListSuggestionsDropdownMac::selectOption):
(-[WKDataListSuggestionsView currentSelectedString]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (235477 => 235478)


--- trunk/Source/WebKit/ChangeLog	2018-08-29 20:55:28 UTC (rev 235477)
+++ trunk/Source/WebKit/ChangeLog	2018-08-29 21:09:43 UTC (rev 235478)
@@ -1,3 +1,21 @@
+2018-08-29  Aditya Keerthi  <[email protected]>
+
+        Followup (r235427): Use the null string instead of std::nullopt when no suggestion is selected
+        https://bugs.webkit.org/show_bug.cgi?id=189095
+
+        Reviewed by Tim Horton.
+
+        Followup to r235427 as per Darin's comment.
+
+        We can avoid unnecessary use of std::optional by taking advantage of the fact that
+        WTF::String already has a null value distinct from the empty value.
+
+        No change in behavior.
+
+        * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
+        (WebKit::WebDataListSuggestionsDropdownMac::selectOption):
+        (-[WKDataListSuggestionsView currentSelectedString]):
+
 2018-08-29  Wenson Hsieh  <[email protected]>
 
         Use the null string instead of std::nullopt for missing attachment file names and content types

Modified: trunk/Source/WebKit/UIProcess/mac/WebDataListSuggestionsDropdownMac.mm (235477 => 235478)


--- trunk/Source/WebKit/UIProcess/mac/WebDataListSuggestionsDropdownMac.mm	2018-08-29 20:55:28 UTC (rev 235477)
+++ trunk/Source/WebKit/UIProcess/mac/WebDataListSuggestionsDropdownMac.mm	2018-08-29 21:09:43 UTC (rev 235478)
@@ -77,7 +77,7 @@
 - (void)moveSelectionByDirection:(const String&)direction;
 - (void)invalidate;
 
-- (std::optional<String>)currentSelectedString;
+- (String)currentSelectedString;
 @end
 
 namespace WebKit {
@@ -120,9 +120,9 @@
     if (!m_client)
         return;
 
-    std::optional<String> selectedOption = [m_dropdownUI currentSelectedString];
-    if (selectedOption)
-        m_client->didSelectOption(selectedOption.value());
+    String selectedOption = [m_dropdownUI currentSelectedString];
+    if (!selectedOption.isNull())
+        m_client->didSelectOption(selectedOption);
 
     close();
 }
@@ -329,13 +329,13 @@
     return self;
 }
 
-- (std::optional<String>)currentSelectedString
+- (String)currentSelectedString
 {
     std::optional<size_t> selectedRow = [_table currentActiveRow];
     if (selectedRow && selectedRow.value() < _suggestions.size())
         return _suggestions.at(selectedRow.value());
 
-    return std::nullopt;
+    return String();
 }
 
 - (void)updateWithInformation:(WebCore::DataListSuggestionInformation&&)information
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to