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 2981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2992 // Non zero page scale and scroll. | 2992 // Non zero page scale and scroll. |
2993 webViewImpl->applyScrollAndScale(WebSize(9, 13), 2.0f); | 2993 webViewImpl->applyScrollAndScale(WebSize(9, 13), 2.0f); |
2994 EXPECT_FALSE(client.wasProgrammaticScroll()); | 2994 EXPECT_FALSE(client.wasProgrammaticScroll()); |
2995 EXPECT_TRUE(client.wasUserScroll()); | 2995 EXPECT_TRUE(client.wasUserScroll()); |
2996 client.reset(); | 2996 client.reset(); |
2997 | 2997 |
2998 m_webView->close(); | 2998 m_webView->close(); |
2999 m_webView = 0; | 2999 m_webView = 0; |
3000 } | 3000 } |
3001 | 3001 |
| 3002 TEST_F(WebFrameTest, OverflowHiddenScrollable) |
| 3003 { |
| 3004 WebCore::Settings::setMockScrollbarsEnabled(true); |
| 3005 WebCore::Settings::setUsesOverlayScrollbars(true); |
| 3006 EXPECT_TRUE(WebCore::ScrollbarTheme::theme()->usesOverlayScrollbars()); |
| 3007 |
| 3008 registerMockedHttpURLLoad("clipped-body.html"); |
| 3009 |
| 3010 FixedLayoutTestWebViewClient client; |
| 3011 client.m_screenInfo.deviceScaleFactor = 1; |
| 3012 int fixedLayoutWidth = 500; // Smaller than the full content width 1000. "ov
erflow-x: hidden" will clip in this direction. |
| 3013 int fixedLayoutHeight = 3000; // Bigger than the full content height 1000 wh
ich won't be clipped. |
| 3014 |
| 3015 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "clipped-body
.html", true, 0, &client); |
| 3016 m_webView->enableFixedLayoutMode(true); |
| 3017 m_webView->settings()->setViewportEnabled(true); |
| 3018 m_webView->resize(WebSize(fixedLayoutWidth, fixedLayoutHeight)); |
| 3019 m_webView->layout(); |
| 3020 |
| 3021 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView); |
| 3022 WebCore::FrameView* frameView = webViewImpl->mainFrameImpl()->frameView(); |
| 3023 m_webView->setFixedLayoutSize(WebSize(fixedLayoutWidth, fixedLayoutHeight)); |
| 3024 m_webView->layout(); |
| 3025 |
| 3026 EXPECT_EQ(fixedLayoutWidth, frameView->contentsWidth()); |
| 3027 EXPECT_EQ(fixedLayoutWidth, frameView->visibleWidth()); |
| 3028 EXPECT_FALSE(frameView->isScrollable()); |
| 3029 |
| 3030 m_webView->setPageScaleFactorPreservingScrollOffset(2); |
| 3031 m_webView->layout(); |
| 3032 |
| 3033 EXPECT_EQ(fixedLayoutWidth / 2, frameView->visibleWidth()); |
| 3034 EXPECT_EQ(fixedLayoutWidth, frameView->contentsWidth()); |
| 3035 EXPECT_TRUE(frameView->isScrollable()); |
| 3036 EXPECT_EQ(fixedLayoutWidth / 2, frameView->maximumScrollPosition().x()); |
| 3037 } |
3002 | 3038 |
3003 } // namespace | 3039 } // namespace |
OLD | NEW |