Title: [174988] trunk/Source/WebKit2
Revision
174988
Author
[email protected]
Date
2014-10-21 10:58:01 -0700 (Tue, 21 Oct 2014)

Log Message

WKRemoteObjectCoder should handle floats
https://bugs.webkit.org/show_bug.cgi?id=137926
<rdar://problem/18695126>

Reviewed by Beth Dakin.

* Shared/API/Cocoa/WKRemoteObjectCoder.mm:
(encodeInvocation):
(-[WKRemoteObjectEncoder encodeFloat:forKey:]):
(decodeInvocationArguments):
(-[WKRemoteObjectDecoder decodeFloatForKey:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (174987 => 174988)


--- trunk/Source/WebKit2/ChangeLog	2014-10-21 17:46:11 UTC (rev 174987)
+++ trunk/Source/WebKit2/ChangeLog	2014-10-21 17:58:01 UTC (rev 174988)
@@ -1,3 +1,17 @@
+2014-10-21  Anders Carlsson  <[email protected]>
+
+        WKRemoteObjectCoder should handle floats
+        https://bugs.webkit.org/show_bug.cgi?id=137926
+        <rdar://problem/18695126>
+
+        Reviewed by Beth Dakin.
+
+        * Shared/API/Cocoa/WKRemoteObjectCoder.mm:
+        (encodeInvocation):
+        (-[WKRemoteObjectEncoder encodeFloat:forKey:]):
+        (decodeInvocationArguments):
+        (-[WKRemoteObjectDecoder decodeFloatForKey:]):
+
 2014-10-21  Jeff Miller  <[email protected]>
 
         WKContext needs to provide an API to resume a download

Modified: trunk/Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm (174987 => 174988)


--- trunk/Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm	2014-10-21 17:46:11 UTC (rev 174987)
+++ trunk/Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm	2014-10-21 17:58:01 UTC (rev 174988)
@@ -137,6 +137,15 @@
             break;
         }
 
+        // float
+        case 'f': {
+            float value;
+            [invocation getArgument:&value atIndex:i];
+
+            encodeToObjectStream(encoder, @(value));
+            break;
+        }
+
         // int
         case 'i': {
             int value;
@@ -300,6 +309,11 @@
     return [self encodeInt64:intv forKey:key];
 }
 
+- (void)encodeFloat:(float)value forKey:(NSString *)key
+{
+    _currentDictionary->set(escapeKey(key), API::Double::create(value));
+}
+
 - (void)encodeDouble:(double)value forKey:(NSString *)key
 {
     _currentDictionary->set(escapeKey(key), API::Double::create(value));
@@ -428,6 +442,13 @@
             break;
         }
 
+        // float
+        case 'f': {
+            float value = [decodeObjectFromObjectStream(decoder, [NSSet setWithObject:[NSNumber class]]) floatValue];
+            [invocation setArgument:&value atIndex:i];
+            break;
+        }
+
         // int
         case 'i': {
             int value = [decodeObjectFromObjectStream(decoder, [NSSet setWithObject:[NSNumber class]]) intValue];
@@ -585,6 +606,14 @@
     return [self decodeInt64ForKey:key];
 }
 
+- (float)decodeFloatForKey:(NSString *)key
+{
+    const API::Double* value = _currentDictionary->get<API::Double>(escapeKey(key));
+    if (!value)
+        return 0;
+    return value->value();
+}
+
 - (double)decodeDoubleForKey:(NSString *)key
 {
     const API::Double* value = _currentDictionary->get<API::Double>(escapeKey(key));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to