| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "core/html/HTMLDivElement.h" | 43 #include "core/html/HTMLDivElement.h" |
| 44 #include "core/html/HTMLHeadElement.h" | 44 #include "core/html/HTMLHeadElement.h" |
| 45 #include "core/html/HTMLHtmlElement.h" | 45 #include "core/html/HTMLHtmlElement.h" |
| 46 #include "core/html/HTMLImageElement.h" | 46 #include "core/html/HTMLImageElement.h" |
| 47 #include "core/html/HTMLMetaElement.h" | 47 #include "core/html/HTMLMetaElement.h" |
| 48 #include "core/layout/LayoutObject.h" | 48 #include "core/layout/LayoutObject.h" |
| 49 #include "core/loader/DocumentLoader.h" | 49 #include "core/loader/DocumentLoader.h" |
| 50 #include "core/loader/FrameLoader.h" | 50 #include "core/loader/FrameLoader.h" |
| 51 #include "core/loader/resource/ImageResource.h" | 51 #include "core/loader/resource/ImageResource.h" |
| 52 #include "core/page/Page.h" | 52 #include "core/page/Page.h" |
| 53 #include "platform/HostWindow.h" | 53 #include "platform/PlatformChromeClient.h" |
| 54 #include "platform/wtf/text/StringBuilder.h" | 54 #include "platform/wtf/text/StringBuilder.h" |
| 55 | 55 |
| 56 namespace { | 56 namespace { |
| 57 | 57 |
| 58 // The base square size is set to 10 because it rounds nicely for both the | 58 // The base square size is set to 10 because it rounds nicely for both the |
| 59 // minimum scale (0.1) and maximum scale (5.0). | 59 // minimum scale (0.1) and maximum scale (5.0). |
| 60 const int kBaseCheckerSize = 10; | 60 const int kBaseCheckerSize = 10; |
| 61 | 61 |
| 62 } // namespace | 62 } // namespace |
| 63 | 63 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 DCHECK(image_element_->CachedImage()); | 306 DCHECK(image_element_->CachedImage()); |
| 307 const float zoom = PageZoomFactor(this); | 307 const float zoom = PageZoomFactor(this); |
| 308 LayoutSize image_size = image_element_->CachedImage()->ImageSize( | 308 LayoutSize image_size = image_element_->CachedImage()->ImageSize( |
| 309 LayoutObject::ShouldRespectImageOrientation( | 309 LayoutObject::ShouldRespectImageOrientation( |
| 310 image_element_->GetLayoutObject()), | 310 image_element_->GetLayoutObject()), |
| 311 zoom); | 311 zoom); |
| 312 | 312 |
| 313 // We want to pretend the viewport is larger when the user has zoomed the | 313 // We want to pretend the viewport is larger when the user has zoomed the |
| 314 // page in (but not when the zoom is coming from device scale). | 314 // page in (but not when the zoom is coming from device scale). |
| 315 const float manual_zoom = | 315 const float manual_zoom = |
| 316 zoom / view->GetHostWindow()->WindowToViewportScalar(1.f); | 316 zoom / view->GetChromeClient()->WindowToViewportScalar(1.f); |
| 317 float width_scale = | 317 float width_scale = |
| 318 view->Width() * manual_zoom / image_size.Width().ToFloat(); | 318 view->Width() * manual_zoom / image_size.Width().ToFloat(); |
| 319 float height_scale = | 319 float height_scale = |
| 320 view->Height() * manual_zoom / image_size.Height().ToFloat(); | 320 view->Height() * manual_zoom / image_size.Height().ToFloat(); |
| 321 | 321 |
| 322 return std::min(width_scale, height_scale); | 322 return std::min(width_scale, height_scale); |
| 323 } | 323 } |
| 324 | 324 |
| 325 void ImageDocument::ResizeImageToFit() { | 325 void ImageDocument::ResizeImageToFit() { |
| 326 DCHECK_EQ(shrink_to_fit_mode_, kDesktop); | 326 DCHECK_EQ(shrink_to_fit_mode_, kDesktop); |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 } | 630 } |
| 631 | 631 |
| 632 bool ImageEventListener::operator==(const EventListener& listener) const { | 632 bool ImageEventListener::operator==(const EventListener& listener) const { |
| 633 if (const ImageEventListener* image_event_listener = | 633 if (const ImageEventListener* image_event_listener = |
| 634 ImageEventListener::Cast(&listener)) | 634 ImageEventListener::Cast(&listener)) |
| 635 return doc_ == image_event_listener->doc_; | 635 return doc_ == image_event_listener->doc_; |
| 636 return false; | 636 return false; |
| 637 } | 637 } |
| 638 | 638 |
| 639 } // namespace blink | 639 } // namespace blink |
| OLD | NEW |