Commit 6535ea23 authored by darin@apple.com's avatar darin@apple.com

<https://webkit.org/b/119948> Change drag-specific clipboard writing in...

<https://webkit.org/b/119948> Change drag-specific clipboard writing in DragController to go straight to Pasteboard, not forward through Clipboard

Reviewed by Andreas Kling.

* dom/Clipboard.cpp: Removed writeRange, writePlainText, and writeURL functions.
All three are just unneeded forwarding to pasteboard.
* dom/Clipboard.h: Ditto.

* page/DragController.cpp:
(WebCore::DragController::startDrag): Move the logic in here. Later we might
want to straighten this out a bit, perhaps using functions in Editor, but it's
not much code so fine to just have it here for now.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154231 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e316d682
2013-08-17 Darin Adler <darin@apple.com>
<https://webkit.org/b/119948> Change drag-specific clipboard writing in DragController to go straight to Pasteboard, not forward through Clipboard
Reviewed by Andreas Kling.
* dom/Clipboard.cpp: Removed writeRange, writePlainText, and writeURL functions.
All three are just unneeded forwarding to pasteboard.
* dom/Clipboard.h: Ditto.
* page/DragController.cpp:
(WebCore::DragController::startDrag): Move the logic in here. Later we might
want to straighten this out a bit, perhaps using functions in Editor, but it's
not much code so fine to just have it here for now.
2013-08-17 Darin Adler <darin@apple.com>
<https://webkit.org/b/119947> Remove LEGACY_STYLE_ABSTRACT_CLIPBOARD_CLASS
......@@ -366,29 +366,6 @@ void DragImageLoader::imageChanged(CachedImage*, const IntRect*)
m_clipboard->updateDragImage();
}
void Clipboard::writeRange(Range* range, Frame* frame)
{
ASSERT(range);
ASSERT(frame);
// FIXME: This is a design mistake, a layering violation that should be fixed.
// The code to write the range to a pasteboard should be an Editor function that takes a pasteboard argument.
// FIXME: The frame argument seems redundant, since a Range is in a particular document, which has a corresponding frame.
m_pasteboard->writeSelection(range, frame->editor().smartInsertDeleteEnabled() && frame->selection()->granularity() == WordGranularity, frame, IncludeImageAltTextForClipboard);
}
void Clipboard::writePlainText(const String& text)
{
m_pasteboard->writePlainText(text, Pasteboard::CannotSmartReplace);
}
void Clipboard::writeURL(const KURL& url, const String& title, Frame* frame)
{
ASSERT(frame);
// FIXME: This is a design mistake, a layering violation that should be fixed.
// The pasteboard writeURL function should not take a frame argument, nor does this function need a frame.
m_pasteboard->writeURL(url, title, frame);
}
#endif // ENABLE(DRAG_SUPPORT)
} // namespace WebCore
......@@ -79,9 +79,6 @@ namespace WebCore {
Node* dragImageElement() const { return m_dragImageElement.get(); }
DragImageRef createDragImage(IntPoint& dragLocation) const;
void writeURL(const KURL&, const String&, Frame*);
void writeRange(Range*, Frame*);
void writePlainText(const String&);
bool hasData();
......
......@@ -61,6 +61,7 @@
#include "ImageOrientation.h"
#include "MoveSelectionCommand.h"
#include "Page.h"
#include "Pasteboard.h"
#include "PlatformKeyboardEvent.h"
#include "PluginDocument.h"
#include "PluginViewBase.h"
......@@ -792,9 +793,11 @@ bool DragController::startDrag(Frame* src, const DragState& state, DragOperation
src->editor().willWriteSelectionToPasteboard(selectionRange.get());
if (enclosingTextFormControl(src->selection()->start()))
clipboard->writePlainText(src->editor().selectedTextForClipboard());
else
clipboard->writeRange(selectionRange.get(), src);
clipboard->pasteboard().writePlainText(src->editor().selectedTextForClipboard(), Pasteboard::CannotSmartReplace);
else {
// FIXME: Could this instead be a helper function in Editor?
clipboard->pasteboard().writeSelection(selectionRange.get(), src->editor().smartInsertDeleteEnabled() && src->selection()->granularity() == WordGranularity, src, IncludeImageAltTextForClipboard);
}
src->editor().didWriteSelectionToPasteboard();
}
......@@ -830,7 +833,7 @@ bool DragController::startDrag(Frame* src, const DragState& state, DragOperation
if (!clipboard->hasData())
// Simplify whitespace so the title put on the clipboard resembles what the user sees
// on the web page. This includes replacing newlines with spaces.
clipboard->writeURL(linkURL, hitTestResult.textContent().simplifyWhiteSpace(), src);
clipboard->pasteboard().writeURL(linkURL, hitTestResult.textContent().simplifyWhiteSpace(), src);
if (src->selection()->isCaret() && src->selection()->isContentEditable()) {
// a user can initiate a drag on a link without having any text
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment