| 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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 ImageResource* ImageDocument::cachedImage() | 356 ImageResource* ImageDocument::cachedImage() |
| 357 { | 357 { |
| 358 if (!m_imageElement) | 358 if (!m_imageElement) |
| 359 createDocumentStructure(); | 359 createDocumentStructure(); |
| 360 | 360 |
| 361 return m_imageElement->cachedImage(); | 361 return m_imageElement->cachedImage(); |
| 362 } | 362 } |
| 363 | 363 |
| 364 bool ImageDocument::shouldShrinkToFit() const | 364 bool ImageDocument::shouldShrinkToFit() const |
| 365 { | 365 { |
| 366 return frame()->page()->settings().shrinksStandaloneImagesToFit() && frame()
->page()->mainFrame() == frame(); | 366 return frame()->settings()->shrinksStandaloneImagesToFit() && frame()->page(
)->mainFrame() == frame(); |
| 367 } | 367 } |
| 368 | 368 |
| 369 void ImageDocument::dispose() | 369 void ImageDocument::dispose() |
| 370 { | 370 { |
| 371 m_imageElement = 0; | 371 m_imageElement = 0; |
| 372 HTMLDocument::dispose(); | 372 HTMLDocument::dispose(); |
| 373 } | 373 } |
| 374 | 374 |
| 375 // -------- | 375 // -------- |
| 376 | 376 |
| 377 void ImageEventListener::handleEvent(ScriptExecutionContext*, Event* event) | 377 void ImageEventListener::handleEvent(ScriptExecutionContext*, Event* event) |
| 378 { | 378 { |
| 379 if (event->type() == eventNames().resizeEvent) | 379 if (event->type() == eventNames().resizeEvent) |
| 380 m_doc->windowSizeChanged(); | 380 m_doc->windowSizeChanged(); |
| 381 else if (event->type() == eventNames().clickEvent && event->isMouseEvent())
{ | 381 else if (event->type() == eventNames().clickEvent && event->isMouseEvent())
{ |
| 382 MouseEvent* mouseEvent = toMouseEvent(event); | 382 MouseEvent* mouseEvent = toMouseEvent(event); |
| 383 m_doc->imageClicked(mouseEvent->x(), mouseEvent->y()); | 383 m_doc->imageClicked(mouseEvent->x(), mouseEvent->y()); |
| 384 } | 384 } |
| 385 } | 385 } |
| 386 | 386 |
| 387 bool ImageEventListener::operator==(const EventListener& listener) | 387 bool ImageEventListener::operator==(const EventListener& listener) |
| 388 { | 388 { |
| 389 if (const ImageEventListener* imageEventListener = ImageEventListener::cast(
&listener)) | 389 if (const ImageEventListener* imageEventListener = ImageEventListener::cast(
&listener)) |
| 390 return m_doc == imageEventListener->m_doc; | 390 return m_doc == imageEventListener->m_doc; |
| 391 return false; | 391 return false; |
| 392 } | 392 } |
| 393 | 393 |
| 394 } | 394 } |
| OLD | NEW |