Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |