Diff
Modified: trunk/Source/WebCore/ChangeLog (215723 => 215724)
--- trunk/Source/WebCore/ChangeLog 2017-04-25 06:52:04 UTC (rev 215723)
+++ trunk/Source/WebCore/ChangeLog 2017-04-25 07:00:59 UTC (rev 215724)
@@ -1,3 +1,37 @@
+2017-04-25 Wenson Hsieh <wenson_hs...@apple.com>
+
+ Support reading NSURL titles from the pasteboard when performing data interaction
+ https://bugs.webkit.org/show_bug.cgi?id=171156
+ <rdar://problem/31356937>
+
+ Reviewed by Tim Horton.
+
+ Support reading link titles from the pasteboard when performing data interaction. To do this, we refactor
+ Pasteboard::readURL to take in an additional String& title which is ultimately plumbed to the PlatformPasteboard
+ where it is set to the value of -[NSURL _title].
+
+ Test: DataInteractionTests.ExternalSourceTitledNSURL.
+
+ * editing/FrameSelection.h:
+ * editing/ios/EditorIOS.mm:
+ (WebCore::Editor::WebContentReader::readURL):
+ * page/DragController.cpp:
+ (WebCore::DragController::performDragOperation):
+ (WebCore::DragController::concludeEditDrag):
+
+ Move calls to clearDragCaret() out of concludeEditDrag and into the call site, in performDragOperation after
+ attempting to concludeEditDrag. This is done so that if the WebEditorClient queries whether the drag caret is
+ in richly editable content for the purposes of generating a document fragment to insert, the answer will not
+ always be false as a drop is occurring.
+
+ * platform/PasteboardStrategy.h:
+ * platform/PlatformPasteboard.h:
+ * platform/ios/PasteboardIOS.mm:
+ (WebCore::Pasteboard::respectsUTIFidelities):
+ (WebCore::Pasteboard::readString):
+ * platform/ios/PlatformPasteboardIOS.mm:
+ (WebCore::PlatformPasteboard::readURL):
+
2017-04-24 Andy VanWagoner <thetalecraf...@gmail.com>
Clean up ICU headers
Modified: trunk/Source/WebCore/editing/FrameSelection.h (215723 => 215724)
--- trunk/Source/WebCore/editing/FrameSelection.h 2017-04-25 06:52:04 UTC (rev 215723)
+++ trunk/Source/WebCore/editing/FrameSelection.h 2017-04-25 07:00:59 UTC (rev 215724)
@@ -97,7 +97,7 @@
void paintDragCaret(Frame*, GraphicsContext&, const LayoutPoint&, const LayoutRect& clipRect) const;
bool isContentEditable() const { return m_position.rootEditableElement(); }
- bool isContentRichlyEditable() const;
+ WEBCORE_EXPORT bool isContentRichlyEditable() const;
bool hasCaret() const { return m_position.isNotNull(); }
const VisiblePosition& caretPosition() { return m_position; }
Modified: trunk/Source/WebCore/editing/ios/EditorIOS.mm (215723 => 215724)
--- trunk/Source/WebCore/editing/ios/EditorIOS.mm 2017-04-25 06:52:04 UTC (rev 215723)
+++ trunk/Source/WebCore/editing/ios/EditorIOS.mm 2017-04-25 07:00:59 UTC (rev 215724)
@@ -320,7 +320,7 @@
return fragment;
}
-bool Editor::WebContentReader::readURL(const URL& url, const String&)
+bool Editor::WebContentReader::readURL(const URL& url, const String& title)
{
if (url.isEmpty())
return false;
@@ -348,8 +348,10 @@
} else {
auto anchor = HTMLAnchorElement::create(*frame.document());
anchor->setAttributeWithoutSynchronization(HTMLNames::hrefAttr, url.string());
- anchor->appendChild(frame.document()->createTextNode([[(NSURL *)url absoluteString] precomposedStringWithCanonicalMapping]));
+ String linkText = title.length() ? title : String([[(NSURL *)url absoluteString] precomposedStringWithCanonicalMapping]);
+ anchor->appendChild(frame.document()->createTextNode(linkText));
+
auto newFragment = frame.document()->createDocumentFragment();
newFragment->appendChild(anchor);
addFragment(WTFMove(newFragment));
Modified: trunk/Source/WebCore/page/DragController.cpp (215723 => 215724)
--- trunk/Source/WebCore/page/DragController.cpp 2017-04-25 06:52:04 UTC (rev 215723)
+++ trunk/Source/WebCore/page/DragController.cpp 2017-04-25 07:00:59 UTC (rev 215724)
@@ -249,10 +249,12 @@
if ((m_dragDestinationAction & DragDestinationActionEdit) && concludeEditDrag(dragData)) {
m_client.didConcludeEditDrag();
m_documentUnderMouse = nullptr;
+ clearDragCaret();
return true;
}
m_documentUnderMouse = nullptr;
+ clearDragCaret();
if (operationForLoad(dragData) == DragOperationNone)
return false;
@@ -508,13 +510,10 @@
return fileInput->receiveDroppedFiles(dragData);
}
- if (!m_page.dragController().canProcessDrag(dragData)) {
- clearDragCaret();
+ if (!m_page.dragController().canProcessDrag(dragData))
return false;
- }
VisibleSelection dragCaret = m_page.dragCaretController().caretPosition();
- clearDragCaret();
RefPtr<Range> range = dragCaret.toNormalizedRange();
RefPtr<Element> rootEditableElement = innerFrame->selection().selection().rootEditableElement();
Modified: trunk/Source/WebCore/platform/PasteboardStrategy.h (215723 => 215724)
--- trunk/Source/WebCore/platform/PasteboardStrategy.h 2017-04-25 06:52:04 UTC (rev 215723)
+++ trunk/Source/WebCore/platform/PasteboardStrategy.h 2017-04-25 07:00:59 UTC (rev 215724)
@@ -50,7 +50,7 @@
virtual int getPasteboardItemsCount(const String& pasteboardName) = 0;
virtual String readStringFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) = 0;
virtual RefPtr<SharedBuffer> readBufferFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) = 0;
- virtual URL readURLFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) = 0;
+ virtual URL readURLFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName, String& title) = 0;
virtual void getFilenamesForDataInteraction(Vector<String>& filenames, const String& pasteboardName) = 0;
virtual void getTypesByFidelityForItemAtIndex(Vector<String>& types, uint64_t index, const String& pasteboardName) = 0;
#endif // PLATFORM(IOS)
Modified: trunk/Source/WebCore/platform/PlatformPasteboard.h (215723 => 215724)
--- trunk/Source/WebCore/platform/PlatformPasteboard.h 2017-04-25 06:52:04 UTC (rev 215723)
+++ trunk/Source/WebCore/platform/PlatformPasteboard.h 2017-04-25 07:00:59 UTC (rev 215724)
@@ -83,7 +83,7 @@
WEBCORE_EXPORT void write(const PasteboardURL&);
WEBCORE_EXPORT RefPtr<SharedBuffer> readBuffer(int index, const String& pasteboardType);
WEBCORE_EXPORT String readString(int index, const String& pasteboardType);
- WEBCORE_EXPORT URL readURL(int index, const String& pasteboardType);
+ WEBCORE_EXPORT URL readURL(int index, const String& pasteboardType, String& title);
WEBCORE_EXPORT int count();
WEBCORE_EXPORT int numberOfFiles();
Modified: trunk/Source/WebCore/platform/ios/PasteboardIOS.mm (215723 => 215724)
--- trunk/Source/WebCore/platform/ios/PasteboardIOS.mm 2017-04-25 06:52:04 UTC (rev 215723)
+++ trunk/Source/WebCore/platform/ios/PasteboardIOS.mm 2017-04-25 07:00:59 UTC (rev 215724)
@@ -193,8 +193,9 @@
}
if ([type isEqualToString:(NSString *)kUTTypeURL]) {
- URL url = "" kUTTypeURL, pasteboardName);
- return !url.isNull() && reader.readURL(url, String());
+ String title;
+ URL url = "" kUTTypeURL, pasteboardName, title);
+ return !url.isNull() && reader.readURL(url, title);
}
if (UTTypeConformsTo((CFStringRef)type, kUTTypeText)) {
@@ -328,7 +329,8 @@
NSString *cocoaValue = nil;
if ([cocoaType isEqualToString:(NSString *)kUTTypeURL]) {
- URL url = "" kUTTypeURL, m_pasteboardName);
+ String title;
+ URL url = "" kUTTypeURL, m_pasteboardName, title);
if (!url.isNull())
cocoaValue = [(NSURL *)url absoluteString];
} else if ([cocoaType isEqualToString:(NSString *)kUTTypeText]) {
Modified: trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm (215723 => 215724)
--- trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm 2017-04-25 06:52:04 UTC (rev 215723)
+++ trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm 2017-04-25 07:00:59 UTC (rev 215724)
@@ -389,7 +389,7 @@
return String();
}
-URL PlatformPasteboard::readURL(int index, const String& type)
+URL PlatformPasteboard::readURL(int index, const String& type, String& title)
{
NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:index];
@@ -403,6 +403,13 @@
if (![value isKindOfClass:[NSURL class]])
return URL();
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
+ if ([value respondsToSelector:@selector(_title)])
+ title = [value _title];
+#else
+ UNUSED_PARAM(title);
+#endif
+
return (NSURL *)value;
}
Modified: trunk/Source/WebKit/mac/ChangeLog (215723 => 215724)
--- trunk/Source/WebKit/mac/ChangeLog 2017-04-25 06:52:04 UTC (rev 215723)
+++ trunk/Source/WebKit/mac/ChangeLog 2017-04-25 07:00:59 UTC (rev 215724)
@@ -1,3 +1,20 @@
+2017-04-25 Wenson Hsieh <wenson_hs...@apple.com>
+
+ Support reading NSURL titles from the pasteboard when performing data interaction
+ https://bugs.webkit.org/show_bug.cgi?id=171156
+ <rdar://problem/31356937>
+
+ Reviewed by Tim Horton.
+
+ Add a new WK1 SPI property, -[WebFrame hasRichlyEditableDragCaret].
+
+ * WebCoreSupport/WebPlatformStrategies.h:
+ * WebCoreSupport/WebPlatformStrategies.mm:
+ (WebPlatformStrategies::readURLFromPasteboard):
+ * WebView/WebFrame.mm:
+ (-[WebFrame hasRichlyEditableDragCaret]):
+ * WebView/WebFramePrivate.h:
+
2017-04-24 Andy VanWagoner <thetalecraf...@gmail.com>
Clean up ICU headers
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h (215723 => 215724)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h 2017-04-25 06:52:04 UTC (rev 215723)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h 2017-04-25 07:00:59 UTC (rev 215724)
@@ -65,7 +65,7 @@
int getPasteboardItemsCount(const String& pasteboardName) override;
String readStringFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) override;
RefPtr<WebCore::SharedBuffer> readBufferFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) override;
- WebCore::URL readURLFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) override;
+ WebCore::URL readURLFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName, String& title) override;
void getFilenamesForDataInteraction(Vector<String>& filenames, const String& pasteboardName) override;
void getTypesByFidelityForItemAtIndex(Vector<String>& types, uint64_t index, const String& pasteboardName) override;
#endif
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm (215723 => 215724)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm 2017-04-25 06:52:04 UTC (rev 215723)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm 2017-04-25 07:00:59 UTC (rev 215724)
@@ -221,9 +221,9 @@
return PlatformPasteboard(pasteboardName).readBuffer(index, type);
}
-WebCore::URL WebPlatformStrategies::readURLFromPasteboard(int index, const String& type, const String& pasteboardName)
+WebCore::URL WebPlatformStrategies::readURLFromPasteboard(int index, const String& type, const String& pasteboardName, String& title)
{
- return PlatformPasteboard(pasteboardName).readURL(index, type);
+ return PlatformPasteboard(pasteboardName).readURL(index, type, title);
}
String WebPlatformStrategies::readStringFromPasteboard(int index, const String& type, const String& pasteboardName)
Modified: trunk/Source/WebKit/mac/WebView/WebFrame.mm (215723 => 215724)
--- trunk/Source/WebKit/mac/WebView/WebFrame.mm 2017-04-25 06:52:04 UTC (rev 215723)
+++ trunk/Source/WebKit/mac/WebView/WebFrame.mm 2017-04-25 07:00:59 UTC (rev 215724)
@@ -2216,6 +2216,13 @@
coreFrame->loader().setOpener(0);
}
+- (BOOL)hasRichlyEditableDragCaret
+{
+ if (auto* page = core(self)->page())
+ return page->dragCaretController().isContentRichlyEditable();
+ return NO;
+}
+
// Used by pagination code called from AppKit when a standalone web page is printed.
- (NSArray *)_computePageRectsWithPrintScaleFactor:(float)printScaleFactor pageSize:(NSSize)pageSize
{
Modified: trunk/Source/WebKit/mac/WebView/WebFramePrivate.h (215723 => 215724)
--- trunk/Source/WebKit/mac/WebView/WebFramePrivate.h 2017-04-25 06:52:04 UTC (rev 215723)
+++ trunk/Source/WebKit/mac/WebView/WebFramePrivate.h 2017-04-25 07:00:59 UTC (rev 215724)
@@ -277,6 +277,9 @@
// Printing.
- (NSArray *)_computePageRectsWithPrintScaleFactor:(float)printWidthScaleFactor pageSize:(NSSize)pageSize;
+// Drag and drop support.
+@property (nonatomic, readonly) BOOL hasRichlyEditableDragCaret;
+
#if TARGET_OS_IPHONE
- (DOMDocumentFragment *)_documentFragmentForText:(NSString *)text;
// These have the side effect of adding subresources to our WebDataSource where appropriate.
Modified: trunk/Source/WebKit2/ChangeLog (215723 => 215724)
--- trunk/Source/WebKit2/ChangeLog 2017-04-25 06:52:04 UTC (rev 215723)
+++ trunk/Source/WebKit2/ChangeLog 2017-04-25 07:00:59 UTC (rev 215724)
@@ -1,3 +1,29 @@
+2017-04-25 Wenson Hsieh <wenson_hs...@apple.com>
+
+ Support reading NSURL titles from the pasteboard when performing data interaction
+ https://bugs.webkit.org/show_bug.cgi?id=171156
+ <rdar://problem/31356937>
+
+ Reviewed by Tim Horton.
+
+ Adjust for interface changes in WebCore to support plumbing the title of an NSURL from the platform pasteboard
+ back to WebCore. Additionally, implement WebEditorClient::hasRichlyEditableSelection (which previously returned
+ false) to check whether the current selection is richly editable, or the drop caret is in richly editable content.
+ See WebCore ChangeLog for more details.
+
+ * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
+ (WebKit::WebPasteboardProxy::readURLFromPasteboard):
+ * UIProcess/WebPasteboardProxy.h:
+ * UIProcess/WebPasteboardProxy.messages.in:
+ * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+ (WebKit::WebPlatformStrategies::readURLFromPasteboard):
+ * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
+ * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
+ (WebKit::WebEditorClient::hasRichlyEditableSelection):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::hasRichlyEditableSelection):
+ * WebProcess/WebPage/WebPage.h:
+
2017-04-24 Wenson Hsieh <wenson_hs...@apple.com>
Respect fidelity order when reading web content from item providers
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm (215723 => 215724)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm 2017-04-25 06:52:04 UTC (rev 215723)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm 2017-04-25 07:00:59 UTC (rev 215724)
@@ -170,9 +170,9 @@
value = PlatformPasteboard(pasteboardName).readString(index, pasteboardType);
}
-void WebPasteboardProxy::readURLFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, String& url)
+void WebPasteboardProxy::readURLFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, String& url, String& title)
{
- url = "" pasteboardType);
+ url = "" pasteboardType, title);
}
void WebPasteboardProxy::readBufferFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, SharedMemory::Handle& handle, uint64_t& size)
Modified: trunk/Source/WebKit2/UIProcess/WebPasteboardProxy.h (215723 => 215724)
--- trunk/Source/WebKit2/UIProcess/WebPasteboardProxy.h 2017-04-25 06:52:04 UTC (rev 215723)
+++ trunk/Source/WebKit2/UIProcess/WebPasteboardProxy.h 2017-04-25 07:00:59 UTC (rev 215724)
@@ -75,7 +75,7 @@
void writeImageToPasteboard(const WebCore::PasteboardImage&, const String& pasteboardName);
void writeStringToPasteboard(const String& pasteboardType, const String&, const String& pasteboardName);
void readStringFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, WTF::String&);
- void readURLFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, String&);
+ void readURLFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, String& url, String& title);
void readBufferFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, SharedMemory::Handle&, uint64_t& size);
void getPasteboardItemsCount(const String& pasteboardName, uint64_t& itemsCount);
void getFilenamesForDataInteraction(const String& pasteboardName, Vector<String>& filenames);
Modified: trunk/Source/WebKit2/UIProcess/WebPasteboardProxy.messages.in (215723 => 215724)
--- trunk/Source/WebKit2/UIProcess/WebPasteboardProxy.messages.in 2017-04-25 06:52:04 UTC (rev 215723)
+++ trunk/Source/WebKit2/UIProcess/WebPasteboardProxy.messages.in 2017-04-25 07:00:59 UTC (rev 215724)
@@ -27,7 +27,7 @@
WriteImageToPasteboard(struct WebCore::PasteboardImage pasteboardImage, String pasteboardName)
WriteStringToPasteboard(String pasteboardType, String text, String pasteboardName)
ReadStringFromPasteboard(uint64_t index, String pasteboardType, String pasteboardName) -> (String string)
- ReadURLFromPasteboard(uint64_t index, String pasteboardType, String pasteboardName) -> (String string)
+ ReadURLFromPasteboard(uint64_t index, String pasteboardType, String pasteboardName) -> (String url, String title)
ReadBufferFromPasteboard(uint64_t index, String pasteboardType, String pasteboardName) -> (WebKit::SharedMemory::Handle handle, uint64_t size)
GetPasteboardItemsCount(String pasteboardName) -> (uint64_t itemsCount)
GetFilenamesForDataInteraction(String pasteboardName) -> (Vector<String> filenames)
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp (215723 => 215724)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp 2017-04-25 06:52:04 UTC (rev 215723)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp 2017-04-25 07:00:59 UTC (rev 215724)
@@ -335,10 +335,10 @@
return SharedBuffer::create(static_cast<unsigned char *>(sharedMemoryBuffer->data()), size);
}
-WebCore::URL WebPlatformStrategies::readURLFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName)
+WebCore::URL WebPlatformStrategies::readURLFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName, String& title)
{
String urlString;
- WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::ReadURLFromPasteboard(index, pasteboardType, pasteboardName), Messages::WebPasteboardProxy::ReadURLFromPasteboard::Reply(urlString), 0);
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::ReadURLFromPasteboard(index, pasteboardType, pasteboardName), Messages::WebPasteboardProxy::ReadURLFromPasteboard::Reply(urlString, title), 0);
return URL(ParsedURLString, urlString);
}
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h (215723 => 215724)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h 2017-04-25 06:52:04 UTC (rev 215723)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h 2017-04-25 07:00:59 UTC (rev 215724)
@@ -66,7 +66,7 @@
int getPasteboardItemsCount(const String& pasteboardName) override;
String readStringFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) override;
RefPtr<WebCore::SharedBuffer> readBufferFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) override;
- WebCore::URL readURLFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) override;
+ WebCore::URL readURLFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName, String& title) override;
void getFilenamesForDataInteraction(Vector<String>& filenames, const String& pasteboardName) override;
void getTypesByFidelityForItemAtIndex(Vector<String>& types, uint64_t index, const String& pasteboardName) override;
#endif
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm (215723 => 215724)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm 2017-04-25 06:52:04 UTC (rev 215723)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm 2017-04-25 07:00:59 UTC (rev 215724)
@@ -101,8 +101,7 @@
bool WebEditorClient::hasRichlyEditableSelection()
{
- notImplemented();
- return false;
+ return m_page->hasRichlyEditableSelection();
}
int WebEditorClient::getPasteboardItemsCount()
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (215723 => 215724)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2017-04-25 06:52:04 UTC (rev 215723)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2017-04-25 07:00:59 UTC (rev 215724)
@@ -3869,6 +3869,15 @@
}
#endif
+bool WebPage::hasRichlyEditableSelection() const
+{
+ auto& frame = m_page->focusController().focusedOrMainFrame();
+ if (m_page->dragCaretController().isContentRichlyEditable())
+ return true;
+
+ return frame.selection().selection().isContentRichlyEditable();
+}
+
void WebPage::changeSpellingToWord(const String& word)
{
replaceSelectionWithText(&m_page->focusController().focusedOrMainFrame(), word);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (215723 => 215724)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2017-04-25 06:52:04 UTC (rev 215723)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2017-04-25 07:00:59 UTC (rev 215724)
@@ -599,6 +599,7 @@
void setForceAlwaysUserScalable(bool);
#endif
+ bool hasRichlyEditableSelection() const;
void setLayerTreeStateIsFrozen(bool);
void markLayersVolatile(std::function<void ()> completionHandler = { });
Modified: trunk/Tools/ChangeLog (215723 => 215724)
--- trunk/Tools/ChangeLog 2017-04-25 06:52:04 UTC (rev 215723)
+++ trunk/Tools/ChangeLog 2017-04-25 07:00:59 UTC (rev 215724)
@@ -1,3 +1,16 @@
+2017-04-25 Wenson Hsieh <wenson_hs...@apple.com>
+
+ Support reading NSURL titles from the pasteboard when performing data interaction
+ https://bugs.webkit.org/show_bug.cgi?id=171156
+ <rdar://problem/31356937>
+
+ Reviewed by Tim Horton.
+
+ Adds a new unit test, DataInteractionTests.ExternalSourceTitledNSURL.
+
+ * TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
+ (TestWebKitAPI::TEST):
+
2017-04-24 Wenson Hsieh <wenson_hs...@apple.com>
Respect fidelity order when reading web content from item providers
Modified: trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm (215723 => 215724)
--- trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm 2017-04-25 06:52:04 UTC (rev 215723)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm 2017-04-25 07:00:59 UTC (rev 215724)
@@ -534,6 +534,25 @@
checkSelectionRectsWithLogging(@[ makeCGRectValue(1, 201, 215, 174) ], [dataInteractionSimulator finalSelectionRects]);
}
+TEST(DataInteractionTests, ExternalSourceTitledNSURL)
+{
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
+ [webView synchronouslyLoadTestPageNamed:@"autofocus-contenteditable"];
+ [webView stringByEvaluatingJavaScript:@"getSelection().removeAllRanges()"];
+
+ NSURL *titledURL = [NSURL URLWithString:@"https://www.apple.com"];
+ titledURL._title = @"Apple";
+ auto simulatedItemProvider = adoptNS([[UIItemProvider alloc] init]);
+ [simulatedItemProvider registerObject:titledURL visibility:NSItemProviderRepresentationVisibilityAll];
+
+ auto dataInteractionSimulator = adoptNS([[DataInteractionSimulator alloc] initWithWebView:webView.get()]);
+ [dataInteractionSimulator setExternalItemProviders:@[ simulatedItemProvider.get() ]];
+ [dataInteractionSimulator runFrom:CGPointMake(300, 400) to:CGPointMake(100, 300)];
+
+ EXPECT_WK_STREQ("Apple", [webView stringByEvaluatingJavaScript:@"editor.querySelector('a').textContent"]);
+ EXPECT_WK_STREQ("https://www.apple.com/", [webView stringByEvaluatingJavaScript:@"editor.querySelector('a').href"]);
+}
+
TEST(DataInteractionTests, OverrideDataInteractionOperation)
{
RetainPtr<TestWKWebView> webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);