Title: [207626] branches/safari-602-branch
Revision
207626
Author
matthew_han...@apple.com
Date
2016-10-20 11:06:29 -0700 (Thu, 20 Oct 2016)

Log Message

Merge r206449. rdar://problem/28635085

Modified Paths

Added Paths

Diff

Modified: branches/safari-602-branch/LayoutTests/ChangeLog (207625 => 207626)


--- branches/safari-602-branch/LayoutTests/ChangeLog	2016-10-20 18:02:31 UTC (rev 207625)
+++ branches/safari-602-branch/LayoutTests/ChangeLog	2016-10-20 18:06:29 UTC (rev 207626)
@@ -1,3 +1,20 @@
+2016-10-20  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r206449. rdar://problem/28635085
+
+    2016-09-27  Dan Bernstein  <m...@apple.com>
+
+            [iOS] REGRESSION (r182126): Selection highlight and handles aren’t visible with WKSelectionGranularityCharacter
+            https://bugs.webkit.org/show_bug.cgi?id=162577
+            <rdar://problem/28481984>
+
+            Reviewed by Simon Fraser.
+
+            * TestExpectations:
+            * editing/selection/character-granularity-rect-expected.txt: Added.
+            * editing/selection/character-granularity-rect.html: Added.
+            * platform/ios-simulator-wk2/TestExpectations:
+
 2016-10-20  Daniel Bates  <daba...@apple.com>
 
         Merge r206809. rdar://problem/28718761

Modified: branches/safari-602-branch/LayoutTests/TestExpectations (207625 => 207626)


--- branches/safari-602-branch/LayoutTests/TestExpectations	2016-10-20 18:02:31 UTC (rev 207625)
+++ branches/safari-602-branch/LayoutTests/TestExpectations	2016-10-20 18:06:29 UTC (rev 207626)
@@ -58,6 +58,10 @@
 # This test only makes sense on Mac
 fast/attachment/attachment-subtitle-resize.html
 
+# Only iOS has selection UI drawn by UIKit
+editing/selection/character-granularity-rect.html [ Skip ]
+
+WKSelectionGranularityCharacter
 #//////////////////////////////////////////////////////////////////////////////////////////
 # End platform-specific tests.
 #//////////////////////////////////////////////////////////////////////////////////////////

Added: branches/safari-602-branch/LayoutTests/editing/selection/character-granularity-rect-expected.txt (0 => 207626)


--- branches/safari-602-branch/LayoutTests/editing/selection/character-granularity-rect-expected.txt	                        (rev 0)
+++ branches/safari-602-branch/LayoutTests/editing/selection/character-granularity-rect-expected.txt	2016-10-20 18:06:29 UTC (rev 207626)
@@ -0,0 +1 @@
+PASS

Added: branches/safari-602-branch/LayoutTests/editing/selection/character-granularity-rect.html (0 => 207626)


--- branches/safari-602-branch/LayoutTests/editing/selection/character-granularity-rect.html	                        (rev 0)
+++ branches/safari-602-branch/LayoutTests/editing/selection/character-granularity-rect.html	2016-10-20 18:06:29 UTC (rev 207626)
@@ -0,0 +1,56 @@
+<!-- webkit-test-runner [ useCharacterSelectionGranularity=true ] -->
+<meta name=viewport content="width=device-width">
+<style>
+    #target {
+        height: 100px;
+        width: 200px;
+        background-color: silver;
+    }
+</style>
+<div id="target">
+	<p style="font-family: ahem;">PressMe</p>
+    This test requires UIScriptController to run.
+</div>
+<script>
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+    }
+
+    function getUIScript()
+    {
+        return `
+        (function() {
+            uiController.longPressAtPoint(30, 20, function() {
+                uiController.uiScriptComplete(JSON.stringify(uiController.selectionRangeViewRects));
+            });
+        })();`
+    }
+
+    function runTest()
+    {
+        if (!testRunner.runUIScript)
+            return;
+
+        var target = document.getElementById('target');
+        if (testRunner.runUIScript) {
+            testRunner.runUIScript(getUIScript(), function(result) {
+                var selectionRangeViewRects = JSON.parse(result);
+                var output;
+                if (selectionRangeViewRects.length !== 1)
+                    output = 'FAIL: Unexpected number of selection range views: ' + result;
+                else {
+                    var rect = selectionRangeViewRects[0];
+                    if (rect.left != 8 || rect.top != 8 || rect.width != 112 || rect.height != 17 )
+                        output = 'FAIL: Unexpected selection range view frame: ' + result;
+                    else
+                        output = 'PASS';
+                }
+                document.getElementById('target').innerText = output;
+                testRunner.notifyDone();
+            });
+        }
+    }
+
+    runTest();
+</script>

