Commit 66de1c18 authored by darin@apple.com's avatar darin@apple.com

No need for generalPasteboard (aside from "global selection mode")

https://bugs.webkit.org/show_bug.cgi?id=120367

Reviewed by Alexey Proskuryakov.

* editing/Editor.cpp:
(WebCore::Editor::pasteAsPlainTextBypassingDHTML):
(WebCore::Editor::dispatchCPPEvent):
(WebCore::Editor::cut):
(WebCore::Editor::copy):
(WebCore::Editor::paste):
(WebCore::Editor::pasteAsPlainText):
(WebCore::Editor::copyURL):
(WebCore::Editor::copyImage):
Use Pasteboard::createForCopyAndPaste rather than the single general pasteboard
for editing operations.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154712 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a3b075f7
2013-08-27 Darin Adler <darin@apple.com>
No need for generalPasteboard (aside from "global selection mode")
https://bugs.webkit.org/show_bug.cgi?id=120367
Reviewed by Alexey Proskuryakov.
* editing/Editor.cpp:
(WebCore::Editor::pasteAsPlainTextBypassingDHTML):
(WebCore::Editor::dispatchCPPEvent):
(WebCore::Editor::cut):
(WebCore::Editor::copy):
(WebCore::Editor::paste):
(WebCore::Editor::pasteAsPlainText):
(WebCore::Editor::copyURL):
(WebCore::Editor::copyImage):
Use Pasteboard::createForCopyAndPaste rather than the single general pasteboard
for editing operations.
2013-08-27 Chris Fleizach <cfleizach@apple.com>
<https://webkit.org/b/120117> AX: <noscript> contents are exposed as static text
......@@ -414,7 +414,7 @@ void Editor::pasteAsFragment(PassRefPtr<DocumentFragment> pastingFragment, bool
void Editor::pasteAsPlainTextBypassingDHTML()
{
pasteAsPlainTextWithPasteboard(Pasteboard::generalPasteboard());
pasteAsPlainTextWithPasteboard(Pasteboard::createForCopyAndPaste().get());
}
void Editor::pasteAsPlainTextWithPasteboard(Pasteboard* pasteboard)
......@@ -706,7 +706,7 @@ bool Editor::dispatchCPPEvent(const AtomicString& eventType, ClipboardAccessPoli
target->dispatchEvent(event, IGNORE_EXCEPTION);
bool noDefaultProcessing = event->defaultPrevented();
if (noDefaultProcessing && policy == ClipboardWritable) {
Pasteboard* pasteboard = Pasteboard::generalPasteboard();
OwnPtr<Pasteboard> pasteboard = Pasteboard::createForCopyAndPaste();
pasteboard->clear();
pasteboard->writePasteboard(clipboard->pasteboard());
}
......@@ -1041,10 +1041,10 @@ void Editor::cut()
if (shouldDeleteRange(selection.get())) {
updateMarkersForWordsAffectedByEditing(true);
if (enclosingTextFormControl(m_frame.selection().start())) {
Pasteboard::generalPasteboard()->writePlainText(selectedTextForClipboard(),
Pasteboard::createForCopyAndPaste()->writePlainText(selectedTextForClipboard(),
canSmartCopyOrDelete() ? Pasteboard::CanSmartReplace : Pasteboard::CannotSmartReplace);
} else
Pasteboard::generalPasteboard()->writeSelection(selection.get(), canSmartCopyOrDelete(), &m_frame, IncludeImageAltTextForClipboard);
Pasteboard::createForCopyAndPaste()->writeSelection(selection.get(), canSmartCopyOrDelete(), &m_frame, IncludeImageAltTextForClipboard);
didWriteSelectionToPasteboard();
deleteSelectionWithSmartDelete(canSmartCopyOrDelete());
}
......@@ -1061,14 +1061,14 @@ void Editor::copy()
willWriteSelectionToPasteboard(selectedRange());
if (enclosingTextFormControl(m_frame.selection().start())) {
Pasteboard::generalPasteboard()->writePlainText(selectedTextForClipboard(),
Pasteboard::createForCopyAndPaste()->writePlainText(selectedTextForClipboard(),
canSmartCopyOrDelete() ? Pasteboard::CanSmartReplace : Pasteboard::CannotSmartReplace);
} else {
Document* document = m_frame.document();
if (HTMLImageElement* imageElement = imageElementFromImageDocument(document))
Pasteboard::generalPasteboard()->writeImage(imageElement, document->url(), document->title());
Pasteboard::createForCopyAndPaste()->writeImage(imageElement, document->url(), document->title());
else
Pasteboard::generalPasteboard()->writeSelection(selectedRange().get(), canSmartCopyOrDelete(), &m_frame, IncludeImageAltTextForClipboard);
Pasteboard::createForCopyAndPaste()->writeSelection(selectedRange().get(), canSmartCopyOrDelete(), &m_frame, IncludeImageAltTextForClipboard);
}
didWriteSelectionToPasteboard();
......@@ -1085,9 +1085,9 @@ void Editor::paste()
CachedResourceLoader* loader = m_frame.document()->cachedResourceLoader();
ResourceCacheValidationSuppressor validationSuppressor(loader);
if (m_frame.selection().isContentRichlyEditable())
pasteWithPasteboard(Pasteboard::generalPasteboard(), true);
pasteWithPasteboard(Pasteboard::createForCopyAndPaste().get(), true);
else
pasteAsPlainTextWithPasteboard(Pasteboard::generalPasteboard());
pasteAsPlainTextWithPasteboard(Pasteboard::createForCopyAndPaste().get());
}
void Editor::pasteAsPlainText()
......@@ -1097,7 +1097,7 @@ void Editor::pasteAsPlainText()
if (!canPaste())
return;
updateMarkersForWordsAffectedByEditing(false);
pasteAsPlainTextWithPasteboard(Pasteboard::generalPasteboard());
pasteAsPlainTextWithPasteboard(Pasteboard::createForCopyAndPaste().get());
}
void Editor::performDelete()
......@@ -1135,7 +1135,7 @@ void Editor::simplifyMarkup(Node* startNode, Node* endNode)
void Editor::copyURL(const KURL& url, const String& title)
{
Pasteboard::generalPasteboard()->writeURL(url, title, &m_frame);
Pasteboard::createForCopyAndPaste()->writeURL(url, title, &m_frame);
}
void Editor::copyImage(const HitTestResult& result)
......@@ -1144,7 +1144,7 @@ void Editor::copyImage(const HitTestResult& result)
if (url.isEmpty())
url = result.absoluteImageURL();
Pasteboard::generalPasteboard()->writeImage(result.innerNonSharedNode(), url, result.altDisplayString());
Pasteboard::createForCopyAndPaste()->writeImage(result.innerNonSharedNode(), url, result.altDisplayString());
}
bool Editor::isContinuousSpellCheckingEnabled() const
......
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