WebKit Bugzilla
Attachment 357641 Details for
Bug 192839
: UI process crash when focusing an editable image
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192839-20181218173619.patch (text/plain), 24.94 KB, created by
Tim Horton
on 2018-12-18 17:36:20 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Tim Horton
Created:
2018-12-18 17:36:20 PST
Size:
24.94 KB
patch
obsolete
>Subversion Revision: 239282 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index cc9c4ab4fa4c7dca456962bff2591f4c082d317b..36a694c80afa0ae90aa3191f630c5b691f1a71c3 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,36 @@ >+2018-12-18 Tim Horton <timothy_horton@apple.com> >+ >+ UI process crash when focusing an editable image >+ https://bugs.webkit.org/show_bug.cgi?id=192839 >+ <rdar://problem/46786670> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * SourcesCocoa.txt: >+ * UIProcess/ios/WKContentViewInteraction.h: >+ * UIProcess/ios/WKContentViewInteraction.mm: >+ (-[WKContentView _requiresKeyboardWhenFirstResponder]): >+ (-[WKContentView inputView]): >+ (-[WKContentView requiresAccessoryView]): >+ (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]): >+ (-[WKContentView _stopAssistingNode]): >+ (-[WKContentView _installInkPickerForDrawingViewWithID:]): >+ (-[WKContentView _uninstallInkPicker]): >+ * UIProcess/ios/WKInkPickerView.h: Renamed from Source/WebKit/UIProcess/ios/WKInkPickerControl.h. >+ * UIProcess/ios/WKInkPickerView.mm: Renamed from Source/WebKit/UIProcess/ios/WKInkPickerControl.mm. >+ (-[WKInkPickerView initWithDrawingView:]): >+ (-[WKInkPickerView didPickInk]): >+ (-[WKInkPickerView inlineInkPickerDidToggleRuler:]): >+ (-[WKInkPickerView inlineInkPicker:didSelectTool:]): >+ (-[WKInkPickerView inlineInkPicker:didSelectColor:]): >+ (-[WKInkPickerView inkPickerSize]): >+ (-[WKInkPickerView layoutSubviews]): >+ (-[WKInkPickerView sizeThatFits:]): >+ (-[WKInkPickerView viewControllerForPopoverPresentationFromInlineInkPicker:]): >+ * WebKit.xcodeproj/project.pbxproj: >+ Make WKInkPickerView a WKWebView subview instead of an inputView. >+ Also, don't force the keyboard to be visible when an editable image is focused. >+ > 2018-12-17 Zan Dobersek <zdobersek@igalia.com> > > Unreviewed WPE build fix after r239277. >diff --git a/Source/WebKit/SourcesCocoa.txt b/Source/WebKit/SourcesCocoa.txt >index f1a057a45db0fa35ce10dcf419693efe818a6da3..ed65b8fa739e8e1960b3dce6b864e5145e2f9183 100644 >--- a/Source/WebKit/SourcesCocoa.txt >+++ b/Source/WebKit/SourcesCocoa.txt >@@ -390,7 +390,7 @@ UIProcess/ios/WKContentViewInteraction.mm @no-unify > UIProcess/ios/WKDrawingView.mm > UIProcess/ios/WKGeolocationProviderIOS.mm > UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm >-UIProcess/ios/WKInkPickerControl.mm >+UIProcess/ios/WKInkPickerView.mm > UIProcess/ios/WKInspectorNodeSearchGestureRecognizer.mm > UIProcess/ios/WKKeyboardScrollingAnimator.mm > UIProcess/ios/WKLegacyPDFView.mm >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >index e794e3c631ddeb53a1a469b7909429b4cba3bc61..5dd18f08bf610615d0664e3ed31a576729d00b1c 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >@@ -96,6 +96,7 @@ class WebPageProxy; > @class WKFocusedFormControlView; > @class WKFormInputControl; > @class WKFormInputSession; >+@class WKInkPickerView; > @class WKInspectorNodeSearchGestureRecognizer; > > typedef void (^UIWKAutocorrectionCompletionHandler)(UIWKAutocorrectionRects *rectsForInput); >@@ -284,6 +285,10 @@ struct WKAutoCorrectionData { > RetainPtr<NSArray<UITextSuggestion *>> _dataListTextSuggestions; > #endif > >+#if HAVE(PENCILKIT) >+ RetainPtr<WKInkPickerView> _inkPicker; >+#endif >+ > BOOL _isEditable; > BOOL _showingTextStyleOptions; > BOOL _hasValidPositionInformation; >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index 026f1f7a8762b9894a338c2c4878ffa38462d870..08eb485564d4051db1143f92e3562efad42c7b97 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -47,7 +47,7 @@ > #import "WKFormInputControl.h" > #import "WKFormSelectControl.h" > #import "WKImagePreviewViewController.h" >-#import "WKInkPickerControl.h" >+#import "WKInkPickerView.h" > #import "WKInspectorNodeSearchGestureRecognizer.h" > #import "WKNSURLExtras.h" > #import "WKPreviewActionItemIdentifiers.h" >@@ -1360,6 +1360,7 @@ - (BOOL)_requiresKeyboardWhenFirstResponder > // FIXME: We should add the logic to handle keyboard visibility during focus redirects. > switch (_assistedNodeInformation.elementType) { > case WebKit::InputType::None: >+ case WebKit::InputType::Drawing: > return NO; > case WebKit::InputType::Select: > #if ENABLE(INPUT_TYPE_COLOR) >@@ -1370,8 +1371,6 @@ - (BOOL)_requiresKeyboardWhenFirstResponder > case WebKit::InputType::DateTimeLocal: > case WebKit::InputType::Time: > return !currentUserInterfaceIdiomIsPad(); >- case WebKit::InputType::Drawing: >- return YES; > default: > return !_assistedNodeInformation.isReadOnly; > } >@@ -1420,14 +1419,6 @@ - (UIView *)inputView > case WebKit::InputType::Color: > _inputPeripheral = adoptNS([[WKFormColorControl alloc] initWithView:self]); > break; >-#endif >- case WebKit::InputType::Drawing: >-#if HAVE(PENCILKIT) >- _inputPeripheral = adoptNS([[WKInkPickerControl alloc] initWithDrawingView:_page->editableImageController().editableImage(_assistedNodeInformation.embeddedViewID)->drawingView.get()]); >- break; >-#else >- ASSERT_NOT_REACHED(); >- return [[UIView new] autorelease]; > #endif > default: > _inputPeripheral = adoptNS([[WKFormInputControl alloc] initWithView:self]); >@@ -2189,6 +2180,7 @@ - (BOOL)requiresAccessoryView > > switch (_assistedNodeInformation.elementType) { > case WebKit::InputType::None: >+ case WebKit::InputType::Drawing: > return NO; > case WebKit::InputType::Text: > case WebKit::InputType::Password: >@@ -2211,8 +2203,6 @@ - (BOOL)requiresAccessoryView > case WebKit::InputType::Color: > #endif > return !currentUserInterfaceIdiomIsPad(); >- case WebKit::InputType::Drawing: >- return YES; > } > } > >@@ -4442,6 +4432,11 @@ - (void)_startAssistingNode:(const WebKit::AssistedNodeInformation&)information > if (blurPreviousNode) > [self _stopAssistingNode]; > >+#if HAVE(PENCILKIT) >+ if (information.elementType == WebKit::InputType::Drawing) >+ [self _installInkPickerForDrawingViewWithID:information.embeddedViewID]; >+#endif >+ > if (!shouldShowKeyboard) > return; > >@@ -4492,6 +4487,7 @@ - (void)_startAssistingNode:(const WebKit::AssistedNodeInformation&)information > case WebKit::InputType::Time: > case WebKit::InputType::Month: > case WebKit::InputType::Date: >+ case WebKit::InputType::Drawing: > #if ENABLE(INPUT_TYPE_COLOR) > case WebKit::InputType::Color: > #endif >@@ -4525,6 +4521,11 @@ - (void)_stopAssistingNode > { > SetForScope<BOOL> isBlurringFocusedNodeForScope { _isBlurringFocusedNode, YES }; > >+#if HAVE(PENCILKIT) >+ if (_inkPicker) >+ [self _uninstallInkPicker]; >+#endif >+ > [_formInputSession invalidate]; > _formInputSession = nil; > >@@ -6205,6 +6206,30 @@ - (void)_hoverGestureRecognizerChanged:(UIGestureRecognizer *)gestureRecognizer > } > #endif > >+#if HAVE(PENCILKIT) >+- (void)_installInkPickerForDrawingViewWithID:(WebCore::GraphicsLayer::EmbeddedViewID)embeddedViewID >+{ >+ _inkPicker = adoptNS([[WKInkPickerView alloc] initWithDrawingView:_page->editableImageController().editableImage(embeddedViewID)->drawingView.get()]); >+ [_inkPicker sizeToFit]; >+ [_inkPicker setTranslatesAutoresizingMaskIntoConstraints:NO]; >+ [_webView addSubview:_inkPicker.get()]; >+ >+ [NSLayoutConstraint activateConstraints:@[ >+ [[_inkPicker heightAnchor] constraintEqualToConstant:[_inkPicker frame].size.height], >+ [[_inkPicker bottomAnchor] constraintEqualToAnchor:_webView.safeAreaLayoutGuide.bottomAnchor], >+ [[_inkPicker leftAnchor] constraintEqualToAnchor:_webView.safeAreaLayoutGuide.leftAnchor], >+ [[_inkPicker rightAnchor] constraintEqualToAnchor:_webView.safeAreaLayoutGuide.rightAnchor], >+ ]]; >+} >+ >+- (void)_uninstallInkPicker >+{ >+ [_inkPicker removeFromSuperview]; >+ _inkPicker = nil; >+} >+ >+#endif // HAVE(PENCILKIT) >+ > @end > > @implementation WKContentView (WKTesting) >diff --git a/Source/WebKit/UIProcess/ios/WKInkPickerControl.h b/Source/WebKit/UIProcess/ios/WKInkPickerControl.h >deleted file mode 100644 >index 08cdabfac3e48696ed897a3abfe1fe0654486370..0000000000000000000000000000000000000000 >--- a/Source/WebKit/UIProcess/ios/WKInkPickerControl.h >+++ /dev/null >@@ -1,39 +0,0 @@ >-/* >- * Copyright (C) 2018 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#if HAVE(PENCILKIT) >- >-#import "WKFormPeripheral.h" >- >-OBJC_CLASS WKDrawingView; >- >-@interface WKInkPickerControl : NSObject <WKFormPeripheral> >- >-- (instancetype)initWithDrawingView:(WKDrawingView *)drawingView; >- >-@end >- >- >-#endif // HAVE(PENCILKIT) >diff --git a/Source/WebKit/UIProcess/ios/WKInkPickerControl.mm b/Source/WebKit/UIProcess/ios/WKInkPickerControl.mm >deleted file mode 100644 >index 5bd0afda6b3a4354aec3e953ea6a69eb4972c74e..0000000000000000000000000000000000000000 >--- a/Source/WebKit/UIProcess/ios/WKInkPickerControl.mm >+++ /dev/null >@@ -1,141 +0,0 @@ >-/* >- * Copyright (C) 2018 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#import "config.h" >-#import "WKInkPickerControl.h" >- >-#if HAVE(PENCILKIT) >- >-#import "WKDrawingView.h" >- >-#import "PencilKitSoftLink.h" >- >-@interface WKInkPickerView : UIView <PKInlineInkPickerDelegate> >-@end >- >-@implementation WKInkPickerView { >- RetainPtr<PKInlineInkPicker> _inlinePicker; >- RetainPtr<WKDrawingView> _drawingView; >-} >- >-- (instancetype)initWithFrame:(CGRect)frame drawingView:(WKDrawingView *)drawingView >-{ >- self = [super initWithFrame:frame]; >- if (!self) >- return nil; >- >- _inlinePicker = adoptNS([WebKit::allocPKInlineInkPickerInstance() init]); >- [_inlinePicker setSelectedInk:[drawingView canvasView].ink animated:NO]; >- [_inlinePicker addTarget:self action:@selector(didPickInk) forControlEvents:UIControlEventValueChanged]; >- [_inlinePicker setDelegate:self]; >- >- _drawingView = drawingView; >- [self addSubview:_inlinePicker.get()]; >- >- return self; >-} >- >-- (void)didPickInk >-{ >- [_drawingView canvasView].ink = [_inlinePicker selectedInk]; >-} >- >-- (void)inlineInkPickerDidToggleRuler:(PKInlineInkPicker *)inlineInkPicker >-{ >- [_drawingView canvasView].rulerEnabled = ![_drawingView canvasView].rulerEnabled; >-} >- >-- (void)inlineInkPicker:(PKInlineInkPicker *)inlineInkPicker didSelectTool:(PKInkIdentifier)identifer >-{ >- [self didPickInk]; >-} >- >-- (void)inlineInkPicker:(PKInlineInkPicker *)inlineInkPicker didSelectColor:(UIColor *)color >-{ >- [self didPickInk]; >-} >- >-- (CGSize)inkPickerSize >-{ >- CGSize keyboardSize = [UIKeyboard defaultSizeForInterfaceOrientation:[UIApp interfaceOrientation]]; >- return [_inlinePicker sizeThatFits:keyboardSize]; >-} >- >-- (void)layoutSubviews >-{ >- CGSize pickerSize = self.inkPickerSize; >- [_inlinePicker setFrame:CGRectMake(CGRectGetMidX(self.bounds) - (pickerSize.width / 2), 0, pickerSize.width, pickerSize.height)]; >-} >- >-- (CGSize)sizeThatFits:(CGSize)size >-{ >- CGSize keyboardSize = [UIKeyboard defaultSizeForInterfaceOrientation:[UIApp interfaceOrientation]]; >- return CGSizeMake(keyboardSize.width, self.inkPickerSize.height); >-} >- >-- (UIViewController *)viewControllerForPopoverPresentationFromInlineInkPicker:(PKInlineInkPicker *)inlineInkPicker >-{ >- return [UIViewController _viewControllerForFullScreenPresentationFromView:_drawingView.get()]; >-} >- >-@end >- >-@implementation WKInkPickerControl { >- RetainPtr<WKInkPickerView> _picker; >- RetainPtr<WKDrawingView> _drawingView; >-} >- >-- (instancetype)initWithDrawingView:(WKDrawingView *)drawingView >-{ >- self = [super init]; >- if (!self) >- return nil; >- >- _drawingView = drawingView; >- >- return self; >-} >- >-- (void)beginEditing >-{ >- >-} >- >-- (void)endEditing >-{ >- >-} >- >-- (UIView *)assistantView >-{ >- if (!_picker) >- _picker = adoptNS([[WKInkPickerView alloc] initWithFrame:CGRectZero drawingView:_drawingView.get()]); >- [_picker sizeToFit]; >- return _picker.get(); >-} >- >-@end >- >-#endif // HAVE(PENCILKIT) >diff --git a/Source/WebKit/UIProcess/ios/WKInkPickerView.h b/Source/WebKit/UIProcess/ios/WKInkPickerView.h >new file mode 100644 >index 0000000000000000000000000000000000000000..c843607664152f4f0cefbdc3f8a7e7c6d7ba23a5 >--- /dev/null >+++ b/Source/WebKit/UIProcess/ios/WKInkPickerView.h >@@ -0,0 +1,38 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#if HAVE(PENCILKIT) >+ >+#import <UIKit/UIKit.h> >+ >+OBJC_CLASS WKDrawingView; >+ >+@interface WKInkPickerView : UIView >+ >+- (instancetype)initWithDrawingView:(WKDrawingView *)drawingView; >+ >+@end >+ >+#endif // HAVE(PENCILKIT) >diff --git a/Source/WebKit/UIProcess/ios/WKInkPickerView.mm b/Source/WebKit/UIProcess/ios/WKInkPickerView.mm >new file mode 100644 >index 0000000000000000000000000000000000000000..9a37438e5872588d440050c4bf4bb81dd4afca83 >--- /dev/null >+++ b/Source/WebKit/UIProcess/ios/WKInkPickerView.mm >@@ -0,0 +1,105 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#import "config.h" >+#import "WKInkPickerView.h" >+ >+#if HAVE(PENCILKIT) >+ >+#import "WKDrawingView.h" >+ >+#import "PencilKitSoftLink.h" >+ >+@interface WKInkPickerView () <PKInlineInkPickerDelegate> >+@end >+ >+@implementation WKInkPickerView { >+ RetainPtr<PKInlineInkPicker> _inlinePicker; >+ RetainPtr<WKDrawingView> _drawingView; >+} >+ >+- (instancetype)initWithDrawingView:(WKDrawingView *)drawingView >+{ >+ self = [super initWithFrame:CGRectZero]; >+ if (!self) >+ return nil; >+ >+ _inlinePicker = adoptNS([WebKit::allocPKInlineInkPickerInstance() init]); >+ [_inlinePicker setSelectedInk:[drawingView canvasView].ink animated:NO]; >+ [_inlinePicker addTarget:self action:@selector(didPickInk) forControlEvents:UIControlEventValueChanged]; >+ [_inlinePicker setDelegate:self]; >+ >+ _drawingView = drawingView; >+ [self addSubview:_inlinePicker.get()]; >+ >+ return self; >+} >+ >+- (void)didPickInk >+{ >+ [_drawingView canvasView].ink = [_inlinePicker selectedInk]; >+} >+ >+- (void)inlineInkPickerDidToggleRuler:(PKInlineInkPicker *)inlineInkPicker >+{ >+ [_drawingView canvasView].rulerEnabled = ![_drawingView canvasView].rulerEnabled; >+} >+ >+- (void)inlineInkPicker:(PKInlineInkPicker *)inlineInkPicker didSelectTool:(PKInkIdentifier)identifer >+{ >+ [self didPickInk]; >+} >+ >+- (void)inlineInkPicker:(PKInlineInkPicker *)inlineInkPicker didSelectColor:(UIColor *)color >+{ >+ [self didPickInk]; >+} >+ >+- (CGSize)inkPickerSize >+{ >+ CGSize keyboardSize = [UIKeyboard defaultSizeForInterfaceOrientation:[UIApp interfaceOrientation]]; >+ return [_inlinePicker sizeThatFits:keyboardSize]; >+} >+ >+- (void)layoutSubviews >+{ >+ CGSize pickerSize = self.inkPickerSize; >+ [_inlinePicker setFrame:CGRectMake(CGRectGetMidX(self.bounds) - (pickerSize.width / 2), 0, pickerSize.width, pickerSize.height)]; >+} >+ >+- (CGSize)sizeThatFits:(CGSize)size >+{ >+ CGSize keyboardSize = [UIKeyboard defaultSizeForInterfaceOrientation:[UIApp interfaceOrientation]]; >+ return CGSizeMake(keyboardSize.width, self.inkPickerSize.height); >+} >+ >+- (UIViewController *)viewControllerForPopoverPresentationFromInlineInkPicker:(PKInlineInkPicker *)inlineInkPicker >+{ >+ return [UIViewController _viewControllerForFullScreenPresentationFromView:_drawingView.get()]; >+} >+ >+@end >+ >+#endif // HAVE(PENCILKIT) >diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >index 2832bb7c4b81ae89965666ee4b517fe0d307b1f7..dcd9f76a7be2c7a02170c911c5b1486928087e1d 100644 >--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj >+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >@@ -2545,8 +2545,6 @@ > 2D6AB540192B1C4A003A9FD1 /* WKPDFPageNumberIndicator.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKPDFPageNumberIndicator.mm; path = ios/WKPDFPageNumberIndicator.mm; sourceTree = "<group>"; }; > 2D6B371918A967AD0042AE80 /* _WKThumbnailView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKThumbnailView.h; sourceTree = "<group>"; }; > 2D6B371A18A967AD0042AE80 /* _WKThumbnailView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKThumbnailView.mm; sourceTree = "<group>"; }; >- 2D6BF11E21AE145F001E79C9 /* WKInkPickerControl.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = WKInkPickerControl.mm; path = ios/WKInkPickerControl.mm; sourceTree = "<group>"; }; >- 2D6BF11F21AE145F001E79C9 /* WKInkPickerControl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WKInkPickerControl.h; path = ios/WKInkPickerControl.h; sourceTree = "<group>"; }; > 2D6BF12121AF56E1001E79C9 /* PencilKitSoftLink.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PencilKitSoftLink.mm; path = ios/PencilKitSoftLink.mm; sourceTree = "<group>"; }; > 2D6BF12221AF56E1001E79C9 /* PencilKitSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PencilKitSoftLink.h; path = ios/PencilKitSoftLink.h; sourceTree = "<group>"; }; > 2D6CD117189058A500E5A4A0 /* ViewSnapshotStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewSnapshotStore.h; sourceTree = "<group>"; }; >@@ -2791,6 +2789,8 @@ > 2DE6943B18BD2A68005C15E5 /* SmartMagnificationControllerMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SmartMagnificationControllerMessageReceiver.cpp; path = DerivedSources/WebKit2/SmartMagnificationControllerMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; > 2DE6943C18BD2A68005C15E5 /* SmartMagnificationControllerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SmartMagnificationControllerMessages.h; path = DerivedSources/WebKit2/SmartMagnificationControllerMessages.h; sourceTree = BUILT_PRODUCTS_DIR; }; > 2DEAC5CE1AC368BB00A195D8 /* _WKFindOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKFindOptions.h; sourceTree = "<group>"; }; >+ 2DF3962A21C8DC50008835E3 /* WKInkPickerView.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = WKInkPickerView.mm; path = ios/WKInkPickerView.mm; sourceTree = "<group>"; }; >+ 2DF3962B21C8DC50008835E3 /* WKInkPickerView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WKInkPickerView.h; path = ios/WKInkPickerView.h; sourceTree = "<group>"; }; > 2DF9593418A42412009785A1 /* ViewGestureControllerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ViewGestureControllerIOS.mm; path = ios/ViewGestureControllerIOS.mm; sourceTree = "<group>"; }; > 2DF9EEE31A781FB400B6CFBE /* APIFrameInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIFrameInfo.cpp; sourceTree = "<group>"; }; > 2DF9EEE41A781FB400B6CFBE /* APIFrameInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIFrameInfo.h; sourceTree = "<group>"; }; >@@ -5833,8 +5833,8 @@ > 0FCB4E4118BBE044000FCFC9 /* WKGeolocationProviderIOSObjCSecurityOrigin.mm */, > 933DF82D1B3BC09000AEA9E3 /* WKImagePreviewViewController.h */, > 933DF82F1B3BC0B400AEA9E3 /* WKImagePreviewViewController.mm */, >- 2D6BF11F21AE145F001E79C9 /* WKInkPickerControl.h */, >- 2D6BF11E21AE145F001E79C9 /* WKInkPickerControl.mm */, >+ 2DF3962B21C8DC50008835E3 /* WKInkPickerView.h */, >+ 2DF3962A21C8DC50008835E3 /* WKInkPickerView.mm */, > 0F3C7259196F5F6800AEDD0C /* WKInspectorHighlightView.h */, > 0F3C7257196F5F5000AEDD0C /* WKInspectorHighlightView.mm */, > A54293A2195A43C6002782C7 /* WKInspectorNodeSearchGestureRecognizer.h */,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192839
:
357641
|
357732
|
357733