Title: [238708] trunk/Source
Revision
238708
Author
[email protected]
Date
2018-11-29 16:32:14 -0800 (Thu, 29 Nov 2018)

Log Message

Make drawing tools available when an editable image is focused
https://bugs.webkit.org/show_bug.cgi?id=192172
<rdar://problem/30337960>

Reviewed by Dean Jackson.

* Platform/spi/ios/PencilKitSPI.h:
Add some more SPI.

* Shared/AssistedNodeInformation.cpp:
(WebKit::AssistedNodeInformation::encode const):
(WebKit::AssistedNodeInformation::decode):
* Shared/AssistedNodeInformation.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::handleStylusSingleTapAtPoint):
(WebKit::isAssistableElement):
(WebKit::WebPage::getAssistedNodeInformation):
Plumb the assisted node's embedded view ID, if available.
Also add a new input type for drawings, and use it when appropriate.

* SourcesCocoa.txt:
* UIProcess/API/Cocoa/_WKFocusedElementInfo.h:
Add WKInputTypeDrawing.

* UIProcess/ios/PencilKitSoftLink.h: Added.
* UIProcess/ios/PencilKitSoftLink.mm: Added.
Pull soft-linking out into its own file, to fix unified sources.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKFocusedElementInfo initWithAssistedNodeInformation:isUserInitiated:userObject:]):
(-[WKContentView _requiresKeyboardWhenFirstResponder]):
(-[WKContentView requiresAccessoryView]):
Install a keyboard when a drawing is focused.
Also, deduplicate one "curretUserInterfaceIdiomIsPad"; just fall through.

(-[WKContentView inputView]):
Make a WKInkPickerControl when a drawing is focused.

(-[WKContentView textInputTraits]):
(isAssistableInputType):
* UIProcess/ios/WKDrawingView.h:
* UIProcess/ios/WKDrawingView.mm:
(-[WKDrawingView initWithEmbeddedViewID:webPageProxy:]):
(-[WKDrawingView PNGRepresentation]):
(-[WKDrawingView loadDrawingFromPNGRepresentation:]):
Adopt PencilKitSoftLink.

(-[WKDrawingView canvasView]):
Expose the internal canvas view for use by WKInkPickerControl.

* UIProcess/ios/WKInkPickerControl.h: Copied from Source/WebKit/Platform/spi/ios/PencilKitSPI.h.
* UIProcess/ios/WKInkPickerControl.mm: Added.
(-[WKInkPickerView initWithFrame:drawingView:]):
(-[WKInkPickerView didPickInk]):
(-[WKInkPickerView inlineInkPickerDidToggleRuler:]):
(-[WKInkPickerView inlineInkPicker:didSelectTool:]):
(-[WKInkPickerView inlineInkPicker:didSelectColor:]):
(-[WKInkPickerView inkPickerSize]):
(-[WKInkPickerView layoutSubviews]):
(-[WKInkPickerView sizeThatFits:]):
(-[WKInkPickerView viewControllerForPopoverPresentationFromInlineInkPicker:]):
(-[WKInkPickerControl initWithDrawingView:]):
(-[WKInkPickerControl beginEditing]):
(-[WKInkPickerControl endEditing]):
(-[WKInkPickerControl assistantView]):
Install and hook up a PKInlineInkPicker.
Center it in the keyboard.
Plumb changes through to the canvas view.

* WebKit.xcodeproj/project.pbxproj:

* editing/Editor.cpp:
(WebCore::Editor::insertEditableImage):
* editing/Editor.h:
* editing/InsertEditableImageCommand.cpp:
(WebCore::InsertEditableImageCommand::insertEditableImage):
(WebCore::InsertEditableImageCommand::doApply):
* editing/InsertEditableImageCommand.h:
Add InsertEditableImageCommand::insertEditableImage, which returns the
inserted image element.

* html/HTMLImageElement.h:
Make HTMLImageElement focusable if it is editable.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (238707 => 238708)


--- trunk/Source/WebCore/ChangeLog	2018-11-30 00:28:57 UTC (rev 238707)
+++ trunk/Source/WebCore/ChangeLog	2018-11-30 00:32:14 UTC (rev 238708)
@@ -1,3 +1,24 @@
+2018-11-29  Tim Horton  <[email protected]>
+
+        Make drawing tools available when an editable image is focused
+        https://bugs.webkit.org/show_bug.cgi?id=192172
+        <rdar://problem/30337960>
+
+        Reviewed by Dean Jackson.
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::insertEditableImage):
+        * editing/Editor.h:
+        * editing/InsertEditableImageCommand.cpp:
+        (WebCore::InsertEditableImageCommand::insertEditableImage):
+        (WebCore::InsertEditableImageCommand::doApply):
+        * editing/InsertEditableImageCommand.h:
+        Add InsertEditableImageCommand::insertEditableImage, which returns the
+        inserted image element.
+
+        * html/HTMLImageElement.h:
+        Make HTMLImageElement focusable if it is editable.
+
 2018-11-29  Zalan Bujtas  <[email protected]>
 
         [LFC][BFC][Quirk] Body and html height stretching.

