Diff
Modified: trunk/Source/WebKit/mac/ChangeLog (214283 => 214284)
--- trunk/Source/WebKit/mac/ChangeLog 2017-03-22 23:18:54 UTC (rev 214283)
+++ trunk/Source/WebKit/mac/ChangeLog 2017-03-22 23:21:38 UTC (rev 214284)
@@ -1,3 +1,17 @@
+2017-03-21 Wenson Hsieh <[email protected]>
+
+ Add support for showing the platform data interaction caret
+ https://bugs.webkit.org/show_bug.cgi?id=169898
+ <rdar://problem/31146295>
+
+ Reviewed by Beth Dakin.
+
+ Plumb the dataInteractionCaretRect through WebView SPI to WebKit1 clients.
+
+ * WebView/WebView.mm:
+ (-[WebView _dataInteractionCaretRect]):
+ * WebView/WebViewPrivate.h:
+
2017-03-22 Dan Bernstein <[email protected]>
[iOS] downloadableBinaryFontsEnabled is set to false in -initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:
Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (214283 => 214284)
--- trunk/Source/WebKit/mac/WebView/WebView.mm 2017-03-22 23:18:54 UTC (rev 214283)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm 2017-03-22 23:21:38 UTC (rev 214284)
@@ -1819,6 +1819,14 @@
_private->textIndicatorData = [[[WebUITextIndicatorData alloc] initWithImage:image scale:_private->page->deviceScaleFactor()] retain];
}
+- (CGRect)_dataInteractionCaretRect
+{
+ if (auto* page = _private->page)
+ return page->dragCaretController().caretPosition().absoluteCaretBounds();
+
+ return { };
+}
+
- (WebUITextIndicatorData *)_dataOperationTextIndicator
{
return _private->dataOperationTextIndicator.get();
@@ -1920,6 +1928,11 @@
{
return nil;
}
+
+- (CGRect)_dataInteractionCaretRect
+{
+ return CGRectNull;
+}
#endif
#endif // ENABLE(DATA_INTERACTION) && defined(__cplusplus)
Modified: trunk/Source/WebKit/mac/WebView/WebViewPrivate.h (214283 => 214284)
--- trunk/Source/WebKit/mac/WebView/WebViewPrivate.h 2017-03-22 23:18:54 UTC (rev 214283)
+++ trunk/Source/WebKit/mac/WebView/WebViewPrivate.h 2017-03-22 23:21:38 UTC (rev 214284)
@@ -478,6 +478,7 @@
- (void)_endedDataInteraction:(CGPoint)clientPosition global:(CGPoint)clientPosition;
#if TARGET_OS_IPHONE
+@property (nonatomic, readonly, getter=_dataInteractionCaretRect) CGRect dataInteractionCaretRect;
- (UIImage *)_createImageWithPlatterForImage:(UIImage *)image boundingRect:(CGRect)boundingRect contentScaleFactor:(CGFloat)contentScaleFactor clippingRects:(NSArray<NSValue *> *)clippingRects;
// Deprecated. Use -[WebDataSource _quickLookContent] instead.
- (NSDictionary *)quickLookContentForURL:(NSURL *)url;
Modified: trunk/Source/WebKit2/ChangeLog (214283 => 214284)
--- trunk/Source/WebKit2/ChangeLog 2017-03-22 23:18:54 UTC (rev 214283)
+++ trunk/Source/WebKit2/ChangeLog 2017-03-22 23:21:38 UTC (rev 214284)
@@ -1,3 +1,37 @@
+2017-03-21 Wenson Hsieh <[email protected]>
+
+ Add support for showing the platform data interaction caret
+ https://bugs.webkit.org/show_bug.cgi?id=169898
+ <rdar://problem/31146295>
+
+ Reviewed by Beth Dakin.
+
+ Add support for showing the caret rect when data interacting over an editable target. To do this, we add
+ boilerplate plumbing to inform the WKContentView whenever the WebPageProxy's current caret rect changes.
+
+ * Platform/spi/ios/UIKitSPI.h:
+
+ Define IPI to retrieve the default insertion caret color.
+
+ * UIProcess/PageClient.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::didPerformDragControllerAction):
+ (WebKit::WebPageProxy::dragEnded):
+ (WebKit::WebPageProxy::didEndDragging):
+ (WebKit::WebPageProxy::resetCurrentDragInformation):
+ (WebKit::WebPageProxy::setDragCaretRect):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * UIProcess/ios/PageClientImplIOS.h:
+ * UIProcess/ios/PageClientImplIOS.mm:
+ (WebKit::PageClientImpl::didChangeDataInteractionCaretRect):
+ * UIProcess/ios/WKContentViewInteraction.h:
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView cleanupInteraction]):
+ (-[WKContentView insertionPointColor]):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::dragEnded):
+
2017-03-22 John Wilander <[email protected]>
Resource Load Statistics: Fix partitioning bug for client-side cookie access
Modified: trunk/Source/WebKit2/Platform/spi/ios/UIKitSPI.h (214283 => 214284)
--- trunk/Source/WebKit2/Platform/spi/ios/UIKitSPI.h 2017-03-22 23:18:54 UTC (rev 214283)
+++ trunk/Source/WebKit2/Platform/spi/ios/UIKitSPI.h 2017-03-22 23:21:38 UTC (rev 214284)
@@ -865,6 +865,10 @@
#endif // USE(APPLE_INTERNAL_SDK)
+@interface UIColor (IPI)
++ (UIColor *)insertionPointColor;
+@end
+
@interface UIView (IPI)
- (UIScrollView *)_scroller;
- (CGPoint)accessibilityConvertPointFromSceneReferenceCoordinates:(CGPoint)point;
Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (214283 => 214284)
--- trunk/Source/WebKit2/UIProcess/PageClient.h 2017-03-22 23:18:54 UTC (rev 214283)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h 2017-03-22 23:21:38 UTC (rev 214284)
@@ -385,6 +385,7 @@
virtual void didHandleStartDataInteractionRequest(bool started) = 0;
virtual void startDataInteractionWithImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& image, std::optional<WebCore::TextIndicatorData>, const WebCore::FloatPoint& anchorPoint, uint64_t action) = 0;
virtual void didConcludeEditDataInteraction(std::optional<WebCore::TextIndicatorData>) = 0;
+ virtual void didChangeDataInteractionCaretRect(const WebCore::IntRect& previousCaretRect, const WebCore::IntRect& caretRect) = 0;
#endif
};
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (214283 => 214284)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2017-03-22 23:18:54 UTC (rev 214283)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2017-03-22 23:21:38 UTC (rev 214284)
@@ -1808,7 +1808,7 @@
m_currentDragOperation = static_cast<DragOperation>(dragOperation);
m_currentDragIsOverFileInput = mouseIsOverFileInput;
m_currentDragNumberOfFilesToBeAccepted = numberOfItemsToBeAccepted;
- m_currentDragCaretRect = insertionRect;
+ setDragCaretRect(insertionRect);
}
#if PLATFORM(GTK)
@@ -1826,6 +1826,7 @@
if (!isValid())
return;
m_process->send(Messages::WebPage::DragEnded(clientPosition, globalPosition, operation), m_pageID);
+ setDragCaretRect({ });
}
void WebPageProxy::dragCancelled()
@@ -1834,13 +1835,28 @@
m_process->send(Messages::WebPage::DragCancelled(), m_pageID);
}
+void WebPageProxy::didEndDragging()
+{
+ resetCurrentDragInformation();
+}
+
void WebPageProxy::resetCurrentDragInformation()
{
m_currentDragOperation = WebCore::DragOperationNone;
m_currentDragIsOverFileInput = false;
m_currentDragNumberOfFilesToBeAccepted = 0;
- m_currentDragCaretRect = { };
+ setDragCaretRect({ });
}
+
+#if !ENABLE(DATA_INTERACTION)
+
+void WebPageProxy::setDragCaretRect(const IntRect& dragCaretRect)
+{
+ m_currentDragCaretRect = dragCaretRect;
+}
+
+#endif
+
#endif // ENABLE(DRAG_SUPPORT)
void WebPageProxy::handleMouseEvent(const NativeWebMouseEvent& event)
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (214283 => 214284)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2017-03-22 23:18:54 UTC (rev 214283)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2017-03-22 23:21:38 UTC (rev 214284)
@@ -835,6 +835,7 @@
void didPerformDragControllerAction(uint64_t dragOperation, bool mouseIsOverFileInput, unsigned numberOfItemsToBeAccepted, const WebCore::IntRect& insertionRect);
void dragEnded(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition, uint64_t operation);
void dragCancelled();
+ void setDragCaretRect(const WebCore::IntRect&);
#if PLATFORM(COCOA)
void setDragImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& dragImageHandle, std::optional<WebCore::TextIndicatorData>, const WebCore::FloatPoint& dragImageAnchor, uint64_t action);
void setPromisedDataForImage(const String& pasteboardName, const SharedMemory::Handle& imageHandle, uint64_t imageSize, const String& filename, const String& extension,
@@ -890,6 +891,7 @@
unsigned currentDragNumberOfFilesToBeAccepted() const { return m_currentDragNumberOfFilesToBeAccepted; }
WebCore::IntRect currentDragCaretRect() const { return m_currentDragCaretRect; }
void resetCurrentDragInformation();
+ void didEndDragging();
#endif
void preferencesDidChange();
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (214283 => 214284)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2017-03-22 23:18:54 UTC (rev 214283)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2017-03-22 23:21:38 UTC (rev 214284)
@@ -296,6 +296,7 @@
# Drag and drop messages
#if ENABLE(DRAG_SUPPORT)
DidPerformDragControllerAction(uint64_t dragOperation, bool mouseIsOverFileInput, unsigned numberOfItemsToBeAccepted, WebCore::IntRect insertionRect)
+ DidEndDragging();
#endif
#if PLATFORM(COCOA) && ENABLE(DRAG_SUPPORT)
SetDragImage(WebCore::IntPoint clientPosition, WebKit::ShareableBitmap::Handle dragImage, std::optional<WebCore::TextIndicatorData> textIndicator, WebCore::FloatPoint dragImageAnchor, uint64_t action)
Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h (214283 => 214284)
--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h 2017-03-22 23:18:54 UTC (rev 214283)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h 2017-03-22 23:21:38 UTC (rev 214284)
@@ -207,6 +207,7 @@
void didHandleStartDataInteractionRequest(bool started) override;
void startDataInteractionWithImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& image, std::optional<WebCore::TextIndicatorData>, const WebCore::FloatPoint& anchorPoint, uint64_t action) override;
void didConcludeEditDataInteraction(std::optional<WebCore::TextIndicatorData>) override;
+ void didChangeDataInteractionCaretRect(const WebCore::IntRect& previousCaretRect, const WebCore::IntRect& caretRect) override;
#endif
WKContentView *m_contentView;
Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (214283 => 214284)
--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm 2017-03-22 23:18:54 UTC (rev 214283)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm 2017-03-22 23:21:38 UTC (rev 214284)
@@ -790,6 +790,11 @@
{
[m_contentView _didConcludeEditDataInteraction:data];
}
+
+void PageClientImpl::didChangeDataInteractionCaretRect(const IntRect& previousCaretRect, const IntRect& caretRect)
+{
+ [m_contentView _didChangeDataInteractionCaretRect:previousCaretRect currentRect:caretRect];
+}
#endif
void PageClientImpl::handleActiveNowPlayingSessionInfoResponse(bool hasActiveSession, const String& title, double duration, double elapsedTime)
Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h (214283 => 214284)
--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h 2017-03-22 23:18:54 UTC (rev 214283)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h 2017-03-22 23:21:38 UTC (rev 214284)
@@ -74,6 +74,10 @@
@class _UIHighlightView;
@class _UIWebHighlightLongPressGestureRecognizer;
+#if ENABLE(DATA_INTERACTION)
+@class WKDataInteractionCaretView;
+#endif
+
typedef void (^UIWKAutocorrectionCompletionHandler)(UIWKAutocorrectionRects *rectsForInput);
typedef void (^UIWKAutocorrectionContextHandler)(UIWKAutocorrectionContext *autocorrectionContext);
typedef void (^UIWKDictationContextHandler)(NSString *selectedText, NSString *beforeText, NSString *afterText);
@@ -193,14 +197,13 @@
#if ENABLE(DATA_INTERACTION)
WebKit::WKDataInteractionState _dataInteractionState;
BOOL _isPerformingDataInteractionOperation;
-#if HAS_DATA_INTERACTION_SPI
RetainPtr<WKDataInteraction> _dataInteraction;
RetainPtr<WKDataOperation> _dataOperation;
-#endif
CGPoint _deferredActionSheetRequestLocation;
RetainPtr<UIView> _visibleContentViewSnapshot;
RetainPtr<UIImageView> _dataInteractionUnselectedContentSnapshot;
BOOL _isRunningConcludeEditDataInteractionAnimation;
+ RetainPtr<WKDataInteractionCaretView> _dataInteractionCaretView;
#endif
}
@@ -285,6 +288,8 @@
- (void)_didHandleStartDataInteractionRequest:(BOOL)started;
- (void)_startDataInteractionWithImage:(RetainPtr<CGImageRef>)image withIndicatorData:(std::optional<WebCore::TextIndicatorData>)indicatorData atClientPosition:(CGPoint)clientPosition anchorPoint:(CGPoint)anchorPoint action:(uint64_t)action;
- (void)_didConcludeEditDataInteraction:(std::optional<WebCore::TextIndicatorData>)data;
+- (void)_didChangeDataInteractionCaretRect:(CGRect)previousRect currentRect:(CGRect)rect;
+
- (void)_simulateDataInteractionEntered:(id)info;
- (void)_simulateDataInteractionUpdated:(id)info;
- (void)_simulateDataInteractionPerformOperation:(id)info;
Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (214283 => 214284)
--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm 2017-03-22 23:18:54 UTC (rev 214283)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm 2017-03-22 23:21:38 UTC (rev 214284)
@@ -108,6 +108,19 @@
@end
+#if ENABLE(DATA_INTERACTION)
+
+@interface WKDataInteractionCaretView : UIView
+
+- (instancetype)initWithTextInputView:(UIView<UITextInput> *)textInputView;
+- (void)insertAtPosition:(UITextPosition *)position;
+- (void)updateToPosition:(UITextPosition *)position;
+- (void)remove;
+
+@end
+
+#endif
+
using namespace WebCore;
using namespace WebKit;
@@ -641,6 +654,8 @@
#if ENABLE(DATA_INTERACTION)
[self teardownDataInteractionDelegates];
_isPerformingDataInteractionOperation = NO;
+ [_dataInteractionCaretView remove];
+ _dataInteractionCaretView = nil;
#endif
_inspectorNodeSearchEnabled = NO;
@@ -1964,6 +1979,11 @@
return result;
}
+- (UIColor *)insertionPointColor
+{
+ return [UIColor insertionPointColor];
+}
+
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
return NO;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (214283 => 214284)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2017-03-22 23:18:54 UTC (rev 214283)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2017-03-22 23:21:38 UTC (rev 214284)
@@ -3593,6 +3593,8 @@
// FIXME: These are fake modifier keys here, but they should be real ones instead.
PlatformMouseEvent event(adjustedClientPosition, adjustedGlobalPosition, LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, currentTime(), 0, WebCore::NoTap);
m_page->mainFrame().eventHandler().dragSourceEndedAt(event, (DragOperation)operation);
+
+ send(Messages::WebPageProxy::DidEndDragging());
}
void WebPage::willPerformLoadDragDestinationAction()