| 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 if (!m_imageSizeIsKnown || imageFitsInWindow()) | 286 if (!m_imageSizeIsKnown || imageFitsInWindow()) |
| 287 return; | 287 return; |
| 288 | 288 |
| 289 m_shouldShrinkImage = !m_shouldShrinkImage; | 289 m_shouldShrinkImage = !m_shouldShrinkImage; |
| 290 | 290 |
| 291 if (m_shouldShrinkImage) { | 291 if (m_shouldShrinkImage) { |
| 292 windowSizeChanged(ScaleZoomedDocument); | 292 windowSizeChanged(ScaleZoomedDocument); |
| 293 } else { | 293 } else { |
| 294 restoreImageSize(ScaleZoomedDocument); | 294 restoreImageSize(ScaleZoomedDocument); |
| 295 | 295 |
| 296 updateLayout(); | 296 updateStyleAndLayout(); |
| 297 | 297 |
| 298 double scale = this->scale(); | 298 double scale = this->scale(); |
| 299 | 299 |
| 300 double scrollX = x / scale - static_cast<double>(frame()->view()->width(
)) / 2; | 300 double scrollX = x / scale - static_cast<double>(frame()->view()->width(
)) / 2; |
| 301 double scrollY = y / scale - static_cast<double>(frame()->view()->height
()) / 2; | 301 double scrollY = y / scale - static_cast<double>(frame()->view()->height
()) / 2; |
| 302 | 302 |
| 303 frame()->view()->setScrollPosition(DoublePoint(scrollX, scrollY), Progra
mmaticScroll); | 303 frame()->view()->setScrollPosition(DoublePoint(scrollX, scrollY), Progra
mmaticScroll); |
| 304 } | 304 } |
| 305 } | 305 } |
| 306 | 306 |
| 307 void ImageDocument::imageUpdated() | 307 void ImageDocument::imageUpdated() |
| 308 { | 308 { |
| 309 ASSERT(m_imageElement); | 309 ASSERT(m_imageElement); |
| 310 | 310 |
| 311 if (m_imageSizeIsKnown) | 311 if (m_imageSizeIsKnown) |
| 312 return; | 312 return; |
| 313 | 313 |
| 314 updateLayoutTree(); | 314 updateStyleAndLayoutTree(); |
| 315 if (!m_imageElement->cachedImage() || m_imageElement->cachedImage()->imageSi
ze(LayoutObject::shouldRespectImageOrientation(m_imageElement->layoutObject()),
pageZoomFactor(this)).isEmpty()) | 315 if (!m_imageElement->cachedImage() || m_imageElement->cachedImage()->imageSi
ze(LayoutObject::shouldRespectImageOrientation(m_imageElement->layoutObject()),
pageZoomFactor(this)).isEmpty()) |
| 316 return; | 316 return; |
| 317 | 317 |
| 318 m_imageSizeIsKnown = true; | 318 m_imageSizeIsKnown = true; |
| 319 | 319 |
| 320 if (shouldShrinkToFit()) { | 320 if (shouldShrinkToFit()) { |
| 321 // Force resizing of the image | 321 // Force resizing of the image |
| 322 windowSizeChanged(ScaleOnlyUnzoomedDocument); | 322 windowSizeChanged(ScaleOnlyUnzoomedDocument); |
| 323 } | 323 } |
| 324 } | 324 } |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 } | 442 } |
| 443 | 443 |
| 444 bool ImageEventListener::operator==(const EventListener& listener) const | 444 bool ImageEventListener::operator==(const EventListener& listener) const |
| 445 { | 445 { |
| 446 if (const ImageEventListener* imageEventListener = ImageEventListener::cast(
&listener)) | 446 if (const ImageEventListener* imageEventListener = ImageEventListener::cast(
&listener)) |
| 447 return m_doc == imageEventListener->m_doc; | 447 return m_doc == imageEventListener->m_doc; |
| 448 return false; | 448 return false; |
| 449 } | 449 } |
| 450 | 450 |
| 451 } // namespace blink | 451 } // namespace blink |
| OLD | NEW |