Modified: trunk/Source/WebCore/editing/Editor.cpp (238707 => 238708)


--- trunk/Source/WebCore/editing/Editor.cpp	2018-11-30 00:28:57 UTC (rev 238707)
+++ trunk/Source/WebCore/editing/Editor.cpp	2018-11-30 00:32:14 UTC (rev 238708)
@@ -4251,9 +4251,9 @@
     return { };
 }
 
-void Editor::insertEditableImage()
+RefPtr<HTMLImageElement> Editor::insertEditableImage()
 {
-    InsertEditableImageCommand::create(document())->apply();
+    return InsertEditableImageCommand::insertEditableImage(document());
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/editing/Editor.h (238707 => 238708)


--- trunk/Source/WebCore/editing/Editor.h	2018-11-30 00:28:57 UTC (rev 238707)
+++ trunk/Source/WebCore/editing/Editor.h	2018-11-30 00:32:14 UTC (rev 238708)
@@ -532,7 +532,7 @@
 #endif
 #endif
 
-    WEBCORE_EXPORT void insertEditableImage();
+    WEBCORE_EXPORT RefPtr<HTMLImageElement> insertEditableImage();
 
 private:
     Document& document() const;

Modified: trunk/Source/WebCore/editing/InsertEditableImageCommand.cpp (238707 => 238708)


--- trunk/Source/WebCore/editing/InsertEditableImageCommand.cpp	2018-11-30 00:28:57 UTC (rev 238707)
+++ trunk/Source/WebCore/editing/InsertEditableImageCommand.cpp	2018-11-30 00:32:14 UTC (rev 238708)
@@ -31,6 +31,13 @@
 
 namespace WebCore {
 
+RefPtr<HTMLImageElement> InsertEditableImageCommand::insertEditableImage(Document& document)
+{
+    RefPtr<InsertEditableImageCommand> insertCommand = create(document);
+    insertCommand->apply();
+    return insertCommand->m_imageElement;
+}
+
 InsertEditableImageCommand::InsertEditableImageCommand(Document& document)
     : CompositeEditCommand(document)
 {
@@ -41,14 +48,14 @@
     if (endingSelection().isNone())
         return;
 
-    auto imgElement = HTMLImageElement::create(document());
-    imgElement->setAttributeWithoutSynchronization(x_apple_editable_imageAttr, emptyAtom());
-    imgElement->setAttributeWithoutSynchronization(widthAttr, AtomicString("100%", AtomicString::ConstructFromLiteral));
-    imgElement->setAttributeWithoutSynchronization(heightAttr, AtomicString("300px", AtomicString::ConstructFromLiteral));
-    imgElement->setAttributeWithoutSynchronization(styleAttr, AtomicString("display: block", AtomicString::ConstructFromLiteral));
+    m_imageElement = HTMLImageElement::create(document());
+    m_imageElement->setAttributeWithoutSynchronization(x_apple_editable_imageAttr, emptyAtom());
+    m_imageElement->setAttributeWithoutSynchronization(widthAttr, AtomicString("100%", AtomicString::ConstructFromLiteral));
+    m_imageElement->setAttributeWithoutSynchronization(heightAttr, AtomicString("300px", AtomicString::ConstructFromLiteral));
+    m_imageElement->setAttributeWithoutSynchronization(styleAttr, AtomicString("display: block", AtomicString::ConstructFromLiteral));
 
-    insertNodeAt(imgElement.copyRef(), endingSelection().start());
-    setEndingSelection(visiblePositionAfterNode(imgElement.get()));
+    insertNodeAt(*m_imageElement, endingSelection().start());
+    setEndingSelection(visiblePositionAfterNode(*m_imageElement));
 }
 
 }

Modified: trunk/Source/WebCore/editing/InsertEditableImageCommand.h (238707 => 238708)


--- trunk/Source/WebCore/editing/InsertEditableImageCommand.h	2018-11-30 00:28:57 UTC (rev 238707)
+++ trunk/Source/WebCore/editing/InsertEditableImageCommand.h	2018-11-30 00:32:14 UTC (rev 238708)
@@ -36,11 +36,15 @@
         return adoptRef(*new InsertEditableImageCommand(document));
     }
 
+    static RefPtr<HTMLImageElement> insertEditableImage(Document&);
+
 private:
     InsertEditableImageCommand(Document&);
 
     void doApply() override;
     EditAction editingAction() const final { return EditAction::InsertEditableImage; }
+
+    RefPtr<HTMLImageElement> m_imageElement;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/html/HTMLImageElement.cpp (238707 => 238708)


