| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 199 |
| 200 m_imageElement = HTMLImageElement::create(*this); | 200 m_imageElement = HTMLImageElement::create(*this); |
| 201 m_imageElement->setAttribute(styleAttr, "-webkit-user-select: none"); | 201 m_imageElement->setAttribute(styleAttr, "-webkit-user-select: none"); |
| 202 m_imageElement->setLoadManually(true); | 202 m_imageElement->setLoadManually(true); |
| 203 m_imageElement->setSrc(url().string()); | 203 m_imageElement->setSrc(url().string()); |
| 204 body->appendChild(m_imageElement.get()); | 204 body->appendChild(m_imageElement.get()); |
| 205 | 205 |
| 206 if (shouldShrinkToFit()) { | 206 if (shouldShrinkToFit()) { |
| 207 // Add event listeners | 207 // Add event listeners |
| 208 RefPtr<EventListener> listener = ImageEventListener::create(this); | 208 RefPtr<EventListener> listener = ImageEventListener::create(this); |
| 209 if (DOMWindow* domWindow = this->domWindow()) | 209 if (LocalDOMWindow* domWindow = this->domWindow()) |
| 210 domWindow->addEventListener("resize", listener, false); | 210 domWindow->addEventListener("resize", listener, false); |
| 211 m_imageElement->addEventListener("click", listener.release(), false); | 211 m_imageElement->addEventListener("click", listener.release(), false); |
| 212 } | 212 } |
| 213 | 213 |
| 214 rootElement->appendChild(head); | 214 rootElement->appendChild(head); |
| 215 rootElement->appendChild(body); | 215 rootElement->appendChild(body); |
| 216 } | 216 } |
| 217 | 217 |
| 218 float ImageDocument::scale() const | 218 float ImageDocument::scale() const |
| 219 { | 219 { |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 } | 393 } |
| 394 | 394 |
| 395 bool ImageEventListener::operator==(const EventListener& listener) | 395 bool ImageEventListener::operator==(const EventListener& listener) |
| 396 { | 396 { |
| 397 if (const ImageEventListener* imageEventListener = ImageEventListener::cast(
&listener)) | 397 if (const ImageEventListener* imageEventListener = ImageEventListener::cast(
&listener)) |
| 398 return m_doc == imageEventListener->m_doc; | 398 return m_doc == imageEventListener->m_doc; |
| 399 return false; | 399 return false; |
| 400 } | 400 } |
| 401 | 401 |
| 402 } | 402 } |
| OLD | NEW |