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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 using WebCore::HitTestRequest; | 97 using WebCore::HitTestRequest; |
98 using WebCore::Range; | 98 using WebCore::Range; |
99 using blink::URLTestHelpers::toKURL; | 99 using blink::URLTestHelpers::toKURL; |
100 using blink::FrameTestHelpers::runPendingTasks; | 100 using blink::FrameTestHelpers::runPendingTasks; |
101 | 101 |
102 namespace { | 102 namespace { |
103 | 103 |
104 const int touchPointPadding = 32; | 104 const int touchPointPadding = 32; |
105 | 105 |
106 #define EXPECT_EQ_RECT(a, b) \ | 106 #define EXPECT_EQ_RECT(a, b) \ |
107 EXPECT_EQ(a.x(), b.x()); \ | 107 do { \ |
108 EXPECT_EQ(a.y(), b.y()); \ | 108 EXPECT_EQ(a.x(), b.x()); \ |
109 EXPECT_EQ(a.width(), b.width()); \ | 109 EXPECT_EQ(a.y(), b.y()); \ |
110 EXPECT_EQ(a.height(), b.height()); | 110 EXPECT_EQ(a.width(), b.width()); \ |
| 111 EXPECT_EQ(a.height(), b.height()); \ |
| 112 } while (false) |
111 | 113 |
112 class FakeWebFrameClient : public WebFrameClient { | 114 class FakeWebFrameClient : public WebFrameClient { |
113 // To make the destructor public. | 115 // To make the destructor public. |
114 }; | 116 }; |
115 | 117 |
116 class FakeCompositingWebViewClient : public WebViewClient { | 118 class FakeCompositingWebViewClient : public WebViewClient { |
117 public: | 119 public: |
118 virtual ~FakeCompositingWebViewClient() | 120 virtual ~FakeCompositingWebViewClient() |
119 { | 121 { |
120 } | 122 } |
(...skipping 4799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4920 ASSERT_FALSE(webScrollLayer->userScrollableVertical()); | 4922 ASSERT_FALSE(webScrollLayer->userScrollableVertical()); |
4921 | 4923 |
4922 // Call javascript to make the layer scrollable, and verify it. | 4924 // Call javascript to make the layer scrollable, and verify it. |
4923 WebFrameImpl* frame = (WebFrameImpl*)webViewHelper.webView()->mainFrame(); | 4925 WebFrameImpl* frame = (WebFrameImpl*)webViewHelper.webView()->mainFrame(); |
4924 frame->executeScript(WebScriptSource("allowScroll();")); | 4926 frame->executeScript(WebScriptSource("allowScroll();")); |
4925 webViewHelper.webView()->layout(); | 4927 webViewHelper.webView()->layout(); |
4926 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal()); | 4928 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal()); |
4927 ASSERT_TRUE(webScrollLayer->userScrollableVertical()); | 4929 ASSERT_TRUE(webScrollLayer->userScrollableVertical()); |
4928 } | 4930 } |
4929 | 4931 |
| 4932 TEST_F(WebFrameTest, heightChangeRepaint) |
| 4933 { |
| 4934 const char* kTests[] = { |
| 4935 "repaint/height-change-no-full-repaint1.html", |
| 4936 "repaint/height-change-no-full-repaint2.html", |
| 4937 |
| 4938 // The following tests need full repaint on height change for now, |
| 4939 // but may be optimized not to need full repaint in the future and need |
| 4940 // to be updated. |
| 4941 "repaint/height-change-repaint1.html", // vertical writing mode |
| 4942 "repaint/height-change-repaint2.html", // frameset |
| 4943 "repaint/height-change-repaint3.html", // percentage height |
| 4944 "repaint/height-change-repaint4.html", // positioned percentage height |
| 4945 "repaint/height-change-repaint5.html", // percentage top |
| 4946 "repaint/height-change-repaint6.html", // bottom |
| 4947 "repaint/height-change-repaint7.html", // viewport related media query |
| 4948 // FIXME: this depends on https://codereview.chromium.org/82083002/. |
| 4949 // "repaint/height-change-repaint8.html", // viewport percentage length |
| 4950 }; |
| 4951 |
| 4952 UseMockScrollbarSettings mockScrollbarSettings; |
| 4953 WebCore::RuntimeEnabledFeatures::setOptimizedLayoutOnViewHeightChangeEnabled
(true); |
| 4954 |
| 4955 FrameTestHelpers::WebViewHelper webViewHelper; |
| 4956 WebViewImpl* webView = webViewHelper.initialize(true); |
| 4957 |
| 4958 for (size_t i = 0; i < arraysize(kTests); ++i) { |
| 4959 SCOPED_TRACE(kTests[i]); |
| 4960 registerMockedHttpURLLoad(kTests[i]); |
| 4961 FrameTestHelpers::loadFrame(webView->mainFrame(), m_baseURL + kTests[i])
; |
| 4962 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(
); |
| 4963 |
| 4964 webView->resize(WebSize(200, 200)); |
| 4965 webView->layout(); |
| 4966 |
| 4967 // Change height. |
| 4968 WebCore::FrameView* frameView = webView->mainFrameImpl()->frameView(); |
| 4969 frameView->setTracksRepaints(true); |
| 4970 webView->resize(WebSize(200, 300)); |
| 4971 webView->layout(); |
| 4972 if (strstr(kTests[i], "no-full-repaint")) |
| 4973 EXPECT_EQ_RECT(WebCore::IntRect(0, 200, 200, 100), WebCore::unionRec
t(frameView->trackedRepaintRects())); |
| 4974 else |
| 4975 EXPECT_EQ_RECT(WebCore::IntRect(0, 0, 200, 300), WebCore::unionRect(
frameView->trackedRepaintRects())); |
| 4976 frameView->setTracksRepaints(false); |
| 4977 |
| 4978 // Change width, ensure optimized logic for height change doesn't break
repaint on width change. |
| 4979 frameView->setTracksRepaints(true); |
| 4980 webView->resize(WebSize(300, 300)); |
| 4981 webView->layout(); |
| 4982 EXPECT_EQ_RECT(WebCore::IntRect(0, 0, 300, 300), WebCore::unionRect(fram
eView->trackedRepaintRects())); |
| 4983 frameView->setTracksRepaints(false); |
| 4984 } |
| 4985 |
| 4986 WebCore::RuntimeEnabledFeatures::setOptimizedLayoutOnViewHeightChangeEnabled
(false); |
| 4987 } |
| 4988 |
4930 } // namespace | 4989 } // namespace |
OLD | NEW |