| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 document()->imageUpdated(); | 155 document()->imageUpdated(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 document()->finishedParsing(); | 158 document()->finishedParsing(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 // -------- | 161 // -------- |
| 162 | 162 |
| 163 ImageDocument::ImageDocument(const DocumentInit& initializer) | 163 ImageDocument::ImageDocument(const DocumentInit& initializer) |
| 164 : HTMLDocument(initializer, ImageDocumentClass) | 164 : HTMLDocument(initializer, ImageDocumentClass) |
| 165 , m_imageElement(0) | 165 , m_imageElement(nullptr) |
| 166 , m_imageSizeIsKnown(false) | 166 , m_imageSizeIsKnown(false) |
| 167 , m_didShrinkImage(false) | 167 , m_didShrinkImage(false) |
| 168 , m_shouldShrinkImage(shouldShrinkToFit()) | 168 , m_shouldShrinkImage(shouldShrinkToFit()) |
| 169 { | 169 { |
| 170 setCompatibilityMode(QuirksMode); | 170 setCompatibilityMode(QuirksMode); |
| 171 lockCompatibilityMode(); | 171 lockCompatibilityMode(); |
| 172 } | 172 } |
| 173 | 173 |
| 174 PassRefPtr<DocumentParser> ImageDocument::createParser() | 174 PassRefPtr<DocumentParser> ImageDocument::createParser() |
| 175 { | 175 { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 return m_imageElement->cachedImage(); | 358 return m_imageElement->cachedImage(); |
| 359 } | 359 } |
| 360 | 360 |
| 361 bool ImageDocument::shouldShrinkToFit() const | 361 bool ImageDocument::shouldShrinkToFit() const |
| 362 { | 362 { |
| 363 return frame()->settings()->shrinksStandaloneImagesToFit() && frame()->isMai
nFrame(); | 363 return frame()->settings()->shrinksStandaloneImagesToFit() && frame()->isMai
nFrame(); |
| 364 } | 364 } |
| 365 | 365 |
| 366 void ImageDocument::dispose() | 366 void ImageDocument::dispose() |
| 367 { | 367 { |
| 368 m_imageElement = 0; | 368 m_imageElement = nullptr; |
| 369 HTMLDocument::dispose(); | 369 HTMLDocument::dispose(); |
| 370 } | 370 } |
| 371 | 371 |
| 372 // -------- | 372 // -------- |
| 373 | 373 |
| 374 void ImageEventListener::handleEvent(ExecutionContext*, Event* event) | 374 void ImageEventListener::handleEvent(ExecutionContext*, Event* event) |
| 375 { | 375 { |
| 376 if (event->type() == EventTypeNames::resize) | 376 if (event->type() == EventTypeNames::resize) |
| 377 m_doc->windowSizeChanged(); | 377 m_doc->windowSizeChanged(); |
| 378 else if (event->type() == EventTypeNames::click && event->isMouseEvent()) { | 378 else if (event->type() == EventTypeNames::click && event->isMouseEvent()) { |
| 379 MouseEvent* mouseEvent = toMouseEvent(event); | 379 MouseEvent* mouseEvent = toMouseEvent(event); |
| 380 m_doc->imageClicked(mouseEvent->x(), mouseEvent->y()); | 380 m_doc->imageClicked(mouseEvent->x(), mouseEvent->y()); |
| 381 } | 381 } |
| 382 } | 382 } |
| 383 | 383 |
| 384 bool ImageEventListener::operator==(const EventListener& listener) | 384 bool ImageEventListener::operator==(const EventListener& listener) |
| 385 { | 385 { |
| 386 if (const ImageEventListener* imageEventListener = ImageEventListener::cast(
&listener)) | 386 if (const ImageEventListener* imageEventListener = ImageEventListener::cast(
&listener)) |
| 387 return m_doc == imageEventListener->m_doc; | 387 return m_doc == imageEventListener->m_doc; |
| 388 return false; | 388 return false; |
| 389 } | 389 } |
| 390 | 390 |
| 391 } | 391 } |
| OLD | NEW |