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) | |
ojan
2014/01/03 02:04:26
Did you mean to include this in this patch?
Xianzhu
2014/01/03 20:46:24
Yes, otherwise my added code won't compile.
| |
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 | |
4954 FrameTestHelpers::WebViewHelper webViewHelper; | |
4955 WebViewImpl* webView = webViewHelper.initialize(true); | |
4956 | |
4957 for (size_t i = 0; i < arraysize(kTests); ++i) { | |
4958 SCOPED_TRACE(kTests[i]); | |
4959 registerMockedHttpURLLoad(kTests[i]); | |
4960 FrameTestHelpers::loadFrame(webView->mainFrame(), m_baseURL + kTests[i]) ; | |
4961 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests( ); | |
4962 | |
4963 webView->resize(WebSize(200, 200)); | |
4964 webView->layout(); | |
4965 | |
4966 // Change height. | |
4967 WebCore::FrameView* frameView = webView->mainFrameImpl()->frameView(); | |
4968 frameView->setTracksRepaints(true); | |
4969 webView->resize(WebSize(200, 300)); | |
4970 webView->layout(); | |
4971 if (strstr(kTests[i], "no-full-repaint")) | |
4972 EXPECT_EQ_RECT(WebCore::IntRect(0, 200, 200, 100), WebCore::unionRec t(frameView->trackedRepaintRects())); | |
4973 else | |
4974 EXPECT_EQ_RECT(WebCore::IntRect(0, 0, 200, 300), WebCore::unionRect( frameView->trackedRepaintRects())); | |
4975 frameView->setTracksRepaints(false); | |
4976 | |
4977 // Change width, ensure optimized logic for height change doesn't break repaint on width change. | |
4978 frameView->setTracksRepaints(true); | |
4979 webView->resize(WebSize(300, 300)); | |
4980 webView->layout(); | |
4981 EXPECT_EQ_RECT(WebCore::IntRect(0, 0, 300, 300), WebCore::unionRect(fram eView->trackedRepaintRects())); | |
4982 frameView->setTracksRepaints(false); | |
4983 } | |
4984 } | |
4985 | |
4930 } // namespace | 4986 } // namespace |
OLD | NEW |