| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 242 |
| 243 // Required to see any updates in contentAsText. | 243 // Required to see any updates in contentAsText. |
| 244 m_webView->layout(); | 244 m_webView->layout(); |
| 245 | 245 |
| 246 // Verify that only the first addition is in the body of the page. | 246 // Verify that only the first addition is in the body of the page. |
| 247 std::string content = std::string(m_webView->mainFrame()->contentAsText(1024
).utf8().data()); | 247 std::string content = std::string(m_webView->mainFrame()->contentAsText(1024
).utf8().data()); |
| 248 EXPECT_NE(std::string::npos, content.find("Message 1.")); | 248 EXPECT_NE(std::string::npos, content.find("Message 1.")); |
| 249 EXPECT_EQ(std::string::npos, content.find("Message 2.")); | 249 EXPECT_EQ(std::string::npos, content.find("Message 2.")); |
| 250 } | 250 } |
| 251 | 251 |
| 252 #if ENABLE(VIEWPORT) | |
| 253 | |
| 254 class FixedLayoutTestWebViewClient : public WebViewClient { | 252 class FixedLayoutTestWebViewClient : public WebViewClient { |
| 255 public: | 253 public: |
| 256 virtual WebScreenInfo screenInfo() OVERRIDE { return m_screenInfo; } | 254 virtual WebScreenInfo screenInfo() OVERRIDE { return m_screenInfo; } |
| 257 | 255 |
| 258 WebScreenInfo m_screenInfo; | 256 WebScreenInfo m_screenInfo; |
| 259 }; | 257 }; |
| 260 | 258 |
| 261 TEST_F(WebFrameTest, FrameViewNeedsLayoutOnFixedLayoutResize) | 259 TEST_F(WebFrameTest, FrameViewNeedsLayoutOnFixedLayoutResize) |
| 262 { | 260 { |
| 263 registerMockedHttpURLLoad("fixed_layout.html"); | 261 registerMockedHttpURLLoad("fixed_layout.html"); |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 m_webView->resize(WebSize(viewportWidth, viewportHeight)); | 701 m_webView->resize(WebSize(viewportWidth, viewportHeight)); |
| 704 | 702 |
| 705 EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, m_web
View->fixedLayoutSize().width, 1.0f); | 703 EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, m_web
View->fixedLayoutSize().width, 1.0f); |
| 706 EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, m_we
bView->fixedLayoutSize().height, 1.0f); | 704 EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, m_we
bView->fixedLayoutSize().height, 1.0f); |
| 707 EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, m_webView->pag
eScaleFactor(), 0.01f); | 705 EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, m_webView->pag
eScaleFactor(), 0.01f); |
| 708 | 706 |
| 709 m_webView->close(); | 707 m_webView->close(); |
| 710 m_webView = 0; | 708 m_webView = 0; |
| 711 } | 709 } |
| 712 } | 710 } |
| 713 #endif | |
| 714 | 711 |
| 715 class WebFrameResizeTest : public WebFrameTest { | 712 class WebFrameResizeTest : public WebFrameTest { |
| 716 protected: | 713 protected: |
| 717 | 714 |
| 718 static WebCore::FloatSize computeRelativeOffset(const WebCore::IntPoint& abs
oluteOffset, const WebCore::LayoutRect& rect) | 715 static WebCore::FloatSize computeRelativeOffset(const WebCore::IntPoint& abs
oluteOffset, const WebCore::LayoutRect& rect) |
| 719 { | 716 { |
| 720 WebCore::FloatSize relativeOffset = WebCore::FloatPoint(absoluteOffset)
- rect.location(); | 717 WebCore::FloatSize relativeOffset = WebCore::FloatPoint(absoluteOffset)
- rect.location(); |
| 721 relativeOffset.scale(1.f / rect.width(), 1.f / rect.height()); | 718 relativeOffset.scale(1.f / rect.width(), 1.f / rect.height()); |
| 722 return relativeOffset; | 719 return relativeOffset; |
| 723 } | 720 } |
| (...skipping 2091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2815 EXPECT_FALSE(client.wasProgrammaticScroll()); | 2812 EXPECT_FALSE(client.wasProgrammaticScroll()); |
| 2816 EXPECT_TRUE(client.wasUserScroll()); | 2813 EXPECT_TRUE(client.wasUserScroll()); |
| 2817 client.reset(); | 2814 client.reset(); |
| 2818 | 2815 |
| 2819 m_webView->close(); | 2816 m_webView->close(); |
| 2820 m_webView = 0; | 2817 m_webView = 0; |
| 2821 } | 2818 } |
| 2822 | 2819 |
| 2823 | 2820 |
| 2824 } // namespace | 2821 } // namespace |
| OLD | NEW |