| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/html/ImageDocument.h" | 5 #include "core/html/ImageDocument.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/dom/DocumentParser.h" | 8 #include "core/dom/DocumentParser.h" |
| 9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
| 10 #include "core/loader/EmptyClients.h" | 10 #include "core/loader/EmptyClients.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x00, 0x14, 0x11, 0x01, 0x00, 0x00, | 43 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x00, 0x14, 0x11, 0x01, 0x00, 0x00, |
| 44 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 44 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 45 0x00, 0x00, 0xff, 0xda, 0x00, 0x0c, 0x03, 0x01, 0x00, 0x02, 0x11, 0x03, | 45 0x00, 0x00, 0xff, 0xda, 0x00, 0x0c, 0x03, 0x01, 0x00, 0x02, 0x11, 0x03, |
| 46 0x11, 0x00, 0x3f, 0x00, 0x00, 0x94, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, | 46 0x11, 0x00, 0x3f, 0x00, 0x00, 0x94, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 47 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 47 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 48 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xd9}; | 48 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xd9}; |
| 49 | 49 |
| 50 jpeg.Append(kData, sizeof(kData)); | 50 jpeg.Append(kData, sizeof(kData)); |
| 51 return jpeg; | 51 return jpeg; |
| 52 } | 52 } |
| 53 } | 53 } // namespace |
| 54 | 54 |
| 55 class WindowToViewportScalingChromeClient : public EmptyChromeClient { | 55 class WindowToViewportScalingChromeClient : public EmptyChromeClient { |
| 56 public: | 56 public: |
| 57 WindowToViewportScalingChromeClient() | 57 WindowToViewportScalingChromeClient() |
| 58 : EmptyChromeClient(), scale_factor_(1.f) {} | 58 : EmptyChromeClient(), scale_factor_(1.f) {} |
| 59 | 59 |
| 60 void SetScalingFactor(float s) { scale_factor_ = s; } | 60 void SetScalingFactor(float s) { scale_factor_ = s; } |
| 61 float WindowToViewportScalar(const float s) const override { | 61 float WindowToViewportScalar(const float s) const override { |
| 62 return s * scale_factor_; | 62 return s * scale_factor_; |
| 63 } | 63 } |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 GetDocument().GetPage()->GetSettings().SetForceZeroLayoutHeight(false); | 199 GetDocument().GetPage()->GetSettings().SetForceZeroLayoutHeight(false); |
| 200 LoadImage(); | 200 LoadImage(); |
| 201 EXPECT_TRUE(GetDocument().ShouldShrinkToFit()); | 201 EXPECT_TRUE(GetDocument().ShouldShrinkToFit()); |
| 202 EXPECT_EQ(15, GetDocument().ImageElement()->OffsetLeft()); | 202 EXPECT_EQ(15, GetDocument().ImageElement()->OffsetLeft()); |
| 203 EXPECT_EQ(10, GetDocument().ImageElement()->OffsetTop()); | 203 EXPECT_EQ(10, GetDocument().ImageElement()->OffsetTop()); |
| 204 EXPECT_EQ(50, ImageWidth()); | 204 EXPECT_EQ(50, ImageWidth()); |
| 205 EXPECT_EQ(50, ImageHeight()); | 205 EXPECT_EQ(50, ImageHeight()); |
| 206 } | 206 } |
| 207 | 207 |
| 208 } // namespace blink | 208 } // namespace blink |
| OLD | NEW |