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

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

Issue 1801543002: HTMLImageElement::cachedImage() may return null in ImageDocument construction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 body->setAttribute(styleAttr, "margin: 0px;"); 220 body->setAttribute(styleAttr, "margin: 0px;");
221 221
222 if (frame()) 222 if (frame())
223 frame()->loader().client()->dispatchWillInsertBody(); 223 frame()->loader().client()->dispatchWillInsertBody();
224 224
225 m_imageElement = HTMLImageElement::create(*this); 225 m_imageElement = HTMLImageElement::create(*this);
226 m_imageElement->setAttribute(styleAttr, "-webkit-user-select: none"); 226 m_imageElement->setAttribute(styleAttr, "-webkit-user-select: none");
227 m_imageElement->setLoadingImageDocument(); 227 m_imageElement->setLoadingImageDocument();
228 m_imageElement->setSrc(url().getString()); 228 m_imageElement->setSrc(url().getString());
229 body->appendChild(m_imageElement.get()); 229 body->appendChild(m_imageElement.get());
230 if (loader()) 230 if (loader() && m_imageElement->cachedImage())
Nate Chapin 2016/03/15 21:27:53 Do we know why this can be null? It's not immediat
yhirano 2016/03/16 08:40:48 ImageResource::fetch can return null. In ImageLoad
231 m_imageElement->cachedImage()->responseReceived(loader()->response(), nu llptr); 231 m_imageElement->cachedImage()->responseReceived(loader()->response(), nu llptr);
232 232
233 if (shouldShrinkToFit()) { 233 if (shouldShrinkToFit()) {
234 // Add event listeners 234 // Add event listeners
235 RefPtrWillBeRawPtr<EventListener> listener = ImageEventListener::create( this); 235 RefPtrWillBeRawPtr<EventListener> listener = ImageEventListener::create( this);
236 if (LocalDOMWindow* domWindow = this->domWindow()) 236 if (LocalDOMWindow* domWindow = this->domWindow())
237 domWindow->addEventListener("resize", listener, false); 237 domWindow->addEventListener("resize", listener, false);
238 if (m_shrinkToFitMode == Desktop) 238 if (m_shrinkToFitMode == Desktop)
239 m_imageElement->addEventListener("click", listener.release(), false) ; 239 m_imageElement->addEventListener("click", listener.release(), false) ;
240 } 240 }
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 } 443 }
444 444
445 bool ImageEventListener::operator==(const EventListener& listener) const 445 bool ImageEventListener::operator==(const EventListener& listener) const
446 { 446 {
447 if (const ImageEventListener* imageEventListener = ImageEventListener::cast( &listener)) 447 if (const ImageEventListener* imageEventListener = ImageEventListener::cast( &listener))
448 return m_doc == imageEventListener->m_doc; 448 return m_doc == imageEventListener->m_doc;
449 return false; 449 return false;
450 } 450 }
451 451
452 } // namespace blink 452 } // 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