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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp

Issue 2598963004: Add missing null pointer check in HTMLCanvasElement.cpp (Closed)
Patch Set: Created 3 years, 12 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
« no previous file with comments | « no previous file | no next file » | 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) 2004, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 108
109 // A default value of quality argument for toDataURL and toBlob 109 // A default value of quality argument for toDataURL and toBlob
110 // It is in an invalid range (outside 0.0 - 1.0) so that it will not be 110 // It is in an invalid range (outside 0.0 - 1.0) so that it will not be
111 // misinterpreted as a user-input value 111 // misinterpreted as a user-input value
112 const int UndefinedQualityValue = -1.0; 112 const int UndefinedQualityValue = -1.0;
113 113
114 sk_sp<SkImage> createTransparentSkImage(const IntSize& size) { 114 sk_sp<SkImage> createTransparentSkImage(const IntSize& size) {
115 DCHECK(ImageBuffer::canCreateImageBuffer(size)); 115 DCHECK(ImageBuffer::canCreateImageBuffer(size));
116 sk_sp<SkSurface> surface = 116 sk_sp<SkSurface> surface =
117 SkSurface::MakeRasterN32Premul(size.width(), size.height()); 117 SkSurface::MakeRasterN32Premul(size.width(), size.height());
118 return surface->makeImageSnapshot(); 118 return surface ? surface->makeImageSnapshot() : nullptr;
119 } 119 }
120 120
121 PassRefPtr<Image> createTransparentImage(const IntSize& size) { 121 PassRefPtr<Image> createTransparentImage(const IntSize& size) {
122 sk_sp<SkImage> image = createTransparentSkImage(size); 122 sk_sp<SkImage> image = createTransparentSkImage(size);
123 return image ? StaticBitmapImage::create(image) : nullptr; 123 return image ? StaticBitmapImage::create(image) : nullptr;
124 } 124 }
125 125
126 } // namespace 126 } // namespace
127 127
128 inline HTMLCanvasElement::HTMLCanvasElement(Document& document) 128 inline HTMLCanvasElement::HTMLCanvasElement(Document& document)
(...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 m_surfaceLayerBridge = WTF::wrapUnique(new CanvasSurfaceLayerBridge(this)); 1413 m_surfaceLayerBridge = WTF::wrapUnique(new CanvasSurfaceLayerBridge(this));
1414 // Creates a placeholder layer first before Surface is created. 1414 // Creates a placeholder layer first before Surface is created.
1415 m_surfaceLayerBridge->createSolidColorLayer(); 1415 m_surfaceLayerBridge->createSolidColorLayer();
1416 } 1416 }
1417 1417
1418 void HTMLCanvasElement::OnWebLayerReplaced() { 1418 void HTMLCanvasElement::OnWebLayerReplaced() {
1419 setNeedsCompositingUpdate(); 1419 setNeedsCompositingUpdate();
1420 } 1420 }
1421 1421
1422 } // namespace blink 1422 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698