Changeset 127862 in webkit
- Timestamp:
- Sep 7, 2012 5:51:44 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r127858 r127862 1 2012-09-07 Allan Sandfeld Jensen <allan.jensen@nokia.com> 2 3 X11 Global Selection 4 https://bugs.webkit.org/show_bug.cgi?id=88238 5 6 Reviewed by Tony Chang. 7 8 Adds a test for the new editor-command, and disables it an all platforms where it is not supported. 9 10 * editing/pasteboard/paste-global-selection-expected.txt: Added. 11 * editing/pasteboard/paste-global-selection.html: Added. 12 * platform/chromium/TestExpectations: 13 * platform/efl/TestExpectations: 14 * platform/gtk/TestExpectations: 15 * platform/mac/Skipped: 16 * platform/qt-mac/Skipped: 17 * platform/win/Skipped: 18 1 19 2012-09-06 Vsevolod Vlasov <vsevik@chromium.org> 2 20 -
trunk/LayoutTests/platform/chromium/TestExpectations
r127803 r127862 890 890 WONTFIX : platform/gtk/plugins/invalidate-rect-with-null-npp-argument.html = TEXT 891 891 892 // Mac and Win does not have global selection. 893 WONTFIX MAC WIN : editing/pasteboard/paste-global-selection.html = TEXT 894 892 895 // Skipping rules for ANDROID are in platform/chromium-android/TestExpectations. 893 896 -
trunk/LayoutTests/platform/efl/TestExpectations
r127855 r127862 1087 1087 // Fails after r127534. 1088 1088 BUGWK95813 : fast/innerHTML/innerHTML-iframe.html = TEXT 1089 1090 // EFL does not yet support global selection 1091 BUGWK88238 SKIP : editing/pasteboard/paste-global-selection.html = TEXT -
trunk/LayoutTests/platform/gtk/TestExpectations
r127834 r127862 424 424 BUGWK92942 SKIP : fast/dom/Proximity = PASS 425 425 BUGWK92942 SKIP : fast/events/constructors/device-proximity-event-constructor.html = PASS 426 427 // Mac and Win does not have global selections. 428 WONTFIX MAC WIN : editing/pasteboard/paste-global-selection.html = TEXT 426 429 427 430 ////////////////////////////////////////////////////////////////////////////////////////// -
trunk/LayoutTests/platform/mac/Skipped
r127380 r127862 1034 1034 platform/mac/editing/spelling/delete-autocorrected-word-2.html 1035 1035 1036 // Mac does not have global selections. 1037 editing/pasteboard/paste-global-selection.html 1038 1036 1039 # --- WebGL --- 1037 1040 # Currently failing WebGL tests <rdar://problem/9355460> -
trunk/LayoutTests/platform/qt-mac/Skipped
r124696 r127862 4 4 # requires video.buffered to be able to return multiple timeranges 5 5 http/tests/media/video-buffered.html 6 7 // Mac does not have global selection 8 editing/pasteboard/paste-global-selection.html 6 9 7 10 # flakey tests -
trunk/LayoutTests/platform/win/Skipped
r127830 r127862 2221 2221 # Dialog element is not yet enabled. 2222 2222 fast/dom/HTMLDialogElement 2223 2224 // Windows does not have global selection. 2225 editing/pasteboard/paste-global-selection.html -
trunk/Source/WebCore/ChangeLog
r127861 r127862 1 2012-09-07 Allan Sandfeld Jensen <allan.jensen@nokia.com> 2 3 X11 Global Selection 4 https://bugs.webkit.org/show_bug.cgi?id=88238 5 6 Reviewed by Tony Chang. 7 8 In X11 global selection is the ability to share the active selection 9 between applications and pasting with middle mouse-button. 10 11 This patch moves the implementations of global selection from the 12 separate implementations in Qt WebKit, Chromium and GTK to WebCore, 13 by implementing a new EditorCommand for pasting the global selection. 14 15 Test: editing/pasteboard/paste-global-selection.html 16 17 * editing/EditorCommand.cpp: 18 (WebCore::executePasteGlobalSelection): 19 (WebCore::createCommandMap): 20 * page/EditorClient.h: 21 (EditorClient): 22 (WebCore::EditorClient::supportsGlobalSelection): 23 * platform/Pasteboard.h: 24 (WebCore::Pasteboard::isSelectionMode): 25 (WebCore::Pasteboard::setSelectionMode): 26 * platform/gtk/PasteboardGtk.cpp: 27 (WebCore::Pasteboard::writeSelection): 28 (WebCore::Pasteboard::writeURL): 29 (WebCore::Pasteboard::isSelectionMode): 30 (WebCore::Pasteboard::setSelectionMode): 31 1 32 2012-09-06 Vsevolod Vlasov <vsevik@chromium.org> 2 33 -
trunk/Source/WebCore/editing/EditorCommand.cpp
r126967 r127862 50 50 #include "KillRing.h" 51 51 #include "Page.h" 52 #include "Pasteboard.h" 52 53 #include "RenderBox.h" 53 54 #include "ReplaceSelectionCommand.h" … … 914 915 } else 915 916 frame->editor()->paste(); 917 return true; 918 } 919 920 static bool executePasteGlobalSelection(Frame* frame, Event*, EditorCommandSource source, const String&) 921 { 922 if (!frame->editor()->client()->supportsGlobalSelection()) 923 return false; 924 ASSERT_UNUSED(source, source == CommandFromMenuOrKeyBinding); 925 UserTypingGestureIndicator typingGestureIndicator(frame); 926 927 bool oldSelectionMode = Pasteboard::generalPasteboard()->isSelectionMode(); 928 Pasteboard::generalPasteboard()->setSelectionMode(true); 929 frame->editor()->paste(); 930 Pasteboard::generalPasteboard()->setSelectionMode(oldSelectionMode); 916 931 return true; 917 932 } … … 1545 1560 { "PasteAndMatchStyle", { executePasteAndMatchStyle, supportedPaste, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } }, 1546 1561 { "PasteAsPlainText", { executePasteAsPlainText, supportedPaste, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } }, 1562 { "PasteGlobalSelection", { executePasteGlobalSelection, supportedFromMenuOrKeyBinding, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } }, 1547 1563 { "Print", { executePrint, supported, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1548 1564 { "Redo", { executeRedo, supported, enabledRedo, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, -
trunk/Source/WebCore/page/EditorClient.h
r119687 r127862 156 156 virtual void willSetInputMethodState() = 0; 157 157 virtual void setInputMethodState(bool enabled) = 0; 158 159 // Support for global selections, used on platforms like the X Window System that treat 160 // selection as a type of clipboard. 161 virtual bool supportsGlobalSelection() { return false; } 158 162 }; 159 163 -
trunk/Source/WebCore/platform/Pasteboard.h
r125247 r127862 101 101 String plainText(Frame* = 0); 102 102 103 #if PLATFORM(QT) || PLATFORM(CHROMIUM) 103 #if PLATFORM(QT) || PLATFORM(CHROMIUM) || PLATFORM(GTK) 104 104 bool isSelectionMode() const; 105 void setSelectionMode(bool selectionMode); 105 void setSelectionMode(bool); 106 #else 107 bool isSelectionMode() const { return false; } 108 void setSelectionMode(bool) { } 106 109 #endif 107 110 -
trunk/Source/WebCore/platform/gtk/PasteboardGtk.cpp
r127757 r127862 59 59 { 60 60 PasteboardHelper* helper = PasteboardHelper::defaultPasteboardHelper(); 61 GtkClipboard* clipboard = helper->getC lipboard(frame);61 GtkClipboard* clipboard = helper->getCurrentClipboard(frame); 62 62 63 63 DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard); … … 86 86 87 87 PasteboardHelper* helper = PasteboardHelper::defaultPasteboardHelper(); 88 GtkClipboard* clipboard = helper->getC lipboard(frame);88 GtkClipboard* clipboard = helper->getCurrentClipboard(frame); 89 89 90 90 DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard); … … 200 200 } 201 201 202 } 202 bool Pasteboard::isSelectionMode() const 203 { 204 return PasteboardHelper::defaultPasteboardHelper()->usePrimarySelectionClipboard(); 205 } 206 207 void Pasteboard::setSelectionMode(bool selectionMode) 208 { 209 PasteboardHelper::defaultPasteboardHelper()->setUsePrimarySelectionClipboard(selectionMode); 210 } 211 212 } -
trunk/Source/WebKit/chromium/ChangeLog
r127843 r127862 1 2012-09-07 Allan Sandfeld Jensen <allan.jensen@nokia.com> 2 3 X11 Global Selection 4 https://bugs.webkit.org/show_bug.cgi?id=88238 5 6 Reviewed by Tony Chang. 7 8 Use new editor command for pasting global selection. 9 10 * src/EditorClientImpl.cpp: 11 (WebKit::EditorClientImpl::supportsGlobalSelection): 12 * src/EditorClientImpl.h: 13 (EditorClientImpl): 14 * src/WebViewImpl.cpp: 15 (WebKit::WebViewImpl::handleMouseUp): 16 1 17 2012-09-07 Yoshifumi Inoue <yosin@chromium.org> 2 18 -
trunk/Source/WebKit/chromium/src/EditorClientImpl.cpp
r127757 r127862 850 850 } 851 851 852 bool EditorClientImpl::supportsGlobalSelection() 853 { 854 #if OS(UNIX) && !OS(DARWIN) 855 return true; 856 #else 857 return false; 858 #endif 859 } 860 852 861 void EditorClientImpl::willSetInputMethodState() 853 862 { -
trunk/Source/WebKit/chromium/src/EditorClientImpl.h
r119192 r127862 114 114 virtual void setInputMethodState(bool enabled); 115 115 virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>); 116 virtual bool supportsGlobalSelection() OVERRIDE; 116 117 117 118 virtual WebCore::TextCheckerClient* textChecker() { return this; } -
trunk/Source/WebKit/chromium/src/WebViewImpl.cpp
r127794 r127862 644 644 if (!hitTestResult.scrollbar() && !hitTestResult.isLiveLink() && focused && !view->scrollbarAtPoint(clickPoint)) { 645 645 Editor* editor = focused->editor(); 646 Pasteboard* pasteboard = Pasteboard::generalPasteboard(); 647 bool oldSelectionMode = pasteboard->isSelectionMode(); 648 pasteboard->setSelectionMode(true); 649 editor->command(AtomicString("Paste")).execute(); 650 pasteboard->setSelectionMode(oldSelectionMode); 646 editor->command(AtomicString("PasteGlobalSelection")).execute(); 651 647 } 652 648 } -
trunk/Source/WebKit/qt/Api/qwebpage.cpp
r126926 r127862 758 758 #ifndef QT_NO_CLIPBOARD 759 759 if (QApplication::clipboard()->supportsSelection()) { 760 bool oldSelectionMode = Pasteboard::generalPasteboard()->isSelectionMode();761 Pasteboard::generalPasteboard()->setSelectionMode(true);762 760 WebCore::Frame* focusFrame = page->focusController()->focusedOrMainFrame(); 763 if (button == Qt::LeftButton) { 764 if (focusFrame && (focusFrame->editor()->canCopy() || focusFrame->editor()->canDHTMLCopy())) { 765 Pasteboard::generalPasteboard()->writeSelection(focusFrame->editor()->selectedRange().get(), focusFrame->editor()->canSmartCopyOrDelete(), focusFrame); 766 ev->setAccepted(true); 767 } 768 } else if (button == Qt::MidButton) { 769 if (focusFrame && (focusFrame->editor()->canPaste() || focusFrame->editor()->canDHTMLPaste())) { 770 focusFrame->editor()->paste(); 761 if (button == Qt::MidButton) { 762 if (focusFrame) { 763 focusFrame->editor()->command(AtomicString("PasteGlobalSelection")).execute(); 771 764 ev->setAccepted(true); 772 765 } 773 766 } 774 Pasteboard::generalPasteboard()->setSelectionMode(oldSelectionMode);775 767 } 776 768 #endif -
trunk/Source/WebKit/qt/ChangeLog
r127757 r127862 1 2012-09-07 Allan Sandfeld Jensen <allan.jensen@nokia.com> 2 3 X11 Global Selection 4 https://bugs.webkit.org/show_bug.cgi?id=88238 5 6 Reviewed by Tony Chang. 7 8 Use new editor command for pasting global selection, and update it using 9 the respondToChangedSelection callback. 10 11 * Api/qwebpage.cpp: 12 (QWebPagePrivate::handleClipboard): 13 * WebCoreSupport/EditorClientQt.cpp: 14 (WebCore::EditorClientQt::respondToChangedSelection): 15 (WebCore::EditorClientQt::supportsGlobalSelection): 16 * WebCoreSupport/EditorClientQt.h: 17 (EditorClientQt): 18 1 19 2012-09-05 Sam Weinig <sam@webkit.org> 2 20 -
trunk/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
r108462 r127862 43 43 #include "NotImplemented.h" 44 44 #include "Page.h" 45 #include "Pasteboard.h" 45 46 #include "PlatformKeyboardEvent.h" 46 47 #include "QWebPageClient.h" … … 50 51 #include "StylePropertySet.h" 51 52 #include "WindowsKeyboardCodes.h" 53 #include "qguiapplication.h" 52 54 #include "qwebpage.h" 53 55 #include "qwebpage_p.h" 54 56 57 #include <QClipboard> 55 58 #include <QUndoStack> 56 59 #include <stdio.h> … … 210 213 // selection.formatForDebugger(buffer, sizeof(buffer)); 211 214 // printf("%s\n", buffer); 215 216 if (supportsGlobalSelection() && frame->selection()->isRange()) { 217 bool oldSelectionMode = Pasteboard::generalPasteboard()->isSelectionMode(); 218 Pasteboard::generalPasteboard()->setSelectionMode(true); 219 Pasteboard::generalPasteboard()->writeSelection(frame->selection()->toNormalizedRange().get(), frame->editor()->canSmartCopyOrDelete(), frame); 220 Pasteboard::generalPasteboard()->setSelectionMode(oldSelectionMode); 221 } 212 222 213 223 m_page->d->updateEditorActions(); … … 633 643 } 634 644 645 bool EditorClientQt::supportsGlobalSelection() 646 { 647 return qApp->clipboard()->supportsSelection(); 648 } 649 635 650 } 636 651 -
trunk/Source/WebKit/qt/WebCoreSupport/EditorClientQt.h
r117572 r127862 106 106 virtual TextCheckerClient* textChecker() { return &m_textCheckerClient; } 107 107 108 virtual bool supportsGlobalSelection() OVERRIDE; 109 108 110 bool isEditing() const; 109 111 -
trunk/Source/WebKit2/ChangeLog
r127845 r127862 1 2012-09-07 Allan Sandfeld Jensen <allan.jensen@nokia.com> 2 3 X11 Global Selection 4 https://bugs.webkit.org/show_bug.cgi?id=88238 5 6 Reviewed by Tony Chang. 7 8 Implements the hooks for supporting global selections in Qt WebKit2. 9 10 * WebProcess/WebCoreSupport/WebEditorClient.cpp: 11 (WebKit::WebEditorClient::respondToChangedSelection): 12 (WebKit::WebEditorClient::updateGlobalSelection): 13 (WebKit::WebEditorClient::supportsGlobalSelection): 14 * WebProcess/WebCoreSupport/WebEditorClient.h: 15 * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp: 16 (WebKit::WebEditorClient::updateGlobalSelection): 17 * WebProcess/WebPage/WebPage.cpp: 18 (WebKit::handleMouseEvent): 19 * WebProcess/WebPage/WebPage.h: 20 (WebPage): 21 * WebProcess/WebPage/qt/WebPageQt.cpp: 22 (WebKit::WebPage::handleMouseReleaseEvent): 23 1 24 2012-09-07 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> 2 25 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
r127098 r127862 49 49 #include <WebCore/UserTypingGestureIndicator.h> 50 50 51 #if PLATFORM(QT) 52 #include <QClipboard> 53 #include <QGuiApplication> 54 #include <WebCore/Pasteboard.h> 55 #endif 56 51 57 using namespace WebCore; 52 58 using namespace HTMLNames; … … 196 202 unsigned end; 197 203 m_page->send(Messages::WebPageProxy::DidChangeCompositionSelection(frame->editor()->getCompositionSelection(start, end))); 198 #elif PLATFORM(GTK) 199 setSelectionPrimaryClipboardIfNeeded(frame); 200 #endif 201 } 204 #elif PLATFORM(GTK) || PLATFORM(QT) 205 updateGlobalSelection(frame); 206 #endif 207 } 208 209 #if PLATFORM(QT) 210 // FIXME: Use this function for other X11-based platforms that need to manually update the global selection. 211 void WebEditorClient::updateGlobalSelection(Frame* frame) 212 { 213 if (supportsGlobalSelection() && frame->selection()->isRange()) { 214 bool oldSelectionMode = Pasteboard::generalPasteboard()->isSelectionMode(); 215 Pasteboard::generalPasteboard()->setSelectionMode(true); 216 Pasteboard::generalPasteboard()->writeSelection(frame->selection()->toNormalizedRange().get(), frame->editor()->canSmartCopyOrDelete(), frame); 217 Pasteboard::generalPasteboard()->setSelectionMode(oldSelectionMode); 218 } 219 } 220 #endif 202 221 203 222 void WebEditorClient::didEndEditing() … … 463 482 } 464 483 484 bool WebEditorClient::supportsGlobalSelection() 485 { 486 #if PLATFORM(QT) 487 return qApp->clipboard()->supportsSelection(); 488 #elif PLATFORM(GTK) && PLATFORM(X11) 489 return true; 490 #else 491 // FIXME: Return true on other X11 platforms when they support global selection. 492 return false; 493 #endif 494 } 495 465 496 } // namespace WebKit -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h
r122400 r127862 125 125 bool executePendingEditorCommands(WebCore::Frame*, Vector<WTF::String>, bool) OVERRIDE; 126 126 void getEditorCommandsForKeyEvent(const WebCore::KeyboardEvent*, Vector<WTF::String>&) OVERRIDE; 127 void setSelectionPrimaryClipboardIfNeeded(WebCore::Frame*) OVERRIDE; 127 #endif 128 #if PLATFORM(GTK) || PLATFORM(QT) 129 void updateGlobalSelection(WebCore::Frame*); 128 130 #endif 129 131 … … 150 152 virtual bool shouldShowUnicodeMenu() OVERRIDE; 151 153 #endif 154 155 virtual bool supportsGlobalSelection() OVERRIDE; 156 152 157 WebPage* m_page; 153 158 }; -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp
r110865 r127862 171 171 #endif 172 172 173 void WebEditorClient:: setSelectionPrimaryClipboardIfNeeded(Frame* frame)173 void WebEditorClient::updateGlobalSelection(Frame* frame) 174 174 { 175 175 #if PLATFORM(X11) -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r127432 r127862 1353 1353 } 1354 1354 case PlatformEvent::MouseReleased: 1355 #if PLATFORM(QT) 1356 if (page->handleMouseReleaseEvent(platformMouseEvent)) 1357 return true; 1358 #endif 1355 1359 return frame->eventHandler()->handleMouseReleaseEvent(platformMouseEvent); 1356 1360 case PlatformEvent::MouseMoved: -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r126343 r127862 461 461 #endif 462 462 463 #if PLATFORM(QT) 464 bool handleMouseReleaseEvent(const WebCore::PlatformMouseEvent&); 465 #endif 466 463 467 void setCompositionForTesting(const String& compositionString, uint64_t from, uint64_t length); 464 468 bool hasCompositionForTesting(); -
trunk/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp
r123216 r127862 35 35 #include "WebPopupMenu.h" 36 36 #include "WebProcess.h" 37 #include <QClipboard> 38 #include <QGuiApplication> 37 39 #include <WebCore/DOMWrapperWorld.h> 38 40 #include <WebCore/FocusController.h> … … 439 441 } 440 442 443 bool WebPage::handleMouseReleaseEvent(const PlatformMouseEvent& platformMouseEvent) 444 { 445 if (platformMouseEvent.button() != WebCore::MiddleButton) 446 return false; 447 448 if (qApp->clipboard()->supportsSelection()) { 449 WebCore::Frame* focusFrame = m_page->focusController()->focusedOrMainFrame(); 450 if (focusFrame) { 451 focusFrame->editor()->command(AtomicString("PasteGlobalSelection")).execute(); 452 return true; 453 } 454 } 455 return false; 456 } 457 441 458 } // namespace WebKit
Note: See TracChangeset
for help on using the changeset viewer.