--- trunk/Source/WebCore/html/HTMLImageElement.cpp	2018-11-30 00:28:57 UTC (rev 238707)
+++ trunk/Source/WebCore/html/HTMLImageElement.cpp	2018-11-30 00:32:14 UTC (rev 238708)
@@ -291,6 +291,20 @@
     return false;
 }
 
+bool HTMLImageElement::supportsFocus() const
+{
+    if (hasEditableImageAttribute())
+        return true;
+    return HTMLElement::supportsFocus();
+}
+
+bool HTMLImageElement::isFocusable() const
+{
+    if (hasEditableImageAttribute())
+        return true;
+    return HTMLElement::isFocusable();
+}
+
 void HTMLImageElement::didAttachRenderers()
 {
     if (!is<RenderImage>(renderer()))

Modified: trunk/Source/WebCore/html/HTMLImageElement.h (238707 => 238708)


--- trunk/Source/WebCore/html/HTMLImageElement.h	2018-11-30 00:28:57 UTC (rev 238707)
+++ trunk/Source/WebCore/html/HTMLImageElement.h	2018-11-30 00:32:14 UTC (rev 238708)
@@ -56,6 +56,9 @@
     WEBCORE_EXPORT int naturalHeight() const;
     const AtomicString& currentSrc() const { return m_currentSrc; }
 
+    bool supportsFocus() const override;
+    bool isFocusable() const override;
+
     bool isServerMap() const;
 
     const AtomicString& altText() const;
@@ -115,8 +118,8 @@
     WEBCORE_EXPORT bool isSystemPreviewImage() const;
 #endif
 
-    GraphicsLayer::EmbeddedViewID editableImageViewID() const;
-    bool hasEditableImageAttribute() const;
+    WEBCORE_EXPORT GraphicsLayer::EmbeddedViewID editableImageViewID() const;
+    WEBCORE_EXPORT bool hasEditableImageAttribute() const;
 
 protected:
     HTMLImageElement(const QualifiedName&, Document&, HTMLFormElement* = 0);

Modified: trunk/Source/WebKit/ChangeLog (238707 => 238708)


--- trunk/Source/WebKit/ChangeLog	2018-11-30 00:28:57 UTC (rev 238707)
+++ trunk/Source/WebKit/ChangeLog	2018-11-30 00:32:14 UTC (rev 238708)
@@ -1,3 +1,76 @@
+2018-11-29  Tim Horton  <[email protected]>
+
+        Make drawing tools available when an editable image is focused
+        https://bugs.webkit.org/show_bug.cgi?id=192172
+        <rdar://problem/30337960>
+
+        Reviewed by Dean Jackson.
+
+        * Platform/spi/ios/PencilKitSPI.h:
+        Add some more SPI.
+
+        * Shared/AssistedNodeInformation.cpp:
+        (WebKit::AssistedNodeInformation::encode const):
+        (WebKit::AssistedNodeInformation::decode):
+        * Shared/AssistedNodeInformation.h:
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::handleStylusSingleTapAtPoint):
+        (WebKit::isAssistableElement):
+        (WebKit::WebPage::getAssistedNodeInformation):
+        Plumb the assisted node's embedded view ID, if available.
+        Also add a new input type for drawings, and use it when appropriate.
+
+        * SourcesCocoa.txt:
+        * UIProcess/API/Cocoa/_WKFocusedElementInfo.h:
+        Add WKInputTypeDrawing.
+
+        * UIProcess/ios/PencilKitSoftLink.h: Added.
+        * UIProcess/ios/PencilKitSoftLink.mm: Added.
+        Pull soft-linking out into its own file, to fix unified sources.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKFocusedElementInfo initWithAssistedNodeInformation:isUserInitiated:userObject:]):
+        (-[WKContentView _requiresKeyboardWhenFirstResponder]):
+        (-[WKContentView requiresAccessoryView]):
+        Install a keyboard when a drawing is focused.
+        Also, deduplicate one "curretUserInterfaceIdiomIsPad"; just fall through.
+
+        (-[WKContentView inputView]):
+        Make a WKInkPickerControl when a drawing is focused.
+
+        (-[WKContentView textInputTraits]):
+        (isAssistableInputType):
+        * UIProcess/ios/WKDrawingView.h:
+        * UIProcess/ios/WKDrawingView.mm:
+        (-[WKDrawingView initWithEmbeddedViewID:webPageProxy:]):
+        (-[WKDrawingView PNGRepresentation]):
+        (-[WKDrawingView loadDrawingFromPNGRepresentation:]):
+        Adopt PencilKitSoftLink.
+
+        (-[WKDrawingView canvasView]):
+        Expose the internal canvas view for use by WKInkPickerControl.
+
+        * UIProcess/ios/WKInkPickerControl.h: Copied from Source/WebKit/Platform/spi/ios/PencilKitSPI.h.
+        * UIProcess/ios/WKInkPickerControl.mm: Added.
+        (-[WKInkPickerView initWithFrame:drawingView:]):
+        (-[WKInkPickerView didPickInk]):
+        (-[WKInkPickerView inlineInkPickerDidToggleRuler:]):
+        (-[WKInkPickerView inlineInkPicker:didSelectTool:]):
+        (-[WKInkPickerView inlineInkPicker:didSelectColor:]):
+        (-[WKInkPickerView inkPickerSize]):
+        (-[WKInkPickerView layoutSubviews]):
+        (-[WKInkPickerView sizeThatFits:]):
+        (-[WKInkPickerView viewControllerForPopoverPresentationFromInlineInkPicker:]):
+        (-[WKInkPickerControl initWithDrawingView:]):
+        (-[WKInkPickerControl beginEditing]):
+        (-[WKInkPickerControl endEditing]):
+        (-[WKInkPickerControl assistantView]):
+        Install and hook up a PKInlineInkPicker.
+        Center it in the keyboard.
+        Plumb changes through to the canvas view.
+
+        * WebKit.xcodeproj/project.pbxproj:
+
 2018-11-29  Per Arne Vollan  <[email protected]>
 
         [macOS] Add logging for some sandbox entries.

