Title: [162997] trunk/Source/WebCore
Revision
162997
Author
enr...@apple.com
Date
2014-01-28 20:09:12 -0800 (Tue, 28 Jan 2014)

Log Message

Add support for ActionSheets in WK2 for iOS.
https://bugs.webkit.org/show_bug.cgi?id=127586
<rdar://problem/15283667>

Reviewed by Benjamin Poulain.

This patch contains some WebCore changes required to
implement support for ActionSheets.
It adds copyURL implementation for iOS in the Editor
class and fixes some bugs in the iOS specific pasteboard
writing code.
The changes to Localizable.strings are the result of
running update-webkit-localizedstrings script.

* English.lproj/Localizable.strings:
* WebCore.exp.in:
* editing/Editor.cpp:
* editing/Editor.h:
* editing/ios/EditorIOS.mm:
(WebCore::Editor::writeImageToPasteboard):
* platform/ios/PasteboardIOS.mm:
(WebCore::Pasteboard::write):
* platform/ios/PlatformPasteboardIOS.mm:
(WebCore::PlatformPasteboard::write):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (162996 => 162997)


--- trunk/Source/WebCore/ChangeLog	2014-01-29 03:24:01 UTC (rev 162996)
+++ trunk/Source/WebCore/ChangeLog	2014-01-29 04:09:12 UTC (rev 162997)
@@ -1,3 +1,30 @@
+2014-01-28  Enrica Casucci  <enr...@apple.com>
+
+        Add support for ActionSheets in WK2 for iOS.
+        https://bugs.webkit.org/show_bug.cgi?id=127586
+        <rdar://problem/15283667>
+
+        Reviewed by Benjamin Poulain.
+
+        This patch contains some WebCore changes required to
+        implement support for ActionSheets.
+        It adds copyURL implementation for iOS in the Editor
+        class and fixes some bugs in the iOS specific pasteboard
+        writing code.
+        The changes to Localizable.strings are the result of
+        running update-webkit-localizedstrings script.
+
+        * English.lproj/Localizable.strings:
+        * WebCore.exp.in:
+        * editing/Editor.cpp:
+        * editing/Editor.h:
+        * editing/ios/EditorIOS.mm:
+        (WebCore::Editor::writeImageToPasteboard):
+        * platform/ios/PasteboardIOS.mm:
+        (WebCore::Pasteboard::write):
+        * platform/ios/PlatformPasteboardIOS.mm:
+        (WebCore::PlatformPasteboard::write):
+
 2014-01-28  Andy Estes  <aes...@apple.com>
 
         [iOS] REGRESSION (r162663): Webpages have strange artifacts or corruption around tile boundaries

Modified: trunk/Source/WebCore/English.lproj/Localizable.strings (162996 => 162997)


--- trunk/Source/WebCore/English.lproj/Localizable.strings	2014-01-29 03:24:01 UTC (rev 162996)
+++ trunk/Source/WebCore/English.lproj/Localizable.strings	2014-01-29 04:09:12 UTC (rev 162997)
@@ -64,6 +64,9 @@
 /* window title for a standalone image (uses multiplication symbol, not x) */
 "<filename> %d×%d pixels" = "<filename> %d×%d pixels";
 
+/* Title for Add to Reading List action button */
+"Add to Reading List" = "Add to Reading List";
+
 /* Undo action name */
 "Align Left (Undo action name)" = "Align Left";
 
@@ -88,6 +91,9 @@
 /* Undo action name */
 "Bold (Undo action name)" = "Bold";
 
+/* Title for Cancel button label in button bar */
+"Cancel button label in button bar" = "Cancel";
+
 /* Capitalize context menu item */
 "Capitalize" = "Capitalize";
 
@@ -112,11 +118,11 @@
 /* title for a multiple file chooser button used in HTML forms. This title should be as short as possible. */
 "Choose Files" = "Choose Files";
 
-/* PLATFORM(IOS) title for file button used in HTML forms for media files */
-"Choose Media (Single)" = "Choose Photo";
+/* Title for file button used in HTML5 forms for multiple media files */
+"Choose Media (Multiple)" = "Choose Media (Multiple)";
 
