Title: [154031] trunk/Source/WebKit/mac
Revision
154031
Author
[email protected]
Date
2013-08-13 17:12:59 -0700 (Tue, 13 Aug 2013)

Log Message

<https://webkit.org/b/119777> Get rid of two gotos

Reviewed by Tim Horton.

* WebView/WebHTMLView.mm:
(-[WebHTMLView mouseDown:]):
(-[WebHTMLView namesOfPromisedFilesDroppedAtDestination:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/mac/ChangeLog (154030 => 154031)


--- trunk/Source/WebKit/mac/ChangeLog	2013-08-13 23:37:00 UTC (rev 154030)
+++ trunk/Source/WebKit/mac/ChangeLog	2013-08-14 00:12:59 UTC (rev 154031)
@@ -1,3 +1,13 @@
+2013-08-13  Anders Carlsson  <[email protected]>
+
+        <https://webkit.org/b/119777> Get rid of two gotos
+
+        Reviewed by Tim Horton.
+
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView mouseDown:]):
+        (-[WebHTMLView namesOfPromisedFilesDroppedAtDestination:]):
+
 2013-08-13  Tim Horton  <[email protected]>
 
         Remotely hosted plugins don’t work in window-server-hosted WebKit1 views

Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (154030 => 154031)


--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm	2013-08-13 23:37:00 UTC (rev 154030)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm	2013-08-14 00:12:59 UTC (rev 154031)
@@ -3555,23 +3555,22 @@
     [self _setMouseDownEvent:event];
 
     NSInputManager *currentInputManager = [NSInputManager currentInputManager];
-    if ([currentInputManager wantsToHandleMouseEvents] && [currentInputManager handleMouseEvent:event])
-        goto done;
 
-    [_private->completionController endRevertingChange:NO moveLeft:NO];
+    if (![currentInputManager wantsToHandleMouseEvents] || ![currentInputManager handleMouseEvent:event]) {
+        [_private->completionController endRevertingChange:NO moveLeft:NO];
 
-    // If the web page handles the context menu event and menuForEvent: returns nil, we'll get control click events here.
-    // We don't want to pass them along to KHTML a second time.
-    if (!([event modifierFlags] & NSControlKeyMask)) {
-        _private->ignoringMouseDraggedEvents = NO;
+        // If the web page handles the context menu event and menuForEvent: returns nil, we'll get control click events here.
+        // We don't want to pass them along to KHTML a second time.
+        if (!([event modifierFlags] & NSControlKeyMask)) {
+            _private->ignoringMouseDraggedEvents = NO;
 
-        // Let WebCore get a chance to deal with the event. This will call back to us
-        // to start the autoscroll timer if appropriate.
-        if (Frame* coreframe = core([self _frame]))
-            coreframe->eventHandler()->mouseDown(event);
+            // Let WebCore get a chance to deal with the event. This will call back to us
+            // to start the autoscroll timer if appropriate.
+            if (Frame* coreframe = core([self _frame]))
+                coreframe->eventHandler()->mouseDown(event);
+        }
     }
 
-done:
     _private->handlingMouseDownEvent = NO;
 }
 
@@ -3666,24 +3665,19 @@
     NSURL *draggingImageURL = nil;
     
     if (WebCore::CachedImage* tiffResource = [self promisedDragTIFFDataSource]) {
-        
-        ResourceBuffer *buffer = static_cast<CachedResource*>(tiffResource)->resourceBuffer();
-        if (!buffer)
-            goto noPromisedData;
-        
-        NSData *data = ""
-        NSURLResponse *response = tiffResource->response().nsURLResponse();
-        draggingImageURL = [response URL];
-        wrapper = [[[NSFileWrapper alloc] initRegularFileWithContents:data] autorelease];
-        NSString* filename = [response suggestedFilename];
-        NSString* trueExtension(tiffResource->image()->filenameExtension());
-        if (!matchesExtensionOrEquivalent(filename, trueExtension))
-            filename = [[filename stringByAppendingString:@"."] stringByAppendingString:trueExtension];
-        [wrapper setPreferredFilename:filename];
+        if (ResourceBuffer *buffer = static_cast<CachedResource*>(tiffResource)->resourceBuffer()) {
+            NSData *data = ""
+            NSURLResponse *response = tiffResource->response().nsURLResponse();
+            draggingImageURL = [response URL];
+            wrapper = [[[NSFileWrapper alloc] initRegularFileWithContents:data] autorelease];
+            NSString* filename = [response suggestedFilename];
+            NSString* trueExtension(tiffResource->image()->filenameExtension());
+            if (!matchesExtensionOrEquivalent(filename, trueExtension))
+                filename = [[filename stringByAppendingString:@"."] stringByAppendingString:trueExtension];
+            [wrapper setPreferredFilename:filename];
+        }
     }
     
-noPromisedData:
-    
     if (!wrapper) {
         ASSERT(![self _webView] || [self _isTopHTMLView]);
         Page* page = core([self _webView]);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to