Modified: trunk/Source/WebKit/Platform/spi/ios/PencilKitSPI.h (238707 => 238708)


--- trunk/Source/WebKit/Platform/spi/ios/PencilKitSPI.h	2018-11-30 00:28:57 UTC (rev 238707)
+++ trunk/Source/WebKit/Platform/spi/ios/PencilKitSPI.h	2018-11-30 00:32:14 UTC (rev 238708)
@@ -28,22 +28,67 @@
 #if USE(APPLE_INTERNAL_SDK)
 
 #import <PencilKit/PencilKit.h>
+#import <PencilKit/PKCanvasView_Private.h>
 #import <PencilKit/PKDrawing_Private.h>
+#import <PencilKit/PKInlineInkPicker.h>
+#import <PencilKit/PKInlineInkPicker_Private.h>
 
 #else
 
+#import <UIKit/UIKit.h>
+
+@class PKCanvasView;
+@class PKDrawing;
+@class PKInk;
+@class PKInlineInkPicker;
+
+typedef NSString * PKInkIdentifier;
+
+@protocol PKCanvasViewDelegate
+@optional
+- (void)drawingDidChange:(PKCanvasView *)canvasView;
+@end
+
+@protocol PKInlineInkPickerDelegate <NSObject>
+@optional
+- (void)inlineInkPicker:(PKInlineInkPicker *)inlineInkPicker didSelectTool:(PKInkIdentifier)identifer;
+- (void)inlineInkPickerDidToggleRuler:(PKInlineInkPicker *)inlineInkPicker;
+- (void)inlineInkPicker:(PKInlineInkPicker *)inlineInkPicker didSelectColor:(UIColor *)color;
+- (UIViewController *)viewControllerForPopoverPresentationFromInlineInkPicker:(PKInlineInkPicker *)inlineInkPicker;
+@end
+
 @interface PKCanvasView : UIView
 
 @property (nonatomic, getter=isFingerDrawingEnabled) BOOL fingerDrawingEnabled;
+@property (nonatomic) BOOL rulerEnabled;
+@property (nonatomic, copy) PKDrawing *drawing;
+@property (nonatomic, strong) PKInk *ink;
+@property (nonatomic, weak) NSObject<PKCanvasViewDelegate> *drawingDelegate;
 
 @end
 
+@interface PKInlineInkPicker : UIControl
+
+@property (nonatomic, copy) PKInk *selectedInk;
+- (void)setSelectedInk:(PKInk *)selectedInk animated:(BOOL)animated;
+@property (nonatomic, weak) id<PKInlineInkPickerDelegate> delegate;
+
+@end
+
 @interface PKDrawing : NSObject
 
+- (instancetype)initWithData:(NSData *)data error:(NSError **)error;
 - (NSData *)serialize;
 
 @end
 
+@interface PKImageRenderer : NSObject
+
+- (instancetype)initWithSize:(CGSize)size scale:(CGFloat)scale renderQueue:(dispatch_queue_t)renderQueue;
+- (void)renderDrawing:(PKDrawing *)drawing completion:(void(^)(UIImage *image))completionBlock;
+
+@end
+
 #endif
 
 #endif // HAVE(PENCILKIT)

Modified: trunk/Source/WebKit/Shared/AssistedNodeInformation.cpp (238707 => 238708)


--- trunk/Source/WebKit/Shared/AssistedNodeInformation.cpp	2018-11-30 00:28:57 UTC (rev 238707)
+++ trunk/Source/WebKit/Shared/AssistedNodeInformation.cpp	2018-11-30 00:32:14 UTC (rev 238708)
@@ -97,6 +97,7 @@
     encoder << placeholder;
     encoder << label;
     encoder << ariaLabel;