Modified: branches/safari-602-branch/LayoutTests/platform/ios-simulator-wk2/TestExpectations (207625 => 207626)


--- branches/safari-602-branch/LayoutTests/platform/ios-simulator-wk2/TestExpectations	2016-10-20 18:02:31 UTC (rev 207625)
+++ branches/safari-602-branch/LayoutTests/platform/ios-simulator-wk2/TestExpectations	2016-10-20 18:06:29 UTC (rev 207626)
@@ -10,6 +10,7 @@
 fast/harness/concurrent-ui-side-scripts.html [ Pass ]
 fast/zooming/ios [ Pass ]
 fast/scrolling/ios [ Pass ]
+editing/selection/character-granularity-rect.html [ Pass ]
 
 #//////////////////////////////////////////////////////////////////////////////////////////
 # End platform-specific directories.

Modified: branches/safari-602-branch/Source/WebKit2/ChangeLog (207625 => 207626)


--- branches/safari-602-branch/Source/WebKit2/ChangeLog	2016-10-20 18:02:31 UTC (rev 207625)
+++ branches/safari-602-branch/Source/WebKit2/ChangeLog	2016-10-20 18:06:29 UTC (rev 207626)
@@ -1,3 +1,25 @@
+2016-10-20  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r206449. rdar://problem/28635085
+
+    2016-09-27  Dan Bernstein  <m...@apple.com>
+
+            [iOS] REGRESSION (r182126): Selection highlight and handles aren’t visible with WKSelectionGranularityCharacter
+            https://bugs.webkit.org/show_bug.cgi?id=162577
+            <rdar://problem/28481984>
+
+            Reviewed by Simon Fraser.
+
+            * UIProcess/API/Cocoa/WKWebView.mm:
+            (-[WKWebView _uiTextSelectionRectViews]): Added this method in the WKTesting category, which
+              uses UIKit internals to get the views used for the selection highlight.
+            * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+
+            * UIProcess/ios/WKContentViewInteraction.mm:
+            (-[WKContentView _selectionClipRect]): When selection is not confined to a form control or
+              content-editable element, return the null rect to indicate no clipping, rather than
+              clipping to the empty rect at the origin.
+
 2016-10-20  Daniel Bates  <daba...@apple.com>
 
         Merge r206809. rdar://problem/28718761

Modified: branches/safari-602-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (207625 => 207626)


--- branches/safari-602-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2016-10-20 18:02:31 UTC (rev 207625)
+++ branches/safari-602-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2016-10-20 18:06:29 UTC (rev 207626)
@@ -4517,6 +4517,11 @@
     [_contentView setForceIPadStyleZoomOnInputFocus:forceIPadStyleZoom];
 }
 
+- (NSArray<UIView *> *)_uiTextSelectionRectViews
+{
+    return [_contentView valueForKeyPath:@"interactionAssistant.selectionView.rangeView.m_rectViews"];
+}
+
 #endif // PLATFORM(IOS)
 
 #if PLATFORM(MAC)

Modified: branches/safari-602-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (207625 => 207626)


--- branches/safari-602-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h	2016-10-20 18:02:31 UTC (rev 207625)
+++ branches/safari-602-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h	2016-10-20 18:06:29 UTC (rev 207626)
@@ -264,6 +264,8 @@
 - (void)keyboardAccessoryBarPrevious WK_API_AVAILABLE(ios(WK_IOS_TBA));
 
 @property (nonatomic) BOOL forceIPadStyleZoomOnInputFocus WK_API_AVAILABLE(ios(WK_IOS_TBA));
+
+@property (nonatomic, readonly) NSArray<UIView *> *_uiTextSelectionRectViews WK_API_AVAILABLE(ios(WK_IOS_TBA));
 #endif
 
 #if !TARGET_OS_IPHONE

Modified: branches/safari-602-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (207625 => 207626)


--- branches/safari-602-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2016-10-20 18:02:31 UTC (rev 207625)
+++ branches/safari-602-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2016-10-20 18:06:29 UTC (rev 207626)
@@ -1111,7 +1111,7 @@
 - (CGRect)_selectionClipRect
 {
     if (_assistedNodeInformation.elementType == InputType::None)
-        return CGRectZero;
+        return CGRectNull;
     return _page->editorState().postLayoutData().selectionClipRect;
 }
 

Modified: branches/safari-602-branch/Tools/ChangeLog (207625 => 207626)