-/* PLATFORM(IOS) title for file button used in HTML5 forms for multiple media files */
-"Choose Media (Multiple)" = "Choose Photos";
+/* Title for file button used in HTML forms for media files */
+"Choose Media (Single)" = "Choose Media (Single)";
 
 /* menu item in Recent Searches menu that empties menu's contents */
 "Clear Recent Searches" = "Clear Recent Searches";
@@ -136,6 +142,9 @@
 /* Copy context menu item */
 "Copy" = "Copy";
 
+/* Title for Copy Link or Image action button */
+"Copy ActionSheet Link" = "Copy";
+
 /* Copy Audio Address Location context menu item */
 "Copy Audio Address" = "Copy Audio Address";
 
@@ -163,15 +172,15 @@
 /* Default writing direction context menu item */
 "Default" = "Default";
 
-/* PLATFORM(IOS) Undo action name */
+/* Undo action name (Used only by PLATFORM(IOS) code) */
 "Delete (Undo action name)" = "Delete";
 
-/* PLATFORM(IOS) Undo action name */
-"Dictation (Undo action name)" = "Dictation";
-
 /* text to display in <details> tag when it has no <summary> child */
 "Details" = "Details";
 
+/* Undo action name (Used only by PLATFORM(IOS) code) */
+"Dictation (Undo action name)" = "Dictation";
+
 /* Download Audio To Disk context menu item */
 "Download Audio" = "Download Audio";
 
@@ -247,6 +256,9 @@
 /* WebKitErrorJavaUnavailable description */
 "Java is unavailable" = "Java is unavailable";
 
+/* Title for action sheet for _javascript_ link */
+"_javascript_ Action Sheet Title" = "_javascript_";
+
 /* Undo action name */
 "Justify (Undo action name)" = "Justify";
 
@@ -307,6 +319,9 @@
 /* Menu item label for the track that represents disabling closed captions */
 "Off" = "Off";
 
+/* Title for Open Link action button */
+"Open ActionSheet Link" = "Open";
+
 /* Open Audio in New Window context menu item */
 "Open Audio in New Window" = "Open Audio in New Window";
 
@@ -391,6 +406,9 @@
 /* Right to Left context menu item */
 "Right to Left" = "Right to Left";
 
+/* Title for Save Image action button */
+"Save Image" = "Save Image";
+
 /* Search in Spotlight context menu item */
 "Search in Spotlight" = "Search in Spotlight";
 
@@ -433,6 +451,9 @@
 /* menu item title */
 "Show Substitutions" = "Show Substitutions";
 
+/* Title of the context menu item to show when PDFPlugin was used instead of a blocked plugin */
+"Show in blocked plug-in" = "Show in blocked plug-in";
+
 /* Smart Copy/Paste context menu item */
 "Smart Copy/Paste" = "Smart Copy/Paste";
 
@@ -544,7 +565,7 @@
 /* Undo action name */
 "Turn Off Ligatures (Undo action name)" = "Turn Off Ligatures";
 
-/* Undo action name */
+/* We don't care if we find this string, but searching for it will load the plist and save the results. */
 "Typing (Undo action name)" = "Typing";
 
 /* Underline context menu item */
@@ -793,15 +814,15 @@
 /* text to display in file button used in HTML forms when no files are selected and the button allows multiple files to be selected */
 "no files selected" = "no files selected";
 
-/* PLATFORM(IOS) text to display in file button used in HTML forms for media files when no media file is selected */
-"no media selected (single)" = "no photo selected";
-
-/* PLATFORM(IOS) text to display in file button used in HTML forms for media files when no media files are selected and the button allows multiple files to be selected */
-"no media selected (multiple)" = "no photos selected";
-
 /* HTTP result code string */
 "no longer exists" = "no longer exists";
 
+/* Text to display in file button used in HTML forms for media files when no media files are selected and the button allows multiple files to be selected */
+"no media selected (multiple)" = "no media selected (multiple)";
+
+/* Text to display in file button used in HTML forms for media files when no media file is selected */
+"no media selected (single)" = "no media selected (single)";
+
 /* HTTP result code string */
 "non-authoritative information" = "non-authoritative information";
 
@@ -985,5 +1006,3 @@
 /* accessibility label for video element controller */
 "video playback" = "video playback";
 
-/* title of the context menu item to show when PDFPlugin was used instead of a blocked plugin */
-"Show in blocked plug-in" = "Show in blocked plug-in";

Modified: trunk/Source/WebCore/WebCore.exp.in (162996 => 162997)


