Diff
Modified: trunk/LayoutTests/ChangeLog (88065 => 88066)
--- trunk/LayoutTests/ChangeLog 2011-06-03 21:53:04 UTC (rev 88065)
+++ trunk/LayoutTests/ChangeLog 2011-06-03 21:55:11 UTC (rev 88066)
@@ -1,3 +1,23 @@
+2011-05-31 Martin Robinson <[email protected]>
+
+ Reviewed by Ryosuke Niwa.
+
+ [GTK] Support smart replace for the pasteboard
+ https://bugs.webkit.org/show_bug.cgi?id=61734
+
+ Unskip tests which are now passing and update results for other tests
+ which vary depending on smart replace support.
+
+ * platform/gtk/Skipped: Unskip tests which are now passing.
+ * platform/gtk/editing/deleting/smart-delete-003-expected.txt:
+ * platform/gtk/editing/deleting/smart-delete-004-expected.txt:
+ * platform/gtk/editing/pasteboard/4944770-2-expected.txt:
+ * platform/gtk/editing/pasteboard/drag-drop-modifies-page-expected.txt:
+ * platform/gtk/editing/pasteboard/smart-paste-007-expected.txt:
+ * platform/gtk/editing/pasteboard/smart-paste-008-expected.txt:
+ * platform/gtk/editing/pasteboard/subframe-dragndrop-1-expected.txt:
+ * platform/gtk/fast/lists/drag-into-marker-expected.txt:
+
2011-06-03 Martin Robinson <[email protected]>
Reviewed by Dimitri Glazkov.
Modified: trunk/LayoutTests/platform/gtk/Skipped (88065 => 88066)
--- trunk/LayoutTests/platform/gtk/Skipped 2011-06-03 21:53:04 UTC (rev 88065)
+++ trunk/LayoutTests/platform/gtk/Skipped 2011-06-03 21:55:11 UTC (rev 88066)
@@ -402,11 +402,6 @@
# GTK doesn't support smart replace
# https://bugs.webkit.org/show_bug.cgi?id=61661
editing/pasteboard/smart-drag-drop.html
-editing/pasteboard/smart-paste-001.html
-editing/pasteboard/smart-paste-002.html
-editing/pasteboard/smart-paste-003.html
-editing/pasteboard/smart-paste-004.html
-editing/pasteboard/smart-paste-005.html
editing/pasteboard/drag-drop-list.html
###############################################################################
Modified: trunk/LayoutTests/platform/gtk/editing/deleting/smart-delete-003-expected.txt (88065 => 88066)
--- trunk/LayoutTests/platform/gtk/editing/deleting/smart-delete-003-expected.txt 2011-06-03 21:53:04 UTC (rev 88065)
+++ trunk/LayoutTests/platform/gtk/editing/deleting/smart-delete-003-expected.txt 2011-06-03 21:55:11 UTC (rev 88066)
@@ -6,6 +6,7 @@
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldDeleteDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 3 of #text > DIV > BODY > HTML > #document to 3 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
layer at (0,0) size 800x600
@@ -20,8 +21,8 @@
text run at (740,0) width 28: "You"
text run at (0,19) width 127: "should see 'foo baz'."
RenderBlock {DIV} at (0,54) size 784x19
- RenderText {#text} at (0,0) size 25x19
- text run at (0,0) width 25: "foo "
- RenderText {#text} at (25,0) size 26x19
- text run at (25,0) width 26: " baz"
-caret: position 4 of child 0 {#text} of child 2 {DIV} of body
+ RenderText {#text} at (0,0) size 21x19
+ text run at (0,0) width 21: "foo"
+ RenderText {#text} at (21,0) size 26x19
+ text run at (21,0) width 26: " baz"
+caret: position 3 of child 0 {#text} of child 2 {DIV} of body
Modified: trunk/LayoutTests/platform/gtk/editing/deleting/smart-delete-004-expected.txt (88065 => 88066)
--- trunk/LayoutTests/platform/gtk/editing/deleting/smart-delete-004-expected.txt 2011-06-03 21:53:04 UTC (rev 88065)
+++ trunk/LayoutTests/platform/gtk/editing/deleting/smart-delete-004-expected.txt 2011-06-03 21:55:11 UTC (rev 88066)
@@ -6,6 +6,7 @@
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldDeleteDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 3 of #text > DIV > BODY > HTML > #document to 3 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
layer at (0,0) size 800x600
@@ -20,8 +21,8 @@
text run at (0,19) width 45: "delete. "
text run at (45,19) width 159: "You should see 'foo baz'."
RenderBlock {DIV} at (0,54) size 784x19
- RenderText {#text} at (0,0) size 25x19
- text run at (0,0) width 25: "foo "
- RenderText {#text} at (25,0) size 26x19
- text run at (25,0) width 26: " baz"
-caret: position 4 of child 0 {#text} of child 2 {DIV} of body
+ RenderText {#text} at (0,0) size 21x19
+ text run at (0,0) width 21: "foo"
+ RenderText {#text} at (21,0) size 26x19
+ text run at (21,0) width 26: " baz"
+caret: position 3 of child 0 {#text} of child 2 {DIV} of body
Modified: trunk/LayoutTests/platform/gtk/editing/pasteboard/4944770-2-expected.txt (88065 => 88066)
--- trunk/LayoutTests/platform/gtk/editing/pasteboard/4944770-2-expected.txt 2011-06-03 21:53:04 UTC (rev 88065)
+++ trunk/LayoutTests/platform/gtk/editing/pasteboard/4944770-2-expected.txt 2011-06-03 21:55:11 UTC (rev 88066)
@@ -16,10 +16,14 @@
RenderBlock {DIV} at (0,85) size 784x31
RenderText {#text} at (0,6) size 8x19
text run at (0,6) width 8: "x"
- RenderMenuList {SELECT} at (10,2) size 37x27 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
+ RenderText {#text} at (8,6) size 4x19
+ text run at (8,6) width 4: " "
+ RenderMenuList {SELECT} at (14,2) size 37x27 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
RenderBlock (anonymous) at (1,1) size 35x25
RenderText at (3,3) size 9x19
text run at (3,3) width 9: "1"
- RenderText {#text} at (49,6) size 8x19
- text run at (49,6) width 8: "x"
-caret: position 3 of child 1 {SELECT} of child 4 {DIV} of body
+ RenderText {#text} at (53,6) size 4x19
+ text run at (53,6) width 4: " "
+ RenderText {#text} at (57,6) size 8x19
+ text run at (57,6) width 8: "x"
+caret: position 1 of child 3 {#text} of child 4 {DIV} of body
Modified: trunk/LayoutTests/platform/gtk/editing/pasteboard/drag-drop-modifies-page-expected.txt (88065 => 88066)
--- trunk/LayoutTests/platform/gtk/editing/pasteboard/drag-drop-modifies-page-expected.txt 2011-06-03 21:53:04 UTC (rev 88065)
+++ trunk/LayoutTests/platform/gtk/editing/pasteboard/drag-drop-modifies-page-expected.txt 2011-06-03 21:55:11 UTC (rev 88066)
@@ -17,9 +17,9 @@
text run at (0,0) width 719: "This tests non-smartmove drag/drop. The space should be deleted on move, but not reinserted on drop, resulting in"
text run at (0,19) width 86: "\"worldhello\"."
RenderBlock {DIV} at (0,54) size 784x19
- RenderText {#text} at (0,0) size 41x19
- text run at (0,0) width 41: " world"
- RenderText {#text} at (41,0) size 31x19
- text run at (41,0) width 31: "hello"
+ RenderText {#text} at (0,0) size 37x19
+ text run at (0,0) width 37: "world"
+ RenderText {#text} at (37,0) size 31x19
+ text run at (37,0) width 31: "hello"
selection start: position 0 of child 1 {#text} of child 3 {DIV} of body
selection end: position 5 of child 1 {#text} of child 3 {DIV} of body
Modified: trunk/LayoutTests/platform/gtk/editing/pasteboard/smart-paste-007-expected.txt (88065 => 88066)
--- trunk/LayoutTests/platform/gtk/editing/pasteboard/smart-paste-007-expected.txt 2011-06-03 21:53:04 UTC (rev 88065)
+++ trunk/LayoutTests/platform/gtk/editing/pasteboard/smart-paste-007-expected.txt 2011-06-03 21:55:11 UTC (rev 88066)
@@ -20,7 +20,7 @@
EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 4 of #text > DIV > DIV > BODY > HTML > #document to 4 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
layer at (0,0) size 800x600
@@ -49,9 +49,9 @@
RenderBlock {DIV} at (0,0) size 784x32 [border: (2px solid #FF0000)]
RenderText {#text} at (2,2) size 6x28
text run at (2,2) width 6: "."
- RenderText {#text} at (8,2) size 34x28
- text run at (8,2) width 34: "test"
- RenderText {#text} at (42,2) size 6x28
- text run at (42,2) width 6: "."
+ RenderText {#text} at (8,2) size 40x28
+ text run at (8,2) width 40: " test"
+ RenderText {#text} at (48,2) size 6x28
+ text run at (48,2) width 6: "."
RenderBlock (anonymous) at (0,32) size 784x0
-caret: position 4 of child 1 {#text} of child 1 {DIV} of child 3 {DIV} of body
+caret: position 5 of child 1 {#text} of child 1 {DIV} of child 3 {DIV} of body
Modified: trunk/LayoutTests/platform/gtk/editing/pasteboard/smart-paste-008-expected.txt (88065 => 88066)
--- trunk/LayoutTests/platform/gtk/editing/pasteboard/smart-paste-008-expected.txt 2011-06-03 21:53:04 UTC (rev 88065)
+++ trunk/LayoutTests/platform/gtk/editing/pasteboard/smart-paste-008-expected.txt 2011-06-03 21:55:11 UTC (rev 88066)
@@ -9,7 +9,7 @@
EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 3 of #text > DIV > DIV > BODY > HTML > #document to 3 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 4 of #text > DIV > DIV > BODY > HTML > #document to 4 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
layer at (0,0) size 800x600
@@ -31,9 +31,9 @@
RenderBlock {DIV} at (0,0) size 784x19
RenderText {#text} at (0,0) size 5x19
text run at (0,0) width 5: "f"
- RenderText {#text} at (5,0) size 21x19
- text run at (5,0) width 21: "foo"
- RenderText {#text} at (26,0) size 24x19
- text run at (26,0) width 24: " bar"
+ RenderText {#text} at (5,0) size 25x19
+ text run at (5,0) width 25: " foo"
+ RenderText {#text} at (30,0) size 24x19
+ text run at (30,0) width 24: " bar"
RenderBlock (anonymous) at (0,19) size 784x0
-caret: position 3 of child 1 {#text} of child 0 {DIV} of child 4 {DIV} of body
+caret: position 4 of child 1 {#text} of child 0 {DIV} of child 4 {DIV} of body
Modified: trunk/LayoutTests/platform/gtk/editing/pasteboard/subframe-dragndrop-1-expected.txt (88065 => 88066)
--- trunk/LayoutTests/platform/gtk/editing/pasteboard/subframe-dragndrop-1-expected.txt 2011-06-03 21:53:04 UTC (rev 88065)
+++ trunk/LayoutTests/platform/gtk/editing/pasteboard/subframe-dragndrop-1-expected.txt 2011-06-03 21:55:11 UTC (rev 88066)
@@ -10,9 +10,8 @@
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 11 of #text > BODY > HTML > #document to 11 of #text > BODY > HTML > #document givenAction:WebViewInsertActionDropped
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > BODY > HTML > #document to 3 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 4 of #text > BODY > HTML > #document to 5 of #text > BODY > HTML > #document toDOMRange:range from 0 of #text > BODY > HTML > #document to 3 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
@@ -26,10 +25,10 @@
layer at (0,0) size 300x300
RenderBlock {HTML} at (0,0) size 300x300
RenderBody {BODY} at (8,8) size 284x284 [bgcolor=#FFFFE0]
- RenderText {#text} at (0,0) size 51x19
- text run at (0,0) width 51: "foo baz"
- RenderText {#text} at (51,0) size 20x19
- text run at (51,0) width 20: "bar"
+ RenderText {#text} at (0,0) size 47x19
+ text run at (0,0) width 47: "foo baz"
+ RenderText {#text} at (47,0) size 20x19
+ text run at (47,0) width 20: "bar"
RenderText {#text} at (0,0) size 0x0
RenderBlock {P} at (0,320) size 800x38
RenderText {#text} at (0,0) size 795x38
Modified: trunk/LayoutTests/platform/gtk/fast/lists/drag-into-marker-expected.txt (88065 => 88066)
--- trunk/LayoutTests/platform/gtk/fast/lists/drag-into-marker-expected.txt 2011-06-03 21:53:04 UTC (rev 88065)
+++ trunk/LayoutTests/platform/gtk/fast/lists/drag-into-marker-expected.txt 2011-06-03 21:55:11 UTC (rev 88066)
@@ -8,9 +8,8 @@
RenderListMarker at (-36,0) size 16x54: black square
RenderText {#text} at (0,0) size 112x54
text run at (0,0) width 112: "world"
- RenderText {#text} at (112,0) size 107x54
+ RenderText {#text} at (112,0) size 95x54
text run at (112,0) width 95: "hello"
- text run at (207,0) width 12: " "
RenderBlock {P} at (0,73) size 784x76
RenderText {#text} at (0,0) size 768x76
text run at (0,0) width 562: "This is an automated test for elementAtPoint for points over position:outside list markers. "
Modified: trunk/Source/WebCore/ChangeLog (88065 => 88066)
--- trunk/Source/WebCore/ChangeLog 2011-06-03 21:53:04 UTC (rev 88065)
+++ trunk/Source/WebCore/ChangeLog 2011-06-03 21:55:11 UTC (rev 88066)
@@ -1,3 +1,28 @@
+2011-05-31 Martin Robinson <[email protected]>
+
+ Reviewed by Ryosuke Niwa.
+
+ [GTK] Support smart replace for the pasteboard
+ https://bugs.webkit.org/show_bug.cgi?id=61734
+
+ Add smart replace support to WebCore and add hooks for it in WebKit
+ via DumpRenderTreeSupportGtk. When a platform supports smart replace,
+ WebCore will remove extra spaces that appear when pasting text. Eventually
+ WebKitGTK+ may want to expose this in the public API.
+
+ * platform/gtk/PasteboardGtk.cpp:
+ (WebCore::Pasteboard::writeSelection): Now pass whether or not to use smart replace
+ when calling writeSelection.
+ (WebCore::Pasteboard::canSmartReplace): Added an implementation that checks the clipboard
+ for whether or not it supports smart paste.
+ * platform/gtk/PasteboardHelper.cpp:
+ (WebCore::initGdkAtoms): Added initialization for smart replace atom.
+ (WebCore::PasteboardHelper::fillSelectionData): Added no-op handler for smart replace atom.
+ (WebCore::PasteboardHelper::targetListForDataObject): Properly handle new smart replace parameter.
+ (WebCore::PasteboardHelper::writeClipboardContents): Properly handle new smart replace parameter.
+ (WebCore::PasteboardHelper::clipboardContentSupportsSmartReplace): Added helper for Pasteboard.
+ * platform/gtk/PasteboardHelper.h: Add new method definition.
+
2011-06-03 Levi Weintraub <[email protected]>
Reviewed by Eric Seidel.
Modified: trunk/Source/WebCore/platform/gtk/PasteboardGtk.cpp (88065 => 88066)
--- trunk/Source/WebCore/platform/gtk/PasteboardGtk.cpp 2011-06-03 21:53:04 UTC (rev 88065)
+++ trunk/Source/WebCore/platform/gtk/PasteboardGtk.cpp 2011-06-03 21:55:11 UTC (rev 88066)
@@ -61,7 +61,7 @@
DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
dataObject->setText(frame->editor()->selectedText());
dataObject->setMarkup(createMarkup(selectedRange, 0, AnnotateForInterchange, false, AbsoluteURLs));
- helper->writeClipboardContents(clipboard);
+ helper->writeClipboardContents(clipboard, canSmartCopyOrDelete ? PasteboardHelper::IncludeSmartPaste : PasteboardHelper::DoNotIncludeSmartPaste);
}
void Pasteboard::writePlainText(const String& text)
@@ -142,8 +142,8 @@
bool Pasteboard::canSmartReplace()
{
- notImplemented();
- return false;
+ return PasteboardHelper::defaultPasteboardHelper()->clipboardContentSupportsSmartReplace(
+ gtk_clipboard_get_for_display(gdk_display_get_default(), GDK_SELECTION_CLIPBOARD));
}
PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefPtr<Range> context,
Modified: trunk/Source/WebCore/platform/gtk/PasteboardHelper.cpp (88065 => 88066)
--- trunk/Source/WebCore/platform/gtk/PasteboardHelper.cpp 2011-06-03 21:53:04 UTC (rev 88065)
+++ trunk/Source/WebCore/platform/gtk/PasteboardHelper.cpp 2011-06-03 21:55:11 UTC (rev 88066)
@@ -38,6 +38,7 @@
static GdkAtom markupAtom;
static GdkAtom netscapeURLAtom;
static GdkAtom uriListAtom;
+static GdkAtom smartPasteAtom;
static String gMarkupPrefix;
static void removeMarkupPrefix(String& markup)
@@ -61,6 +62,7 @@
markupAtom = gdk_atom_intern("text/html", FALSE);
netscapeURLAtom = gdk_atom_intern("_NETSCAPE_URL", FALSE);
uriListAtom = gdk_atom_intern("text/uri-list", FALSE);
+ smartPasteAtom = gdk_atom_intern("application/vnd.webkitgtk.smartpaste", FALSE);
gMarkupPrefix = "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">";
}
@@ -190,9 +192,12 @@
} else if (info == TargetTypeImage)
gtk_selection_data_set_pixbuf(selectionData, dataObject->image());
+
+ else if (info == TargetTypeSmartPaste)
+ gtk_selection_data_set_text(selectionData, "", -1);
}
-GtkTargetList* PasteboardHelper::targetListForDataObject(DataObjectGtk* dataObject)
+GtkTargetList* PasteboardHelper::targetListForDataObject(DataObjectGtk* dataObject, SmartPasteInclusion shouldInludeSmartPaste)
{
GtkTargetList* list = gtk_target_list_new(0, 0);
@@ -210,6 +215,9 @@
if (dataObject->hasImage())
gtk_target_list_add_image_targets(list, TargetTypeImage, TRUE);
+ if (shouldInludeSmartPaste == IncludeSmartPaste)
+ gtk_target_list_add(list, smartPasteAtom, 0, TargetTypeSmartPaste);
+
return list;
}
@@ -289,10 +297,10 @@
g_closure_unref(callback);
}
-void PasteboardHelper::writeClipboardContents(GtkClipboard* clipboard, GClosure* callback)
+void PasteboardHelper::writeClipboardContents(GtkClipboard* clipboard, SmartPasteInclusion includeSmartPaste, GClosure* callback)
{
DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
- GtkTargetList* list = targetListForDataObject(dataObject);
+ GtkTargetList* list = targetListForDataObject(dataObject, includeSmartPaste);
int numberOfTargets;
GtkTargetEntry* table = gtk_target_table_new_from_list(list, &numberOfTargets);
@@ -314,5 +322,10 @@
gtk_target_list_unref(list);
}
+bool PasteboardHelper::clipboardContentSupportsSmartReplace(GtkClipboard* clipboard)
+{
+ return gtk_clipboard_wait_is_target_available(clipboard, smartPasteAtom);
}
+}
+
Modified: trunk/Source/WebCore/platform/gtk/PasteboardHelper.h (88065 => 88066)
--- trunk/Source/WebCore/platform/gtk/PasteboardHelper.h 2011-06-03 21:53:04 UTC (rev 88065)
+++ trunk/Source/WebCore/platform/gtk/PasteboardHelper.h 2011-06-03 21:55:11 UTC (rev 88066)
@@ -40,18 +40,21 @@
void setUsePrimarySelectionClipboard(bool usePrimary) { m_usePrimarySelectionClipboard = usePrimary; }
bool usePrimarySelectionClipboard() { return m_usePrimarySelectionClipboard; }
+ enum SmartPasteInclusion { IncludeSmartPaste, DoNotIncludeSmartPaste };
+
GtkClipboard* getCurrentClipboard(Frame*);
GtkClipboard* getClipboard(Frame*) const;
GtkClipboard* getPrimarySelectionClipboard(Frame*) const;
GtkTargetList* targetList() const;
- GtkTargetList* targetListForDataObject(DataObjectGtk*);
+ GtkTargetList* targetListForDataObject(DataObjectGtk*, SmartPasteInclusion = DoNotIncludeSmartPaste);
void fillSelectionData(GtkSelectionData*, guint, DataObjectGtk*);
void fillDataObjectFromDropData(GtkSelectionData*, guint, DataObjectGtk*);
Vector<GdkAtom> dropAtomsForContext(GtkWidget*, GdkDragContext*);
- void writeClipboardContents(GtkClipboard*, GClosure* closure = 0);
+ void writeClipboardContents(GtkClipboard*, SmartPasteInclusion = DoNotIncludeSmartPaste, GClosure* = 0);
void getClipboardContents(GtkClipboard*);
- enum PasteboardTargetType { TargetTypeMarkup, TargetTypeText, TargetTypeImage, TargetTypeURIList, TargetTypeNetscapeURL, TargetTypeUnknown };
+ enum PasteboardTargetType { TargetTypeMarkup, TargetTypeText, TargetTypeImage, TargetTypeURIList, TargetTypeNetscapeURL, TargetTypeSmartPaste, TargetTypeUnknown };
+ bool clipboardContentSupportsSmartReplace(GtkClipboard*);
private:
GtkTargetList* m_targetList;
Modified: trunk/Source/WebKit/gtk/ChangeLog (88065 => 88066)
--- trunk/Source/WebKit/gtk/ChangeLog 2011-06-03 21:53:04 UTC (rev 88065)
+++ trunk/Source/WebKit/gtk/ChangeLog 2011-06-03 21:55:11 UTC (rev 88066)
@@ -1,3 +1,25 @@
+2011-05-31 Martin Robinson <[email protected]>
+
+ Reviewed by Ryosuke Niwa.
+
+ [GTK] Support smart replace for the pasteboard
+ https://bugs.webkit.org/show_bug.cgi?id=61734
+
+ Add the EditorClient and DumpRenderTreeSupportGtk hooks for enabling
+ smart replace in the tests.
+
+ * WebCoreSupport/DragClientGtk.cpp:
+ (WebKit::DragClient::startDrag): targeListForDataObject now takes another
+ parameter determining whether or not to add smart paste support. Add it here.
+ * WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
+ (DumpRenderTreeSupportGtk::setSmartInsertDeleteEnabled): Added.
+ * WebCoreSupport/DumpRenderTreeSupportGtk.h: Add new method definition.
+ * WebCoreSupport/EditorClientGtk.cpp:
+ (WebKit::EditorClient::toggleSmartInsertDelete): Added implementation.
+ (WebKit::EditorClient::smartInsertDeleteEnabled): Added.
+ (WebKit::EditorClient::EditorClient):
+ * WebCoreSupport/EditorClientGtk.h: Add new method definition.
+
2011-06-03 Sergio Villar Senin <[email protected]>
Reviewed by Martin Robinson.
Modified: trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp (88065 => 88066)
--- trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp 2011-06-03 21:53:04 UTC (rev 88065)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp 2011-06-03 21:55:11 UTC (rev 88066)
@@ -28,6 +28,7 @@
#include "AnimationController.h"
#include "DOMWrapperWorld.h"
#include "Document.h"
+#include "EditorClientGtk.h"
#include "Element.h"
#include "FocusController.h"
#include "FrameLoaderClientGtk.h"
@@ -607,6 +608,15 @@
return true;
}
+void DumpRenderTreeSupportGtk::setSmartInsertDeleteEnabled(WebKitWebView* webView, bool enabled)
+{
+ g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
+ g_return_if_fail(webView);
+
+ WebKit::EditorClient* client = static_cast<WebKit::EditorClient*>(core(webView)->editorClient());
+ client->setSmartInsertDeleteEnabled(enabled);
+}
+
void DumpRenderTreeSupportGtk::whiteListAccessFromOrigin(const gchar* sourceOrigin, const gchar* destinationProtocol, const gchar* destinationHost, bool allowDestinationSubdomains)
{
SecurityOrigin::addOriginAccessWhitelistEntry(*SecurityOrigin::createFromString(sourceOrigin), destinationProtocol, destinationHost, allowDestinationSubdomains);
Modified: trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h (88065 => 88066)
--- trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h 2011-06-03 21:53:04 UTC (rev 88065)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h 2011-06-03 21:55:11 UTC (rev 88066)
@@ -105,6 +105,7 @@
static void setMinimumTimerInterval(WebKitWebView*, double);
static void rectangleForSelection(WebKitWebFrame*, GdkRectangle*);
static void scalePageBy(WebKitWebView*, float, float, float);
+ static void setSmartInsertDeleteEnabled(WebKitWebView*, bool);
// Accessibility
static void incrementAccessibilityValue(AtkObject*);
Modified: trunk/Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp (88065 => 88066)
--- trunk/Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp 2011-06-03 21:53:04 UTC (rev 88065)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp 2011-06-03 21:55:11 UTC (rev 88066)
@@ -295,7 +295,7 @@
viewSettingClipboard = webView;
GClosure* callback = g_cclosure_new_object(G_CALLBACK(collapseSelection), G_OBJECT(webView));
g_closure_set_marshal(callback, g_cclosure_marshal_VOID__VOID);
- PasteboardHelper::defaultPasteboardHelper()->writeClipboardContents(clipboard, callback);
+ PasteboardHelper::defaultPasteboardHelper()->writeClipboardContents(clipboard, PasteboardHelper::DoNotIncludeSmartPaste, callback);
viewSettingClipboard = 0;
}
#endif
@@ -423,10 +423,14 @@
delete this;
}
+void EditorClient::setSmartInsertDeleteEnabled(bool enabled)
+{
+ m_smartInsertDeleteEnabled = enabled;
+}
+
bool EditorClient::smartInsertDeleteEnabled()
{
- notImplemented();
- return false;
+ return m_smartInsertDeleteEnabled;
}
bool EditorClient::isSelectTrailingWhitespaceEnabled()
@@ -626,6 +630,7 @@
, m_webView(webView)
, m_preventNextCompositionCommit(false)
, m_treatContextCommitAsKeyEvent(false)
+ , m_smartInsertDeleteEnabled(false)
{
WebKitWebViewPrivate* priv = m_webView->priv;
g_signal_connect(priv->imContext.get(), "commit", G_CALLBACK(imContextCommitted), this);
Modified: trunk/Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.h (88065 => 88066)
--- trunk/Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.h 2011-06-03 21:53:04 UTC (rev 88065)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.h 2011-06-03 21:55:11 UTC (rev 88066)
@@ -80,6 +80,7 @@
virtual bool shouldDeleteRange(WebCore::Range*);
virtual bool shouldShowDeleteInterface(WebCore::HTMLElement*);
virtual bool smartInsertDeleteEnabled();
+ void setSmartInsertDeleteEnabled(bool);
virtual bool isSelectTrailingWhitespaceEnabled();
virtual bool isContinuousSpellCheckingEnabled();
virtual void toggleContinuousSpellChecking();
@@ -149,6 +150,8 @@
WebCore::KeyBindingTranslator m_keyBindingTranslator;
Vector<WTF::String> m_pendingEditorCommands;
+
+ bool m_smartInsertDeleteEnabled;
};
}
Modified: trunk/Tools/ChangeLog (88065 => 88066)
--- trunk/Tools/ChangeLog 2011-06-03 21:53:04 UTC (rev 88065)
+++ trunk/Tools/ChangeLog 2011-06-03 21:55:11 UTC (rev 88066)
@@ -1,3 +1,19 @@
+2011-05-31 Martin Robinson <[email protected]>
+
+ Reviewed by Ryosuke Niwa.
+
+ [GTK] Support smart replace for the pasteboard
+ https://bugs.webkit.org/show_bug.cgi?id=61734
+
+ Call into the DumpRenderTreeSupportGtk hooks to toggle smart replace.
+ This is required to produce consistent test results.
+
+ * DumpRenderTree/gtk/DumpRenderTree.cpp:
+ (resetDefaultsToConsistentValues): Set the smart replace setting to on by default.
+ * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
+ (LayoutTestController::setSmartInsertDeleteEnabled): Added an implementation of this
+ methods which calls into DumpRenderTreeSupportGtk.
+
2011-06-03 Martin Robinson <[email protected]>
Reviewed by Dimitri Glazkov.
Modified: trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp (88065 => 88066)
--- trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp 2011-06-03 21:53:04 UTC (rev 88065)
+++ trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp 2011-06-03 21:55:11 UTC (rev 88066)
@@ -467,6 +467,7 @@
DumpRenderTreeSupportGtk::setLinksIncludedInFocusChain(true);
webkit_icon_database_set_path(webkit_get_icon_database(), 0);
DumpRenderTreeSupportGtk::setSelectTrailingWhitespaceEnabled(false);
+ DumpRenderTreeSupportGtk::setSmartInsertDeleteEnabled(webView, true);
if (axController)
axController->resetToConsistentState();
Modified: trunk/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp (88065 => 88066)
--- trunk/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp 2011-06-03 21:53:04 UTC (rev 88065)
+++ trunk/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp 2011-06-03 21:55:11 UTC (rev 88066)
@@ -365,7 +365,7 @@
void LayoutTestController::setSmartInsertDeleteEnabled(bool flag)
{
- // FIXME: implement
+ DumpRenderTreeSupportGtk::setSmartInsertDeleteEnabled(webkit_web_frame_get_web_view(mainFrame), flag);
}
static gboolean waitToDumpWatchdogFired(void*)