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

Side by Side Diff: Source/core/html/HTMLImageElement.cpp

Issue 1293023002: Fix crash when content() url is -webkit-canvas (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/images/content-url-canvas-expected.html ('k') | 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv ed. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv ed.
5 * Copyright (C) 2010 Google Inc. All rights reserved. 5 * Copyright (C) 2010 Google Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 if (candidate.isEmpty()) 325 if (candidate.isEmpty())
326 continue; 326 continue;
327 return candidate; 327 return candidate;
328 } 328 }
329 return ImageCandidate(); 329 return ImageCandidate();
330 } 330 }
331 331
332 LayoutObject* HTMLImageElement::createLayoutObject(const ComputedStyle& style) 332 LayoutObject* HTMLImageElement::createLayoutObject(const ComputedStyle& style)
333 { 333 {
334 const ContentData* contentData = style.contentData(); 334 const ContentData* contentData = style.contentData();
335 if (contentData && contentData->isImage() && !toImageContentData(contentData )->image()->cachedImage()->errorOccurred()) 335 if (contentData && contentData->isImage()) {
336 return LayoutObject::createObject(this, style); 336 const StyleImage* contentImage = toImageContentData(contentData)->image( );
337 bool errorOccurred = contentImage && contentImage->cachedImage() && cont entImage->cachedImage()->errorOccurred();
338 if (!errorOccurred)
339 return LayoutObject::createObject(this, style);
340 }
337 341
338 if (m_useFallbackContent) 342 if (m_useFallbackContent)
339 return new LayoutBlockFlow(this); 343 return new LayoutBlockFlow(this);
340 344
341 LayoutImage* image = new LayoutImage(this); 345 LayoutImage* image = new LayoutImage(this);
342 image->setImageResource(LayoutImageResource::create()); 346 image->setImageResource(LayoutImageResource::create());
343 image->setImageDevicePixelRatio(m_imageDevicePixelRatio); 347 image->setImageDevicePixelRatio(m_imageDevicePixelRatio);
344 return image; 348 return image;
345 } 349 }
346 350
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 ensureUserAgentShadowRoot(); 757 ensureUserAgentShadowRoot();
754 } 758 }
755 759
756 bool HTMLImageElement::isOpaque() const 760 bool HTMLImageElement::isOpaque() const
757 { 761 {
758 Image* image = const_cast<HTMLImageElement*>(this)->imageContents(); 762 Image* image = const_cast<HTMLImageElement*>(this)->imageContents();
759 return image && image->currentFrameKnownToBeOpaque(); 763 return image && image->currentFrameKnownToBeOpaque();
760 } 764 }
761 765
762 } 766 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/images/content-url-canvas-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698