Changeset 206449 in webkit


Ignore:
Timestamp:
Sep 27, 2016, 11:31:32 AM (9 years ago)
Author:
mitz@apple.com
Message:

[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.

Source/WebKit2:

  • 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.

Tools:

  • 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.

LayoutTests:

  • TestExpectations:
  • editing/selection/character-granularity-rect-expected.txt: Added.
  • editing/selection/character-granularity-rect.html: Added.
  • platform/ios-simulator-wk2/TestExpectations:
Location:
trunk
Files:
2 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r206440 r206449  
     12016-09-27  Dan Bernstein  <mitz@apple.com>
     2
     3        [iOS] REGRESSION (r182126): Selection highlight and handles aren’t visible with WKSelectionGranularityCharacter
     4        https://bugs.webkit.org/show_bug.cgi?id=162577
     5        <rdar://problem/28481984>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * TestExpectations:
     10        * editing/selection/character-granularity-rect-expected.txt: Added.
     11        * editing/selection/character-granularity-rect.html: Added.
     12        * platform/ios-simulator-wk2/TestExpectations:
     13
    1142016-09-27  Jer Noble  <jer.noble@apple.com>
    215
  • trunk/LayoutTests/TestExpectations

    r206422 r206449  
    6363# This test only makes sense on iOS
    6464fast/attachment/attachment-wrapping-action.html
     65
     66# Only iOS has selection UI drawn by UIKit
     67editing/selection/character-granularity-rect.html [ Skip ]
    6568
    6669#//////////////////////////////////////////////////////////////////////////////////////////
  • trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations

    r206261 r206449  
    99fast/scrolling/ios [ Pass ]
    1010fast/viewport/ios [ Pass ]
     11editing/selection/character-granularity-rect.html [ Pass ]
    1112
    1213#//////////////////////////////////////////////////////////////////////////////////////////
  • trunk/Source/WebKit2/ChangeLog

    r206440 r206449  
     12016-09-27  Dan Bernstein  <mitz@apple.com>
     2
     3        [iOS] REGRESSION (r182126): Selection highlight and handles aren’t visible with WKSelectionGranularityCharacter
     4        https://bugs.webkit.org/show_bug.cgi?id=162577
     5        <rdar://problem/28481984>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * UIProcess/API/Cocoa/WKWebView.mm:
     10        (-[WKWebView _uiTextSelectionRectViews]): Added this method in the WKTesting category, which
     11          uses UIKit internals to get the views used for the selection highlight.
     12        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
     13
     14        * UIProcess/ios/WKContentViewInteraction.mm:
     15        (-[WKContentView _selectionClipRect]): When selection is not confined to a form control or
     16          content-editable element, return the null rect to indicate no clipping, rather than
     17          clipping to the empty rect at the origin.
     18
    1192016-09-27  Jer Noble  <jer.noble@apple.com>
    220
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

    r206413 r206449  
    45304530}
    45314531
     4532- (NSArray<UIView *> *)_uiTextSelectionRectViews
     4533{
     4534    return [_contentView valueForKeyPath:@"interactionAssistant.selectionView.rangeView.m_rectViews"];
     4535}
     4536
    45324537#endif // PLATFORM(IOS)
    45334538
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h

    r206135 r206449  
    268268- (void)didEndFormControlInteraction WK_API_AVAILABLE(ios(WK_IOS_TBA));
    269269
     270@property (nonatomic, readonly) NSArray<UIView *> *_uiTextSelectionRectViews WK_API_AVAILABLE(ios(WK_IOS_TBA));
     271
    270272#endif
    271273
  • trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm

    r205682 r206449  
    11281128{
    11291129    if (_assistedNodeInformation.elementType == InputType::None)
    1130         return CGRectZero;
     1130        return CGRectNull;
    11311131    return _page->editorState().postLayoutData().selectionClipRect;
    11321132}
  • trunk/Tools/ChangeLog

    r206441 r206449  
     12016-09-27  Dan Bernstein  <mitz@apple.com>
     2
     3        [iOS] REGRESSION (r182126): Selection highlight and handles aren’t visible with WKSelectionGranularityCharacter
     4        https://bugs.webkit.org/show_bug.cgi?id=162577
     5        <rdar://problem/28481984>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * DumpRenderTree/ios/UIScriptControllerIOS.mm:
     10        (WTR::UIScriptController::selectionRangeViewRects): Returns null.
     11
     12        * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: Declared new
     13          selectionRangeViewRects attribute.
     14
     15        * TestRunnerShared/UIScriptContext/UIScriptContext.h:
     16        (WTR::UIScriptContext::jsContext): Added this public accessor.
     17
     18        * TestRunnerShared/UIScriptContext/UIScriptController.cpp:
     19        (WTR::selectionRangeViewRects): Generic implementation that returns null.
     20        * TestRunnerShared/UIScriptContext/UIScriptController.h:
     21
     22        * WebKitTestRunner/TestController.cpp:
     23        (WTR::updateTestOptionsFromTestHeader): Parse the new useCharacterSelectionGranularity
     24          option.
     25
     26        * WebKitTestRunner/TestOptions.h: Added new useCharacterSelectionGranularity option.
     27
     28        * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
     29        (WTR::TestController::platformCreateWebView): Set the configuration’s selectionGranularity
     30          property based on the new option.
     31
     32        * WebKitTestRunner/ios/PlatformWebViewIOS.mm:
     33        (WTR::PlatformWebView::viewSupportsOptions): Compare selection granularity option values.
     34
     35        * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
     36        (WTR::UIScriptController::selectionRangeViewRects): iOS-specific implementation that calls
     37          the new -[WKWebView _uiTextSelectionRectViews] and returns an array of view frame
     38          dictionaries.
     39
    1402016-09-27  Daniel Bates  <dabates@apple.com>
    241
  • trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm

    r206282 r206449  
    190190}
    191191
     192JSObjectRef UIScriptController::selectionRangeViewRects() const
     193{
     194    return nullptr;
     195}
     196
    192197}
    193198
  • trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl

    r206282 r206449  
    8080    readonly attribute object contentVisibleRect; // Returned object has 'left', 'top', 'width', 'height' properties.
    8181
     82    readonly attribute object selectionRangeViewRects; // An array of objects with 'left', 'top', 'width', and 'height' properties.
     83
    8284    void uiScriptComplete(DOMString result);
    8385};
  • trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.h

    r204877 r206449  
    8383    JSObjectRef objectFromRect(const WebCore::FloatRect&) const;
    8484
     85    JSGlobalContextRef jsContext() const { return m_context.get(); }
     86
    8587private:
    8688    JSRetainPtr<JSGlobalContextRef> m_context;
  • trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp

    r206282 r206449  
    233233}
    234234
     235JSObjectRef UIScriptController::selectionRangeViewRects() const
     236{
     237    return nullptr;
     238}
     239
    235240void UIScriptController::platformSetDidStartFormControlInteractionCallback()
    236241{
  • trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h

    r206282 r206449  
    104104    JSObjectRef contentVisibleRect() const;
    105105   
     106    JSObjectRef selectionRangeViewRects() const;
     107
    106108    void uiScriptComplete(JSStringRef result);
    107109
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r206355 r206449  
    951951        if (key == "ignoresViewportScaleLimits")
    952952            testOptions.ignoresViewportScaleLimits = parseBooleanTestHeaderValue(value);
     953        if (key == "useCharacterSelectionGranularity")
     954            testOptions.useCharacterSelectionGranularity = parseBooleanTestHeaderValue(value);
    953955        pairStart = pairEnd + 1;
    954956    }
  • trunk/Tools/WebKitTestRunner/TestOptions.h

    r203075 r206449  
    4343    bool needsSiteSpecificQuirks { false };
    4444    bool ignoresViewportScaleLimits { false };
     45    bool useCharacterSelectionGranularity { false };
    4546
    4647    float deviceScaleFactor { 1 };
  • trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm

    r203855 r206449  
    8989    if (options.ignoresViewportScaleLimits)
    9090        [copiedConfiguration setIgnoresViewportScaleLimits:YES];
     91    if (options.useCharacterSelectionGranularity)
     92        [copiedConfiguration setSelectionGranularity:WKSelectionGranularityCharacter];
    9193#endif
    9294
  • trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm

    r204853 r206449  
    279279bool PlatformWebView::viewSupportsOptions(const TestOptions& options) const
    280280{
    281     if (m_options.overrideLanguages != options.overrideLanguages || m_options.needsSiteSpecificQuirks != options.needsSiteSpecificQuirks)
     281    if (m_options.overrideLanguages != options.overrideLanguages || m_options.needsSiteSpecificQuirks != options.needsSiteSpecificQuirks || m_options.useCharacterSelectionGranularity != options.useCharacterSelectionGranularity)
    282282        return false;
    283283
  • trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm

    r206282 r206449  
    3535#import "TestRunnerWKWebView.h"
    3636#import "UIScriptContext.h"
     37#import <JavaScriptCore/JavaScriptCore.h>
    3738#import <UIKit/UIKit.h>
    3839#import <WebCore/FloatRect.h>
     
    304305}
    305306
     307JSObjectRef UIScriptController::selectionRangeViewRects() const
     308{
     309    NSMutableArray *selectionRects = [[NSMutableArray alloc] init];
     310    for (UIView *rectView in TestController::singleton().mainWebView()->platformView()._uiTextSelectionRectViews) {
     311        if (rectView.hidden)
     312            continue;
     313
     314        CGRect frame = rectView.frame;
     315        [selectionRects addObject:@{
     316            @"left": @(frame.origin.x),
     317            @"top": @(frame.origin.y),
     318            @"width": @(frame.size.width),
     319            @"height": @(frame.size.height),
     320        }];
     321    }
     322    return JSValueToObject(m_context->jsContext(), [JSValue valueWithObject:selectionRects inContext:[JSContext contextWithJSGlobalContextRef:m_context->jsContext()]].JSValueRef, nullptr);
     323}
     324
    306325void UIScriptController::platformSetDidStartFormControlInteractionCallback()
    307326{
Note: See TracChangeset for help on using the changeset viewer.