[iOS] Cleanup -[WAKView _selfHandleEvent:] and -[WAKWindow sendEventSynchronously:]
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Oct 2018 03:08:34 +0000 (03:08 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Oct 2018 03:08:34 +0000 (03:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=190402

Reviewed by Anders Carlsson.

Unindent case statements. Remove use of default case statements with body ASSERT_NOT_REACHED()
to catch the cases of a missing enumerator. By omitting the default case statement we turn
such a scenario into a compile-time error instead of handling it as a runtime error.

* platform/ios/wak/WAKView.mm:
(-[WAKView _selfHandleEvent:]):
* platform/ios/wak/WAKWindow.mm:
(-[WAKWindow sendEventSynchronously:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237027 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/ios/wak/WAKView.mm
Source/WebCore/platform/ios/wak/WAKWindow.mm

index befbc32..953cbe8 100644 (file)
@@ -1,3 +1,19 @@
+2018-10-10  Daniel Bates  <dabates@apple.com>
+
+        [iOS] Cleanup -[WAKView _selfHandleEvent:] and -[WAKWindow sendEventSynchronously:]
+        https://bugs.webkit.org/show_bug.cgi?id=190402
+
+        Reviewed by Anders Carlsson.
+
+        Unindent case statements. Remove use of default case statements with body ASSERT_NOT_REACHED()
+        to catch the cases of a missing enumerator. By omitting the default case statement we turn
+        such a scenario into a compile-time error instead of handling it as a runtime error.
+
+        * platform/ios/wak/WAKView.mm:
+        (-[WAKView _selfHandleEvent:]):
+        * platform/ios/wak/WAKWindow.mm:
+        (-[WAKWindow sendEventSynchronously:]):
+
 2018-10-05  Ryosuke Niwa  <rniwa@webkit.org>
 
         Rename MarkupAccumulator::appendStartTag, appendElement, etc... for clarity
index bb3a751..deee38b 100644 (file)
@@ -130,47 +130,34 @@ static void notificationCallback (WKViewRef v, WKViewNotificationType type, void
 
 - (BOOL)_selfHandleEvent:(WebEvent *)event
 {
-    WebEventType type = event.type;
-    
-    switch (type) {
-        case WebEventMouseDown: {
-            [self mouseDown:event];
-            break;
-        }
-        case WebEventMouseUp: {
-            [self mouseUp:event];
-            break;
-        }
-        case WebEventMouseMoved: {
-            [self mouseMoved:event];
-            break;
-        }
-        case WebEventKeyDown: {
-            [self keyDown:event];
-            break;
-        }
-        case WebEventKeyUp: {
-            [self keyUp:event];
-            break;
-        }
-        case WebEventScrollWheel: {
-            [self scrollWheel:event];
-            break;
-        }
+    switch (event.type) {
+    case WebEventMouseDown:
+        [self mouseDown:event];
+        return YES;
+    case WebEventMouseUp:
+        [self mouseUp:event];
+        return YES;
+    case WebEventMouseMoved:
+        [self mouseMoved:event];
+        return YES;
+    case WebEventKeyDown:
+        [self keyDown:event];
+        return YES;
+    case WebEventKeyUp:
+        [self keyUp:event];
+        return YES;
+    case WebEventScrollWheel:
+        [self scrollWheel:event];
+        return YES;
+    case WebEventTouchBegin:
+    case WebEventTouchChange:
+    case WebEventTouchEnd:
+    case WebEventTouchCancel:
 #if ENABLE(TOUCH_EVENTS)
-        case WebEventTouchBegin:
-        case WebEventTouchChange:
-        case WebEventTouchEnd:
-        case WebEventTouchCancel: {
-            [self touch:event];
-            break;
-        }
+        [self touch:event];
 #endif
-        default:
-            ASSERT_NOT_REACHED();
-            break;
+        return YES;
     }
-    return YES;
 }
 
 - (NSResponder *)nextResponder
index aceffbc..7e32966 100644 (file)
@@ -328,32 +328,28 @@ static id<OrientationProvider> gOrientationProvider;
     currentEvent = [anEvent retain];
 
     switch (anEvent.type) {
-        case WebEventMouseMoved:
-        case WebEventScrollWheel:
-            if (WAKView *hitView = [_contentView hitTest:(anEvent.locationInWindow)])
-                [hitView handleEvent:anEvent];
-            break;
-
-        case WebEventMouseUp:
-        case WebEventKeyDown:
-        case WebEventKeyUp:
-        case WebEventTouchChange:
-            [_responderView handleEvent:anEvent];
-            break;
-
-        case WebEventMouseDown:
-        case WebEventTouchBegin:
-        case WebEventTouchEnd:
-        case WebEventTouchCancel:
-            if (WAKView *hitView = [_contentView hitTest:(anEvent.locationInWindow)]) {
-                [self makeFirstResponder:hitView];
-                [hitView handleEvent:anEvent];
-            }
-            break;
-
-        default:
-            ASSERT_NOT_REACHED();
-            break;
+    case WebEventMouseMoved:
+    case WebEventScrollWheel:
+        if (WAKView *hitView = [_contentView hitTest:(anEvent.locationInWindow)])
+            [hitView handleEvent:anEvent];
+        break;
+
+    case WebEventMouseUp:
+    case WebEventKeyDown:
+    case WebEventKeyUp:
+    case WebEventTouchChange:
+        [_responderView handleEvent:anEvent];
+        break;
+
+    case WebEventMouseDown:
+    case WebEventTouchBegin:
+    case WebEventTouchEnd:
+    case WebEventTouchCancel:
+        if (WAKView *hitView = [_contentView hitTest:(anEvent.locationInWindow)]) {
+            [self makeFirstResponder:hitView];
+            [hitView handleEvent:anEvent];
+        }
+        break;
     }
 
     [currentEvent release];