--- branches/safari-602-branch/Tools/ChangeLog	2016-10-20 18:02:31 UTC (rev 207625)
+++ branches/safari-602-branch/Tools/ChangeLog	2016-10-20 18:06:29 UTC (rev 207626)
@@ -1,3 +1,46 @@
+2016-10-20  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r206449. rdar://problem/28635085
+
+    2016-09-27  Dan Bernstein  <m...@apple.com>
+
+            [iOS] REGRESSION (r182126): Selection highlight and handles aren’t visible with WKSelectionGranularityCharacter
+            https://bugs.webkit.org/show_bug.cgi?id=162577
+            <rdar://problem/28481984>
+
+            Reviewed by Simon Fraser.
+
+            * DumpRenderTree/ios/UIScriptControllerIOS.mm:
+            (WTR::UIScriptController::selectionRangeViewRects): Returns null.
+
+            * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: Declared new
+              selectionRangeViewRects attribute.
+
+            * TestRunnerShared/UIScriptContext/UIScriptContext.h:
+            (WTR::UIScriptContext::jsContext): Added this public accessor.
+
+            * TestRunnerShared/UIScriptContext/UIScriptController.cpp:
+            (WTR::selectionRangeViewRects): Generic implementation that returns null.
+            * TestRunnerShared/UIScriptContext/UIScriptController.h:
+
+            * WebKitTestRunner/TestController.cpp:
+            (WTR::updateTestOptionsFromTestHeader): Parse the new useCharacterSelectionGranularity
+              option.
+
+            * WebKitTestRunner/TestOptions.h: Added new useCharacterSelectionGranularity option.
+
+            * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
+            (WTR::TestController::platformCreateWebView): Set the configuration’s selectionGranularity
+              property based on the new option.
+
+            * WebKitTestRunner/ios/PlatformWebViewIOS.mm:
+            (WTR::PlatformWebView::viewSupportsOptions): Compare selection granularity option values.
+
+            * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+            (WTR::UIScriptController::selectionRangeViewRects): iOS-specific implementation that calls
+              the new -[WKWebView _uiTextSelectionRectViews] and returns an array of view frame
+              dictionaries.
+
 2016-10-20  Matthew Hanson  <matthew_hanson>
 
         Merge r207385. rdar://problem/28811872

Modified: branches/safari-602-branch/Tools/WebKitTestRunner/TestController.cpp (207625 => 207626)


--- branches/safari-602-branch/Tools/WebKitTestRunner/TestController.cpp	2016-10-20 18:02:31 UTC (rev 207625)
+++ branches/safari-602-branch/Tools/WebKitTestRunner/TestController.cpp	2016-10-20 18:06:29 UTC (rev 207626)
@@ -949,6 +949,8 @@
             testOptions.needsSiteSpecificQuirks = parseBooleanTestHeaderValue(value);
         if (key == "ignoresViewportScaleLimits")
             testOptions.ignoresViewportScaleLimits = parseBooleanTestHeaderValue(value);
+        if (key == "useCharacterSelectionGranularity")
+            testOptions.useCharacterSelectionGranularity = parseBooleanTestHeaderValue(value);
         pairStart = pairEnd + 1;
     }
 }

Modified: branches/safari-602-branch/Tools/WebKitTestRunner/TestOptions.h (207625 => 207626)


--- branches/safari-602-branch/Tools/WebKitTestRunner/TestOptions.h	2016-10-20 18:02:31 UTC (rev 207625)
+++ branches/safari-602-branch/Tools/WebKitTestRunner/TestOptions.h	2016-10-20 18:06:29 UTC (rev 207626)
@@ -42,6 +42,7 @@
     bool useMockScrollbars { true };
     bool needsSiteSpecificQuirks { false };
     bool ignoresViewportScaleLimits { false };
+    bool useCharacterSelectionGranularity { false };
 
     float deviceScaleFactor { 1 };
     Vector<String> overrideLanguages;

Modified: branches/safari-602-branch/Tools/WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl (207625 => 207626)


--- branches/safari-602-branch/Tools/WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl	2016-10-20 18:02:31 UTC (rev 207625)
+++ branches/safari-602-branch/Tools/WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl	2016-10-20 18:06:29 UTC (rev 207626)
@@ -63,5 +63,7 @@
     // Behavior
     attribute boolean forceIPadStyleZoomOnInputFocus;
 
+    readonly attribute object selectionRangeViewRects; // An array of objects with 'left', 'top', 'width', and 'height' properties.
+
     void uiScriptComplete(DOMString result);
 };

Modified: branches/safari-602-branch/Tools/WebKitTestRunner/UIScriptContext/UIScriptContext.h (207625 => 207626)


--- branches/safari-602-branch/Tools/WebKitTestRunner/UIScriptContext/UIScriptContext.h	2016-10-20 18:02:31 UTC (rev 207625)
+++ branches/safari-602-branch/Tools/WebKitTestRunner/UIScriptContext/UIScriptContext.h	2016-10-20 18:06:29 UTC (rev 207626)
@@ -73,6 +73,8 @@
 
     JSObjectRef objectFromRect(const WKRect&) const;
 