--- trunk/Source/WebCore/WebCore.exp.in	2014-01-29 03:24:01 UTC (rev 162996)
+++ trunk/Source/WebCore/WebCore.exp.in	2014-01-29 04:09:12 UTC (rev 162997)
@@ -1062,6 +1062,7 @@
 __ZN7WebCore5RangeD1Ev
 __ZN7WebCore6Chrome16setStatusbarTextEPNS_5FrameERKN3WTF6StringE
 __ZN7WebCore6Chrome5printEPNS_5FrameE
+__ZN7WebCore6Editor7copyURLERKNS_3URLERKN3WTF6StringE
 __ZN7WebCore6Editor10applyStyleEPNS_15StylePropertiesENS_10EditActionE
 __ZN7WebCore6Editor10findStringERKN3WTF6StringEj
 __ZN7WebCore6Editor10insertTextERKN3WTF6StringEPNS_5EventE
@@ -1080,6 +1081,7 @@
 __ZN7WebCore6Editor19deleteWithDirectionENS_18SelectionDirectionENS_15TextGranularityEbb
 __ZN7WebCore6Editor19insertUnorderedListEv
 __ZN7WebCore6Editor21applyStyleToSelectionEPNS_15StylePropertiesENS_10EditActionE
+__ZN7WebCore6Editor22writeImageToPasteboardERNS_10PasteboardERNS_7ElementERKNS_3URLERKN3WTF6StringE
 __ZN7WebCore6Editor23setBaseWritingDirectionE16WritingDirection
 __ZN7WebCore6Editor24computeAndSetTypingStyleEPNS_15StylePropertiesENS_10EditActionE
 __ZN7WebCore6Editor24isSelectionUngrammaticalEv
@@ -1087,6 +1089,7 @@
 __ZN7WebCore6Editor26decreaseSelectionListLevelEv
 __ZN7WebCore6Editor26increaseSelectionListLevelEv
 __ZN7WebCore6Editor26toggleOverwriteModeEnabledEv
+__ZN7WebCore6Editor26writeSelectionToPasteboardERNS_10PasteboardE
 __ZN7WebCore6Editor28replaceSelectionWithFragmentEN3WTF10PassRefPtrINS_16DocumentFragmentEEEbbb
 __ZN7WebCore6Editor29canDecreaseSelectionListLevelEv
 __ZN7WebCore6Editor29canIncreaseSelectionListLevelEv
@@ -1341,6 +1344,7 @@
 __ZN7WebCore9HTMLNames9scriptTagE
 __ZN7WebCore9HTMLNames9selectTagE
 __ZN7WebCore9HTMLNames9styleAttrE
+__ZN7WebCore9HTMLNames9titleAttrE
 __ZN7WebCore9HTMLNames9valueAttrE
 __ZN7WebCore9InlineBox14adjustPositionEff
 __ZN7WebCore9InlineBox14dirtyLineBoxesEv
@@ -1390,6 +1394,7 @@
 __ZN7WebCore9plainTextEPKNS_5RangeENS_20TextIteratorBehaviorEb
 __ZN7WebCore9toElementEN3JSC7JSValueE
 __ZN7WebCore9unionRectERKN3WTF6VectorINS_9FloatRectELm0ENS0_15CrashOnOverflowEEE
+__ZN7WebCore10Pasteboard21createForCopyAndPasteEv
 __ZN7WebCore10TimeRanges13intersectWithEPKS0_
 __ZN7WebCore10TimeRangesC1Edd
 __ZNK3JSC8Bindings10RootObject12globalObjectEv

Modified: trunk/Source/WebCore/editing/Editor.cpp (162996 => 162997)


--- trunk/Source/WebCore/editing/Editor.cpp	2014-01-29 03:24:01 UTC (rev 162996)
+++ trunk/Source/WebCore/editing/Editor.cpp	2014-01-29 04:09:12 UTC (rev 162997)
@@ -1391,7 +1391,6 @@
     applyCommand(SimplifyMarkupCommand::create(document(), startNode, (endNode) ? NodeTraversal::next(endNode) : 0));
 }
 
-#if !PLATFORM(IOS)
 void Editor::copyURL(const URL& url, const String& title)
 {
     copyURL(url, title, *Pasteboard::createForCopyAndPaste());
@@ -1410,6 +1409,7 @@
     pasteboard.write(pasteboardURL);
 }
 
