Reviewed by Anders.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Aug 2006 15:21:10 +0000 (15:21 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Aug 2006 15:21:10 +0000 (15:21 +0000)
        - clean up "flip"-related code a tiny bit

        * platform/Screen.h: Removed redundant parameter names.
        * platform/mac/ScreenMac.mm:
        (WebCore::flipScreenRect): Changed to call flipScreenPoint so we only have one
        copy of the flipping code.
        (WebCore::flipScreenPoint): Fixed indentation.

        * bridge/mac/WebCoreFrameBridge.mm: (globalPoint): Removed type casts and
        simplified a bit.

        * platform/mac/PlatformMouseEventMac.mm: (WebCore::globalPositionForEvent):
        * platform/mac/WheelEventMac.mm: (WebCore::globalPositionForEvent):
        Removed unneeded local variable.

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

WebCore/ChangeLog
WebCore/bridge/mac/WebCoreFrameBridge.mm
WebCore/platform/Screen.h
WebCore/platform/mac/PlatformMouseEventMac.mm
WebCore/platform/mac/ScreenMac.mm
WebCore/platform/mac/WheelEventMac.mm

index 5370e58af9ed4e47f7d07f5a78c48d41b51ccaf3..f3f9a5007d744b10369b8f58b6ee255793f064c1 100644 (file)
@@ -1,3 +1,22 @@
+2006-08-03  Darin Adler  <darin@apple.com>
+
+        Reviewed by Anders.
+
+        - clean up "flip"-related code a tiny bit
+
+        * platform/Screen.h: Removed redundant parameter names.
+        * platform/mac/ScreenMac.mm:
+        (WebCore::flipScreenRect): Changed to call flipScreenPoint so we only have one
+        copy of the flipping code.
+        (WebCore::flipScreenPoint): Fixed indentation.
+
+        * bridge/mac/WebCoreFrameBridge.mm: (globalPoint): Removed type casts and
+        simplified a bit.
+
+        * platform/mac/PlatformMouseEventMac.mm: (WebCore::globalPositionForEvent):
+        * platform/mac/WheelEventMac.mm: (WebCore::globalPositionForEvent):
+        Removed unneeded local variable.
+
 2006-08-02  David Hyatt  <hyatt@apple.com>
 
         Abstract RenderLayer scrollbar creation and destruction so that there
index e7343858d9f70c136471e41195446466a2aec74a..8cc2ae806f1a095afd6b8d81f101d021fa21a168 100644 (file)
@@ -2316,8 +2316,7 @@ static HTMLFormElement *formElementFromDOMElement(DOMElement *element)
 
 static IntPoint globalPoint(NSWindow* window, NSPoint windowPoint)
 {
-    NSPoint screenPoint = [window convertBaseToScreen:windowPoint];
-    return IntPoint((int)screenPoint.x, (int)(flipScreenPoint(screenPoint).y));
+    return IntPoint(flipScreenPoint([window convertBaseToScreen:windowPoint]));
 }
 
 static PlatformMouseEvent createMouseEventFromDraggingInfo(NSWindow* window, id <NSDraggingInfo> info)
index e9d143358818795b3367a62924c137f9680a4b79..2bfa0a2c70303219716ee90b44eec6d6c56e17bb 100644 (file)
@@ -41,8 +41,8 @@ namespace WebCore {
     FloatRect scaleWidgetRectToScreen(FloatRect, Widget*);
 
 #if PLATFORM(MAC)
-    NSRect flipScreenRect(NSRect rect);
-    NSPoint flipScreenPoint(NSPoint point);
+    NSRect flipScreenRect(NSRect);
+    NSPoint flipScreenPoint(NSPoint);
 #endif
     
 }
index aebc5b1e63c91732bd9d2a3d2e9a4cf9b3648155..710a37951f5c85707b5afe96eec979eb37a37828 100644 (file)
@@ -86,10 +86,8 @@ static IntPoint globalPositionForEvent(NSEvent *event)
         case NSOtherMouseUp:
         case NSOtherMouseDragged:
         case NSMouseMoved:
-        case NSScrollWheel: {
-            NSPoint point = [[event window] convertBaseToScreen:[event locationInWindow]];
-            return IntPoint(flipScreenPoint(point));
-        }
+        case NSScrollWheel:
+            return IntPoint(flipScreenPoint([[event window] convertBaseToScreen:[event locationInWindow]]));
         default:
             return IntPoint();
     }
index 4cdeca6693167fe94cc9f0012e4d400438f53533..dc97d310e9d5e6f79cefd4b112c2766289aa1ab5 100644 (file)
@@ -41,14 +41,14 @@ static NSScreen* screen(Widget* widget)
 
 NSRect flipScreenRect(NSRect rect)
 {
-    rect.origin.y = NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - NSMaxY(rect);
+    rect.origin = flipScreenPoint(rect.origin);
     return rect;
 }
 
 NSPoint flipScreenPoint(NSPoint point)
 {
-  point.y = NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - point.y;
-  return point;
+    point.y = NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - point.y;
+    return point;
 }
 
 FloatRect scaleScreenRectToWidget(FloatRect rect, Widget* widget)
index 42949963b9396c7b1e7f5756d151ea45b757b9e1..10c07787a7554b35db043044535befc6dc6818fa 100644 (file)
@@ -45,10 +45,8 @@ static IntPoint positionForEvent(NSEvent *event)
 static IntPoint globalPositionForEvent(NSEvent *event)
 {
     switch ([event type]) {
-        case NSScrollWheel: {
-            NSPoint point = [[event window] convertBaseToScreen:[event locationInWindow]];
-            return IntPoint(flipScreenPoint(point));
-        }
+        case NSScrollWheel:
+            return IntPoint(flipScreenPoint([[event window] convertBaseToScreen:[event locationInWindow]]));
         default:
             return IntPoint();
     }