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

Side by Side Diff: Source/core/editing/Editor.cpp

Issue 389273002: Fix copyImage for WebGL elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: seperated negative test Created 6 years, 5 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, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 } 443 }
444 444
445 return nullptr; 445 return nullptr;
446 } 446 }
447 447
448 static void writeImageNodeToPasteboard(Pasteboard* pasteboard, Node* node, const String& title) 448 static void writeImageNodeToPasteboard(Pasteboard* pasteboard, Node* node, const String& title)
449 { 449 {
450 ASSERT(pasteboard); 450 ASSERT(pasteboard);
451 ASSERT(node); 451 ASSERT(node);
452 452
453 Image* image = imageFromNode(*node); 453 RefPtrWillBeRawPtr<Image> image = imageFromNode(*node);
454 if (!image) 454 if (!image.get())
455 return; 455 return;
456 456
457 // FIXME: This should probably be reconciled with HitTestResult::absoluteIma geURL. 457 // FIXME: This should probably be reconciled with HitTestResult::absoluteIma geURL.
458 AtomicString urlString; 458 AtomicString urlString;
459 if (isHTMLImageElement(*node) || isHTMLInputElement(*node)) 459 if (isHTMLImageElement(*node) || isHTMLInputElement(*node))
460 urlString = toElement(node)->getAttribute(srcAttr); 460 urlString = toElement(node)->getAttribute(srcAttr);
461 else if (isSVGImageElement(*node)) 461 else if (isSVGImageElement(*node))
462 urlString = toElement(node)->getAttribute(XLinkNames::hrefAttr); 462 urlString = toElement(node)->getAttribute(XLinkNames::hrefAttr);
463 else if (isHTMLEmbedElement(*node) || isHTMLObjectElement(*node) || isHTMLCa nvasElement(*node)) 463 else if (isHTMLEmbedElement(*node) || isHTMLObjectElement(*node) || isHTMLCa nvasElement(*node))
464 urlString = toElement(node)->imageSourceURL(); 464 urlString = toElement(node)->imageSourceURL();
465 KURL url = urlString.isEmpty() ? KURL() : node->document().completeURL(strip LeadingAndTrailingHTMLSpaces(urlString)); 465 KURL url = urlString.isEmpty() ? KURL() : node->document().completeURL(strip LeadingAndTrailingHTMLSpaces(urlString));
466 466
467 pasteboard->writeImage(image, url, title); 467 pasteboard->writeImage(image.get(), url, title);
468 } 468 }
469 469
470 // Returns whether caller should continue with "the default processing", which i s the same as 470 // Returns whether caller should continue with "the default processing", which i s the same as
471 // the event handler NOT setting the return value to false 471 // the event handler NOT setting the return value to false
472 bool Editor::dispatchCPPEvent(const AtomicString &eventType, DataTransferAccessP olicy policy, PasteMode pasteMode) 472 bool Editor::dispatchCPPEvent(const AtomicString &eventType, DataTransferAccessP olicy policy, PasteMode pasteMode)
473 { 473 {
474 Node* target = findEventTargetFromSelection(); 474 Node* target = findEventTargetFromSelection();
475 if (!target) 475 if (!target)
476 return true; 476 return true;
477 477
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 frame().selection().setShouldShowBlockCursor(m_overwriteModeEnabled); 1278 frame().selection().setShouldShowBlockCursor(m_overwriteModeEnabled);
1279 } 1279 }
1280 1280
1281 void Editor::trace(Visitor* visitor) 1281 void Editor::trace(Visitor* visitor)
1282 { 1282 {
1283 visitor->trace(m_lastEditCommand); 1283 visitor->trace(m_lastEditCommand);
1284 visitor->trace(m_mark); 1284 visitor->trace(m_mark);
1285 } 1285 }
1286 1286
1287 } // namespace WebCore 1287 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698