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

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

Issue 1860293003: Serialize original node when dragging a link instead of synthesizing HTML. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: delete delete Created 4 years, 8 months 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
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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 324
325 m_dataObject->setURLAndTitle(url, title); 325 m_dataObject->setURLAndTitle(url, title);
326 326
327 // Write the bytes in the image to the file format. 327 // Write the bytes in the image to the file format.
328 writeImageToDataObject(m_dataObject.get(), element, url); 328 writeImageToDataObject(m_dataObject.get(), element, url);
329 329
330 // Put img tag on the clipboard referencing the image 330 // Put img tag on the clipboard referencing the image
331 m_dataObject->setData(mimeTypeTextHTML, createMarkup(element, IncludeNode, R esolveAllURLs)); 331 m_dataObject->setData(mimeTypeTextHTML, createMarkup(element, IncludeNode, R esolveAllURLs));
332 } 332 }
333 333
334 void DataTransfer::writeURL(const KURL& url, const String& title) 334 void DataTransfer::writeURL(Node* node, const KURL& url, const String& title)
335 { 335 {
336 if (!m_dataObject) 336 if (!m_dataObject)
337 return; 337 return;
338 ASSERT(!url.isEmpty()); 338 ASSERT(!url.isEmpty());
339 339
340 m_dataObject->setURLAndTitle(url, title); 340 m_dataObject->setURLAndTitle(url, title);
341 341
342 // The URL can also be used as plain text. 342 // The URL can also be used as plain text.
343 m_dataObject->setData(mimeTypeTextPlain, url.getString()); 343 m_dataObject->setData(mimeTypeTextPlain, url.getString());
344 344
345 // The URL can also be used as an HTML fragment. 345 // The URL can also be used as an HTML fragment.
346 m_dataObject->setHTMLAndBaseURL(urlToMarkup(url, title), url); 346 m_dataObject->setHTMLAndBaseURL(createMarkup(node, IncludeNode, ResolveAllUR Ls), url);
347 } 347 }
348 348
349 void DataTransfer::writeSelection(const FrameSelection& selection) 349 void DataTransfer::writeSelection(const FrameSelection& selection)
350 { 350 {
351 if (!m_dataObject) 351 if (!m_dataObject)
352 return; 352 return;
353 353
354 if (!enclosingTextFormControl(selection.start())) { 354 if (!enclosingTextFormControl(selection.start())) {
355 m_dataObject->setHTMLAndBaseURL(selection.selectedHTMLForClipboard(), se lection.frame()->document()->url()); 355 m_dataObject->setHTMLAndBaseURL(selection.selectedHTMLForClipboard(), se lection.frame()->document()->url());
356 } 356 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 } 509 }
510 510
511 DEFINE_TRACE(DataTransfer) 511 DEFINE_TRACE(DataTransfer)
512 { 512 {
513 visitor->trace(m_dataObject); 513 visitor->trace(m_dataObject);
514 visitor->trace(m_dragImage); 514 visitor->trace(m_dragImage);
515 visitor->trace(m_dragImageElement); 515 visitor->trace(m_dragImageElement);
516 } 516 }
517 517
518 } // namespace blink 518 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698