Diff
Modified: trunk/Source/WebCore/ChangeLog (222464 => 222465)
--- trunk/Source/WebCore/ChangeLog 2017-09-25 21:05:06 UTC (rev 222464)
+++ trunk/Source/WebCore/ChangeLog 2017-09-25 21:08:10 UTC (rev 222465)
@@ -1,3 +1,43 @@
+2017-09-25 Sam Weinig <[email protected]>
+
+ Remove unnecessary userVisibleString EditorClient function
+ https://bugs.webkit.org/show_bug.cgi?id=177456
+
+ Reviewed by Dan Bernstein.
+
+ The implementation of userVisibleString has been in WebCore for sometime (in WebCoreNSURLExtras)
+ so there is no need to call through the EditorClient, just for it to call back to WebCore.
+
+ * editing/Editor.h:
+
+ Keep userVisibleString helper function but make it static, as it no longer needs
+ any state. It is useful to have this helper, so non-ObjC code in Editor can get a
+ userVisibleString.
+
+ * editing/cocoa/EditorCocoa.mm:
+ (WebCore::Editor::userVisibleString):
+
+ Call through to the WebCoreNSURLExtras implementation.
+
+ * editing/mac/EditorMac.mm:
+ (WebCore::Editor::plainTextFromPasteboard):
+ (WebCore::Editor::writeImageToPasteboard):
+ (WebCore::Editor::userVisibleString): Deleted.
+ * editing/mac/WebContentReaderMac.mm:
+ (WebCore::WebContentReader::readFilenames):
+
+ Replace client calls with direct calls.
+
+ * loader/EmptyClients.cpp:
+ * page/EditorClient.h:
+
+ Remove client function.
+
+ * testing/Internals.mm:
+ (WebCore::Internals::userVisibleString):
+
+ Replace client call with direct call.
+
2017-09-25 Timothy Horton <[email protected]>
Fix the build with <attachment> disabled
Modified: trunk/Source/WebCore/editing/Editor.h (222464 => 222465)
--- trunk/Source/WebCore/editing/Editor.h 2017-09-25 21:05:06 UTC (rev 222464)
+++ trunk/Source/WebCore/editing/Editor.h 2017-09-25 21:08:10 UTC (rev 222465)
@@ -535,8 +535,7 @@
RefPtr<SharedBuffer> selectionInWebArchiveFormat();
String selectionInHTMLFormat();
RefPtr<SharedBuffer> imageInWebArchiveFormat(Element&);
- String userVisibleString(const URL&);
-
+ static String userVisibleString(const URL&);
static RefPtr<SharedBuffer> dataInRTFDFormat(NSAttributedString *);
static RefPtr<SharedBuffer> dataInRTFFormat(NSAttributedString *);
#endif
Modified: trunk/Source/WebCore/editing/cocoa/EditorCocoa.mm (222464 => 222465)
--- trunk/Source/WebCore/editing/cocoa/EditorCocoa.mm 2017-09-25 21:05:06 UTC (rev 222464)
+++ trunk/Source/WebCore/editing/cocoa/EditorCocoa.mm 2017-09-25 21:08:10 UTC (rev 222465)
@@ -49,6 +49,7 @@
#import "RenderStyle.h"
#import "Text.h"
#import "WebContentReader.h"
+#import "WebCoreNSURLExtras.h"
#import <pal/spi/cocoa/NSAttributedStringSPI.h>
#import <wtf/BlockObjCExceptions.h>
@@ -226,6 +227,11 @@
}
}
+String Editor::userVisibleString(const URL& url)
+{
+ return WebCore::userVisibleString(url);
+}
+
RefPtr<SharedBuffer> Editor::dataInRTFDFormat(NSAttributedString *string)
{
NSUInteger length = string.length;
Modified: trunk/Source/WebCore/editing/mac/EditorMac.mm (222464 => 222465)
--- trunk/Source/WebCore/editing/mac/EditorMac.mm 2017-09-25 21:05:06 UTC (rev 222464)
+++ trunk/Source/WebCore/editing/mac/EditorMac.mm 2017-09-25 21:08:10 UTC (rev 222465)
@@ -32,7 +32,6 @@
#import "DataTransfer.h"
#import "DocumentFragment.h"
#import "Editing.h"
-#import "Editor.h"
#import "EditorClient.h"
#import "Frame.h"
#import "FrameView.h"
@@ -50,6 +49,7 @@
#import "RuntimeEnabledFeatures.h"
#import "StyleProperties.h"
#import "WebContentReader.h"
+#import "WebCoreNSURLExtras.h"
#import "WebNSAttributedStringExtras.h"
#import "markup.h"
#import <AppKit/AppKit.h>
@@ -239,11 +239,6 @@
cachedImage = tentativeCachedImage;
}
-String Editor::userVisibleString(const URL& url)
-{
- return client()->userVisibleString(url);
-}
-
void Editor::selectionWillChange()
{
if (!hasComposition() || ignoreSelectionChanges() || m_frame.selection().isNone())
@@ -255,12 +250,12 @@
String Editor::plainTextFromPasteboard(const PasteboardPlainText& text)
{
- String string = text.text;
+ auto string = text.text;
// FIXME: It's not clear this is 100% correct since we know -[NSURL URLWithString:] does not handle
// all the same cases we handle well in the URL code for creating an NSURL.
if (text.isURL)
- string = client()->userVisibleString([NSURL URLWithString:string]);
+ string = userVisibleString([NSURL URLWithString:string]);
// FIXME: WTF should offer a non-Mac-specific way to convert string to precomposed form so we can do it for all platforms.
return [(NSString *)string precomposedStringWithCanonicalMapping];
@@ -279,7 +274,7 @@
pasteboardImage.dataInWebArchiveFormat = imageInWebArchiveFormat(imageElement);
pasteboardImage.url.url = ""
pasteboardImage.url.title = title;
- pasteboardImage.url.userVisibleForm = client()->userVisibleString(pasteboardImage.url.url);
+ pasteboardImage.url.userVisibleForm = userVisibleString(pasteboardImage.url.url);
pasteboardImage.resourceData = cachedImage->resourceBuffer();
pasteboardImage.resourceMIMEType = cachedImage->response().mimeType();
Modified: trunk/Source/WebCore/editing/mac/WebContentReaderMac.mm (222464 => 222465)
--- trunk/Source/WebCore/editing/mac/WebContentReaderMac.mm 2017-09-25 21:05:06 UTC (rev 222464)
+++ trunk/Source/WebCore/editing/mac/WebContentReaderMac.mm 2017-09-25 21:08:10 UTC (rev 222465)
@@ -45,6 +45,7 @@
#import "RuntimeEnabledFeatures.h"
#import "Settings.h"
#import "Text.h"
+#import "WebCoreNSURLExtras.h"
#import "markup.h"
namespace WebCore {
@@ -70,7 +71,7 @@
}
#else
auto paragraph = createDefaultParagraphElement(document);
- paragraph->appendChild(document.createTextNode(frame.editor().client()->userVisibleString([NSURL fileURLWithPath:text])));
+ paragraph->appendChild(document.createTextNode(userVisibleString([NSURL fileURLWithPath:text])));
fragment->appendChild(paragraph);
#endif
}
Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (222464 => 222465)
--- trunk/Source/WebCore/loader/EmptyClients.cpp 2017-09-25 21:05:06 UTC (rev 222464)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp 2017-09-25 21:08:10 UTC (rev 222465)
@@ -217,7 +217,6 @@
bool performTwoStepDrop(DocumentFragment&, Range&, bool) final { return false; }
#if PLATFORM(COCOA)
- NSString *userVisibleString(NSURL *) final { return nullptr; }
void setInsertionPasteboard(const String&) final { };
NSURL *canonicalizeURL(NSURL *) final { return nullptr; }
NSURL *canonicalizeURLString(NSString *) final { return nullptr; }
Modified: trunk/Source/WebCore/page/EditorClient.h (222464 => 222465)
--- trunk/Source/WebCore/page/EditorClient.h 2017-09-25 21:05:06 UTC (rev 222464)
+++ trunk/Source/WebCore/page/EditorClient.h 2017-09-25 21:08:10 UTC (rev 222465)
@@ -142,7 +142,6 @@
#endif
#if PLATFORM(COCOA)
- virtual NSString *userVisibleString(NSURL *) = 0;
virtual void setInsertionPasteboard(const String& pasteboardName) = 0;
virtual NSURL *canonicalizeURL(NSURL *) = 0;
virtual NSURL *canonicalizeURLString(NSString *) = 0;
Modified: trunk/Source/WebCore/testing/Internals.mm (222464 => 222465)
--- trunk/Source/WebCore/testing/Internals.mm 2017-09-25 21:05:06 UTC (rev 222464)
+++ trunk/Source/WebCore/testing/Internals.mm 2017-09-25 21:08:10 UTC (rev 222465)
@@ -27,10 +27,7 @@
#include "Internals.h"
#include "DOMURL.h"
-#include "Document.h"
-#include "Editor.h"
-#include "EditorClient.h"
-#include "Frame.h"
+#include "WebCoreNSURLExtras.h"
#include <wtf/SoftLinking.h>
#if PLATFORM(IOS)
@@ -42,7 +39,7 @@
String Internals::userVisibleString(const DOMURL& url)
{
- return contextDocument()->frame()->editor().client()->userVisibleString(url.href());
+ return WebCore::userVisibleString(url.href());
}
#if PLATFORM(COCOA)
Modified: trunk/Source/WebKit/ChangeLog (222464 => 222465)
--- trunk/Source/WebKit/ChangeLog 2017-09-25 21:05:06 UTC (rev 222464)
+++ trunk/Source/WebKit/ChangeLog 2017-09-25 21:08:10 UTC (rev 222465)
@@ -1,3 +1,18 @@
+2017-09-25 Sam Weinig <[email protected]>
+
+ Remove unnecessary userVisibleString EditorClient function
+ https://bugs.webkit.org/show_bug.cgi?id=177456
+
+ Reviewed by Dan Bernstein.
+
+ * WebProcess/WebCoreSupport/WebEditorClient.h:
+ * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
+ (WebKit::WebEditorClient::userVisibleString): Deleted.
+ * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:
+ (WebKit::WebEditorClient::userVisibleString): Deleted.
+
+ Remove userVisibleString client function.
+
2017-09-25 Commit Queue <[email protected]>
Unreviewed, rolling out r222455.
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h (222464 => 222465)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h 2017-09-25 21:05:06 UTC (rev 222464)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h 2017-09-25 21:08:10 UTC (rev 222465)
@@ -96,7 +96,6 @@
void overflowScrollPositionChanged() final;
#if PLATFORM(COCOA)
- NSString *userVisibleString(NSURL *) final;
void setInsertionPasteboard(const String& pasteboardName) final;
NSURL *canonicalizeURL(NSURL *) final;
NSURL *canonicalizeURLString(NSString *) final;
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm (222464 => 222465)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm 2017-09-25 21:05:06 UTC (rev 222464)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm 2017-09-25 21:08:10 UTC (rev 222465)
@@ -48,12 +48,6 @@
notImplemented();
}
-NSString *WebEditorClient::userVisibleString(NSURL *)
-{
- notImplemented();
- return nil;
-}
-
NSURL *WebEditorClient::canonicalizeURL(NSURL *)
{
notImplemented();
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm (222464 => 222465)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm 2017-09-25 21:05:06 UTC (rev 222464)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm 2017-09-25 21:08:10 UTC (rev 222465)
@@ -57,11 +57,6 @@
if (event->handledByInputMethod())
event->setDefaultHandled();
}
-
-NSString *WebEditorClient::userVisibleString(NSURL *url)
-{
- return WebCore::userVisibleString(url);
-}
NSURL *WebEditorClient::canonicalizeURL(NSURL *url)
{
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (222464 => 222465)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2017-09-25 21:05:06 UTC (rev 222464)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2017-09-25 21:08:10 UTC (rev 222465)
@@ -1,3 +1,16 @@
+2017-09-25 Sam Weinig <[email protected]>
+
+ Remove unnecessary userVisibleString EditorClient function
+ https://bugs.webkit.org/show_bug.cgi?id=177456
+
+ Reviewed by Dan Bernstein.
+
+ * WebCoreSupport/WebEditorClient.h:
+ * WebCoreSupport/WebEditorClient.mm:
+ (WebEditorClient::userVisibleString): Deleted.
+
+ Remove userVisibleString client function.
+
2017-09-25 Alex Christensen <[email protected]>
Separate form submission from PolicyChecker infrastructure
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h (222464 => 222465)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h 2017-09-25 21:05:06 UTC (rev 222464)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h 2017-09-25 21:08:10 UTC (rev 222465)
@@ -79,7 +79,6 @@
void didWriteSelectionToPasteboard() final;
void getClientPasteboardDataForRange(WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer>>& pasteboardData) final;
- NSString *userVisibleString(NSURL *) final;
void setInsertionPasteboard(const String&) final;
NSURL *canonicalizeURL(NSURL *) final;
NSURL *canonicalizeURLString(NSString *) final;
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm (222464 => 222465)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm 2017-09-25 21:05:06 UTC (rev 222464)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm 2017-09-25 21:08:10 UTC (rev 222465)
@@ -418,11 +418,6 @@
// Not implemented WebKit, only WebKit2.
}
-NSString *WebEditorClient::userVisibleString(NSURL *URL)
-{
- return [URL _web_userVisibleString];
-}
-
NSURL *WebEditorClient::canonicalizeURL(NSURL *URL)
{
return [URL _webkit_canonicalize];