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 FakeCompositingWebViewClient : public WebViewClient { | 114 class FakeCompositingWebViewClient : public WebViewClient { |
113 public: | 115 public: |
114 virtual ~FakeCompositingWebViewClient() | 116 virtual ~FakeCompositingWebViewClient() |
115 { | 117 { |
116 } | 118 } |
117 | 119 |
118 virtual void initializeLayerTreeView() OVERRIDE | 120 virtual void initializeLayerTreeView() OVERRIDE |
119 { | 121 { |
120 m_layerTreeView = adoptPtr(Platform::current()->unitTestSupport()->creat
eLayerTreeViewForTesting(WebUnitTestSupport::TestViewTypeUnitTest)); | 122 m_layerTreeView = adoptPtr(Platform::current()->unitTestSupport()->creat
eLayerTreeViewForTesting(WebUnitTestSupport::TestViewTypeUnitTest)); |
(...skipping 4811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4932 EXPECT_TRUE(frame->currentHistoryItem().isNull()); | 4934 EXPECT_TRUE(frame->currentHistoryItem().isNull()); |
4933 | 4935 |
4934 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); | 4936 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); |
4935 | 4937 |
4936 // After commit, there is. | 4938 // After commit, there is. |
4937 WebHistoryItem item = frame->currentHistoryItem(); | 4939 WebHistoryItem item = frame->currentHistoryItem(); |
4938 ASSERT_FALSE(item.isNull()); | 4940 ASSERT_FALSE(item.isNull()); |
4939 EXPECT_EQ(url, item.urlString().utf8()); | 4941 EXPECT_EQ(url, item.urlString().utf8()); |
4940 } | 4942 } |
4941 | 4943 |
| 4944 TEST_F(WebFrameTest, heightChangeRepaint) |
| 4945 { |
| 4946 const char* kTests[] = { |
| 4947 "repaint/height-change-no-full-repaint1.html", |
| 4948 "repaint/height-change-no-full-repaint2.html", |
| 4949 |
| 4950 // The following tests need full repaint on height change for now, |
| 4951 // but may be optimized not to need full repaint in the future and need |
| 4952 // to be updated. |
| 4953 "repaint/height-change-repaint1.html", // vertical writing mode |
| 4954 "repaint/height-change-repaint2.html", // frameset |
| 4955 "repaint/height-change-repaint3.html", // percentage height |
| 4956 "repaint/height-change-repaint4.html", // positioned percentage height |
| 4957 "repaint/height-change-repaint5.html", // percentage top |
| 4958 "repaint/height-change-repaint6.html", // bottom |
| 4959 "repaint/height-change-repaint7.html", // viewport related media query |
| 4960 "repaint/height-change-repaint8.html", // viewport percentage length |
| 4961 }; |
| 4962 |
| 4963 UseMockScrollbarSettings mockScrollbarSettings; |
| 4964 |
| 4965 FrameTestHelpers::WebViewHelper webViewHelper; |
| 4966 WebViewImpl* webView = webViewHelper.initialize(true); |
| 4967 |
| 4968 for (size_t i = 0; i < arraysize(kTests); ++i) { |
| 4969 SCOPED_TRACE(kTests[i]); |
| 4970 registerMockedHttpURLLoad(kTests[i]); |
| 4971 FrameTestHelpers::loadFrame(webView->mainFrame(), m_baseURL + kTests[i])
; |
| 4972 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(
); |
| 4973 |
| 4974 webView->resize(WebSize(200, 200)); |
| 4975 webView->layout(); |
| 4976 |
| 4977 // Change height. |
| 4978 WebCore::FrameView* frameView = webView->mainFrameImpl()->frameView(); |
| 4979 frameView->setTracksRepaints(true); |
| 4980 webView->resize(WebSize(200, 300)); |
| 4981 webView->layout(); |
| 4982 if (strstr(kTests[i], "no-full-repaint")) |
| 4983 EXPECT_EQ_RECT(WebCore::IntRect(0, 200, 200, 100), WebCore::unionRec
t(frameView->trackedRepaintRects())); |
| 4984 else |
| 4985 EXPECT_EQ_RECT(WebCore::IntRect(0, 0, 200, 300), WebCore::unionRect(
frameView->trackedRepaintRects())); |
| 4986 frameView->setTracksRepaints(false); |
| 4987 |
| 4988 // Change width, ensure optimized logic for height change doesn't break
repaint on width change. |
| 4989 frameView->setTracksRepaints(true); |
| 4990 webView->resize(WebSize(300, 300)); |
| 4991 webView->layout(); |
| 4992 EXPECT_EQ_RECT(WebCore::IntRect(0, 0, 300, 300), WebCore::unionRect(fram
eView->trackedRepaintRects())); |
| 4993 frameView->setTracksRepaints(false); |
| 4994 } |
| 4995 } |
| 4996 |
4942 } // namespace | 4997 } // namespace |
OLD | NEW |