+#if !PLATFORM(IOS)
 void Editor::copyImage(const HitTestResult& result)
 {
     Element* element = result.innerNonSharedElement();

Modified: trunk/Source/WebCore/editing/Editor.h (162996 => 162997)


--- trunk/Source/WebCore/editing/Editor.h	2014-01-29 03:24:01 UTC (rev 162996)
+++ trunk/Source/WebCore/editing/Editor.h	2014-01-29 04:09:12 UTC (rev 162997)
@@ -126,9 +126,9 @@
     void pasteAsPlainText();
     void performDelete();
 
-#if !PLATFORM(IOS)
     void copyURL(const URL&, const String& title);
     void copyURL(const URL&, const String& title, Pasteboard&);
+#if !PLATFORM(IOS)
     void copyImage(const HitTestResult&);
 #endif
 

Modified: trunk/Source/WebCore/editing/ios/EditorIOS.mm (162996 => 162997)


--- trunk/Source/WebCore/editing/ios/EditorIOS.mm	2014-01-29 03:24:01 UTC (rev 162996)
+++ trunk/Source/WebCore/editing/ios/EditorIOS.mm	2014-01-29 04:09:12 UTC (rev 162997)
@@ -48,6 +48,7 @@
 #include "Pasteboard.h"
 #include "RenderBlock.h"
 #include "RenderImage.h"
+#include "ResourceBuffer.h"
 #include "SharedBuffer.h"
 #include "SoftLinking.h"
 #include "StyleProperties.h"
@@ -374,6 +375,7 @@
     pasteboardImage.url.url = ""
     pasteboardImage.url.title = title;
     pasteboardImage.resourceMIMEType = pasteboard.resourceMIMEType(cachedImage->response().mimeType());
+    pasteboardImage.resourceData = cachedImage->resourceBuffer()->sharedBuffer();
 
     pasteboard.write(pasteboardImage);
 }

Modified: trunk/Source/WebCore/platform/ios/PasteboardIOS.mm (162996 => 162997)


--- trunk/Source/WebCore/platform/ios/PasteboardIOS.mm	2014-01-29 03:24:01 UTC (rev 162996)
+++ trunk/Source/WebCore/platform/ios/PasteboardIOS.mm	2014-01-29 04:09:12 UTC (rev 162997)
@@ -150,6 +150,11 @@
     platformStrategies()->pasteboardStrategy()->writeToPasteboard(kUTTypeText, text);
 }
 
+void Pasteboard::write(const PasteboardURL& pasteboardURL)
+{
+    platformStrategies()->pasteboardStrategy()->writeToPasteboard(kUTTypeURL, pasteboardURL.url.string());
+}
+
 void Pasteboard::writePasteboard(const Pasteboard&)
 {
 }

Modified: trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm (162996 => 162997)


--- trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm	2014-01-29 03:24:01 UTC (rev 162996)
+++ trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm	2014-01-29 04:09:12 UTC (rev 162997)
@@ -169,7 +169,7 @@
 {
     RetainPtr<NSMutableDictionary> representations = adoptNS([[NSMutableDictionary alloc] init]);
     if (!pasteboardImage.resourceMIMEType.isNull()) {
-        [representations setObject:pasteboardImage.image->data()->createNSData().get() forKey:pasteboardImage.resourceMIMEType];
+        [representations setObject:pasteboardImage.resourceData->createNSData().get() forKey:pasteboardImage.resourceMIMEType];
         [representations setObject:(NSString *)pasteboardImage.url.url forKey:(NSString *)kUTTypeURL];
     }
     [m_pasteboard setItems:@[representations.get()]];
@@ -179,9 +179,10 @@
 {
     RetainPtr<NSDictionary> representations = adoptNS([[NSMutableDictionary alloc] init]);
 
-    if (pasteboardType == String(kUTTypeURL))
+    if (pasteboardType == String(kUTTypeURL)) {
         [representations setValue:adoptNS([[NSURL alloc] initWithString:text]).get() forKey:pasteboardType];
-    else if (!pasteboardType.isNull())
+        [representations setValue:text forKey:(NSString *)kUTTypeText];
+    } else if (!pasteboardType.isNull())
         [representations setValue:text forKey:pasteboardType];
     [m_pasteboard setItems:@[representations.get()]];
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to