Title: [195616] trunk/Source/WebCore
Revision
195616
Author
[email protected]
Date
2016-01-26 13:22:16 -0800 (Tue, 26 Jan 2016)

Log Message

Add a Dictionary overload that returns an Optional result
https://bugs.webkit.org/show_bug.cgi?id=153507

Reviewed by Tim Horton.

* bindings/js/Dictionary.h:
(WebCore::Dictionary::get):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (195615 => 195616)


--- trunk/Source/WebCore/ChangeLog	2016-01-26 21:19:55 UTC (rev 195615)
+++ trunk/Source/WebCore/ChangeLog	2016-01-26 21:22:16 UTC (rev 195616)
@@ -1,3 +1,13 @@
+2016-01-26  Anders Carlsson  <[email protected]>
+
+        Add a Dictionary overload that returns an Optional result
+        https://bugs.webkit.org/show_bug.cgi?id=153507
+
+        Reviewed by Tim Horton.
+
+        * bindings/js/Dictionary.h:
+        (WebCore::Dictionary::get):
+
 2016-01-26  Philip Rogers  <[email protected]>
 
         Let SVG images not taint canvases except when containing foreignObjects

Modified: trunk/Source/WebCore/bindings/js/Dictionary.h (195615 => 195616)


--- trunk/Source/WebCore/bindings/js/Dictionary.h	2016-01-26 21:19:55 UTC (rev 195615)
+++ trunk/Source/WebCore/bindings/js/Dictionary.h	2016-01-26 21:22:16 UTC (rev 195616)
@@ -51,7 +51,10 @@
     bool get(const char* propertyName, Result&) const;
     template <typename Result>
     bool get(const String& propertyName, Result&) const;
-    
+
+    template <typename Result>
+    Optional<Result> get(const char* propertyName) const;
+
     template <typename T>
     RefPtr<EventListener> getEventListener(const char* propertyName, T* target) const;
     template <typename T>
@@ -85,6 +88,17 @@
     return get(propertyName.utf8().data(), result);
 }
 
+template<typename Result>
+Optional<Result> Dictionary::get(const char* propertyName) const
+{
+    Result result;
+
+    if (!get(propertyName, result))
+        return Nullopt;
+
+    return result;
+}
+
 template <typename T>
 RefPtr<EventListener> Dictionary::getEventListener(const char* propertyName, T* target) const
 {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to