+    encoder << embeddedViewID;
     encoder << assistedNodeIdentifier;
 #if ENABLE(DATALIST_ELEMENT)
     encoder << hasSuggestions;
@@ -210,6 +211,9 @@
     if (!decoder.decode(result.ariaLabel))
         return false;
 
+    if (!decoder.decode(result.embeddedViewID))
+        return false;
+
     if (!decoder.decode(result.assistedNodeIdentifier))
         return false;
 

Modified: trunk/Source/WebKit/Shared/AssistedNodeInformation.h (238707 => 238708)


--- trunk/Source/WebKit/Shared/AssistedNodeInformation.h	2018-11-30 00:28:57 UTC (rev 238707)
+++ trunk/Source/WebKit/Shared/AssistedNodeInformation.h	2018-11-30 00:32:14 UTC (rev 238708)
@@ -29,6 +29,7 @@
 #include <WebCore/AutocapitalizeTypes.h>
 #include <WebCore/Autofill.h>
 #include <WebCore/Color.h>
+#include <WebCore/GraphicsLayer.h>
 #include <WebCore/InputMode.h>
 #include <WebCore/IntRect.h>
 #include <WebCore/URL.h>
@@ -55,6 +56,7 @@
     Week,
     Time,
     Select,
+    Drawing,
 #if ENABLE(INPUT_TYPE_COLOR)
     Color
 #endif
@@ -126,6 +128,7 @@
     String placeholder;
     String label;
     String ariaLabel;
+    WebCore::GraphicsLayer::EmbeddedViewID embeddedViewID;
 #if ENABLE(DATALIST_ELEMENT)
     bool hasSuggestions { false };
 #if ENABLE(INPUT_TYPE_COLOR)

Modified: trunk/Source/WebKit/SourcesCocoa.txt (238707 => 238708)


--- trunk/Source/WebKit/SourcesCocoa.txt	2018-11-30 00:28:57 UTC (rev 238707)
+++ trunk/Source/WebKit/SourcesCocoa.txt	2018-11-30 00:32:14 UTC (rev 238708)
@@ -371,6 +371,7 @@
 UIProcess/ios/EditableImageController.mm
 UIProcess/ios/InputViewUpdateDeferrer.mm
 UIProcess/ios/PageClientImplIOS.mm
+UIProcess/ios/PencilKitSoftLink.mm
 UIProcess/ios/ProcessAssertionIOS.mm
 UIProcess/ios/ResourceLoadStatisticsPersistentStorageIOS.mm
 UIProcess/ios/SmartMagnificationController.mm
@@ -387,6 +388,7 @@
 UIProcess/ios/WKDrawingView.mm
 UIProcess/ios/WKGeolocationProviderIOS.mm
 UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm
+UIProcess/ios/WKInkPickerControl.mm
 UIProcess/ios/WKInspectorNodeSearchGestureRecognizer.mm
 UIProcess/ios/WKKeyboardScrollingAnimator.mm
 UIProcess/ios/WKLegacyPDFView.mm

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKFocusedElementInfo.h (238707 => 238708)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKFocusedElementInfo.h	2018-11-30 00:28:57 UTC (rev 238707)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKFocusedElementInfo.h	2018-11-30 00:32:14 UTC (rev 238708)
@@ -53,7 +53,8 @@
     WKInputTypeWeek,
     WKInputTypeTime,
     WKInputTypeSelect,
