Title: [161396] trunk/Tools
Revision
161396
Author
[email protected]
Date
2014-01-06 20:00:31 -0800 (Mon, 06 Jan 2014)

Log Message

<https://webkit.org/b/126560> Fix incorrectness in use of some AppKit enums

Reviewed by Ryosuke Niwa.

* DumpRenderTree/mac/DumpRenderTree.mm:
(-[DRTMockScroller rectForPart:]): Move to using an if with early return instead of a switch
with a single case. This avoids the potential for warnings about unhandled cases.
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView): Cast the argument to NSBackingStoreType.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (161395 => 161396)


--- trunk/Tools/ChangeLog	2014-01-07 03:52:38 UTC (rev 161395)
+++ trunk/Tools/ChangeLog	2014-01-07 04:00:31 UTC (rev 161396)
@@ -1,3 +1,15 @@
+2014-01-06  Mark Rowe  <[email protected]>
+
+        <https://webkit.org/b/126560> Fix incorrectness in use of some AppKit enums
+
+        Reviewed by Ryosuke Niwa.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (-[DRTMockScroller rectForPart:]): Move to using an if with early return instead of a switch
+        with a single case. This avoids the potential for warnings about unhandled cases.
+        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
+        (WTR::PlatformWebView::PlatformWebView): Cast the argument to NSBackingStoreType.
+
 2014-01-04  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Move all GTK/GObject unit tests to Tools/TestWebKitAPI

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (161395 => 161396)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2014-01-07 03:52:38 UTC (rev 161395)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2014-01-07 04:00:31 UTC (rev 161396)
@@ -479,24 +479,21 @@
 
 - (NSRect)rectForPart:(NSScrollerPart)partCode
 {
-    switch (partCode) {
-    case NSScrollerKnob: {
-        NSRect frameRect = [self frame];
-        NSRect bounds = [self bounds];
-        BOOL isHorizontal = frameRect.size.width > frameRect.size.height;
-        CGFloat trackLength = isHorizontal ? bounds.size.width : bounds.size.height;
-        CGFloat minKnobSize = isHorizontal ? bounds.size.height : bounds.size.width;
-        CGFloat knobLength = max(minKnobSize, static_cast<CGFloat>(round(trackLength * [self knobProportion])));
-        CGFloat knobPosition = static_cast<CGFloat>((round([self doubleValue] * (trackLength - knobLength))));
-        
-        if (isHorizontal)
-            return NSMakeRect(bounds.origin.x + knobPosition, bounds.origin.y, knobLength, bounds.size.height);
+    if (partCode != NSScrollerKnob)
+        return [super rectForPart:partCode];
 
-        return NSMakeRect(bounds.origin.x, bounds.origin.y +  + knobPosition, bounds.size.width, knobLength);
-    }
-    }
+    NSRect frameRect = [self frame];
+    NSRect bounds = [self bounds];
+    BOOL isHorizontal = frameRect.size.width > frameRect.size.height;
+    CGFloat trackLength = isHorizontal ? bounds.size.width : bounds.size.height;
+    CGFloat minKnobSize = isHorizontal ? bounds.size.height : bounds.size.width;
+    CGFloat knobLength = max(minKnobSize, static_cast<CGFloat>(round(trackLength * [self knobProportion])));
+    CGFloat knobPosition = static_cast<CGFloat>((round([self doubleValue] * (trackLength - knobLength))));
     
-    return [super rectForPart:partCode];
+    if (isHorizontal)
+        return NSMakeRect(bounds.origin.x + knobPosition, bounds.origin.y, knobLength, bounds.size.height);
+
+    return NSMakeRect(bounds.origin.x, bounds.origin.y +  + knobPosition, bounds.size.width, knobLength);
 }
 
 - (void)drawKnob

Modified: trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm (161395 => 161396)


--- trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm	2014-01-07 03:52:38 UTC (rev 161395)
+++ trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm	2014-01-07 04:00:31 UTC (rev 161396)
@@ -137,7 +137,7 @@
     [m_view setWindowOcclusionDetectionEnabled:NO];
 
     NSRect windowRect = NSOffsetRect(rect, -10000, [(NSScreen *)[[NSScreen screens] objectAtIndex:0] frame].size.height - rect.size.height + 10000);
-    m_window = [[WebKitTestRunnerWindow alloc] initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:_NSBackingStoreUnbuffered defer:YES];
+    m_window = [[WebKitTestRunnerWindow alloc] initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:(NSBackingStoreType)_NSBackingStoreUnbuffered defer:YES];
     m_window.platformWebView = this;
     [m_window setColorSpace:[[NSScreen mainScreen] colorSpace]];
     [m_window setCollectionBehavior:NSWindowCollectionBehaviorStationary];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to