Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Side by Side Diff: Source/web/tests/WebFrameTest.cpp

Issue 99663004: Avoid layout/full-repaint on view height change if possible (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: We have Document::hasViewportUnits() now Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 using WebCore::FloatRect; 96 using WebCore::FloatRect;
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) \
ojan 2014/01/03 21:19:01 Does this really need to be a macro? Can't this ju
Xianzhu 2014/01/03 22:11:53 Being a macro it'll output correct line number whe
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
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
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGRoot.cpp ('k') | Source/web/tests/data/repaint/height-change-no-full-repaint1.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698