-    WKInputTypeColor
+    WKInputTypeColor,
+    WKInputTypeDrawing,
 };
 
 /**

Added: trunk/Source/WebKit/UIProcess/ios/PencilKitSoftLink.h (0 => 238708)


--- trunk/Source/WebKit/UIProcess/ios/PencilKitSoftLink.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/ios/PencilKitSoftLink.h	2018-11-30 00:32:14 UTC (rev 238708)
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#if HAVE(PENCILKIT)
+
+#import "PencilKitSPI.h"
+#import <wtf/SoftLinking.h>
+
+SOFT_LINK_FRAMEWORK_FOR_HEADER(WebKit, PencilKit);
+SOFT_LINK_CLASS_FOR_HEADER(WebKit, PKCanvasView);
+SOFT_LINK_CLASS_FOR_HEADER(WebKit, PKDrawing);
+SOFT_LINK_CLASS_FOR_HEADER(WebKit, PKImageRenderer);
+SOFT_LINK_CLASS_FOR_HEADER(WebKit, PKInlineInkPicker);
+
+#endif // HAVE(PENCILKIT)

Added: trunk/Source/WebKit/UIProcess/ios/PencilKitSoftLink.mm (0 => 238708)


--- trunk/Source/WebKit/UIProcess/ios/PencilKitSoftLink.mm	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/ios/PencilKitSoftLink.mm	2018-11-30 00:32:14 UTC (rev 238708)
@@ -0,0 +1,39 @@
+/*
+ * 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"
+
+#if HAVE(PENCILKIT)
+
+#import "PencilKitSPI.h"
+#import <wtf/SoftLinking.h>
+
+SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE(WebKit, PencilKit);
+SOFT_LINK_CLASS_FOR_SOURCE(WebKit, PencilKit, PKCanvasView);
+SOFT_LINK_CLASS_FOR_SOURCE(WebKit, PencilKit, PKDrawing);
+SOFT_LINK_CLASS_FOR_SOURCE(WebKit, PencilKit, PKImageRenderer);
+SOFT_LINK_CLASS_FOR_SOURCE(WebKit, PencilKit, PKInlineInkPicker);
+
+#endif // HAVE(PENCILKIT)

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (238707 => 238708)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2018-11-30 00:28:57 UTC (rev 238707)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2018-11-30 00:32:14 UTC (rev 238708)
@@ -29,6 +29,7 @@
 #if PLATFORM(IOS_FAMILY)
 
 #import "APIUIClient.h"
+#import "EditableImageController.h"
 #import "EditingRange.h"
 #import "InputViewUpdateDeferrer.h"
 #import "Logging.h"
@@ -46,6 +47,7 @@
 #import "WKFormInputControl.h"
 #import "WKFormSelectControl.h"
 #import "WKImagePreviewViewController.h"
+#import "WKInkPickerControl.h"
 #import "WKInspectorNodeSearchGestureRecognizer.h"
 #import "WKNSURLExtras.h"
 #import "WKPreviewActionItemIdentifiers.h"
@@ -488,6 +490,9 @@
     case WebKit::InputType::Select:
         _type = WKInputTypeSelect;
         break;
+    case WebKit::InputType::Drawing:
+        _type = WKInputTypeDrawing;
+        break;
 #if ENABLE(INPUT_TYPE_COLOR)
     case WebKit::InputType::Color:
         _type = WKInputTypeColor;
@@ -1352,12 +1357,13 @@
 #if ENABLE(INPUT_TYPE_COLOR)
     case InputType::Color:
 #endif
-        return !currentUserInterfaceIdiomIsPad();
     case InputType::Date:
     case InputType::Month:
     case InputType::DateTimeLocal:
     case InputType::Time:
         return !currentUserInterfaceIdiomIsPad();
+    case InputType::Drawing:
+        return YES;
     default:
         return !_assistedNodeInformation.isReadOnly;
     }
@@ -1407,6 +1413,14 @@
             _inputPeripheral = adoptNS([[WKFormColorControl alloc] initWithView:self]);
             break;
 #endif
+        case 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]);
             break;
@@ -2189,6 +2203,8 @@
     case InputType::Color:
 #endif
         return !currentUserInterfaceIdiomIsPad();
+    case InputType::Drawing:
+        return YES;
     }
 }
 
@@ -3769,6 +3785,7 @@
         case InputType::Week:
         case InputType::Time:
         case InputType::Select:
+        case InputType::Drawing:
 #if ENABLE(INPUT_TYPE_COLOR)
         case InputType::Color:
 #endif
@@ -4297,6 +4314,7 @@
     case InputType::Week:
     case InputType::Time:
     case InputType::Select:
+    case InputType::Drawing:
 #if ENABLE(INPUT_TYPE_COLOR)
     case InputType::Color:
 #endif

Modified: trunk/Source/WebKit/UIProcess/ios/WKDrawingView.h (238707 => 238708)


--- trunk/Source/WebKit/UIProcess/ios/WKDrawingView.h	2018-11-30 00:28:57 UTC (rev 238707)
+++ trunk/Source/WebKit/UIProcess/ios/WKDrawingView.h	2018-11-30 00:32:14 UTC (rev 238708)
@@ -28,6 +28,8 @@
 #import "RemoteLayerTreeHost.h"
 #import "RemoteLayerTreeViews.h"
 
+OBJC_CLASS PKCanvasView;
+
 @interface WKDrawingView : WKEmbeddedView <WKNativelyInteractible>
 
 - (instancetype)initWithEmbeddedViewID:(WebCore::GraphicsLayer::EmbeddedViewID)embeddedViewID webPageProxy:(WebKit::WebPageProxy&)webPageProxy;
@@ -35,6 +37,8 @@
 - (NSData *)PNGRepresentation;
 - (void)loadDrawingFromPNGRepresentation:(NSData *)PNGData;
 
+@property (nonatomic, readonly) PKCanvasView *canvasView;
+
 @end
 
 

Modified: trunk/Source/WebKit/UIProcess/ios/WKDrawingView.mm (238707 => 238708)


--- trunk/Source/WebKit/UIProcess/ios/WKDrawingView.mm	2018-11-30 00:28:57 UTC (rev 238707)
+++ trunk/Source/WebKit/UIProcess/ios/WKDrawingView.mm	2018-11-30 00:32:14 UTC (rev 238708)
@@ -29,15 +29,10 @@
 #if HAVE(PENCILKIT)
 
 #import "EditableImageController.h"
-#import "PencilKitSPI.h"
+#import "PencilKitSoftLink.h"
 #import <wtf/OSObjectPtr.h>
 #import <wtf/RetainPtr.h>
 
-SOFT_LINK_PRIVATE_FRAMEWORK(PencilKit);
-SOFT_LINK_CLASS(PencilKit, PKCanvasView);
-SOFT_LINK_CLASS(PencilKit, PKDrawing);
-SOFT_LINK_CLASS(PencilKit, PKImageRenderer);
-
 @interface WKDrawingView () <PKCanvasViewDelegate>
 @end
 
@@ -58,7 +53,7 @@
 
     _webPageProxy = makeWeakPtr(webPageProxy);
 
-    _pencilView = adoptNS([allocPKCanvasViewInstance() initWithFrame:CGRectZero]);
+    _pencilView = adoptNS([WebKit::allocPKCanvasViewInstance() initWithFrame:CGRectZero]);
 
     [_pencilView setFingerDrawingEnabled:NO];
     [_pencilView setUserInteractionEnabled:YES];
@@ -92,7 +87,7 @@
         _renderQueue = adoptOSObject(dispatch_queue_create("com.apple.WebKit.WKDrawingView.Rendering", DISPATCH_QUEUE_SERIAL));
 
     if (!_renderer)
-        _renderer = adoptNS([allocPKImageRendererInstance() initWithSize:self.bounds.size scale:self.window.screen.scale renderQueue:_renderQueue.get()]);
+        _renderer = adoptNS([WebKit::allocPKImageRendererInstance() initWithSize:self.bounds.size scale:self.window.screen.scale renderQueue:_renderQueue.get()]);
 
     auto* drawing = [_pencilView drawing];
 
@@ -145,7 +140,7 @@
     if (!base64Drawing)
         return;
     RetainPtr<NSData> drawingData = adoptNS([[NSData alloc] initWithBase64EncodedString:base64Drawing options:0]);
-    RetainPtr<PKDrawing> drawing = adoptNS([allocPKDrawingInstance() initWithData:drawingData.get() error:nil]);
+    RetainPtr<PKDrawing> drawing = adoptNS([WebKit::allocPKDrawingInstance() initWithData:drawingData.get() error:nil]);
     [_pencilView setDrawing:drawing.get()];
 }
 
@@ -163,6 +158,11 @@
     page.editableImageController().invalidateAttachmentForEditableImage(self.embeddedViewID);
 }
 
+- (PKCanvasView *)canvasView
+{
+    return _pencilView.get();
+}
+
 @end
 
 #endif // HAVE(PENCILKIT)

Added: trunk/Source/WebKit/UIProcess/ios/WKInkPickerControl.h (0 => 238708)


--- trunk/Source/WebKit/UIProcess/ios/WKInkPickerControl.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/ios/WKInkPickerControl.h	2018-11-30 00:32:14 UTC (rev 238708)
@@ -0,0 +1,39 @@
+/*
+ * 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)

Added: trunk/Source/WebKit/UIProcess/ios/WKInkPickerControl.mm (0 => 238708)


--- trunk/Source/WebKit/UIProcess/ios/WKInkPickerControl.mm	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/ios/WKInkPickerControl.mm	2018-11-30 00:32:14 UTC (rev 238708)
@@ -0,0 +1,141 @@
+/*
+ * 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)

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (238707 => 238708)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2018-11-30 00:28:57 UTC (rev 238707)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2018-11-30 00:32:14 UTC (rev 238708)
@@ -608,6 +608,7 @@
 		2D5C9D0619C81D8F00B3C5C1 /* WebPageOverlay.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D5C9D0419C81D8F00B3C5C1 /* WebPageOverlay.h */; };
 		2D6AB541192B1C4A003A9FD1 /* WKPDFPageNumberIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D6AB53F192B1C4A003A9FD1 /* WKPDFPageNumberIndicator.h */; };
 		2D6B371B18A967AD0042AE80 /* _WKThumbnailView.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D6B371918A967AD0042AE80 /* _WKThumbnailView.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		2D6BF12421AF56E1001E79C9 /* PencilKitSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D6BF12221AF56E1001E79C9 /* PencilKitSoftLink.h */; };
 		2D6CD119189058A500E5A4A0 /* ViewSnapshotStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D6CD117189058A500E5A4A0 /* ViewSnapshotStore.h */; };
 		2D72A1FA212BF46E00517A20 /* RemoteLayerTreeDrawingArea.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AB16ADB1648598400290D62 /* RemoteLayerTreeDrawingArea.mm */; };
 		2D7303791A7C2B7500F8F487 /* WKPageNavigationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D7303781A7C2B7500F8F487 /* WKPageNavigationClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -2547,6 +2548,10 @@
 		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>"; };
 		2D6CD118189058A500E5A4A0 /* ViewSnapshotStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ViewSnapshotStore.mm; sourceTree = "<group>"; };
 		2D7303781A7C2B7500F8F487 /* WKPageNavigationClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageNavigationClient.h; sourceTree = "<group>"; };
@@ -5802,6 +5807,8 @@
 				0F0C365D18C110A500F607D7 /* LayerRepresentation.mm */,
 				0FCB4E3618BBE044000FCFC9 /* PageClientImplIOS.h */,
 				0FCB4E3718BBE044000FCFC9 /* PageClientImplIOS.mm */,
