Changeset 168180 in webkit
- Timestamp:
- May 2, 2014 12:28:30 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 added
- 20 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r168171 r168180 1 2014-05-02 Joseph Pecoraro <pecoraro@apple.com> 2 3 [iOS] WebKit2 File Upload Support 4 https://bugs.webkit.org/show_bug.cgi?id=132024 5 6 Reviewed by Enrica Casucci. 7 8 * English.lproj/Localizable.strings: 9 New localized strings for <input type="file"> on iOS. 10 1 11 2014-05-02 Chris Fleizach <cfleizach@apple.com> 2 12 -
trunk/Source/WebCore/English.lproj/Localizable.strings
r166175 r168180 1 /* File Upload multiple photos label */ 2 "# Photos (file upload on page label for multiple photos)" = "%@ Photos"; 3 4 /* File Upload images and videos label */ 5 "# Photos and # Videos (file upload on page label for image and videos)" = "%@ and %@"; 6 7 /* File Upload multiple videos label */ 8 "# Videos (file upload on page label for multiple videos)" = "%@ Videos"; 9 1 10 /* accessibility help text for media controller time value >= 1 day */ 2 11 "%1$d days %2$d hours %3$d minutes %4$d seconds" = "%1$d days %2$d hours %3$d minutes %4$d seconds"; … … 56 65 "1 Item" = "1 Item"; 57 66 67 /* File Upload single photo label */ 68 "1 Photo (file upload on page label for one photo)" = "1 Photo"; 69 70 /* File Upload single video label */ 71 "1 Video (file upload on page label for one video)" = "1 Video"; 72 58 73 /* Menu item title for KEYGEN pop-up menu */ 59 74 "1024 (Medium Grade)" = "1024 (Medium Grade)"; … … 95 110 "Bold (Undo action name)" = "Bold"; 96 111 112 /* File Upload alert sheet button string to cancel */ 113 "Cancel (file upload action sheet)" = "Cancel"; 114 97 115 /* Title for Cancel button label in button bar */ 98 116 "Cancel button label in button bar" = "Cancel"; … … 380 398 "Pause" = "Pause"; 381 399 400 /* File Upload alert sheet button string for choosing an existing media item from the Photo Library */ 401 "Photo Library (file upload action sheet)" = "Photo Library"; 402 382 403 /* Media Play context menu item */ 383 404 "Play" = "Play"; … … 527 548 "Superscript (Undo action name)" = "Superscript"; 528 549 550 /* File Upload alert sheet camera button string for taking only photos */ 551 "Take Photo (file upload action sheet)" = "Take Photo"; 552 553 /* File Upload alert sheet camera button string for taking photos or videos */ 554 "Take Photo or Video (file upload action sheet)" = "Take Photo or Video"; 555 556 /* File Upload alert sheet camera button string for taking only videos */ 557 "Take Video (file upload action sheet)" = "Take Video"; 558 529 559 /* Text Replacement context menu item */ 530 560 "Text Replacement" = "Text Replacement"; -
trunk/Source/WebKit2/ChangeLog
r168175 r168180 1 2014-05-02 Joseph Pecoraro <pecoraro@apple.com> 2 3 [iOS] WebKit2 File Upload Support 4 https://bugs.webkit.org/show_bug.cgi?id=132024 5 6 Reviewed by Enrica Casucci. 7 8 * Configurations/WebKit2.xcconfig: 9 Include MobileCoreServices on iOS for kUTTypeImage/kUTTypeMovie. 10 11 * WebKit2.xcodeproj/project.pbxproj: 12 Add new files. 13 14 * UIProcess/WebOpenPanelResultListenerProxy.h: 15 * UIProcess/WebOpenPanelResultListenerProxy.cpp: 16 (WebKit::filePathsFromFileURLs): 17 (WebKit::WebOpenPanelResultListenerProxy::chooseFiles): 18 * UIProcess/WebPageProxy.h: 19 * UIProcess/WebPageProxy.cpp: 20 (WebKit::WebPageProxy::runOpenPanel): 21 (WebKit::WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon): 22 * WebProcess/WebPage/WebOpenPanelResultListener.h: 23 * WebProcess/WebPage/WebOpenPanelResultListener.cpp: 24 (WebKit::WebOpenPanelResultListener::didChooseFilesWithDisplayStringAndIcon): 25 * WebProcess/WebPage/WebPage.h: 26 * WebProcess/WebPage/WebPage.messages.in: 27 * WebProcess/WebPage/WebPage.cpp: 28 (WebKit::WebPage::didChooseFilesForOpenPanelWithDisplayStringAndIcon): 29 Message forwarding for choosing files and providing a display string and icon, 30 leading down to the existing WebCore FileChooser method. 31 32 * UIProcess/PageClient.h: 33 * UIProcess/ios/PageClientImplIOS.h: 34 * UIProcess/ios/PageClientImplIOS.mm: 35 (WebKit::PageClientImpl::handleRunOpenPanel): 36 Add a default handler for file open panel on iOS. 37 Forwards to the content view. 38 39 * UIProcess/ios/WKContentViewInteraction.h: 40 * UIProcess/ios/WKContentViewInteraction.mm: 41 (-[WKContentView lastInteractionLocation]): 42 (-[WKContentView _webTouchEventsRecognized:]): 43 (-[WKContentView _highlightLongPressRecognized:]): 44 (-[WKContentView _longPressRecognized:]): 45 (-[WKContentView _singleTapRecognized:]): 46 (-[WKContentView _doubleTapRecognized:]): 47 (-[WKContentView _twoFingerDoubleTapRecognized:]): 48 Keep track of the last interaction location. This matches previous behavior 49 of showing the file upload popover where the user tapped, to handle 50 cases where the <input> is hidden. 51 52 (-[WKContentView _showRunOpenPanel:resultListener:]): 53 (-[WKContentView fileUploadPanelDidDismiss:]): 54 Handle showing the cleaning up after the file upload panel. 55 56 * UIProcess/ios/forms/WKFileUploadPanel.h: 57 * UIProcess/ios/forms/WKFileUploadPanel.mm: Added. 58 (squareCropRectForSize): 59 (squareImage): 60 (thumbnailSizedImageForImage): 61 (-[_WKFileUploadItem isVideo]): 62 (-[_WKFileUploadItem fileURL]): 63 (-[_WKFileUploadItem displayImage]): 64 (-[_WKImageFileUploadItem initWithFilePath:originalImage:]): 65 (-[_WKImageFileUploadItem isVideo]): 66 (-[_WKImageFileUploadItem fileURL]): 67 (-[_WKImageFileUploadItem displayImage]): 68 (-[_WKVideoFileUploadItem initWithFilePath:mediaURL:]): 69 (-[_WKVideoFileUploadItem isVideo]): 70 (-[_WKVideoFileUploadItem fileURL]): 71 (-[_WKVideoFileUploadItem displayImage]): 72 Helper class for each image picker selection. Knows how to get 73 a file URL and thumbnail display image for the item. 74 75 (-[WKFileUploadPanel initWithView:]): 76 (-[WKFileUploadPanel dealloc]): 77 (-[WKFileUploadPanel _dispatchDidDismiss]): 78 (-[WKFileUploadPanel _cancel]): 79 (-[WKFileUploadPanel _chooseFiles:displayString:iconImage:]): 80 Lifetime of the upload panel requires that either cancel or choose 81 must happen as we go through the file picking process. 82 83 (-[WKFileUploadPanel presentWithParameters:WebKit::resultListener:WebKit::]): 84 (-[WKFileUploadPanel dismiss]): 85 API to show or dismiss the panel. 86 87 (-[WKFileUploadPanel _dismissDisplayAnimated:]): 88 Helper to clean up the UI as it progresses or completes no matter the device idiom. 89 90 (-[WKFileUploadPanel _presentPopoverWithContentViewController:animated:]): 91 (-[WKFileUploadPanel _presentFullscreenViewController:animated:]): 92 UI presentation for the appropriate idiom. 93 94 (-[WKFileUploadPanel _mediaTypesForPickerSourceType:]): 95 (-[WKFileUploadPanel _showMediaSourceSelectionSheet]): 96 (-[WKFileUploadPanel _showPhotoPickerWithSourceType:]): 97 Showing the action sheet or image picker. 98 99 (-[WKFileUploadPanel popoverControllerDidDismissPopover:]): 100 (-[WKFileUploadPanel _willMultipleSelectionDelegateBeCalled]): 101 (-[WKFileUploadPanel imagePickerController:didFinishPickingMediaWithInfo:]): 102 (-[WKFileUploadPanel imagePickerController:didFinishPickingMultipleMediaWithInfo:]): 103 (-[WKFileUploadPanel imagePickerControllerDidCancel:]): 104 Action sheet or image picker handlers. 105 106 (-[WKFileUploadPanel _processMediaInfoDictionaries:successBlock:failureBlock:]): 107 (-[WKFileUploadPanel _processMediaInfoDictionaries:atIndex:processedResults:processedImageCount:processedVideoCount:successBlock:failureBlock:]): 108 (-[WKFileUploadPanel _uploadItemFromMediaInfo:successBlock:failureBlock:]): 109 (-[WKFileUploadPanel _displayStringForPhotos:videos:]): 110 Processing selections from the image picker to FileUploadItems. 111 1 112 2014-05-01 Simon Fraser <simon.fraser@apple.com> 2 113 -
trunk/Source/WebKit2/Configurations/WebKit2.xcconfig
r167946 r168180 20 20 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 21 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 23 24 24 #include "BaseTarget.xcconfig" … … 31 31 32 32 FRAMEWORK_AND_LIBRARY_LDFLAGS = $(FRAMEWORK_AND_LIBRARY_LDFLAGS_$(PLATFORM_NAME)); 33 FRAMEWORK_AND_LIBRARY_LDFLAGS_iphonesimulator = -lobjc -framework AssertionServices -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CorePDF -framework CoreText -framework Foundation -framework GraphicsServices -framework ImageIO -framework UIKit -framework OpenGLES -framework MobileAsset -framework WebKit -lMobileGestalt -lassertion_extension;33 FRAMEWORK_AND_LIBRARY_LDFLAGS_iphonesimulator = -lobjc -framework AssertionServices -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CorePDF -framework CoreText -framework Foundation -framework GraphicsServices -framework ImageIO -framework UIKit -framework OpenGLES -framework MobileAsset -framework MobileCoreServices -framework WebKit -lMobileGestalt -lassertion_extension; 34 34 FRAMEWORK_AND_LIBRARY_LDFLAGS_iphoneos = $(FRAMEWORK_AND_LIBRARY_LDFLAGS_iphonesimulator) -framework IOSurface; 35 35 FRAMEWORK_AND_LIBRARY_LDFLAGS_macosx = -framework ApplicationServices -framework Carbon -framework Cocoa -framework CoreServices -framework IOKit -framework CoreAudio -framework IOSurface -framework OpenGL; -
trunk/Source/WebKit2/Shared/WebOpenPanelParameters.h
r163958 r168180 44 44 ~WebOpenPanelParameters(); 45 45 46 bool allowMultipleFiles() const { return m_settings.allowsMultipleFiles; } 46 bool allowMultipleFiles() const { return m_settings.allowsMultipleFiles; } 47 47 PassRefPtr<API::Array> acceptMIMETypes() const; 48 48 PassRefPtr<API::Array> selectedFileNames() const; -
trunk/Source/WebKit2/UIProcess/PageClient.h
r167774 r168180 151 151 virtual void handleDownloadRequest(DownloadProxy*) = 0; 152 152 153 virtual bool handleRunOpenPanel(WebPageProxy*, WebFrameProxy*, WebOpenPanelParameters*, WebOpenPanelResultListenerProxy*) { return false; } 154 153 155 #if PLATFORM(EFL) 154 156 virtual void didChangeContentSize(const WebCore::IntSize&) = 0; -
trunk/Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.cpp
r160969 r168180 28 28 29 29 #include "APIArray.h" 30 #include "APIString.h" 30 31 #include "WebPageProxy.h" 31 32 #include <WebCore/URL.h> … … 45 46 } 46 47 48 static Vector<String> filePathsFromFileURLs(const API::Array& fileURLs) 49 { 50 Vector<String> filePaths; 51 52 size_t size = fileURLs.size(); 53 filePaths.reserveInitialCapacity(size); 54 55 for (size_t i = 0; i < size; ++i) { 56 API::URL* apiURL = fileURLs.at<API::URL>(i); 57 if (apiURL) 58 filePaths.uncheckedAppend(URL(URL(), apiURL->string()).fileSystemPath()); 59 } 60 61 return filePaths; 62 } 63 64 #if PLATFORM(IOS) 65 void WebOpenPanelResultListenerProxy::chooseFiles(API::Array* fileURLsArray, API::String* displayString, const API::Data* iconImageData) 66 { 67 if (!m_page) 68 return; 69 70 m_page->didChooseFilesForOpenPanelWithDisplayStringAndIcon(filePathsFromFileURLs(*fileURLsArray), displayString ? displayString->string() : String(), iconImageData); 71 } 72 #endif 73 47 74 void WebOpenPanelResultListenerProxy::chooseFiles(API::Array* fileURLsArray) 48 75 { … … 50 77 return; 51 78 52 size_t size = fileURLsArray->size(); 53 54 Vector<String> filePaths; 55 filePaths.reserveInitialCapacity(size); 56 57 for (size_t i = 0; i < size; ++i) { 58 API::URL* apiURL = fileURLsArray->at<API::URL>(i); 59 if (apiURL) { 60 URL url(URL(), apiURL->string()); 61 filePaths.uncheckedAppend(url.fileSystemPath()); 62 } 63 } 64 65 m_page->didChooseFilesForOpenPanel(filePaths); 79 m_page->didChooseFilesForOpenPanel(filePathsFromFileURLs(*fileURLsArray)); 66 80 } 67 81 -
trunk/Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.h
r160384 r168180 33 33 namespace API { 34 34 class Array; 35 class Data; 36 class String; 35 37 } 36 38 … … 48 50 virtual ~WebOpenPanelResultListenerProxy(); 49 51 52 #if PLATFORM(IOS) 53 void chooseFiles(API::Array*, API::String* displayString, const API::Data* iconImageData); 54 #endif 50 55 void chooseFiles(API::Array*); 51 56 void cancel(); -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r168118 r168180 3084 3084 m_process->responsivenessTimer()->stop(); 3085 3085 3086 if (!m_uiClient->runOpenPanel(this, frame, parameters.get(), m_openPanelResultListener.get())) 3087 didCancelForOpenPanel(); 3086 if (!m_uiClient->runOpenPanel(this, frame, parameters.get(), m_openPanelResultListener.get())) { 3087 if (!m_pageClient.handleRunOpenPanel(this, frame, parameters.get(), m_openPanelResultListener.get())) 3088 didCancelForOpenPanel(); 3089 } 3088 3090 } 3089 3091 … … 3592 3594 } 3593 3595 #endif // ENABLE(CONTEXT_MENUS) 3596 3597 #if PLATFORM(IOS) 3598 void WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon(const Vector<String>& fileURLs, const String& displayString, const API::Data* iconData) 3599 { 3600 if (!isValid()) 3601 return; 3602 3603 m_process->send(Messages::WebPage::DidChooseFilesForOpenPanelWithDisplayStringAndIcon(fileURLs, displayString, iconData ? iconData->dataReference() : IPC::DataReference()), m_pageID); 3604 3605 m_openPanelResultListener->invalidate(); 3606 m_openPanelResultListener = nullptr; 3607 } 3608 #endif 3594 3609 3595 3610 void WebPageProxy::didChooseFilesForOpenPanel(const Vector<String>& fileURLs) -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r168118 r168180 947 947 948 948 // Called by the WebOpenPanelResultListenerProxy. 949 #if PLATFORM(IOS) 950 void didChooseFilesForOpenPanelWithDisplayStringAndIcon(const Vector<String>&, const String& displayString, const API::Data* iconData); 951 #endif 949 952 void didChooseFilesForOpenPanel(const Vector<String>&); 950 953 void didCancelForOpenPanel(); -
trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h
r168038 r168180 121 121 virtual void showPlaybackTargetPicker(bool hasVideo, const WebCore::IntRect& elementRect) override; 122 122 123 virtual bool handleRunOpenPanel(WebPageProxy*, WebFrameProxy*, WebOpenPanelParameters*, WebOpenPanelResultListenerProxy*) override; 124 123 125 #if ENABLE(INSPECTOR) 124 126 virtual void showInspectorIndication() override; -
trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm
r168069 r168180 415 415 } 416 416 417 bool PageClientImpl::handleRunOpenPanel(WebPageProxy*, WebFrameProxy*, WebOpenPanelParameters* parameters, WebOpenPanelResultListenerProxy* listener) 418 { 419 [m_contentView _showRunOpenPanel:parameters resultListener:listener]; 420 return true; 421 } 422 417 423 #if ENABLE(INSPECTOR) 418 424 void PageClientImpl::showInspectorIndication() -
trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h
r168117 r168180 32 32 #import "InteractionInformationAtPosition.h" 33 33 #import "WKAirPlayRoutePicker.h" 34 #import "WKFileUploadPanel.h" 34 35 #import "WKFormPeripheral.h" 35 36 #import <UIKit/UITextInput_Private.h> … … 52 53 class NativeWebTouchEvent; 53 54 class SmartMagnificationController; 55 class WebOpenPanelParameters; 56 class WebOpenPanelResultListenerProxy; 54 57 class WebPageProxy; 55 58 } 56 59 57 @class _UIWebHighlightLongPressGestureRecognizer;58 @class _UIHighlightView;59 @class WebIOSEvent;60 60 @class WKActionSheetAssistant; 61 61 @class WKFormInputSession; 62 @class WebIOSEvent; 63 @class _UIHighlightView; 64 @class _UIWebHighlightLongPressGestureRecognizer; 62 65 63 66 typedef void (^UIWKAutocorrectionCompletionHandler)(UIWKAutocorrectionRects *rectsForInput); … … 99 102 RetainPtr<WKAirPlayRoutePicker> _airPlayRoutePicker; 100 103 RetainPtr<WKFormInputSession> _formInputSession; 104 RetainPtr<WKFileUploadPanel> _fileUploadPanel; 101 105 102 106 std::unique_ptr<WebKit::SmartMagnificationController> _smartMagnificationController; … … 111 115 RetainPtr<NSObject<WKFormPeripheral>> _inputPeripheral; 112 116 117 CGPoint _lastInteractionLocation; 118 113 119 BOOL _isEditable; 114 120 BOOL _showingTextStyleOptions; … … 121 127 @end 122 128 123 @interface WKContentView (WKInteraction) <UIGestureRecognizerDelegate, UIWebTouchEventsGestureRecognizerDelegate, UITextInputPrivate, UIWebFormAccessoryDelegate, UIWKInteractionViewProtocol >129 @interface WKContentView (WKInteraction) <UIGestureRecognizerDelegate, UIWebTouchEventsGestureRecognizerDelegate, UITextInputPrivate, UIWebFormAccessoryDelegate, UIWKInteractionViewProtocol, WKFileUploadPanelDelegate> 124 130 131 @property (nonatomic, readonly) CGPoint lastInteractionLocation; 125 132 @property (nonatomic, readonly) BOOL isEditable; 126 133 @property (nonatomic, readonly) const WebKit::InteractionInformationAtPosition& positionInformation; … … 149 156 - (void)_didUpdateBlockSelectionWithTouch:(WebKit::SelectionTouch)touch withFlags:(WebKit::SelectionFlags)flags growThreshold:(CGFloat)growThreshold shrinkThreshold:(CGFloat)shrinkThreshold; 150 157 - (void)_showPlaybackTargetPicker:(BOOL)hasVideo fromRect:(const WebCore::IntRect&)elementRect; 158 - (void)_showRunOpenPanel:(WebKit::WebOpenPanelParameters*)parameters resultListener:(WebKit::WebOpenPanelResultListenerProxy*)listener; 151 159 - (void)accessoryDone; 152 160 - (Vector<WebKit::WKOptionItem>&) assistedNodeSelectOptions; -
trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
r168142 r168180 33 33 #import "NativeWebTouchEvent.h" 34 34 #import "SmartMagnificationController.h" 35 #import "WKActionSheetAssistant.h" 36 #import "WKFormInputControl.h" 37 #import "WKFormSelectControl.h" 38 #import "WKWebViewPrivate.h" 35 39 #import "WebEvent.h" 36 40 #import "WebIOSEventFactory.h" 37 41 #import "WebPageMessages.h" 38 42 #import "WebProcessProxy.h" 39 #import "WKActionSheetAssistant.h"40 #import "WKFormInputControl.h"41 #import "WKFormSelectControl.h"42 #import "WKWebViewPrivate.h"43 43 #import "_WKFormDelegate.h" 44 44 #import "_WKFormInputSession.h" 45 45 #import <DataDetectorsUI/DDDetectionController.h> 46 46 #import <TextInput/TI_NSStringExtras.h> 47 #import <UIKit/_UIHighlightView.h>48 #import <UIKit/_UIWebHighlightLongPressGestureRecognizer.h>49 47 #import <UIKit/UIFont_Private.h> 50 48 #import <UIKit/UIGestureRecognizer_Private.h> … … 55 53 #import <UIKit/UITextInteractionAssistant_Private.h> 56 54 #import <UIKit/UIWebDocumentView.h> // FIXME: should not include this header. 55 #import <UIKit/_UIHighlightView.h> 56 #import <UIKit/_UIWebHighlightLongPressGestureRecognizer.h> 57 57 #import <WebCore/Color.h> 58 58 #import <WebCore/FloatQuad.h> … … 241 241 [_highlightLongPressGestureRecognizer setDelegate:nil]; 242 242 [_longPressGestureRecognizer setDelegate:nil]; 243 244 if (_fileUploadPanel) { 245 [_fileUploadPanel setDelegate:nil]; 246 [_fileUploadPanel dismiss]; 247 } 243 248 } 244 249 … … 256 261 { 257 262 return _inputDelegate; 263 } 264 265 - (CGPoint)lastInteractionLocation 266 { 267 return _lastInteractionLocation; 258 268 } 259 269 … … 288 298 if (nativeWebTouchEvent.type() == WebKit::WebEvent::TouchStart) 289 299 _canSendTouchEventsAsynchronously = NO; 300 301 _lastInteractionLocation = gestureRecognizer.locationInWindow; 290 302 291 303 if (_canSendTouchEventsAsynchronously) … … 670 682 ASSERT(gestureRecognizer == _highlightLongPressGestureRecognizer); 671 683 684 _lastInteractionLocation = gestureRecognizer.startPoint; 685 672 686 switch ([gestureRecognizer state]) { 673 687 case UIGestureRecognizerStateBegan: … … 691 705 ASSERT(gestureRecognizer == _longPressGestureRecognizer); 692 706 707 _lastInteractionLocation = gestureRecognizer.startPoint; 708 693 709 if ([gestureRecognizer state] == UIGestureRecognizerStateBegan) { 694 710 SEL action = [self _actionForLongPress]; … … 707 723 [_webSelectionAssistant clearSelection]; 708 724 709 [self _attemptClickAtLocation:[gestureRecognizer location]]; 725 _lastInteractionLocation = gestureRecognizer.location; 726 727 [self _attemptClickAtLocation:gestureRecognizer.location]; 710 728 } 711 729 712 730 - (void)_doubleTapRecognized:(UITapGestureRecognizer *)gestureRecognizer 713 731 { 732 _lastInteractionLocation = gestureRecognizer.location; 733 714 734 _smartMagnificationController->handleSmartMagnificationGesture(gestureRecognizer.location); 715 735 } … … 717 737 - (void)_twoFingerDoubleTapRecognized:(UITapGestureRecognizer *)gestureRecognizer 718 738 { 739 _lastInteractionLocation = gestureRecognizer.location; 740 719 741 _smartMagnificationController->handleResetMagnificationGesture(gestureRecognizer.location); 720 742 } … … 2089 2111 } 2090 2112 2113 - (void)_showRunOpenPanel:(WebOpenPanelParameters*)parameters resultListener:(WebOpenPanelResultListenerProxy*)listener 2114 { 2115 ASSERT(!_fileUploadPanel); 2116 if (_fileUploadPanel) 2117 return; 2118 2119 _fileUploadPanel = adoptNS([[WKFileUploadPanel alloc] initWithView:self]); 2120 [_fileUploadPanel setDelegate:self]; 2121 [_fileUploadPanel presentWithParameters:parameters resultListener:listener]; 2122 } 2123 2124 - (void)fileUploadPanelDidDismiss:(WKFileUploadPanel *)fileUploadPanel 2125 { 2126 ASSERT(_fileUploadPanel.get() == fileUploadPanel); 2127 2128 [_fileUploadPanel setDelegate:nil]; 2129 [_fileUploadPanel release]; 2130 _fileUploadPanel = nil; 2131 } 2132 2091 2133 #pragma mark - Implementation of UIWebTouchEventsGestureRecognizerDelegate. 2092 2134 -
trunk/Source/WebKit2/UIProcess/ios/forms/WKFileUploadPanel.h
r168179 r168180 1 1 /* 2 * Copyright (C) 201 0Apple Inc. All rights reserved.2 * Copyright (C) 2014 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #include "config.h" 27 #include "WebOpenPanelResultListener.h" 26 #if PLATFORM(IOS) 27 28 #import <UIKit/UIViewController.h> 29 30 @class WKContentView; 31 @protocol WKFileUploadPanelDelegate; 28 32 29 33 namespace WebKit { 30 31 PassRefPtr<WebOpenPanelResultListener> WebOpenPanelResultListener::create(WebPage* page, PassRefPtr<WebCore::FileChooser> fileChooser) 32 { 33 return adoptRef(new WebOpenPanelResultListener(page, fileChooser)); 34 class WebOpenPanelParameters; 35 class WebOpenPanelResultListenerProxy; 34 36 } 35 37 36 WebOpenPanelResultListener::WebOpenPanelResultListener(WebPage* page, PassRefPtr<WebCore::FileChooser> fileChooser) 37 : m_page(page) 38 , m_fileChooser(fileChooser) 39 { 40 } 38 @interface WKFileUploadPanel : UIViewController 39 @property (nonatomic, assign) id <WKFileUploadPanelDelegate> delegate; 40 - (instancetype)initWithView:(WKContentView *)view; 41 - (void)presentWithParameters:(WebKit::WebOpenPanelParameters*)parameters resultListener:(WebKit::WebOpenPanelResultListenerProxy*)listener; 42 - (void)dismiss; 43 @end 41 44 42 WebOpenPanelResultListener::~WebOpenPanelResultListener() 43 { 44 } 45 @protocol WKFileUploadPanelDelegate <NSObject> 46 @optional 47 - (void)fileUploadPanelDidDismiss:(WKFileUploadPanel *)fileUploadPanel; 48 @end 45 49 46 void WebOpenPanelResultListener::didChooseFiles(const Vector<String>& files) 47 { 48 m_fileChooser->chooseFiles(files); 49 } 50 51 } // namespace WebKit 50 #endif // PLATFORM(IOS) -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r168085 r168180 1040 1040 A1DF631218E0B7C8003A3E2A /* DownloadClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = A1DF631018E0B7C8003A3E2A /* DownloadClient.mm */; }; 1041 1041 A1DF631318E0B7C8003A3E2A /* DownloadClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A1DF631118E0B7C8003A3E2A /* DownloadClient.h */; }; 1042 A58B6F0818FCA733008CBA53 /* WKFileUploadPanel.h in Headers */ = {isa = PBXBuildFile; fileRef = A58B6F0618FCA733008CBA53 /* WKFileUploadPanel.h */; }; 1043 A58B6F0918FCA733008CBA53 /* WKFileUploadPanel.mm in Sources */ = {isa = PBXBuildFile; fileRef = A58B6F0718FCA733008CBA53 /* WKFileUploadPanel.mm */; }; 1042 1044 A5EFD38C16B0E88C00B2F0E8 /* WKPageVisibilityTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = A5EFD38B16B0E88C00B2F0E8 /* WKPageVisibilityTypes.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1043 1045 A7D792D61767CB6E00881CBE /* ActivityAssertion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7D792D51767CB6E00881CBE /* ActivityAssertion.cpp */; }; … … 2923 2925 A1EDD2DC1884B9B500BBFE98 /* SecItemShim.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = SecItemShim.xcconfig; sourceTree = "<group>"; }; 2924 2926 A1EDD2DD1884B9E300BBFE98 /* WebProcessShim.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = WebProcessShim.xcconfig; sourceTree = "<group>"; }; 2927 A58B6F0618FCA733008CBA53 /* WKFileUploadPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKFileUploadPanel.h; path = ios/forms/WKFileUploadPanel.h; sourceTree = "<group>"; }; 2928 A58B6F0718FCA733008CBA53 /* WKFileUploadPanel.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKFileUploadPanel.mm; path = ios/forms/WKFileUploadPanel.mm; sourceTree = "<group>"; }; 2925 2929 A5EFD38B16B0E88C00B2F0E8 /* WKPageVisibilityTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageVisibilityTypes.h; sourceTree = "<group>"; }; 2926 2930 A72D5D7F1236CBA800A88B15 /* WebSerializedScriptValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSerializedScriptValue.h; sourceTree = "<group>"; }; … … 6527 6531 C5FA1ED118E1062200B3F402 /* WKAirPlayRoutePicker.h */, 6528 6532 C5FA1ED218E1062200B3F402 /* WKAirPlayRoutePicker.mm */, 6533 A58B6F0618FCA733008CBA53 /* WKFileUploadPanel.h */, 6534 A58B6F0718FCA733008CBA53 /* WKFileUploadPanel.mm */, 6529 6535 C54256AF18BEC18B00DE4179 /* WKFormInputControl.h */, 6530 6536 C54256B018BEC18B00DE4179 /* WKFormInputControl.mm */, … … 6740 6746 373D122D18A4B6EB0066D9CC /* WKWebProcessPlugInFramePrivate.h in Headers */, 6741 6747 1AD25E96167AB08100EA9BCD /* DownloadProxyMap.h in Headers */, 6748 A58B6F0818FCA733008CBA53 /* WKFileUploadPanel.h in Headers */, 6742 6749 1AB7D61A1288B9D900CFD08C /* DownloadProxyMessages.h in Headers */, 6743 6750 C517388112DF8F4F00EE3F47 /* DragControllerAction.h in Headers */, … … 8459 8466 868160D0187645570021E79D /* WindowServerConnection.mm in Sources */, 8460 8467 3F87B9BD158940120090FF62 /* WebColorChooser.cpp in Sources */, 8468 A58B6F0918FCA733008CBA53 /* WKFileUploadPanel.mm in Sources */, 8461 8469 F036978815F4BF0500C3A80E /* WebColorPicker.cpp in Sources */, 8462 8470 BC4A628F147312BE006C681A /* WebConnection.cpp in Sources */, -
trunk/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.cpp
r95901 r168180 27 27 #include "WebOpenPanelResultListener.h" 28 28 29 #include <WebCore/Icon.h> 30 29 31 namespace WebKit { 30 32 … … 49 51 } 50 52 53 #if PLATFORM(IOS) 54 void WebOpenPanelResultListener::didChooseFilesWithDisplayStringAndIcon(const Vector<String>& files, const String& displayString, WebCore::Icon* displayIcon) 55 { 56 m_fileChooser->chooseMediaFiles(files, displayString, displayIcon); 57 } 58 #endif 59 51 60 } // namespace WebKit -
trunk/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.h
r95901 r168180 30 30 #include <WebCore/FileChooser.h> 31 31 32 namespace WebCore { 33 class Icon; 34 } 35 32 36 namespace WebKit { 33 37 … … 41 45 void disconnectFromPage() { m_page = 0; } 42 46 void didChooseFiles(const Vector<String>&); 47 #if PLATFORM(IOS) 48 void didChooseFilesWithDisplayStringAndIcon(const Vector<String>&, const String& displayString, WebCore::Icon*); 49 #endif 43 50 44 51 private: -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r168085 r168180 186 186 #if PLATFORM(IOS) 187 187 #include "WebVideoFullscreenManager.h" 188 #include <CoreGraphics/CoreGraphics.h> 189 #include <WebCore/Icon.h> 188 190 #endif 189 191 … … 3051 3053 } 3052 3054 3055 #if PLATFORM(IOS) 3056 void WebPage::didChooseFilesForOpenPanelWithDisplayStringAndIcon(const Vector<String>& files, const String& displayString, const IPC::DataReference& iconData) 3057 { 3058 if (!m_activeOpenPanelResultListener) 3059 return; 3060 3061 RefPtr<Icon> icon; 3062 if (!iconData.isEmpty()) { 3063 RetainPtr<CFDataRef> dataRef = adoptCF(CFDataCreate(nullptr, iconData.data(), iconData.size())); 3064 RetainPtr<CGDataProviderRef> imageProviderRef = adoptCF(CGDataProviderCreateWithCFData(dataRef.get())); 3065 RetainPtr<CGImageRef> imageRef = adoptCF(CGImageCreateWithJPEGDataProvider(imageProviderRef.get(), nullptr, true, kCGRenderingIntentDefault)); 3066 icon = Icon::createIconForImage(imageRef.get()); 3067 } 3068 3069 m_activeOpenPanelResultListener->didChooseFilesWithDisplayStringAndIcon(files, displayString, icon.get()); 3070 m_activeOpenPanelResultListener = nullptr; 3071 } 3072 #endif 3073 3053 3074 void WebPage::didChooseFilesForOpenPanel(const Vector<String>& files) 3054 3075 { -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r167974 r168180 960 960 #endif 961 961 962 #if PLATFORM(IOS) 963 void didChooseFilesForOpenPanelWithDisplayStringAndIcon(const Vector<String>&, const String& displayString, const IPC::DataReference& iconData); 964 #endif 962 965 void didChooseFilesForOpenPanel(const Vector<String>&); 963 966 void didCancelForOpenPanel(); -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
r167974 r168180 226 226 227 227 # Open panel. 228 #if PLATFORM(IOS) 229 DidChooseFilesForOpenPanelWithDisplayStringAndIcon(Vector<String> fileURLs, String displayString, IPC::DataReference iconData) 230 #endif 228 231 DidChooseFilesForOpenPanel(Vector<String> fileURLs) 229 232 DidCancelForOpenPanel()
Note: See TracChangeset
for help on using the changeset viewer.