Changeset 170495 in webkit
- Timestamp:
- Jun 26, 2014, 2:23:02 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r170492 r170495 1 2014-06-26 Dan Bernstein <mitz@apple.com> 2 3 [iOS] Add API for opting into character selection granularity 4 https://bugs.webkit.org/show_bug.cgi?id=134354 5 6 Reviewed by Geoff Garen. 7 8 * Shared/API/Cocoa/WKFoundation.h: Added a definition of WK_ENUM_AVAILABLE_IOS. 9 * UIProcess/API/Cocoa/WKWebViewConfiguration.h: 10 (WKSelectionGranularity): Added this enum with two values, one representing dynamic 11 granularity( the current, default behavior) and one representing character granularity. 12 Delcared new selectionGranularity property. 13 * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: 14 (-[WKWebViewConfiguration copyWithZone:]): Copy the _selectionGranularity ivar. 15 16 * UIProcess/ios/WKContentViewInteraction.mm: 17 (toUIWebSelectionMode): Added this helper function for mapping WKSelectionGranularity values 18 to UIWebSelectionMode values. 19 (-[WKContentView setupInteraction]): Use a selection assistant with the mode specified in 20 the configuration. 21 (-[WKContentView _stopAssistingKeyboard]): Ditto. 22 23 * WebProcess/WebPage/ios/WebPageIOS.mm: 24 (WebKit::WebPage::selectWithGesture): Changed the behavior of the loupe gesture type in 25 non-editable text to select a word, rather than an empty range, matching the UITextView 26 behavior. 27 1 28 2014-06-26 Ada Chan <adachan@apple.com> 2 29 -
trunk/Source/WebKit2/Shared/API/Cocoa/WKFoundation.h
r170237 r170495 45 45 #define WK_CLASS_AVAILABLE(_mac, _ios) __attribute__((visibility ("default"))) 46 46 #define WK_ENUM_AVAILABLE(_mac, _ios) 47 #define WK_ENUM_AVAILABLE_IOS(_ios) 47 48 48 49 #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1090 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h
r169818 r170495 33 33 @class WKProcessPool; 34 34 @class WKUserContentController; 35 36 #if TARGET_OS_IPHONE 37 /*! @enum WKSelectionGranularity 38 @abstract The granularity with which a selection can be created and modified interactively. 39 @constant WKSelectionGranularityDynamic Selection granularity varies automatically based on the selection. 40 @constant WKSelectionGranularityCharacter Selection endpoints can be placed at any character boundary. 41 @discussion An example of how granularity may vary when WKSelectionGranularityDynamic is used is 42 that when the selection is within a single block, the granularity may be single character, and when 43 the selection is not confined to a single block, the selection granularity may be single block. 44 */ 45 typedef NS_ENUM(NSInteger, WKSelectionGranularity) { 46 WKSelectionGranularityDynamic, 47 WKSelectionGranularityCharacter, 48 } WK_ENUM_AVAILABLE_IOS(8_0); 49 #endif 35 50 36 51 /*! A WKWebViewConfiguration object is a collection of properties with … … 81 96 @property (nonatomic) BOOL mediaPlaybackAllowsAirPlay; 82 97 98 /*! @abstract The level of granularity with which the user can interactively 99 select content in the web view. 100 @discussion Possible values are described in WKSelectionGranularity. 101 The default value is WKSelectionGranularityDynamic. 102 */ 103 @property (nonatomic) WKSelectionGranularity selectionGranularity; 104 83 105 #endif 84 106 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm
r170371 r170495 117 117 configuration->_mediaPlaybackRequiresUserAction = self->_mediaPlaybackRequiresUserAction; 118 118 configuration->_mediaPlaybackAllowsAirPlay = self->_mediaPlaybackAllowsAirPlay; 119 configuration->_selectionGranularity = self->_selectionGranularity; 119 120 #endif 120 121 -
trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
r170445 r170495 37 37 #import "WKFormSelectControl.h" 38 38 #import "WKInspectorNodeSearchGestureRecognizer.h" 39 #import "WKWebViewConfiguration.h" 39 40 #import "WKWebViewPrivate.h" 40 41 #import "WebEvent.h" … … 191 192 @implementation WKContentView (WKInteraction) 192 193 194 static UIWebSelectionMode toUIWebSelectionMode(WKSelectionGranularity granularity) 195 { 196 switch (granularity) { 197 case WKSelectionGranularityDynamic: 198 return UIWebSelectionModeWeb; 199 case WKSelectionGranularityCharacter: 200 return UIWebSelectionModeTextOnly; 201 } 202 203 ASSERT_NOT_REACHED(); 204 return UIWebSelectionModeWeb; 205 } 206 193 207 - (void)setupInteraction 194 208 { … … 238 252 239 253 // FIXME: This should be called when we get notified that loading has completed. 240 [self useSelectionAssistantWithMode: UIWebSelectionModeWeb];254 [self useSelectionAssistantWithMode:toUIWebSelectionMode([[_webView configuration] selectionGranularity])]; 241 255 242 256 _actionSheetAssistant = adoptNS([[WKActionSheetAssistant alloc] initWithView:self]); … … 2307 2321 - (void)_stopAssistingKeyboard 2308 2322 { 2309 [self useSelectionAssistantWithMode: UIWebSelectionModeWeb];2323 [self useSelectionAssistantWithMode:toUIWebSelectionMode([[_webView configuration] selectionGranularity])]; 2310 2324 } 2311 2325 -
trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm
r170445 r170495 857 857 858 858 case GestureType::Loupe: 859 range = Range::create(*frame.document(), position, position); 859 if (position.rootEditableElement()) 860 range = Range::create(*frame.document(), position, position); 861 else 862 range = wordRangeFromPosition(position); 860 863 break; 861 864
Note:
See TracChangeset
for help on using the changeset viewer.