+				2D6BF12221AF56E1001E79C9 /* PencilKitSoftLink.h */,
+				2D6BF12121AF56E1001E79C9 /* PencilKitSoftLink.mm */,
 				86F9536218FF550B001DB2EF /* ProcessAssertionIOS.mm */,
 				51E6C15F1F29355100FD3437 /* ResourceLoadStatisticsPersistentStorageIOS.mm */,
 				2DAF06D418BD1A470081CEB1 /* SmartMagnificationController.h */,
@@ -5830,6 +5837,8 @@
 				0FCB4E4118BBE044000FCFC9 /* WKGeolocationProviderIOSObjCSecurityOrigin.mm */,
 				933DF82D1B3BC09000AEA9E3 /* WKImagePreviewViewController.h */,
 				933DF82F1B3BC0B400AEA9E3 /* WKImagePreviewViewController.mm */,
+				2D6BF11F21AE145F001E79C9 /* WKInkPickerControl.h */,
+				2D6BF11E21AE145F001E79C9 /* WKInkPickerControl.mm */,
 				0F3C7259196F5F6800AEDD0C /* WKInspectorHighlightView.h */,
 				0F3C7257196F5F5000AEDD0C /* WKInspectorHighlightView.mm */,
 				A54293A2195A43C6002782C7 /* WKInspectorNodeSearchGestureRecognizer.h */,
