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 758493004: canvas: make a temporary buffer when a context doesn't exist. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Don't create temp imageBuffer again Created 6 years 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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 pasteAsFragment(fragment, canSmartReplaceWithPasteboard(pasteboard), cho sePlainText); 414 pasteAsFragment(fragment, canSmartReplaceWithPasteboard(pasteboard), cho sePlainText);
415 } 415 }
416 416
417 void Editor::writeSelectionToPasteboard(Pasteboard* pasteboard, Range* selectedR ange, const String& plainText) 417 void Editor::writeSelectionToPasteboard(Pasteboard* pasteboard, Range* selectedR ange, const String& plainText)
418 { 418 {
419 String html = createMarkup(selectedRange, 0, AnnotateForInterchange, false, ResolveNonLocalURLs); 419 String html = createMarkup(selectedRange, 0, AnnotateForInterchange, false, ResolveNonLocalURLs);
420 KURL url = selectedRange->startContainer()->document().url(); 420 KURL url = selectedRange->startContainer()->document().url();
421 pasteboard->writeHTML(html, url, plainText, canSmartCopyOrDelete()); 421 pasteboard->writeHTML(html, url, plainText, canSmartCopyOrDelete());
422 } 422 }
423 423
424 static Image* imageFromNode(const Node& node) 424 static PassRefPtr<Image> imageFromNode(const Node& node)
425 { 425 {
426 node.document().updateLayoutIgnorePendingStylesheets(); 426 node.document().updateLayoutIgnorePendingStylesheets();
427 RenderObject* renderer = node.renderer(); 427 RenderObject* renderer = node.renderer();
428 if (!renderer) 428 if (!renderer)
429 return nullptr; 429 return nullptr;
430 430
431 if (renderer->isCanvas()) 431 if (renderer->isCanvas())
432 return toHTMLCanvasElement(node).copiedImage(FrontBuffer); 432 return toHTMLCanvasElement(node).copiedImage(FrontBuffer);
dshwang 2014/12/01 14:31:12 This line return PassRefPtr<Image> so this functio
Justin Novosad 2014/12/02 15:48:16 I was thinking that this could be done in an oilpa
433 433
434 if (renderer->isImage()) { 434 if (renderer->isImage()) {
435 RenderImage* renderImage = toRenderImage(renderer); 435 RenderImage* renderImage = toRenderImage(renderer);
436 if (!renderImage) 436 if (!renderImage)
437 return nullptr; 437 return nullptr;
438 438
439 ImageResource* cachedImage = renderImage->cachedImage(); 439 ImageResource* cachedImage = renderImage->cachedImage();
440 if (!cachedImage || cachedImage->errorOccurred()) 440 if (!cachedImage || cachedImage->errorOccurred())
441 return nullptr; 441 return nullptr;
442 return cachedImage->imageForRenderer(renderImage); 442 return cachedImage->imageForRenderer(renderImage);
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 } 1279 }
1280 1280
1281 void Editor::trace(Visitor* visitor) 1281 void Editor::trace(Visitor* visitor)
1282 { 1282 {
1283 visitor->trace(m_frame); 1283 visitor->trace(m_frame);
1284 visitor->trace(m_lastEditCommand); 1284 visitor->trace(m_lastEditCommand);
1285 visitor->trace(m_mark); 1285 visitor->trace(m_mark);
1286 } 1286 }
1287 1287
1288 } // namespace blink 1288 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698