Improve debug description of WAKViews
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Oct 2014 22:23:37 +0000 (22:23 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Oct 2014 22:23:37 +0000 (22:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=137716

Reviewed by Simon Fraser.

Source/WebCore:

No new tests because there is no behavior change.

* platform/ios/wak/WAKView.mm:
(-[WAKView description]):
* platform/ios/wak/WKView.h:
* platform/ios/wak/WKView.mm:
(WKViewGetOrigin):

Source/WebKit/mac:

* WebView/WebView.mm:
(-[WebView _touchEventRegions]): Adding a comment.

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

Source/WebCore/ChangeLog
Source/WebCore/platform/ios/wak/WAKView.mm
Source/WebCore/platform/ios/wak/WKView.h
Source/WebCore/platform/ios/wak/WKView.mm
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebView.mm

index 34a5efe49d563335b3748e254edd6d56e2cf6a14..1ae2d8b0126f1e0318c7ddb140a85dd8508086ce 100644 (file)
@@ -1,3 +1,18 @@
+2014-10-14  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Improve debug description of WAKViews
+        https://bugs.webkit.org/show_bug.cgi?id=137716
+
+        Reviewed by Simon Fraser.
+
+        No new tests because there is no behavior change.
+
+        * platform/ios/wak/WAKView.mm:
+        (-[WAKView description]):
+        * platform/ios/wak/WKView.h:
+        * platform/ios/wak/WKView.mm:
+        (WKViewGetOrigin):
+
 2014-10-14  Chris Dumez  <cdumez@apple.com>
 
         Introduce an isCSSAnimated flag on RenderElement for performance
index 14a765eb6b6db31def9d995ded5e7b4f281812a0..f21f01731935bad1b5d333c88b3f84f772065421 100644 (file)
@@ -754,7 +754,20 @@ static CGInterpolationQuality toCGInterpolationQuality(WebCore::InterpolationQua
 {
     NSMutableString *description = [NSMutableString stringWithFormat:@"<%@: WAK: %p (WK: %p); ", [self class], self, viewRef];
 
+    float scale = [self scale];
+    if (scale != 1)
+        [description appendFormat:@"scale = %g ", scale];
+
+    CGPoint origin = WKViewGetOrigin(viewRef);
+    if (origin.x || origin.y)
+        [description appendFormat:@"origin = (%g %g) ", origin.x, origin.y];
+
+    CGRect bounds = [self bounds];
     CGRect frame = [self frame];
+
+    if (frame.origin.x != bounds.origin.x || frame.origin.y != bounds.origin.y || frame.size.width != bounds.size.width || frame.size.height != bounds.size.height)
+        [description appendFormat:@"bounds = (%g %g; %g %g) ", bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height];
+
     [description appendFormat:@"frame = (%g %g; %g %g)>", frame.origin.x, frame.origin.y, frame.size.width, frame.size.height];
 
     return description;
index e7b35f400c874482639d1a3436436825e5c9e85c..94bc4898460b6daed0e88e6c00648f40250f001a 100644 (file)
@@ -112,6 +112,8 @@ void WKViewSetBoundsSize (WKViewRef view, CGSize newSize);
 
 WEBCORE_EXPORT CGRect WKViewGetFrame (WKViewRef view);
 
+CGPoint WKViewGetOrigin(WKViewRef);
+
 WEBCORE_EXPORT void WKViewSetScale (WKViewRef view, float scale);
 WEBCORE_EXPORT float WKViewGetScale (WKViewRef view);
 CGAffineTransform _WKViewGetTransform(WKViewRef view);
index 4583da7632c26cc6ea28698d7ae5700ef311bdba..a45eb6b30113732f0496a70e2765e50fa0239208 100644 (file)
@@ -143,6 +143,16 @@ CGRect WKViewGetFrame (WKViewRef view)
     return WKViewConvertRectToSuperview(view, view->bounds);
 }
 
+CGPoint WKViewGetOrigin(WKViewRef view)
+{
+    if (!view) {
+        WKError("invalid parameter");
+        return CGPointZero;
+    }
+
+    return view->origin;
+}
+
 static void _WKViewRecursivelyInvalidateGState(WKViewRef view)
 {
     if (!view) {
index 635efb6dd9ae55c8ff5f46698243df0fef73ba90..ef73304e0e79b37f935385be70c96eac15d523fe 100644 (file)
@@ -1,3 +1,13 @@
+2014-10-14  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Improve debug description of WAKViews
+        https://bugs.webkit.org/show_bug.cgi?id=137716
+
+        Reviewed by Simon Fraser.
+
+        * WebView/WebView.mm:
+        (-[WebView _touchEventRegions]): Adding a comment.
+
 2014-10-14  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Addressing post-review comment.
index 1c222995571ad2cdd8ca9cf85e16925f8147bf08..408536ae1beabf169f12dea16b978db351074fbc 100644 (file)
@@ -3658,6 +3658,11 @@ static inline IMP getMethod(id o, SEL s)
         if (rect.isEmpty())
             continue;
 
+        // Note that these rectangles are in the coordinate system of the document (inside the WebHTMLView), which is not
+        // the same as the coordinate system of the WebView. If you want to do comparisons with locations in the WebView,
+        // you must convert between the two using WAKView's convertRect:toView: selector. This will take care of scaling
+        // and translations (which are relevant for right-to-left column layout).
+
         // The event region wants this points in this order:
         //  p2------p3
         //  |       |