+    JSGlobalContextRef jsContext() const { return m_context.get(); }
+
 private:
     JSRetainPtr<JSGlobalContextRef> m_context;
     

Modified: branches/safari-602-branch/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.cpp (207625 => 207626)


--- branches/safari-602-branch/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.cpp	2016-10-20 18:02:31 UTC (rev 207625)
+++ branches/safari-602-branch/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.cpp	2016-10-20 18:06:29 UTC (rev 207626)
@@ -178,6 +178,11 @@
     return nullptr;
 }
 
+JSObjectRef UIScriptController::selectionRangeViewRects() const
+{
+    return nullptr;
+}
+
 bool UIScriptController::forceIPadStyleZoomOnInputFocus() const
 {
     return false;

Modified: branches/safari-602-branch/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.h (207625 => 207626)


--- branches/safari-602-branch/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.h	2016-10-20 18:02:31 UTC (rev 207625)
+++ branches/safari-602-branch/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.h	2016-10-20 18:06:29 UTC (rev 207626)
@@ -84,6 +84,8 @@
     bool forceIPadStyleZoomOnInputFocus() const;
     void setForceIPadStyleZoomOnInputFocus(bool);
 
+    JSObjectRef selectionRangeViewRects() const;
+
     void uiScriptComplete(JSStringRef result);
 
 private:

Modified: branches/safari-602-branch/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm (207625 => 207626)


--- branches/safari-602-branch/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm	2016-10-20 18:02:31 UTC (rev 207625)
+++ branches/safari-602-branch/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm	2016-10-20 18:06:29 UTC (rev 207626)
@@ -88,6 +88,8 @@
         [copiedConfiguration setDataDetectorTypes:WKDataDetectorTypeAll];
     if (options.ignoresViewportScaleLimits)
         [copiedConfiguration setIgnoresViewportScaleLimits:YES];
+    if (options.useCharacterSelectionGranularity)
+        [copiedConfiguration setSelectionGranularity:WKSelectionGranularityCharacter];
 #endif
 
     m_mainWebView = std::make_unique<PlatformWebView>(copiedConfiguration.get(), options);

Modified: branches/safari-602-branch/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm (207625 => 207626)


--- branches/safari-602-branch/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm	2016-10-20 18:02:31 UTC (rev 207625)
+++ branches/safari-602-branch/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm	2016-10-20 18:06:29 UTC (rev 207626)
@@ -243,7 +243,7 @@
 
 bool PlatformWebView::viewSupportsOptions(const TestOptions& options) const
 {
-    if (m_options.overrideLanguages != options.overrideLanguages || m_options.needsSiteSpecificQuirks != options.needsSiteSpecificQuirks)
+    if (m_options.overrideLanguages != options.overrideLanguages || m_options.needsSiteSpecificQuirks != options.needsSiteSpecificQuirks || m_options.useCharacterSelectionGranularity != options.useCharacterSelectionGranularity)
         return false;
 
     return true;

Modified: branches/safari-602-branch/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (207625 => 207626)


--- branches/safari-602-branch/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2016-10-20 18:02:31 UTC (rev 207625)
+++ branches/safari-602-branch/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2016-10-20 18:06:29 UTC (rev 207626)
@@ -34,6 +34,7 @@
 #import "TestController.h"
 #import "TestRunnerWKWebView.h"
 #import "UIScriptContext.h"
+#import <_javascript_Core/_javascript_Core.h>
 #import <UIKit/UIKit.h>
 #import <WebKit/WKWebViewPrivate.h>
 #import <WebKit/WebKit.h>
@@ -209,6 +210,24 @@
     return m_context->objectFromRect(wkRect);
 }
 
+JSObjectRef UIScriptController::selectionRangeViewRects() const
+{
+    NSMutableArray *selectionRects = [[NSMutableArray alloc] init];
+    for (UIView *rectView in TestController::singleton().mainWebView()->platformView()._uiTextSelectionRectViews) {
+        if (rectView.hidden)
+            continue;
+
+        CGRect frame = rectView.frame;
+        [selectionRects addObject:@{
+            @"left": @(frame.origin.x),
+            @"top": @(frame.origin.y),
+            @"width": @(frame.size.width),
+            @"height": @(frame.size.height),
+        }];
+    }
+    return JSValueToObject(m_context->jsContext(), [JSValue valueWithObject:selectionRects inContext:[JSContext contextWithJSGlobalContextRef:m_context->jsContext()]].JSValueRef, nullptr);
+}
+
 bool UIScriptController::forceIPadStyleZoomOnInputFocus() const
 {
     TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to