Changeset 164621 in webkit
- Timestamp:
- Feb 24, 2014, 6:40:28 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 1 deleted
- 13 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r164619 r164621 1 2014-02-24 Simon Fraser <simon.fraser@apple.com> 2 3 Remove WKInteractionView, move code into WKContentView 4 https://bugs.webkit.org/show_bug.cgi?id=129275 5 6 Reviewed by Benjamin Poulain. 7 8 WKInteractionView as an interim solution as WebKit2 on iOS was being 9 brought up, and should be removed. 10 11 Move its code into a category on WKContentView, mostly unchanged. The 12 WKContentView (WKInteraction) categroy now implements the various protocols 13 that WKInteractionView implemented. 14 15 WKContentView is not an API class, so no longer has WK_API_CLASS, and can 16 have implementation-related data members. WKContentViewInternal.h is removed. 17 18 WKContentView now exposes a WebPageProxy* rather than a WKPageRef. 19 20 Other changes: WKActionSheetAssistant no longer stores a WebPageProxy, 21 getting it from the WKContentView instead. 22 23 WKAutoCorrectionData and InteractionInformationAtPosition are stored via unique_ptr 24 to reduce class size, and avoid having to expose their details in the header. 25 26 * Configurations/WebKit2.xcconfig: 27 * UIProcess/API/Cocoa/WKWebViewInternal.h: 28 * UIProcess/API/ios/WKViewIOS.mm: 29 (-[WKView setAllowsBackForwardNavigationGestures:]): 30 (-[WKView pageRef]): 31 (-[WKView _pageExtendedBackgroundColor]): 32 (-[WKView _setBackgroundExtendsBeyondPage:]): 33 (-[WKView _backgroundExtendsBeyondPage]): 34 * UIProcess/ios/PageClientImplIOS.mm: 35 * UIProcess/ios/WKActionSheet.h: 36 * UIProcess/ios/WKActionSheet.mm: 37 (-[WKActionSheet initWithView:]): 38 (+[WKElementAction customElementActionWithTitle:actionHandler:]): 39 (copyElement): 40 (saveImage): 41 (+[WKElementAction standardElementActionWithType:customTitle:]): 42 (-[WKElementAction runActionWithElementInfo:view:]): 43 * UIProcess/ios/WKActionSheetAssistant.h: 44 * UIProcess/ios/WKActionSheetAssistant.mm: 45 (-[WKActionSheetAssistant initWithView:]): 46 (-[WKActionSheetAssistant dealloc]): 47 (-[WKActionSheetAssistant initialPresentationRectInHostViewForSheet]): 48 (-[WKActionSheetAssistant presentationRectInHostViewForSheet]): 49 (-[WKActionSheetAssistant actionSheet:clickedButtonAtIndex:]): 50 (-[WKActionSheetAssistant _createSheetWithElementActions:showLinkTitle:]): 51 (-[WKActionSheetAssistant showImageSheet]): 52 (-[WKActionSheetAssistant showLinkSheet]): 53 (-[WKActionSheetAssistant showDataDetectorsSheet]): 54 (-[WKActionSheetAssistant cleanupSheet]): 55 * UIProcess/ios/WKContentView.h: 56 * UIProcess/ios/WKContentView.mm: 57 (-[WKContentView initWithFrame:context:WebKit::configuration:WebKit::]): 58 (-[WKContentView dealloc]): 59 (-[WKContentView page]): 60 (-[WKContentView isAssistingNode]): 61 (-[WKContentView didFinishScrolling]): 62 (-[WKContentView willStartZoomOrScroll]): 63 (-[WKContentView willStartUserTriggeredScroll]): 64 (-[WKContentView willStartUserTriggeredZoom]): 65 (-[WKContentView didZoomToScale:]): 66 (-[WKContentView _didCommitLoadForMainFrame]): 67 (-[WKContentView _didCommitLayerTree:WebKit::]): 68 * UIProcess/ios/WKContentViewInteraction.h: Renamed from Source/WebKit2/UIProcess/ios/WKInteractionView.h. 69 * UIProcess/ios/WKContentViewInteraction.mm: Renamed from Source/WebKit2/UIProcess/ios/WKInteractionView.mm. 70 (-[WKContentView setupInteraction]): 71 (-[WKContentView cleanupInteraction]): 72 (-[WKContentView positionInformation]): 73 (-[WKContentView setInputDelegate:]): 74 (-[WKContentView inputDelegate]): 75 (-[WKContentView isEditable]): 76 (-[WKContentView canBecomeFirstResponder]): 77 (-[WKContentView resignFirstResponder]): 78 (-[WKContentView _webTouchEventsRecognized:]): 79 (inflateQuad): 80 (-[WKContentView _webTouchEvent:WebKit::preventsNativeGestures:]): 81 (-[WKContentView _didGetTapHighlightForRequest:color:WebCore::quads:WebCore::topLeftRadius:WebCore::topRightRadius:WebCore::bottomLeftRadius:WebCore::bottomRightRadius:WebCore::]): 82 (-[WKContentView _cancelLongPressGestureRecognizer]): 83 (-[WKContentView _didScroll]): 84 (-[WKContentView _requiresKeyboardResetOnReload]): 85 (-[WKContentView gestureRecognizer:canPreventGestureRecognizer:]): 86 (-[WKContentView gestureRecognizer:canBePreventedByGestureRecognizer:]): 87 (isSamePair): 88 (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]): 89 (-[WKContentView _showImageSheet]): 90 (-[WKContentView _showLinkSheet]): 91 (-[WKContentView _showDataDetectorsSheet]): 92 (-[WKContentView _actionForLongPress]): 93 (-[WKContentView ensurePositionInformationIsUpToDate:]): 94 (-[WKContentView _updatePositionInformation]): 95 (-[WKContentView gestureRecognizerShouldBegin:]): 96 (-[WKContentView _cancelInteraction]): 97 (-[WKContentView hasSelectablePositionAtPoint:]): 98 (-[WKContentView pointIsInAssistedNode:]): 99 (-[WKContentView webSelectionRects]): 100 (-[WKContentView _highlightLongPressRecognized:]): 101 (-[WKContentView _longPressRecognized:]): 102 (-[WKContentView _singleTapRecognized:]): 103 (-[WKContentView _doubleTapRecognized:]): 104 (-[WKContentView _twoFingerDoubleTapRecognized:]): 105 (-[WKContentView _twoFingerPanRecognized:]): 106 (-[WKContentView _attemptClickAtLocation:]): 107 (-[WKContentView useSelectionAssistantWithMode:]): 108 (-[WKContentView clearSelection]): 109 (-[WKContentView _positionInformationDidChange:]): 110 (-[WKContentView _willStartScrollingOrZooming]): 111 (-[WKContentView _willStartUserTriggeredScrollingOrZooming]): 112 (-[WKContentView _didEndScrollingOrZooming]): 113 (-[WKContentView inputAccessoryView]): 114 (-[WKContentView supportedPasteboardTypesForCurrentSelection]): 115 (-[WKContentView _addShortcut:]): 116 (-[WKContentView _promptForReplace:]): 117 (-[WKContentView replace:]): 118 (-[WKContentView canPerformAction:withSender:]): 119 (-[WKContentView _resetShowingTextStyle:]): 120 (-[WKContentView _performAction:]): 121 (-[WKContentView copy:]): 122 (-[WKContentView cut:]): 123 (-[WKContentView paste:]): 124 (-[WKContentView select:]): 125 (-[WKContentView selectAll:]): 126 (-[WKContentView toggleBoldface:]): 127 (-[WKContentView toggleItalics:]): 128 (-[WKContentView toggleUnderline:]): 129 (-[WKContentView _showTextStyleOptions:]): 130 (-[WKContentView _showDictionary:]): 131 (-[WKContentView _define:]): 132 (toWKGestureType): 133 (toUIWKGestureType): 134 (toWKSelectionTouch): 135 (toUIWKSelectionTouch): 136 (toWKGestureRecognizerState): 137 (toUIGestureRecognizerState): 138 (toUIWKSelectionFlags): 139 (toWKHandlePosition): 140 (selectionChangedWithGesture): 141 (selectionChangedWithTouch): 142 (-[WKContentView _didUpdateBlockSelectionWithTouch:WebKit::withFlags:WebKit::growThreshold:shrinkThreshold:]): 143 (-[WKContentView changeSelectionWithGestureAt:withGesture:withState:]): 144 (-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:]): 145 (-[WKContentView changeSelectionWithTouchesFrom:to:withGesture:withState:]): 146 (-[WKContentView changeBlockSelectionWithTouchAt:withSelectionTouch:forHandle:]): 147 (-[WKContentView autocorrectionData]): 148 (-[WKContentView requestAutocorrectionRectsForString:withCompletionHandler:]): 149 (-[WKContentView textFirstRect]): 150 (-[WKContentView textLastRect]): 151 (-[WKContentView applyAutocorrection:toString:withCompletionHandler:]): 152 (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]): 153 (-[WKContentView accessoryDone]): 154 (-[WKContentView accessoryTab:]): 155 (-[WKContentView accessoryAutoFill]): 156 (-[WKContentView accessoryClear]): 157 (-[WKContentView _updateAccessory]): 158 (-[WKContentView textInRange:]): 159 (-[WKContentView replaceRange:withText:]): 160 (-[WKContentView selectedTextRange]): 161 (-[WKContentView caretRectForPosition:]): 162 (-[WKContentView selectionRectsForRange:]): 163 (-[WKContentView setSelectedTextRange:]): 164 (-[WKContentView hasMarkedText]): 165 (-[WKContentView markedText]): 166 (-[WKContentView markedTextRange]): 167 (-[WKContentView markedTextStyle]): 168 (-[WKContentView setMarkedTextStyle:]): 169 (-[WKContentView setMarkedText:selectedRange:]): 170 (-[WKContentView unmarkText]): 171 (-[WKContentView beginningOfDocument]): 172 (-[WKContentView endOfDocument]): 173 (-[WKContentView textRangeFromPosition:toPosition:]): 174 (-[WKContentView positionFromPosition:offset:]): 175 (-[WKContentView positionFromPosition:inDirection:offset:]): 176 (-[WKContentView comparePosition:toPosition:]): 177 (-[WKContentView offsetFromPosition:toPosition:]): 178 (-[WKContentView tokenizer]): 179 (-[WKContentView positionWithinRange:farthestInDirection:]): 180 (-[WKContentView characterRangeByExtendingPosition:inDirection:]): 181 (-[WKContentView baseWritingDirectionForPosition:inDirection:]): 182 (-[WKContentView setBaseWritingDirection:forRange:]): 183 (-[WKContentView firstRectForRange:]): 184 (-[WKContentView closestPositionToPoint:]): 185 (-[WKContentView closestPositionToPoint:withinRange:]): 186 (-[WKContentView characterRangeAtPoint:]): 187 (-[WKContentView deleteBackward]): 188 (-[WKContentView insertText:]): 189 (-[WKContentView hasText]): 190 (-[WKContentView textInputTraits]): 191 (-[WKContentView interactionAssistant]): 192 (-[WKContentView webSelectionAssistant]): 193 (-[WKContentView selectionRange]): 194 (-[WKContentView rectForNSRange:]): 195 (-[WKContentView _markedTextNSRange]): 196 (-[WKContentView selectedDOMRange]): 197 (-[WKContentView setSelectedDOMRange:affinityDownstream:]): 198 (-[WKContentView replaceRangeWithTextWithoutClosingTyping:replacementText:]): 199 (-[WKContentView rectContainingCaretSelection]): 200 (-[WKContentView requiresKeyEvents]): 201 (-[WKContentView handleKeyWebEvent:]): 202 (-[WKContentView _interpretKeyEvent:isCharEvent:]): 203 (-[WKContentView setBottomBufferHeight:]): 204 (-[WKContentView automaticallySelectedOverlay]): 205 (-[WKContentView selectionGranularity]): 206 (-[WKContentView insertDictationResult:withCorrectionIdentifier:]): 207 (-[WKContentView metadataDictionariesForDictationResults]): 208 (-[WKContentView previousUnperturbedDictationResultBoundaryFromPosition:]): 209 (-[WKContentView nextUnperturbedDictationResultBoundaryFromPosition:]): 210 (-[WKContentView moveBackward:]): 211 (-[WKContentView moveForward:]): 212 (-[WKContentView characterBeforeCaretSelection]): 213 (-[WKContentView wordContainingCaretSelection]): 214 (-[WKContentView wordRangeContainingCaretSelection]): 215 (-[WKContentView setMarkedText:]): 216 (-[WKContentView hasContent]): 217 (-[WKContentView selectAll]): 218 (-[WKContentView textColorForCaretSelection]): 219 (-[WKContentView fontForCaretSelection]): 220 (-[WKContentView hasSelection]): 221 (-[WKContentView isPosition:atBoundary:inDirection:]): 222 (-[WKContentView positionFromPosition:toBoundary:inDirection:]): 223 (-[WKContentView isPosition:withinTextUnit:inDirection:]): 224 (-[WKContentView rangeEnclosingPosition:withGranularity:inDirection:]): 225 (-[WKContentView takeTraitsFrom:]): 226 (-[WKContentView _startAssistingKeyboard]): 227 (-[WKContentView _stopAssistingKeyboard]): 228 (-[WKContentView _startAssistingNode]): 229 (-[WKContentView _stopAssistingNode]): 230 (-[WKContentView _selectionChanged]): 231 (-[WKContentView shouldIgnoreWebTouch]): 232 (-[WKContentView isAnyTouchOverActiveArea:]): 233 (-[WKTextRange _isCaret]): 234 (-[WKTextRange _isRanged]): 235 (+[WKTextRange textRangeWithState:isRange:isEditable:startRect:endRect:selectionRects:selectedTextLength:]): 236 (-[WKTextRange dealloc]): 237 (-[WKTextRange description]): 238 (-[WKTextRange start]): 239 (-[WKTextRange end]): 240 (-[WKTextRange isEmpty]): 241 (-[WKTextRange isEqual:]): 242 (+[WKTextPosition textPositionWithRect:]): 243 (-[WKTextPosition isEqual:]): 244 (-[WKTextPosition description]): 245 (-[WKTextSelectionRect initWithWebRect:]): 246 (-[WKTextSelectionRect dealloc]): 247 (+[WKTextSelectionRect textSelectionRectsWithWebRects:]): 248 (-[WKTextSelectionRect rect]): 249 (-[WKTextSelectionRect writingDirection]): 250 (-[WKTextSelectionRect range]): 251 (-[WKTextSelectionRect containsStart]): 252 (-[WKTextSelectionRect containsEnd]): 253 (-[WKTextSelectionRect isVertical]): 254 (+[WKAutocorrectionRects autocorrectionRectsWithRects:lastRect:]): 255 (+[WKAutocorrectionContext autocorrectionContextWithData:markedText:selectedText:afterText:selectedRangeInMarkedText:]): 256 (-[WKAutocorrectionContext dealloc]): 257 * UIProcess/ios/WKContentViewInternal.h: Removed. 258 * WebKit2.xcodeproj/project.pbxproj: 259 1 260 2014-02-24 Anders Carlsson <andersca@apple.com> 2 261 -
trunk/Source/WebKit2/Configurations/WebKit2.xcconfig
r164576 r164621 46 46 EXCLUDED_SOURCE_FILE_NAMES_iphoneos = BuiltInPDFView.mm DownloadMac.mm FindIndicatorWindow.mm NetworkProcessMac.mm PDFViewController.mm PageClientImpl.mm PasteboardTypes.mm PluginInfoStoreMac.mm PrintInfoMac.mm SecItemShimMethods.mm TextCheckerMac.mm WKAccessibilityWebPageObject.mm WKFullKeyboardAccessWatcher.mm WKInspector.cpp WKPrintingView.mm UIProcess/API/mac/WKView.mm WKThumbnailView.mm WebContextMenuProxyMac.mm WebEditorClientMac.mm WebInspectorProxyMac.mm WebPageMac.mm WebPageProxyMac.mm WebPlatformTouchPoint.cpp WebProcessMac.mm WebProcessProxyMac.mm WebTouchEvent.cpp *.pdf com.apple.WebKit.NetworkProcess.sb com.apple.WebProcess.sb; 47 47 EXCLUDED_SOURCE_FILE_NAMES_iphonesimulator = $(EXCLUDED_SOURCE_FILE_NAMES_iphoneos); 48 EXCLUDED_SOURCE_FILE_NAMES_macosx = *IOS.mm WKContentView.mm WK ScrollView.mm WKGeolocationProviderIOSObjCSecurityOrigin.mm WKInteractionView.mm WebIOSEventFactory.mm WKActionSheet.mm WKActionSheetAssistant.mm;48 EXCLUDED_SOURCE_FILE_NAMES_macosx = *IOS.mm WKContentView.mm WKContentViewInteraction.mm WKScrollView.mm WKGeolocationProviderIOSObjCSecurityOrigin.mm WebIOSEventFactory.mm WKActionSheet.mm WKActionSheetAssistant.mm; 49 49 50 50 INSTALLHDRS_SCRIPT_PHASE = YES; -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r164603 r164621 140 140 141 141 _contentView = adoptNS([[WKContentView alloc] initWithFrame:bounds context:context configuration:std::move(webPageConfiguration)]); 142 _page = _contentView->_page;142 _page = [_contentView page]; 143 143 [_contentView setDelegate:self]; 144 144 [_contentView layer].anchorPoint = CGPointZero; -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h
r163564 r164621 31 31 32 32 #if PLATFORM(IOS) 33 #import "WKContentView Internal.h"33 #import "WKContentView.h" 34 34 #import <UIKit/UIScrollView_Private.h> 35 35 #endif -
trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm
r164522 r164621 130 130 _allowsBackForwardNavigationGestures = allowsBackForwardNavigationGestures; 131 131 132 WebPageProxy *webPageProxy = toImpl([_contentView _pageRef]);132 WebPageProxy *webPageProxy = [_contentView page]; 133 133 134 134 if (allowsBackForwardNavigationGestures) { … … 308 308 - (WKPageRef)pageRef 309 309 { 310 return [_contentView _pageRef];310 return toAPI([_contentView page]); 311 311 } 312 312 … … 367 367 - (UIColor *)_pageExtendedBackgroundColor 368 368 { 369 WebPageProxy* webPageProxy = toImpl([_contentView _pageRef]); 370 WebCore::Color color = webPageProxy->pageExtendedBackgroundColor(); 369 WebCore::Color color = [_contentView page]->pageExtendedBackgroundColor(); 371 370 if (!color.isValid()) 372 371 return nil; … … 377 376 - (void)_setBackgroundExtendsBeyondPage:(BOOL)backgroundExtends 378 377 { 379 WebPageProxy* webPageProxy = toImpl([_contentView _pageRef]); 380 webPageProxy->setBackgroundExtendsBeyondPage(backgroundExtends); 378 [_contentView page]->setBackgroundExtendsBeyondPage(backgroundExtends); 381 379 } 382 380 383 381 - (BOOL)_backgroundExtendsBeyondPage 384 382 { 385 WebPageProxy* webPageProxy = toImpl([_contentView _pageRef]); 386 return webPageProxy->backgroundExtendsBeyondPage(); 383 return [_contentView page]->backgroundExtendsBeyondPage(); 387 384 } 388 385 -
trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm
r164599 r164621 29 29 #import "NativeWebKeyboardEvent.h" 30 30 #import "InteractionInformationAtPosition.h" 31 #import "WKContentViewInternal.h" 31 #import "WKContentView.h" 32 #import "WKContentViewInteraction.h" 32 33 #import "WebContextMenuProxy.h" 33 34 #import "WebEditCommandProxy.h" -
trunk/Source/WebKit2/UIProcess/ios/WKActionSheet.h
r164599 r164621 29 29 30 30 @protocol WKActionSheetDelegate; 31 @class WK InteractionView;31 @class WKContentView; 32 32 33 33 @interface WKActionSheet : UIActionSheet … … 35 35 @property (nonatomic, assign) id <WKActionSheetDelegate> sheetDelegate; 36 36 @property (nonatomic) UIPopoverArrowDirection arrowDirections; 37 - (id)initWithView:(WK InteractionView *)view;37 - (id)initWithView:(WKContentView *)view; 38 38 - (void)doneWithSheet; 39 39 - (BOOL)presentSheet; … … 62 62 63 63 typedef void (^WKElementActionHandler)(WKElementActionInfo *); 64 typedef void (^WKElementActionHandlerInternal)(WK InteractionView *, WKElementActionInfo *);64 typedef void (^WKElementActionHandlerInternal)(WKContentView *, WKElementActionInfo *); 65 65 66 66 typedef enum { … … 79 79 + (WKElementAction *)standardElementActionWithType:(WKElementActionType)type; 80 80 + (WKElementAction *)standardElementActionWithType:(WKElementActionType)type customTitle:(NSString *)title; 81 - (void)runActionWithElementInfo:(WKElementActionInfo *)info view:(WK InteractionView *)view;81 - (void)runActionWithElementInfo:(WKElementActionInfo *)info view:(WKContentView *)view; 82 82 83 83 @end -
trunk/Source/WebKit2/UIProcess/ios/WKActionSheet.mm
r164599 r164621 28 28 29 29 #import "WKGestureTypes.h" 30 #import "WK InteractionView.h"30 #import "WKContentViewInteraction.h" 31 31 #import <SafariServices/SSReadingList.h> 32 32 #import <UIKit/UIActionSheet_Private.h> … … 41 41 SOFT_LINK_CLASS(SafariServices, SSReadingList); 42 42 43 using namespace WebKit; 44 43 45 @interface WKElementAction(Private) 44 - (void)_runActionWithElement:(NSURL *)targetURL documentView:(WK InteractionView *)view interactionLocation:(CGPoint)interactionLocation;46 - (void)_runActionWithElement:(NSURL *)targetURL documentView:(WKContentView *)view interactionLocation:(CGPoint)interactionLocation; 45 47 @end 46 48 … … 48 50 id<WKActionSheetDelegate> _sheetDelegate; 49 51 id<UIActionSheetDelegate> _delegateWhileRotating; 50 WK InteractionView *_view;52 WKContentView *_view; 51 53 UIPopoverArrowDirection _arrowDirections; 52 54 BOOL _isRotating; 53 55 } 54 56 55 - (id)initWithView:(WK InteractionView *)view57 - (id)initWithView:(WKContentView *)view 56 58 { 57 59 self = [super init]; … … 227 229 { 228 230 return [[[self alloc] initWithTitle:title 229 actionHandler:^(WK InteractionView *view, WKElementActionInfo *actionInfo) { handler(actionInfo); }231 actionHandler:^(WKContentView *view, WKElementActionInfo *actionInfo) { handler(actionInfo); } 230 232 type:WKElementActionTypeCustom] autorelease]; 231 233 } 232 234 233 static void copyElement(WK InteractionView *view)235 static void copyElement(WKContentView *view) 234 236 { 235 237 [view _performAction:WebKit::WKSheetActionCopy]; 236 238 } 237 239 238 static void saveImage(WK InteractionView *view)240 static void saveImage(WKContentView *view) 239 241 { 240 242 [view _performAction:WebKit::WKSheetActionSaveImage]; … … 256 258 case WKElementActionTypeCopy: 257 259 title = WEB_UI_STRING_KEY("Copy", "Copy ActionSheet Link", "Title for Copy Link or Image action button"); 258 handler = ^(WK InteractionView *view, WKElementActionInfo *actionInfo) {260 handler = ^(WKContentView *view, WKElementActionInfo *actionInfo) { 259 261 copyElement(view); 260 262 }; … … 262 264 case WKElementActionTypeOpen: 263 265 title = WEB_UI_STRING_KEY("Open", "Open ActionSheet Link", "Title for Open Link action button"); 264 handler = ^(WK InteractionView *view, WKElementActionInfo *actionInfo) {266 handler = ^(WKContentView *view, WKElementActionInfo *actionInfo) { 265 267 [view _attemptClickAtLocation:actionInfo.interactionLocation]; 266 268 }; … … 268 270 case WKElementActionTypeSaveImage: 269 271 title = WEB_UI_STRING_KEY("Save Image", "Save Image", "Title for Save Image action button"); 270 handler = ^(WK InteractionView *view, WKElementActionInfo *actionInfo) {272 handler = ^(WKContentView *view, WKElementActionInfo *actionInfo) { 271 273 saveImage(view); 272 274 }; … … 274 276 case WKElementActionTypeAddToReadingList: 275 277 title = WEB_UI_STRING("Add to Reading List", "Title for Add to Reading List action button"); 276 handler = ^(WK InteractionView *view, WKElementActionInfo *actionInfo) {278 handler = ^(WKContentView *view, WKElementActionInfo *actionInfo) { 277 279 addToReadingList(actionInfo.url, actionInfo.title); 278 280 }; … … 290 292 } 291 293 292 - (void)runActionWithElementInfo:(WKElementActionInfo *)info view:(WK InteractionView *)view294 - (void)runActionWithElementInfo:(WKElementActionInfo *)info view:(WKContentView *)view 293 295 { 294 296 _actionHandler(view, info); -
trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.h
r164599 r164621 32 32 33 33 @protocol WKActionSheetDelegate; 34 @class WK InteractionView;34 @class WKContentView; 35 35 36 36 namespace WebKit { … … 40 40 @interface WKActionSheetAssistant : NSObject <WKActionSheetDelegate> 41 41 42 - (id)initWithView:(WKInteractionView *)view; 43 - (void)setPage:(PassRefPtr<WebKit::WebPageProxy>)page; 42 - (id)initWithView:(WKContentView *)view; 44 43 - (void)showLinkSheet; 45 44 - (void)showImageSheet; -
trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.mm
r164599 r164621 28 28 29 29 #import "WKActionSheet.h" 30 #import "WK InteractionView.h"30 #import "WKContentViewInteraction.h" 31 31 #import "WebPageProxy.h" 32 32 #import <TCC/TCC.h> … … 53 53 54 54 @interface WKElementAction(Private) 55 - (void)_runActionWithElement:(NSURL *)targetURL documentView:(WK InteractionView *)view interactionLocation:(CGPoint)interactionLocation;55 - (void)_runActionWithElement:(NSURL *)targetURL documentView:(WKContentView *)view interactionLocation:(CGPoint)interactionLocation; 56 56 @end 57 57 58 58 @implementation WKActionSheetAssistant { 59 59 RetainPtr<WKActionSheet> _interactionSheet; 60 RefPtr<WebKit::WebPageProxy> _page;61 60 RetainPtr<NSArray> _elementActions; 62 WK InteractionView *_view;63 } 64 65 - (id)initWithView:(WK InteractionView *)view61 WKContentView *_view; 62 } 63 64 - (id)initWithView:(WKContentView *)view 66 65 { 67 66 _view = view; … … 72 71 { 73 72 [self cleanupSheet]; 74 _page = nullptr;75 73 [super dealloc]; 76 }77 78 - (void)setPage:(PassRefPtr<WebKit::WebPageProxy>)page79 {80 _page = page;81 74 } 82 75 … … 221 214 222 215 [_interactionSheet setCancelButtonIndex:[_interactionSheet addButtonWithTitle:WEB_UI_STRING_KEY("Cancel", "Cancel button label in button bar", "Title for Cancel button label in button bar")]]; 223 _ page->startInteractionWithElementAtPosition(_view.positionInformation.point);216 _view.page->startInteractionWithElementAtPosition(_view.positionInformation.point); 224 217 } 225 218 … … 327 320 - (void)cleanupSheet 328 321 { 329 _ page->stopInteraction();322 _view.page->stopInteraction(); 330 323 331 324 [_interactionSheet doneWithSheet]; -
trunk/Source/WebKit2/UIProcess/ios/WKContentView.h
r164599 r164621 32 32 33 33 @class WKContentView; 34 @class WKWebViewConfiguration;35 34 36 35 namespace WebKit { 36 class DrawingAreaProxy; 37 class GeolocationPermissionRequestProxy; 37 38 class RemoteLayerTreeTransaction; 38 39 class WebContext; 40 class WebFrameProxy; 41 class WebPageProxy; 42 class WebSecurityOrigin; 39 43 struct WebPageConfiguration; 40 44 } … … 48 52 @end 49 53 50 WK_API_CLASS 51 @interface WKContentView : UIView 54 @interface WKContentView : UIView { 55 @package 56 RefPtr<WebKit::WebPageProxy> _page; 57 } 52 58 53 59 @property (nonatomic, readonly) WKBrowsingContextController *browsingContextController; 54 55 60 @property (nonatomic, assign) id <WKContentViewDelegate> delegate; 56 61 57 @property (nonatomic, readonly) W KPageRef _pageRef;62 @property (nonatomic, readonly) WebKit::WebPageProxy* page; 58 63 @property (nonatomic, readonly) BOOL isAssistingNode; 59 64 … … 70 75 - (void)willStartUserTriggeredZoom; 71 76 77 - (std::unique_ptr<WebKit::DrawingAreaProxy>)_createDrawingAreaProxy; 78 - (void)_processDidExit; 79 - (void)_didRelaunchProcess; 80 - (void)_setAcceleratedCompositingRootLayer:(CALayer *)rootLayer; 81 82 - (void)_didCommitLoadForMainFrame; 83 - (void)_didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTreeTransaction; 84 85 - (void)_decidePolicyForGeolocationRequestFromOrigin:(WebKit::WebSecurityOrigin&)origin frame:(WebKit::WebFrameProxy&)frame request:(WebKit::GeolocationPermissionRequestProxy&)permissionRequest; 86 87 - (RetainPtr<CGImageRef>)_takeViewSnapshot; 88 72 89 @end -
trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm
r164603 r164621 25 25 26 26 #import "config.h" 27 #import "WKContentViewInternal.h" 28 29 #import "InteractionInformationAtPosition.h" 27 #import "WKContentViewInteraction.h" 28 30 29 #import "PageClientImplIOS.h" 31 30 #import "RemoteLayerTreeDrawingAreaProxy.h" … … 35 34 #import "WKBrowsingContextGroupPrivate.h" 36 35 #import "WKGeolocationProviderIOS.h" 37 #import "WKInteractionView.h"38 36 #import "WKPreferencesInternal.h" 39 37 #import "WKProcessGroupPrivate.h" … … 45 43 #import "WebSystemInterface.h" 46 44 #import <UIKit/UIWindow_Private.h> 47 #import <WebCore/ViewportArguments.h>48 45 #import <wtf/RetainPtr.h> 49 50 #if USE(IOSURFACE)51 #import <IOSurface/IOSurface.h>52 #endif53 46 54 47 #if __has_include(<QuartzCore/QuartzCorePrivate.h>) … … 68 61 69 62 RetainPtr<UIView> _rootContentView; 70 RetainPtr<WKInteractionView> _interactionView;71 63 } 72 64 … … 94 86 [self addSubview:_rootContentView.get()]; 95 87 96 _interactionView = adoptNS([[WKInteractionView alloc] init]); 97 [_interactionView setPage:_page]; 98 [self addSubview:_interactionView.get()]; 88 [self setupInteraction]; 89 [self setUserInteractionEnabled:YES]; 99 90 100 91 self.layer.hitTestsAsOpaque = YES; … … 105 96 - (void)dealloc 106 97 { 98 [self cleanupInteraction]; 99 107 100 _page->close(); 108 101 … … 110 103 111 104 [super dealloc]; 105 } 106 107 - (WebPageProxy*)page 108 { 109 return _page.get(); 112 110 } 113 111 … … 146 144 - (BOOL)isAssistingNode 147 145 { 148 return [ _interactionViewisEditable];146 return [self isEditable]; 149 147 } 150 148 … … 192 190 { 193 191 [self _updateFixedPositionRect]; 194 [ _interactionView_didEndScrollingOrZooming];192 [self _didEndScrollingOrZooming]; 195 193 } 196 194 197 195 - (void)willStartZoomOrScroll 198 196 { 199 [ _interactionView_willStartScrollingOrZooming];197 [self _willStartScrollingOrZooming]; 200 198 } 201 199 202 200 - (void)willStartUserTriggeredScroll 203 201 { 204 [ _interactionView_willStartUserTriggeredScrollingOrZooming];202 [self _willStartUserTriggeredScrollingOrZooming]; 205 203 } 206 204 207 205 - (void)willStartUserTriggeredZoom 208 206 { 209 [ _interactionView_willStartUserTriggeredScrollingOrZooming];207 [self _willStartUserTriggeredScrollingOrZooming]; 210 208 _page->willStartUserTriggeredZooming(); 211 209 } … … 214 212 { 215 213 _page->didFinishZooming(scale); 216 [ _interactionView_didEndScrollingOrZooming];214 [self _didEndScrollingOrZooming]; 217 215 } 218 216 … … 254 252 if ([_delegate respondsToSelector:@selector(contentViewDidCommitLoadForMainFrame:)]) 255 253 [_delegate contentViewDidCommitLoadForMainFrame:self]; 256 [_interactionView _stopAssistingNode]; 254 255 [self _stopAssistingNode]; 257 256 } 258 257 … … 262 261 263 262 [self setBounds:{CGPointZero, contentsSize}]; 264 [_interactionView setFrame:CGRectMake(0, 0, contentsSize.width, contentsSize.height)];265 263 [_rootContentView setFrame:CGRectMake(0, 0, contentsSize.width, contentsSize.height)]; 266 264 … … 269 267 } 270 268 271 - (void)_webTouchEvent:(const WebKit::NativeWebTouchEvent&)touchEvent preventsNativeGestures:(BOOL)preventsNativeGesture272 {273 [_interactionView _webTouchEvent:touchEvent preventsNativeGestures:preventsNativeGesture];274 }275 276 - (void)_didGetTapHighlightForRequest:(uint64_t)requestID color:(const Color&)color quads:(const Vector<FloatQuad>&)highlightedQuads topLeftRadius:(const IntSize&)topLeftRadius topRightRadius:(const IntSize&)topRightRadius bottomLeftRadius:(const IntSize&)bottomLeftRadius bottomRightRadius:(const IntSize&)bottomRightRadius277 {278 [_interactionView _didGetTapHighlightForRequest:requestID color:color quads:highlightedQuads topLeftRadius:topLeftRadius topRightRadius:topRightRadius bottomLeftRadius:bottomLeftRadius bottomRightRadius:bottomRightRadius];279 }280 281 269 - (void)_setAcceleratedCompositingRootLayer:(CALayer *)rootLayer 282 270 { 283 271 [[_rootContentView layer] setSublayers:@[rootLayer]]; 284 }285 286 // FIXME: change the name. Leave it for now to make it easier to refer to the UIKit implementation.287 - (void)_startAssistingNode288 {289 [_interactionView _startAssistingNode];290 }291 292 - (void)_stopAssistingNode293 {294 [_interactionView _stopAssistingNode];295 }296 297 - (void)_selectionChanged298 {299 [_interactionView _selectionChanged];300 }301 302 - (void)_didUpdateBlockSelectionWithTouch:(WKSelectionTouch)touch withFlags:(WKSelectionFlags)flags growThreshold:(CGFloat)growThreshold shrinkThreshold:(CGFloat)shrinkThreshold303 {304 [_interactionView _didUpdateBlockSelectionWithTouch:touch withFlags:flags growThreshold:growThreshold shrinkThreshold:shrinkThreshold];305 }306 307 - (BOOL)_interpretKeyEvent:(WebIOSEvent *)theEvent isCharEvent:(BOOL)isCharEvent308 {309 return [_interactionView _interpretKeyEvent:theEvent isCharEvent:isCharEvent];310 }311 312 - (void)_positionInformationDidChange:(const InteractionInformationAtPosition&)info313 {314 [_interactionView _positionInformationDidChange:info];315 272 } 316 273 -
trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h
r164620 r164621 24 24 */ 25 25 26 #import "WKContentView.h" 27 28 #import "InteractionInformationAtPosition.h" 26 29 #import "WKGestureTypes.h" 27 #import <UIKit/UIWebFormAccessory.h>28 30 #import <UIKit/UITextInput_Private.h> 29 31 #import <UIKit/UIView.h> 32 #import <UIKit/UIWebFormAccessory.h> 30 33 #import <UIKit/UIWebTouchEventsGestureRecognizer.h> 31 34 #import <UIKit/UIWKSelectionAssistant.h> 32 35 #import <UIKit/UIWKTextInteractionAssistant.h> 33 36 #import <wtf/Forward.h> 37 #import <wtf/text/WTFString.h> 34 38 #import <wtf/Vector.h> 35 36 @class UIWebScrollView;37 39 38 40 namespace WebCore { … … 48 50 } 49 51 52 @class _UIWebHighlightLongPressGestureRecognizer; 53 @class _UIHighlightView; 50 54 @class WebIOSEvent; 55 @class WKActionSheetAssistant; 51 56 52 @interface WKInteractionView : UIView<UIGestureRecognizerDelegate, UIWebTouchEventsGestureRecognizerDelegate, UITextInputPrivate, UIWebFormAccessoryDelegate, UIWKInteractionViewProtocol> 57 typedef void (^UIWKAutocorrectionCompletionHandler)(UIWKAutocorrectionRects *rectsForInput); 58 typedef void (^UIWKAutocorrectionContextHandler)(UIWKAutocorrectionContext *autocorrectionContext); 59 60 namespace WebKit { 61 struct WKAutoCorrectionData { 62 String fontName; 63 CGFloat fontSize; 64 uint64_t fontTraits; 65 CGRect textFirstRect; 66 CGRect textLastRect; 67 UIWKAutocorrectionCompletionHandler autocorrectionHandler; 68 UIWKAutocorrectionContextHandler autocorrectionContextHandler; 69 }; 70 } 71 72 @interface WKContentView () { 73 RetainPtr<UIWebTouchEventsGestureRecognizer> _touchEventGestureRecognizer; 74 BOOL _canSendTouchEventsAsynchronously; 75 unsigned _nativeWebTouchEventUniqueIdBeingSentSynchronously; 76 77 RetainPtr<UITapGestureRecognizer> _singleTapGestureRecognizer; 78 RetainPtr<_UIWebHighlightLongPressGestureRecognizer> _highlightLongPressGestureRecognizer; 79 RetainPtr<UILongPressGestureRecognizer> _longPressGestureRecognizer; 80 RetainPtr<UITapGestureRecognizer> _doubleTapGestureRecognizer; 81 RetainPtr<UITapGestureRecognizer> _twoFingerDoubleTapGestureRecognizer; 82 RetainPtr<UIPanGestureRecognizer> _twoFingerPanGestureRecognizer; 83 84 RetainPtr<UIWKTextInteractionAssistant> _textSelectionAssistant; 85 RetainPtr<UIWKSelectionAssistant> _webSelectionAssistant; 86 87 UITextInputTraits *_traits; 88 BOOL _isEditable; 89 UIWebFormAccessory *_accessory; 90 id <UITextInputDelegate> _inputDelegate; 91 BOOL _showingTextStyleOptions; 92 93 RetainPtr<_UIHighlightView> _highlightView; 94 uint64_t _latestTapHighlightID; 95 BOOL _isTapHighlightIDValid; 96 WebKit::WKAutoCorrectionData _autocorrectionData; 97 RetainPtr<NSString> _markedText; 98 WebKit::InteractionInformationAtPosition _positionInformation; 99 BOOL _hasValidPositionInformation; 100 RetainPtr<WKActionSheetAssistant> _actionSheetAssistant; 101 } 102 103 @end 104 105 @interface WKContentView (WKInteraction) <UIGestureRecognizerDelegate, UIWebTouchEventsGestureRecognizerDelegate, UITextInputPrivate, UIWebFormAccessoryDelegate, UIWKInteractionViewProtocol> 53 106 54 107 @property (nonatomic, readonly) BOOL isEditable; 55 108 56 - (void)set ScrollView:(UIWebScrollView *)scrollView;57 - (void) setPage:(PassRefPtr<WebKit::WebPageProxy>)page;109 - (void)setupInteraction; 110 - (void)cleanupInteraction; 58 111 59 112 - (void)_webTouchEvent:(const WebKit::NativeWebTouchEvent&)touchEvent preventsNativeGestures:(BOOL)preventsDefault; … … 72 125 - (void)_didEndScrollingOrZooming; 73 126 - (void)_didUpdateBlockSelectionWithTouch:(WebKit::WKSelectionTouch)touch withFlags:(WebKit::WKSelectionFlags)flags growThreshold:(CGFloat)growThreshold shrinkThreshold:(CGFloat)shrinkThreshold; 74 @property (readonly, nonatomic) WebKit::InteractionInformationAtPosition positionInformation; 127 128 @property (readonly, nonatomic) const WebKit::InteractionInformationAtPosition& positionInformation; 129 @property (readonly, nonatomic) const WebKit::WKAutoCorrectionData& autocorrectionData; 130 75 131 @end -
trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
r164620 r164621 1 1 /* 2 * Copyright (C) 2012 , 2013Apple Inc. All rights reserved.2 * Copyright (C) 2012-2014 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 25 25 26 26 #import "config.h" 27 #import "WKInteractionView.h" 28 29 #import "InteractionInformationAtPosition.h" 27 #import "WKContentViewInteraction.h" 28 30 29 #import "NativeWebKeyboardEvent.h" 31 30 #import "NativeWebTouchEvent.h" 32 #import "WKActionSheetAssistant.h"33 #import "WKBase.h"34 #import "WKGestureTypes.h"35 31 #import "WebEvent.h" 36 32 #import "WebIOSEventFactory.h" 37 33 #import "WebPageMessages.h" 38 34 #import "WebProcessProxy.h" 35 #import "WKActionSheetAssistant.h" 39 36 #import <DataDetectorsUI/DDDetectionController.h> 37 #import <UIKit/_UIHighlightView.h> 38 #import <UIKit/_UIWebHighlightLongPressGestureRecognizer.h> 40 39 #import <UIKit/UIFont_Private.h> 41 40 #import <UIKit/UIGestureRecognizer_Private.h> … … 44 43 #import <UIKit/UITapGestureRecognizer_Private.h> 45 44 #import <UIKit/UITextInteractionAssistant_Private.h> 46 #import <UIKit/UIWebDocumentView.h> 47 #import <UIKit/UIWebScrollView.h> 48 #import <UIKit/_UIHighlightView.h> 49 #import <UIKit/_UIWebHighlightLongPressGestureRecognizer.h> 45 #import <UIKit/UIWebDocumentView.h> // FIXME: should not include this header. 50 46 #import <WebCore/Color.h> 51 47 #import <WebCore/FloatQuad.h> … … 53 49 #import <WebCore/SoftLinking.h> 54 50 #import <WebCore/WebEvent.h> 55 #import <WebKit/WebSelectionRect.h> 51 #import <WebKit/WebSelectionRect.h> // FIXME: WK2 should not include WebKit headers! 56 52 #import <wtf/RetainPtr.h> 57 #import <wtf/text/WTFString.h>58 53 59 54 SOFT_LINK_PRIVATE_FRAMEWORK(DataDetectorsUI) … … 130 125 @end 131 126 132 typedef void (^UIWKAutocorrectionCompletionHandler)(UIWKAutocorrectionRects *rectsForInput); 133 typedef void (^UIWKAutocorrectionContextHandler)(UIWKAutocorrectionContext *autocorrectionContext); 134 135 struct WKAutoCorrectionData{ 136 String fontName; 137 CGFloat fontSize; 138 uint64_t fontTraits; 139 CGRect textFirstRect; 140 CGRect textLastRect; 141 UIWKAutocorrectionCompletionHandler autocorrectionHandler; 142 UIWKAutocorrectionContextHandler autocorrectionContextHandler; 143 }; 144 145 @interface WKInteractionView (Private) 146 @property (readonly, nonatomic) WKAutoCorrectionData *autocorrectionData; 127 @interface WKContentView () { 128 129 } 130 147 131 @end 148 132 149 @implementation WKInteractionView { 150 RetainPtr<UIWebTouchEventsGestureRecognizer> _touchEventGestureRecognizer; 151 BOOL _canSendTouchEventsAsynchronously; 152 unsigned _nativeWebTouchEventUniqueIdBeingSentSynchronously; 153 154 RetainPtr<UITapGestureRecognizer> _singleTapGestureRecognizer; 155 RetainPtr<_UIWebHighlightLongPressGestureRecognizer> _highlightLongPressGestureRecognizer; 156 RetainPtr<UILongPressGestureRecognizer> _longPressGestureRecognizer; 157 RetainPtr<UITapGestureRecognizer> _doubleTapGestureRecognizer; 158 RetainPtr<UITapGestureRecognizer> _twoFingerDoubleTapGestureRecognizer; 159 RetainPtr<UIPanGestureRecognizer> _twoFingerPanGestureRecognizer; 160 161 RetainPtr<UIWKTextInteractionAssistant> _textSelectionAssistant; 162 RetainPtr<UIWKSelectionAssistant> _webSelectionAssistant; 163 164 UITextInputTraits *_traits; 165 BOOL _isEditable; 166 UIWebFormAccessory *_accessory; 167 id <UITextInputDelegate> _inputDelegate; 168 BOOL _showingTextStyleOptions; 169 170 __weak UIWebScrollView *_scrollView; 171 RefPtr<WebPageProxy> _page; 172 173 RetainPtr<_UIHighlightView> _highlightView; 174 uint64_t _latestTapHighlightID; 175 BOOL _isTapHighlightIDValid; 176 WKAutoCorrectionData _autocorrectionData; 177 RetainPtr<NSString> _markedText; 178 InteractionInformationAtPosition _positionInformation; 179 BOOL _hasValidPositionInformation; 180 RetainPtr<WKActionSheetAssistant> _actionSheetAssistant; 181 } 182 183 @synthesize inputDelegate = _inputDelegate; 184 185 - (id)initWithFrame:(CGRect)frame 186 { 187 self = [super initWithFrame:frame]; 188 if (self) { 189 _touchEventGestureRecognizer = adoptNS([[UIWebTouchEventsGestureRecognizer alloc] initWithTarget:self action:@selector(_webTouchEventsRecognized:) touchDelegate:self]); 190 [_touchEventGestureRecognizer setDelegate:self]; 191 [self addGestureRecognizer:_touchEventGestureRecognizer.get()]; 192 193 _singleTapGestureRecognizer = adoptNS([[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_singleTapRecognized:)]); 194 [_singleTapGestureRecognizer setDelegate:self]; 195 [self addGestureRecognizer:_singleTapGestureRecognizer.get()]; 196 197 _doubleTapGestureRecognizer = adoptNS([[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_doubleTapRecognized:)]); 198 [_doubleTapGestureRecognizer setNumberOfTapsRequired:2]; 199 [_doubleTapGestureRecognizer setDelegate:self]; 200 [self addGestureRecognizer:_doubleTapGestureRecognizer.get()]; 201 [_singleTapGestureRecognizer requireOtherGestureToFail:_doubleTapGestureRecognizer.get()]; 202 203 _highlightLongPressGestureRecognizer = adoptNS([[_UIWebHighlightLongPressGestureRecognizer alloc] initWithTarget:self action:@selector(_highlightLongPressRecognized:)]); 204 [_highlightLongPressGestureRecognizer setDelay:highlightDelay]; 205 [_highlightLongPressGestureRecognizer setDelegate:self]; 206 [self addGestureRecognizer:_highlightLongPressGestureRecognizer.get()]; 207 208 _longPressGestureRecognizer = adoptNS([[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(_longPressRecognized:)]); 209 [_longPressGestureRecognizer setDelay:tapAndHoldDelay]; 210 [_longPressGestureRecognizer setDelegate:self]; 211 [self addGestureRecognizer:_longPressGestureRecognizer.get()]; 212 213 _twoFingerPanGestureRecognizer = adoptNS([[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(_twoFingerPanRecognized:)]); 214 [_twoFingerPanGestureRecognizer setMinimumNumberOfTouches:2]; 215 [_twoFingerPanGestureRecognizer setMaximumNumberOfTouches:2]; 216 [_twoFingerPanGestureRecognizer setDelegate:self]; 217 [self addGestureRecognizer:_twoFingerPanGestureRecognizer.get()]; 218 219 [self setUserInteractionEnabled:YES]; 220 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_resetShowingTextStyle:) name:UIMenuControllerDidHideMenuNotification object:nil]; 221 _showingTextStyleOptions = NO; 222 } 133 @implementation WKContentView (WKInteraction) 134 135 - (void)setupInteraction 136 { 137 _touchEventGestureRecognizer = adoptNS([[UIWebTouchEventsGestureRecognizer alloc] initWithTarget:self action:@selector(_webTouchEventsRecognized:) touchDelegate:self]); 138 [_touchEventGestureRecognizer setDelegate:self]; 139 [self addGestureRecognizer:_touchEventGestureRecognizer.get()]; 140 141 _singleTapGestureRecognizer = adoptNS([[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_singleTapRecognized:)]); 142 [_singleTapGestureRecognizer setDelegate:self]; 143 [self addGestureRecognizer:_singleTapGestureRecognizer.get()]; 144 145 _doubleTapGestureRecognizer = adoptNS([[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_doubleTapRecognized:)]); 146 [_doubleTapGestureRecognizer setNumberOfTapsRequired:2]; 147 [_doubleTapGestureRecognizer setDelegate:self]; 148 [self addGestureRecognizer:_doubleTapGestureRecognizer.get()]; 149 [_singleTapGestureRecognizer requireOtherGestureToFail:_doubleTapGestureRecognizer.get()]; 150 151 _highlightLongPressGestureRecognizer = adoptNS([[_UIWebHighlightLongPressGestureRecognizer alloc] initWithTarget:self action:@selector(_highlightLongPressRecognized:)]); 152 [_highlightLongPressGestureRecognizer setDelay:highlightDelay]; 153 [_highlightLongPressGestureRecognizer setDelegate:self]; 154 [self addGestureRecognizer:_highlightLongPressGestureRecognizer.get()]; 155 156 _longPressGestureRecognizer = adoptNS([[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(_longPressRecognized:)]); 157 [_longPressGestureRecognizer setDelay:tapAndHoldDelay]; 158 [_longPressGestureRecognizer setDelegate:self]; 159 [self addGestureRecognizer:_longPressGestureRecognizer.get()]; 160 161 _twoFingerPanGestureRecognizer = adoptNS([[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(_twoFingerPanRecognized:)]); 162 [_twoFingerPanGestureRecognizer setMinimumNumberOfTouches:2]; 163 [_twoFingerPanGestureRecognizer setMaximumNumberOfTouches:2]; 164 [_twoFingerPanGestureRecognizer setDelegate:self]; 165 [self addGestureRecognizer:_twoFingerPanGestureRecognizer.get()]; 166 167 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_resetShowingTextStyle:) name:UIMenuControllerDidHideMenuNotification object:nil]; 168 _showingTextStyleOptions = NO; 223 169 224 170 // FIXME: This should be called when we get notified that loading has completed. 225 171 [self useSelectionAssistantWithMode:UIWebSelectionModeWeb]; 226 172 227 173 _actionSheetAssistant = adoptNS([[WKActionSheetAssistant alloc] initWithView:self]); 228 return self; 229 } 230 231 - (void)dealloc 174 } 175 176 - (void)cleanupInteraction 232 177 { 233 178 _webSelectionAssistant = nil; … … 242 187 243 188 [_accessory release]; 244 [super dealloc]; 245 } 246 247 - (void)setScrollView:(UIWebScrollView *)scrollView 248 { 249 _scrollView = scrollView; 250 } 251 252 - (void)setPage:(PassRefPtr<WebKit::WebPageProxy>)page 253 { 254 _page = page; 255 [_actionSheetAssistant setPage:_page]; 189 } 190 191 - (const InteractionInformationAtPosition&)positionInformation 192 { 193 return _positionInformation; 194 } 195 196 - (void)setInputDelegate:(id <UITextInputDelegate>)inputDelegate 197 { 198 _inputDelegate = inputDelegate; 199 } 200 201 - (id <UITextInputDelegate>)inputDelegate 202 { 203 return _inputDelegate; 256 204 } 257 205 … … 1126 1074 } 1127 1075 1128 static void selectionChangedWithGesture(bool error, WK InteractionView *view, const WebCore::IntPoint& point, uint32_t gestureType, uint32_t gestureState, uint32_t flags)1076 static void selectionChangedWithGesture(bool error, WKContentView *view, const WebCore::IntPoint& point, uint32_t gestureType, uint32_t gestureState, uint32_t flags) 1129 1077 { 1130 1078 if (error) { … … 1138 1086 } 1139 1087 1140 static void selectionChangedWithTouch(bool error, WK InteractionView *view, const WebCore::IntPoint& point, uint32_t touch)1088 static void selectionChangedWithTouch(bool error, WKContentView *view, const WebCore::IntPoint& point, uint32_t touch) 1141 1089 { 1142 1090 if (error) { … … 1181 1129 } 1182 1130 1183 - ( WKAutoCorrectionData *)autocorrectionData1184 { 1185 return &_autocorrectionData;1131 - (const WKAutoCorrectionData&)autocorrectionData 1132 { 1133 return _autocorrectionData; 1186 1134 } 1187 1135 … … 1193 1141 return; 1194 1142 } 1143 1195 1144 _autocorrectionData.autocorrectionHandler = [completionHandler copy]; 1196 1145 _page->requestAutocorrectionData(input, AutocorrectionDataCallback::create([self, completionHandler](bool, const Vector<FloatRect>& rects, const String& fontName, double fontSize, uint64_t traits) { … … 1201 1150 lastRect = rects[rects.size() - 1]; 1202 1151 } 1203 1204 WKAutoCorrectionData *autocorrectionData = self.autocorrectionData; 1205 autocorrectionData->fontName = fontName; 1206 autocorrectionData->fontSize = fontSize; 1207 autocorrectionData->fontTraits = traits; 1208 autocorrectionData->textFirstRect = firstRect; 1209 autocorrectionData->textLastRect = lastRect; 1210 1211 autocorrectionData->autocorrectionHandler(rects.size() ? [WKAutocorrectionRects autocorrectionRectsWithRects:firstRect lastRect:lastRect] : nil); 1212 [autocorrectionData->autocorrectionHandler release]; 1213 autocorrectionData->autocorrectionHandler = nil; 1152 1153 _autocorrectionData.fontName = fontName; 1154 _autocorrectionData.fontSize = fontSize; 1155 _autocorrectionData.fontTraits = traits; 1156 _autocorrectionData.textFirstRect = firstRect; 1157 _autocorrectionData.textLastRect = lastRect; 1158 1159 _autocorrectionData.autocorrectionHandler(rects.size() ? [WKAutocorrectionRects autocorrectionRectsWithRects:firstRect lastRect:lastRect] : nil); 1160 [_autocorrectionData.autocorrectionHandler release]; 1161 _autocorrectionData.autocorrectionHandler = nil; 1214 1162 })); 1215 1163 } … … 1230 1178 _autocorrectionData.autocorrectionHandler = [completionHandler copy]; 1231 1179 _page->applyAutocorrection(correction, input, StringCallback::create([self](bool /*error*/, StringImpl* string) { 1232 WKAutoCorrectionData *autocorrectionData = self.autocorrectionData; 1233 1234 autocorrectionData->autocorrectionHandler(string ? [WKAutocorrectionRects autocorrectionRectsWithRects:autocorrectionData->textFirstRect lastRect:autocorrectionData->textLastRect] : nil); 1235 [autocorrectionData->autocorrectionHandler release]; 1236 autocorrectionData->autocorrectionHandler = nil; 1180 _autocorrectionData.autocorrectionHandler(string ? [WKAutocorrectionRects autocorrectionRectsWithRects:_autocorrectionData.textFirstRect lastRect:_autocorrectionData.textLastRect] : nil); 1181 [_autocorrectionData.autocorrectionHandler release]; 1182 _autocorrectionData.autocorrectionHandler = nil; 1237 1183 })); 1238 1184 } … … 1255 1201 _autocorrectionData.autocorrectionContextHandler = [completionHandler copy]; 1256 1202 _page->requestAutocorrectionContext(AutocorrectionContextCallback::create([self, completionHandler](bool /*error*/, const String& beforeText, const String& markedText, const String& selectedText, const String& afterText, uint64_t location, uint64_t length) { 1257 WKAutoCorrectionData *autocorrectionData = self.autocorrectionData; 1258 autocorrectionData->autocorrectionContextHandler([WKAutocorrectionContext autocorrectionContextWithData:beforeText markedText:markedText selectedText:selectedText afterText:afterText selectedRangeInMarkedText:NSMakeRange(location, length)]); 1203 _autocorrectionData.autocorrectionContextHandler([WKAutocorrectionContext autocorrectionContextWithData:beforeText markedText:markedText selectedText:selectedText afterText:afterText selectedRangeInMarkedText:NSMakeRange(location, length)]); 1259 1204 })); 1260 1205 } -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r164603 r164621 73 73 0FCB4E4C18BBE044000FCFC9 /* WKContentView.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FCB4E3C18BBE044000FCFC9 /* WKContentView.h */; }; 74 74 0FCB4E4D18BBE044000FCFC9 /* WKContentView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FCB4E3D18BBE044000FCFC9 /* WKContentView.mm */; }; 75 0FCB4E4E18BBE044000FCFC9 /* WKContentViewInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FCB4E3E18BBE044000FCFC9 /* WKContentViewInternal.h */; };76 75 0FCB4E4F18BBE044000FCFC9 /* WKGeolocationProviderIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FCB4E3F18BBE044000FCFC9 /* WKGeolocationProviderIOS.h */; }; 77 76 0FCB4E5018BBE044000FCFC9 /* WKGeolocationProviderIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FCB4E4018BBE044000FCFC9 /* WKGeolocationProviderIOS.mm */; }; 78 77 0FCB4E5118BBE044000FCFC9 /* WKGeolocationProviderIOSObjCSecurityOrigin.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FCB4E4118BBE044000FCFC9 /* WKGeolocationProviderIOSObjCSecurityOrigin.mm */; }; 79 0FCB4E5218BBE044000FCFC9 /* WKInteractionView.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FCB4E4218BBE044000FCFC9 /* WKInteractionView.h */; };80 0FCB4E5318BBE044000FCFC9 /* WKInteractionView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FCB4E4318BBE044000FCFC9 /* WKInteractionView.mm */; };81 78 0FCB4E5418BBE044000FCFC9 /* WKScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FCB4E4418BBE044000FCFC9 /* WKScrollView.h */; }; 82 79 0FCB4E5518BBE044000FCFC9 /* WKScrollView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FCB4E4518BBE044000FCFC9 /* WKScrollView.mm */; }; … … 89 86 0FCB4E6818BBE3D9000FCFC9 /* WKTextInputWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FCB4E5E18BBE3D9000FCFC9 /* WKTextInputWindowController.h */; }; 90 87 0FCB4E6918BBE3D9000FCFC9 /* WKTextInputWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FCB4E5F18BBE3D9000FCFC9 /* WKTextInputWindowController.mm */; }; 88 0FCB4E6C18BBF26A000FCFC9 /* WKContentViewInteraction.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FCB4E6A18BBF26A000FCFC9 /* WKContentViewInteraction.h */; }; 89 0FCB4E6D18BBF26A000FCFC9 /* WKContentViewInteraction.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FCB4E6B18BBF26A000FCFC9 /* WKContentViewInteraction.mm */; }; 91 90 0FF24A2D1879E4BC003ABF0C /* RemoteLayerTreeDrawingAreaProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FF24A2B1879E4BC003ABF0C /* RemoteLayerTreeDrawingAreaProxyMessageReceiver.cpp */; }; 92 91 0FF24A2E1879E4BC003ABF0C /* RemoteLayerTreeDrawingAreaProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FF24A2C1879E4BC003ABF0C /* RemoteLayerTreeDrawingAreaProxyMessages.h */; }; … … 1737 1736 0FCB4E3C18BBE044000FCFC9 /* WKContentView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKContentView.h; path = ios/WKContentView.h; sourceTree = "<group>"; }; 1738 1737 0FCB4E3D18BBE044000FCFC9 /* WKContentView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKContentView.mm; path = ios/WKContentView.mm; sourceTree = "<group>"; }; 1739 0FCB4E3E18BBE044000FCFC9 /* WKContentViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKContentViewInternal.h; path = ios/WKContentViewInternal.h; sourceTree = "<group>"; };1740 1738 0FCB4E3F18BBE044000FCFC9 /* WKGeolocationProviderIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKGeolocationProviderIOS.h; path = ios/WKGeolocationProviderIOS.h; sourceTree = "<group>"; }; 1741 1739 0FCB4E4018BBE044000FCFC9 /* WKGeolocationProviderIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKGeolocationProviderIOS.mm; path = ios/WKGeolocationProviderIOS.mm; sourceTree = "<group>"; }; 1742 1740 0FCB4E4118BBE044000FCFC9 /* WKGeolocationProviderIOSObjCSecurityOrigin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKGeolocationProviderIOSObjCSecurityOrigin.mm; path = ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm; sourceTree = "<group>"; }; 1743 0FCB4E4218BBE044000FCFC9 /* WKInteractionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKInteractionView.h; path = ios/WKInteractionView.h; sourceTree = "<group>"; };1744 0FCB4E4318BBE044000FCFC9 /* WKInteractionView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKInteractionView.mm; path = ios/WKInteractionView.mm; sourceTree = "<group>"; };1745 1741 0FCB4E4418BBE044000FCFC9 /* WKScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKScrollView.h; path = ios/WKScrollView.h; sourceTree = "<group>"; }; 1746 1742 0FCB4E4518BBE044000FCFC9 /* WKScrollView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKScrollView.mm; path = ios/WKScrollView.mm; sourceTree = "<group>"; }; … … 1753 1749 0FCB4E5E18BBE3D9000FCFC9 /* WKTextInputWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKTextInputWindowController.h; sourceTree = "<group>"; }; 1754 1750 0FCB4E5F18BBE3D9000FCFC9 /* WKTextInputWindowController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKTextInputWindowController.mm; sourceTree = "<group>"; }; 1751 0FCB4E6A18BBF26A000FCFC9 /* WKContentViewInteraction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKContentViewInteraction.h; path = ios/WKContentViewInteraction.h; sourceTree = "<group>"; }; 1752 0FCB4E6B18BBF26A000FCFC9 /* WKContentViewInteraction.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKContentViewInteraction.mm; path = ios/WKContentViewInteraction.mm; sourceTree = "<group>"; }; 1755 1753 0FF24A2B1879E4BC003ABF0C /* RemoteLayerTreeDrawingAreaProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteLayerTreeDrawingAreaProxyMessageReceiver.cpp; sourceTree = "<group>"; }; 1756 1754 0FF24A2C1879E4BC003ABF0C /* RemoteLayerTreeDrawingAreaProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteLayerTreeDrawingAreaProxyMessages.h; sourceTree = "<group>"; }; … … 4262 4260 0FCB4E3C18BBE044000FCFC9 /* WKContentView.h */, 4263 4261 0FCB4E3D18BBE044000FCFC9 /* WKContentView.mm */, 4264 0FCB4E3E18BBE044000FCFC9 /* WKContentViewInternal.h */, 4262 0FCB4E6A18BBF26A000FCFC9 /* WKContentViewInteraction.h */, 4263 0FCB4E6B18BBF26A000FCFC9 /* WKContentViewInteraction.mm */, 4265 4264 0FCB4E3F18BBE044000FCFC9 /* WKGeolocationProviderIOS.h */, 4266 4265 0FCB4E4018BBE044000FCFC9 /* WKGeolocationProviderIOS.mm */, 4267 4266 0FCB4E4118BBE044000FCFC9 /* WKGeolocationProviderIOSObjCSecurityOrigin.mm */, 4268 0FCB4E4218BBE044000FCFC9 /* WKInteractionView.h */,4269 0FCB4E4318BBE044000FCFC9 /* WKInteractionView.mm */,4270 4267 0FCB4E4418BBE044000FCFC9 /* WKScrollView.h */, 4271 4268 0FCB4E4518BBE044000FCFC9 /* WKScrollView.mm */, … … 6439 6436 1A3CC16918907EB0001E6ED8 /* WKProcessPoolInternal.h in Headers */, 6440 6437 2D1B5D5E185869C8006C6596 /* ViewGestureControllerMessages.h in Headers */, 6441 0FCB4E5218BBE044000FCFC9 /* WKInteractionView.h in Headers */,6442 6438 1A2328FF162C866A00D82F7A /* MessageEncoder.h in Headers */, 6443 6439 1AC4C82916B876A90069DCCD /* MessageFlags.h in Headers */, … … 6785 6781 BCDB86C11200FB97007254BE /* APIURL.h in Headers */, 6786 6782 51C96119183D294700D2002E /* WebIDBServerConnectionMessages.h in Headers */, 6787 0FCB4E4E18BBE044000FCFC9 /* WKContentViewInternal.h in Headers */,6788 6783 BCE2315D122C30CA00D5C35A /* APIURLRequest.h in Headers */, 6789 6784 BC90A1D2122DD55E00CC8C50 /* APIURLResponse.h in Headers */, … … 6811 6806 BC204EF011C83EC8008F3375 /* WKBundleAPICast.h in Headers */, 6812 6807 935EEB9F127761AC003322B8 /* WKBundleBackForwardList.h in Headers */, 6808 0FCB4E6C18BBF26A000FCFC9 /* WKContentViewInteraction.h in Headers */, 6813 6809 517DD5BF180DA7D30081660B /* DatabaseProcessProxy.h in Headers */, 6814 6810 935EEB9B1277617C003322B8 /* WKBundleBackForwardListItem.h in Headers */, … … 8266 8262 0F594792187B3B3A00437857 /* RemoteScrollingCoordinator.mm in Sources */, 8267 8263 BC4075FB124FF0270068F20A /* WKError.cpp in Sources */, 8268 0FCB4E5318BBE044000FCFC9 /* WKInteractionView.mm in Sources */,8269 8264 BCFD548B132D82680055D816 /* WKErrorCF.cpp in Sources */, 8270 8265 BCE469591214EDF4000B98EB /* WKFormSubmissionListener.cpp in Sources */, … … 8341 8336 BC8699B6116AADAA002A925B /* WKView.mm in Sources */, 8342 8337 C5E1AFE816B20B67006CC1F2 /* WKWebArchive.cpp in Sources */, 8338 0FCB4E6D18BBF26A000FCFC9 /* WKContentViewInteraction.mm in Sources */, 8343 8339 C5E1AFEA16B20B7B006CC1F2 /* WKWebArchiveResource.cpp in Sources */, 8344 8340 373CEAD5185417AE008C363D /* WKNSData.mm in Sources */,
Note:
See TracChangeset
for help on using the changeset viewer.