Fix build for clang-700.0.59.5 by replacing deprecated calls to convert points betwee...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Oct 2015 22:36:57 +0000 (22:36 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Oct 2015 22:36:57 +0000 (22:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=150379

Patch by Gordon Sheridan <gordon_sheridan@apple.com> on 2015-10-22
Reviewed by Andy Estes.

Source/WebCore:

Provide WAKWindow versions of the non-deprecated methods for converting an NSRect between
window and screen coordinates, which replace the deprecated methods that operated on an NSPoint.

* platform/ios/wak/WAKWindow.h:
* platform/ios/wak/WAKWindow.mm:
(-[WAKWindow convertRectToScreen:]): Added.
(-[WAKWindow convertRectFromScreen:]): Added.

Source/WebKit/mac:

* WebView/WebHTMLView.mm:
(-[WebHTMLView characterIndexForPoint:]):
Convert point to rect, and replace call to deprecated convertScreenToBase: with convertRectFromScreen:.

(-[WebHTMLView firstRectForCharacterRange:]):
Replace call to deprecated convertBaseToScreen: with convertRectToScreen:.

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

Source/WebCore/ChangeLog
Source/WebCore/platform/ios/wak/WAKWindow.h
Source/WebCore/platform/ios/wak/WAKWindow.mm
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebHTMLView.mm

index e3e2ae7dceb52ec4def2717dcd0c10308eefc26a..41285285864df50e16649bc44e626b6679447e3f 100644 (file)
@@ -1,3 +1,18 @@
+2015-10-22  Gordon Sheridan  <gordon_sheridan@apple.com>
+
+        Fix build for clang-700.0.59.5 by replacing deprecated calls to convert points between screen and window coordinates for Mac.
+        https://bugs.webkit.org/show_bug.cgi?id=150379
+
+        Reviewed by Andy Estes.
+
+        Provide WAKWindow versions of the non-deprecated methods for converting an NSRect between
+        window and screen coordinates, which replace the deprecated methods that operated on an NSPoint.
+
+        * platform/ios/wak/WAKWindow.h:
+        * platform/ios/wak/WAKWindow.mm:
+        (-[WAKWindow convertRectToScreen:]): Added.
+        (-[WAKWindow convertRectFromScreen:]): Added.
+
 2015-10-22  Alex Christensen  <achristensen@webkit.org>
 
         Fix Mac CMake build after r191433.
index 4bc22f4ae1821e4c211e3c60674db23ad605ca97..2b5b99d99a4742abc248263bc7b153f6bbd963cf 100644 (file)
@@ -107,6 +107,8 @@ WEBCORE_EXPORT @interface WAKWindow : WAKResponder
 
 - (NSPoint)convertBaseToScreen:(NSPoint)aPoint;
 - (NSPoint)convertScreenToBase:(NSPoint)aPoint;
+- (NSRect)convertRectToScreen:(NSRect)aRect;
+- (NSRect)convertRectFromScreen:(NSRect)aRect;
 - (BOOL)isKeyWindow;
 - (void)makeKeyWindow;
 - (BOOL)isVisible;
index bc3fda4af4b16232e57d6d5d8cfb5fbac5a52379..9d83c5d0c6b61b1d436b3bf6cb5dc7201d86385d 100644 (file)
@@ -156,6 +156,24 @@ static id<OrientationProvider> gOrientationProvider;
     return [_hostLayer convertPoint:aPoint fromLayer:rootLayer];
 }
 
+- (NSRect)convertRectToScreen:(NSRect)windowRect
+{
+    CALayer* rootLayer = _hostLayer;
+    while (rootLayer.superlayer)
+        rootLayer = rootLayer.superlayer;
+
+    return [_hostLayer convertRect:windowRect toLayer:rootLayer];
+}
+
+- (NSRect)convertRectFromScreen:(NSRect)screenRect
+{
+    CALayer* rootLayer = _hostLayer;
+    while (rootLayer.superlayer)
+        rootLayer = rootLayer.superlayer;
+
+    return [_hostLayer convertRect:screenRect fromLayer:rootLayer];
+}
+
 - (BOOL)isKeyWindow
 {
     return YES || self == _WAKKeyWindow; 
index 8b8d072f470514451ee5ee19b4962cf9c6c31b32..12be17d8304a986f278ee0b72e7c1983c54b0c76 100644 (file)
@@ -1,3 +1,17 @@
+2015-10-22  Gordon Sheridan  <gordon_sheridan@apple.com>
+
+        Fix build for clang-700.0.59.5 by replacing deprecated calls to convert points between screen and window coordinates for Mac.
+        https://bugs.webkit.org/show_bug.cgi?id=150379
+
+        Reviewed by Andy Estes.
+
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView characterIndexForPoint:]):
+        Convert point to rect, and replace call to deprecated convertScreenToBase: with convertRectFromScreen:.
+
+        (-[WebHTMLView firstRectForCharacterRange:]):
+        Replace call to deprecated convertBaseToScreen: with convertRectToScreen:.
+
 2015-10-22  Myles C. Maxfield  <mmaxfield@apple.com>
 
         [Cocoa] Migrate WKSetPatternPhaseInUserSpace() and WKGetUserToBaseCTM() from WKSI
index 1f1c4828739f4040726d860066191760cc65035d..07b86c69540918d51975fa249bbde6dac147635c 100644 (file)
@@ -6108,8 +6108,10 @@ static BOOL writingDirectionKeyBindingsEnabled()
     NSWindow *window = [self window];
     WebFrame *frame = [self _frame];
 
-    if (window)
-        thePoint = [window convertScreenToBase:thePoint];
+    if (window) {
+        NSRect screenRect = { thePoint, NSZeroSize };
+        thePoint = [window convertRectFromScreen:screenRect].origin;
+    }
     thePoint = [self convertPoint:thePoint fromView:nil];
 
     DOMRange *range = [frame _characterRangeAtPoint:thePoint];
@@ -6149,7 +6151,7 @@ static BOOL writingDirectionKeyBindingsEnabled()
 
     NSWindow *window = [self window];
     if (window)
-        resultRect.origin = [window convertBaseToScreen:resultRect.origin];
+        resultRect.origin = [window convertRectToScreen:resultRect].origin;
     
     LOG(TextInput, "firstRectForCharacterRange:(%u, %u) -> (%f, %f, %f, %f)", theRange.location, theRange.length, resultRect.origin.x, resultRect.origin.y, resultRect.size.width, resultRect.size.height);
     return resultRect;