Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: third_party/WebKit/Source/core/clipboard/DataTransfer.cpp

Issue 1427733003: Use |FrameSelection::selectedText()| where possible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/FrameSelection.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 // The URL can also be used as an HTML fragment. 350 // The URL can also be used as an HTML fragment.
351 m_dataObject->setHTMLAndBaseURL(urlToMarkup(url, title), url); 351 m_dataObject->setHTMLAndBaseURL(urlToMarkup(url, title), url);
352 } 352 }
353 353
354 void DataTransfer::writeSelection(const FrameSelection& selection) 354 void DataTransfer::writeSelection(const FrameSelection& selection)
355 { 355 {
356 if (!m_dataObject) 356 if (!m_dataObject)
357 return; 357 return;
358 358
359 if (!enclosingTextFormControl(selection.start())) { 359 if (!enclosingTextFormControl(selection.start())) {
360 EphemeralRange selectedRange = selection.selection().toNormalizedEphemer alRange(); 360 m_dataObject->setHTMLAndBaseURL(selection.selectedHTMLForClipboard(), se lection.frame()->document()->url());
361 ASSERT(selectedRange.isNotNull());
362 m_dataObject->setHTMLAndBaseURL(createMarkup(selectedRange.startPosition (), selectedRange.endPosition(), AnnotateForInterchange, ConvertBlocksToInlines: :NotConvert, ResolveNonLocalURLs), selectedRange.document().url());
363 } 361 }
364 362
365 String str = selection.selectedTextForClipboard(); 363 String str = selection.selectedTextForClipboard();
366 #if OS(WIN) 364 #if OS(WIN)
367 replaceNewlinesWithWindowsStyleNewlines(str); 365 replaceNewlinesWithWindowsStyleNewlines(str);
368 #endif 366 #endif
369 replaceNBSPWithSpace(str); 367 replaceNBSPWithSpace(str);
370 m_dataObject->setData(mimeTypeTextPlain, str); 368 m_dataObject->setData(mimeTypeTextPlain, str);
371 } 369 }
372 370
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 515
518 DEFINE_TRACE(DataTransfer) 516 DEFINE_TRACE(DataTransfer)
519 { 517 {
520 visitor->trace(m_dataObject); 518 visitor->trace(m_dataObject);
521 #if ENABLE(OILPAN) 519 #if ENABLE(OILPAN)
522 visitor->trace(m_dragImageElement); 520 visitor->trace(m_dragImageElement);
523 #endif 521 #endif
524 } 522 }
525 523
526 } // namespace blink 524 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/FrameSelection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698