RESOLVED FIXED Bug 61734
[GTK] Support smart replace for the pasteboard
https://bugs.webkit.org/show_bug.cgi?id=61734
Summary [GTK] Support smart replace for the pasteboard
Martin Robinson
Reported 2011-05-30 10:12:17 PDT
There are some pasteboard tests that fail because GTK+ does not have a hook for enabling and disabling smart replace.
Attachments
Patch (32.77 KB, patch)
2011-05-31 15:31 PDT, Martin Robinson
no flags
Patch (32.78 KB, patch)
2011-06-03 09:30 PDT, Martin Robinson
rniwa: review+
Martin Robinson
Comment 1 2011-05-31 15:31:29 PDT
Ryosuke Niwa
Comment 2 2011-06-02 18:35:27 PDT
Comment on attachment 95496 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=95496&action=review toggleSmartInsertDelete seems odd to me but maybe it's gtk-style. > Source/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp:106 > - GRefPtr<GtkTargetList> targetList(PasteboardHelper::defaultPasteboardHelper()->targetListForDataObject(dataObject.get())); > + GRefPtr<GtkTargetList> targetList(PasteboardHelper::defaultPasteboardHelper()->targetListForDataObject(dataObject.get(), false)); Can we instead set the default value be false? This is a classic case of enum being superior to bool. > Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp:617 > + if (client->smartInsertDeleteEnabled() != enabled) > + client->toggleSmartInsertDelete(); If we had setSmartInsertDeleteEnabled, then we shouldn't need to have an if statement here. > Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp:429 > +void EditorClient::toggleSmartInsertDelete() > +{ > + m_smartInsertDeleteEnabled = !m_smartInsertDeleteEnabled; > +} We normally add setSmartInsertDeleteEnabled(bool).
Martin Robinson
Comment 3 2011-06-03 09:30:42 PDT
Martin Robinson
Comment 4 2011-06-03 09:55:11 PDT
(In reply to comment #2) > (From update of attachment 95496 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=95496&action=review > toggleSmartInsertDelete seems odd to me but maybe it's gtk-style. Nope, this was just copied from the Mac port. I've converted it to setSmartInsertDeleteEanbled(bool); > > Source/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp:106 > > - GRefPtr<GtkTargetList> targetList(PasteboardHelper::defaultPasteboardHelper()->targetListForDataObject(dataObject.get())); > > + GRefPtr<GtkTargetList> targetList(PasteboardHelper::defaultPasteboardHelper()->targetListForDataObject(dataObject.get(), false)); > > Can we instead set the default value be false? This is a classic case of enum being superior to bool. I've changed the two methods in this class to take an enum. I've uploaded a new patch, in case you had any comments on the naming. If you have no objections, I'll land the new version. > > Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp:617 > > + if (client->smartInsertDeleteEnabled() != enabled) > > + client->toggleSmartInsertDelete(); > > If we had setSmartInsertDeleteEnabled, then we shouldn't need to have an if statement here. We have setSmartInsertDeleteEnabled now so I've corrected this. > > Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp:429 > > +void EditorClient::toggleSmartInsertDelete() > > +{ > > + m_smartInsertDeleteEnabled = !m_smartInsertDeleteEnabled; > > +} > We normally add setSmartInsertDeleteEnabled(bool). Fixed.
Ryosuke Niwa
Comment 5 2011-06-03 11:03:33 PDT
Comment on attachment 95923 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=95923&action=review > Source/WebCore/platform/gtk/PasteboardGtk.cpp:65 > + PasteboardHelper::DoNotIncludeSmartPaste); I don't think we indent deep like this. We normally do: helper->writeClipboardContents(clipboard, canSmartCopyOrDelete ? PasteboardHelper::IncludeSmartPaste : PasteboardHelper::DoNotIncludeSmartPaste); > Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp:616 > + WebKit::EditorClient* client = static_cast<WebKit::EditorClient*>(core(webView)->editorClient()); > + client->setSmartInsertDeleteEnabled(enabled); Can webView or client ever be null?
Martin Robinson
Comment 6 2011-06-03 14:41:11 PDT
Comment on attachment 95923 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=95923&action=review >> Source/WebCore/platform/gtk/PasteboardGtk.cpp:65 >> + PasteboardHelper::DoNotIncludeSmartPaste); > > I don't think we indent deep like this. We normally do: > helper->writeClipboardContents(clipboard, canSmartCopyOrDelete ? PasteboardHelper::IncludeSmartPaste : > PasteboardHelper::DoNotIncludeSmartPaste); In WebKitGTK+ we typically line them up instead of using a 4-space indent. If it's okay with you, I'll just make this one line. >> Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp:616 >> + client->setSmartInsertDeleteEnabled(enabled); > > Can webView or client ever be null? The WebView could potentially be null if DumpRenderTree calls this incorrectly. I'll add: g_return_if_fail(webView);
Martin Robinson
Comment 7 2011-06-03 14:55:29 PDT
Note You need to log in before you can comment on or make changes to this bug.