WebKit Bugzilla
Attachment 357732 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-20181219150626.patch (text/plain), 28.23 KB, created by
Tim Horton
on 2018-12-19 15:06:27 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Tim Horton
Created:
2018-12-19 15:06:27 PST
Size:
28.23 KB
patch
obsolete
>Subversion Revision: 239382 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 8b59e74740361431ce429b0f39b66157505db743..50849895a3724afb5dc55eafe0d20d9502955170 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 Wenson Hsieh. >+ >+ * 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-19 Truitt Savell <tsavell@apple.com> > > Unreviewed, rolling out r239358. >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 dee8988c420adccd57edb2cdc9b429a1f5e9c7b4..543a5e21c880966be14ad0073c3416bb7cc9b271 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" >@@ -1365,6 +1365,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) >@@ -1375,8 +1376,6 @@ - (BOOL)_requiresKeyboardWhenFirstResponder > case WebKit::InputType::DateTimeLocal: > case WebKit::InputType::Time: > return !currentUserInterfaceIdiomIsPad(); >- case WebKit::InputType::Drawing: >- return YES; > default: > return !_assistedNodeInformation.isReadOnly; > } >@@ -1425,14 +1424,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]); >@@ -2194,6 +2185,7 @@ - (BOOL)requiresAccessoryView > > switch (_assistedNodeInformation.elementType) { > case WebKit::InputType::None: >+ case WebKit::InputType::Drawing: > return NO; > case WebKit::InputType::Text: > case WebKit::InputType::Password: >@@ -2216,8 +2208,6 @@ - (BOOL)requiresAccessoryView > case WebKit::InputType::Color: > #endif > return !currentUserInterfaceIdiomIsPad(); >- case WebKit::InputType::Drawing: >- return YES; > } > } > >@@ -4447,6 +4437,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; > >@@ -4497,6 +4492,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 >@@ -4530,6 +4526,11 @@ - (void)_stopAssistingNode > { > SetForScope<BOOL> isBlurringFocusedNodeForScope { _isBlurringFocusedNode, YES }; > >+#if HAVE(PENCILKIT) >+ if (_inkPicker) >+ [self _uninstallInkPicker]; >+#endif >+ > [_formInputSession invalidate]; > _formInputSession = nil; > >@@ -6210,6 +6211,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..2133a275b923f15afbe2d8eb7a9322a3ab21b26b >--- /dev/null >+++ b/Source/WebKit/UIProcess/ios/WKInkPickerView.h >@@ -0,0 +1,42 @@ >+/* >+ * 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)init NS_UNAVAILABLE; >+- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE; >+- (instancetype)initWithCoder:(NSCoder *)coder NS_UNAVAILABLE; >+ >+- (instancetype)initWithDrawingView:(WKDrawingView *)drawingView NS_DESIGNATED_INITIALIZER; >+ >+@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 ffb8f95036b852b7854c494f4420ba958a1282d5..ef1b05db47ddb0b8f14f2aeb1d044086aaa36860 100644 >--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj >+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >@@ -2546,8 +2546,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>"; }; >@@ -2792,6 +2790,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>"; }; >@@ -5835,8 +5835,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 */, >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index ffe070456b7b741f1523fdb8f783c4293c87143d..d4cb8e30b5d7b72e7b6f5f5d3ae29a11310532d7 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,18 @@ >+2018-12-19 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 Wenson Hsieh. >+ >+ * editing/images/basic-editable-image-with-gesture.html: Added. >+ * resources/ui-helper.js: >+ (window.UIHelper.stylusTapAt.return.new.Promise): >+ (window.UIHelper.stylusTapAt): >+ Add a test that ensures that adding an editable image from a gesture >+ doesn't crash, and can be drawn on. >+ > 2018-12-19 Ryan Haddad <ryanhaddad@apple.com> > > REGRESSION (r234940): [ MacOS ] Layout Test imported/w3c/web-platform-tests/media-source/mediasource-changetype-play.html is flaky >diff --git a/LayoutTests/editing/images/basic-editable-image-with-gesture.html b/LayoutTests/editing/images/basic-editable-image-with-gesture.html >new file mode 100644 >index 0000000000000000000000000000000000000000..70c16ec3d42b78c6565dfe16235e12b48fe5a90e >--- /dev/null >+++ b/LayoutTests/editing/images/basic-editable-image-with-gesture.html >@@ -0,0 +1,22 @@ >+<!DOCTYPE html><!-- webkit-test-runner [ enableEditableImages=true ] --> >+<head> >+<script src="../../resources/ui-helper.js"></script> >+<script> >+if (window.testRunner) { >+ testRunner.dumpAsText(); >+ testRunner.waitUntilDone(); >+} >+ >+addEventListener("load", async () => { >+ await UIHelper.stylusTapAt(0, 0); >+ const initialNumberOfStrokesInEditableImage = (await UIHelper.numberOfStrokesInEditableImage()); >+ await UIHelper.drawSquareInEditableImage(); >+ const numberOfStrokesInEditableImageAfterDrawing = (await UIHelper.numberOfStrokesInEditableImage()); >+ document.getElementById("log").innerHTML = `Had ${initialNumberOfStrokesInEditableImage} strokes in editable image before drawing.<br/>Had ${numberOfStrokesInEditableImageAfterDrawing} stroke in editable image after drawing.`; >+ testRunner.notifyDone(); >+}); >+</script> >+</head> >+<body contenteditable> >+<div id="log"></div> >+</body> >diff --git a/LayoutTests/resources/ui-helper.js b/LayoutTests/resources/ui-helper.js >index 67c52c0b9021f51d42ab6159da98f57d7bccbf0d..1ee35c5a1c96cd8c206b16ee465eae78d2e3bb15 100644 >--- a/LayoutTests/resources/ui-helper.js >+++ b/LayoutTests/resources/ui-helper.js >@@ -443,6 +443,19 @@ window.UIHelper = class UIHelper { > return new Promise(resolve => testRunner.runUIScript(`uiController.drawSquareInEditableImage()`, resolve)); > } > >+ static stylusTapAt(x, y) >+ { >+ if (!this.isWebKit2()) >+ return Promise.resolve(); >+ >+ return new Promise((resolve) => { >+ testRunner.runUIScript(` >+ uiController.stylusTapAtPoint(${x}, ${y}, 2, 1, 0.5, function() { >+ uiController.uiScriptComplete('Done'); >+ });`, resolve); >+ }); >+ } >+ > static numberOfStrokesInEditableImage() > { > if (!this.isWebKit2())
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