Title: [149216] trunk/Source/WebCore
Revision
149216
Author
msab...@apple.com
Date
2013-04-26 15:20:51 -0700 (Fri, 26 Apr 2013)

Log Message

WebCore ObjC bridge is missing support for bool type
https://bugs.webkit.org/show_bug.cgi?id=115276

Reviewed by Geoffrey Garen.

Added code to handle conversion between ObjC and JS booleans.

* bridge/objc/objc_instance.mm:
(ObjcInstance::invokeObjcMethod):
* bridge/objc/objc_utility.h:
* bridge/objc/objc_utility.mm:
(JSC::Bindings::convertValueToObjcValue):
(JSC::Bindings::convertObjcValueToValue):
(JSC::Bindings::objcValueTypeForType):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (149215 => 149216)


--- trunk/Source/WebCore/ChangeLog	2013-04-26 22:15:52 UTC (rev 149215)
+++ trunk/Source/WebCore/ChangeLog	2013-04-26 22:20:51 UTC (rev 149216)
@@ -1,3 +1,20 @@
+2013-04-26  Michael Saboff  <msab...@apple.com>
+
+        WebCore ObjC bridge is missing support for bool type
+        https://bugs.webkit.org/show_bug.cgi?id=115276
+
+        Reviewed by Geoffrey Garen.
+
+        Added code to handle conversion between ObjC and JS booleans.
+
+        * bridge/objc/objc_instance.mm:
+        (ObjcInstance::invokeObjcMethod):
+        * bridge/objc/objc_utility.h:
+        * bridge/objc/objc_utility.mm:
+        (JSC::Bindings::convertValueToObjcValue):
+        (JSC::Bindings::convertObjcValueToValue):
+        (JSC::Bindings::objcValueTypeForType):
+
 2013-04-26  Roger Fong  <roger_f...@apple.com>
 
         Disable sub-pixel layout on mac.

Modified: trunk/Source/WebCore/bridge/objc/objc_instance.mm (149215 => 149216)


--- trunk/Source/WebCore/bridge/objc/objc_instance.mm	2013-04-26 22:15:52 UTC (rev 149215)
+++ trunk/Source/WebCore/bridge/objc/objc_instance.mm	2013-04-26 22:20:51 UTC (rev 149216)
@@ -289,6 +289,9 @@
                 case ObjcUnsignedShortType:
                     [invocation setArgument:&value.shortValue atIndex:i];
                     break;
+                case ObjcBoolType:
+                    [invocation setArgument:&value.booleanValue atIndex:i];
+                    break;
                 case ObjcIntType:
                 case ObjcUnsignedIntType:
                     [invocation setArgument:&value.intValue atIndex:i];

Modified: trunk/Source/WebCore/bridge/objc/objc_utility.h (149215 => 149216)


--- trunk/Source/WebCore/bridge/objc/objc_utility.h	2013-04-26 22:15:52 UTC (rev 149215)
+++ trunk/Source/WebCore/bridge/objc/objc_utility.h	2013-04-26 22:20:51 UTC (rev 149216)
@@ -64,6 +64,7 @@
     ObjcUnsignedLongLongType,
     ObjcFloatType,
     ObjcDoubleType,
+    ObjcBoolType,
     ObjcInvalidType
 } ObjcValueType;
 

Modified: trunk/Source/WebCore/bridge/objc/objc_utility.mm (149215 => 149216)


--- trunk/Source/WebCore/bridge/objc/objc_utility.mm	2013-04-26 22:15:52 UTC (rev 149215)
+++ trunk/Source/WebCore/bridge/objc/objc_utility.mm	2013-04-26 22:20:51 UTC (rev 149216)
@@ -113,6 +113,9 @@
         case ObjcUnsignedShortType:
             result.shortValue = (short)d;
             break;
+        case ObjcBoolType:
+            result.booleanValue = (bool)d;
+            break;
         case ObjcIntType:
         case ObjcUnsignedIntType:
             result.intValue = (int)d;
@@ -206,6 +209,8 @@
             return jsNumber(*(short*)buffer);
         case ObjcUnsignedShortType:
             return jsNumber(*(unsigned short*)buffer);
+        case ObjcBoolType:
+            return jsBoolean(*(bool*)buffer);
         case ObjcIntType:
             return jsNumber(*(int*)buffer);
         case ObjcUnsignedIntType:
@@ -261,6 +266,9 @@
             case _C_USHT:
                 objcValueType = ObjcUnsignedShortType;
                 break;
+            case _C_BOOL:
+                objcValueType = ObjcBoolType;
+                break;
             case _C_INT:
                 objcValueType = ObjcIntType;
                 break;
@@ -291,7 +299,8 @@
             default:
                 // Unhandled type. We don't handle C structs, unions, etc.
                 // FIXME: throw an exception?
-                ASSERT_NOT_REACHED();
+                WTFLogAlways("Unhandled ObjC type specifier: \"%c\" used in ObjC bridge.", typeChar);
+                RELEASE_ASSERT_NOT_REACHED();
         }
 
         if (objcValueType != ObjcInvalidType)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to