| 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 if (!m_imageSizeIsKnown || imageFitsInWindow()) | 287 if (!m_imageSizeIsKnown || imageFitsInWindow()) |
| 288 return; | 288 return; |
| 289 | 289 |
| 290 m_shouldShrinkImage = !m_shouldShrinkImage; | 290 m_shouldShrinkImage = !m_shouldShrinkImage; |
| 291 | 291 |
| 292 if (m_shouldShrinkImage) { | 292 if (m_shouldShrinkImage) { |
| 293 windowSizeChanged(ScaleZoomedDocument); | 293 windowSizeChanged(ScaleZoomedDocument); |
| 294 } else { | 294 } else { |
| 295 restoreImageSize(ScaleZoomedDocument); | 295 restoreImageSize(ScaleZoomedDocument); |
| 296 | 296 |
| 297 updateLayout(); | 297 updateStyleAndLayout(); |
| 298 | 298 |
| 299 double scale = this->scale(); | 299 double scale = this->scale(); |
| 300 | 300 |
| 301 double scrollX = x / scale - static_cast<double>(frame()->view()->width(
)) / 2; | 301 double scrollX = x / scale - static_cast<double>(frame()->view()->width(
)) / 2; |
| 302 double scrollY = y / scale - static_cast<double>(frame()->view()->height
()) / 2; | 302 double scrollY = y / scale - static_cast<double>(frame()->view()->height
()) / 2; |
| 303 | 303 |
| 304 frame()->view()->setScrollPosition(DoublePoint(scrollX, scrollY), Progra
mmaticScroll); | 304 frame()->view()->setScrollPosition(DoublePoint(scrollX, scrollY), Progra
mmaticScroll); |
| 305 } | 305 } |
| 306 } | 306 } |
| 307 | 307 |
| 308 void ImageDocument::imageUpdated() | 308 void ImageDocument::imageUpdated() |
| 309 { | 309 { |
| 310 ASSERT(m_imageElement); | 310 ASSERT(m_imageElement); |
| 311 | 311 |
| 312 if (m_imageSizeIsKnown) | 312 if (m_imageSizeIsKnown) |
| 313 return; | 313 return; |
| 314 | 314 |
| 315 updateLayoutTree(); | 315 updateStyleAndLayoutTree(); |
| 316 if (!m_imageElement->cachedImage() || m_imageElement->cachedImage()->imageSi
ze(LayoutObject::shouldRespectImageOrientation(m_imageElement->layoutObject()),
pageZoomFactor(this)).isEmpty()) | 316 if (!m_imageElement->cachedImage() || m_imageElement->cachedImage()->imageSi
ze(LayoutObject::shouldRespectImageOrientation(m_imageElement->layoutObject()),
pageZoomFactor(this)).isEmpty()) |
| 317 return; | 317 return; |
| 318 | 318 |
| 319 m_imageSizeIsKnown = true; | 319 m_imageSizeIsKnown = true; |
| 320 | 320 |
| 321 if (shouldShrinkToFit()) { | 321 if (shouldShrinkToFit()) { |
| 322 // Force resizing of the image | 322 // Force resizing of the image |
| 323 windowSizeChanged(ScaleOnlyUnzoomedDocument); | 323 windowSizeChanged(ScaleOnlyUnzoomedDocument); |
| 324 } | 324 } |
| 325 } | 325 } |
| (...skipping 117 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 |