@@ -9176,6 +9185,7 @@
 				C574A58112E66681002DFE98 /* PasteboardTypes.h in Headers */,
 				C1E123BA20A11573002646F4 /* PDFContextMenu.h in Headers */,
 				E19582D3153CBFD700B60875 /* PDFKitImports.h in Headers */,
+				2D6BF12421AF56E1001E79C9 /* PencilKitSoftLink.h in Headers */,
 				2DC18FB0218912640025A88D /* PencilKitSPI.h in Headers */,
 				5C298DA01C3DF02100470AFE /* PendingDownload.h in Headers */,
 				832ED18C1E2FE157006BA64A /* PerActivityStateCPUUsageSampler.h in Headers */,

Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (238707 => 238708)


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2018-11-30 00:28:57 UTC (rev 238707)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2018-11-30 00:32:14 UTC (rev 238708)
@@ -747,6 +747,8 @@
 
 void WebPage::handleStylusSingleTapAtPoint(const WebCore::IntPoint& point, uint64_t requestID)
 {
+    SetForScope<bool> userIsInteractingChange { m_userIsInteracting, true };
+
     auto& frame = m_page->focusController().focusedOrMainFrame();
 
     auto pointInDocument = frame.view()->rootViewToContents(point);
@@ -771,8 +773,8 @@
 
     auto range = Range::create(*frame.document(), position, position);
     frame.selection().setSelectedRange(range.ptr(), position.affinity(), WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered);
-    frame.editor().insertEditableImage();
-    resetAssistedNodeForFrame(m_mainFrame.get());
+    auto image = frame.editor().insertEditableImage();
+    frame.document()->setFocusedElement(image.get());
 }
 
 void WebPage::potentialTapAtPosition(uint64_t requestID, const WebCore::FloatPoint& position)
@@ -2055,6 +2057,8 @@
         return true;
     if (is<HTMLTextAreaElement>(node))
         return true;
+    if (is<HTMLImageElement>(node) && downcast<HTMLImageElement>(node).hasEditableImageAttribute())
+        return true;
     if (is<HTMLInputElement>(node)) {
         HTMLInputElement& inputElement = downcast<HTMLInputElement>(node);
         // FIXME: This laundry list of types is not a good way to factor this. Need a suitable function on HTMLInputElement itself.
@@ -2519,6 +2523,9 @@
         information.value = element.value();
         information.valueAsNumber = element.valueAsNumber();
         information.autofillFieldName = WebCore::toAutofillFieldName(element.autofillData().fieldName);
+    } else if (is<HTMLImageElement>(*m_assistedNode) && downcast<HTMLImageElement>(*m_assistedNode).hasEditableImageAttribute()) {
+        information.elementType = InputType::Drawing;
+        information.embeddedViewID = downcast<HTMLImageElement>(*m_assistedNode).editableImageViewID();
     } else if (m_assistedNode->hasEditableStyle()) {
         information.elementType = InputType::ContentEditable;
         if (is<HTMLElement>(*m_assistedNode)) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to