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

Unified Diff: Source/web/tests/WebFrameTest.cpp

Issue 204813002: Optimize layout/repaint on FrameView resize (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Keep FrameView::m_doFullRepaint Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/frame/FrameView.cpp ('k') | Source/web/tests/data/repaint/size-change-repaint1.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/WebFrameTest.cpp
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp
index cd0fce10ea541ad81a9d13f20bc0e7e86a71cb81..78502afe1cef06b74a8ef22f2b6a9086a79cafd4 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -5285,6 +5285,79 @@ TEST_F(WebFrameTest, CreateChildFrameFailure)
EXPECT_EQ(1, client.callCount());
}
+TEST_F(WebFrameTest, sizeChangeRepaint)
+{
+ const char* kTests[] = {
+ "repaint/size-change-repaint1.html",
+ "repaint/size-change-repaint2.html",
+ "repaint/size-change-repaint3.html",
+ "repaint/size-change-repaint4.html",
+ "repaint/size-change-repaint5.html",
+ "repaint/size-change-repaint6.html",
+ "repaint/size-change-repaint7.html",
+ "repaint/size-change-repaint8.html",
+ "repaint/size-change-repaint9.html",
+ "repaint/size-change-repaint10.html",
+ };
+
+ const WebCore::IntRect kExpectedRepaintOnHeightChange[] = {
+ WebCore::IntRect(0, 200, 200, 100),
+ WebCore::IntRect(0, 200, 200, 100),
+ WebCore::IntRect(0, 200, 200, 100),
+ WebCore::IntRect(0, 0, 200, 300),
+ WebCore::IntRect(0, 0, 200, 300),
+ WebCore::IntRect(0, 0, 200, 300),
+ WebCore::IntRect(0, 100, 200, 200),
+ WebCore::IntRect(0, 100, 200, 200),
+ WebCore::IntRect(0, 160, 200, 140),
+ WebCore::IntRect(0, 50, 200, 250),
+ };
+
+ const WebCore::IntRect kExpectedRepaintOnWidthChange[] = {
+ WebCore::IntRect(0, 0, 300, 300),
+ WebCore::IntRect(0, 0, 300, 300),
+ WebCore::IntRect(0, 0, 300, 300),
+ WebCore::IntRect(0, 0, 300, 300),
+ WebCore::IntRect(0, 0, 300, 300),
+ WebCore::IntRect(0, 0, 300, 300),
+ WebCore::IntRect(0, 0, 300, 300),
+ WebCore::IntRect(0, 0, 300, 300),
+ WebCore::IntRect(0, 0, 300, 300),
+ WebCore::IntRect(0, 0, 300, 300),
+ };
+
+ UseMockScrollbarSettings mockScrollbarSettings;
+
+ FrameTestHelpers::WebViewHelper webViewHelper;
+ WebViewImpl* webView = webViewHelper.initialize(true);
+
+ for (size_t i = 0; i < arraysize(kTests); ++i) {
+ SCOPED_TRACE(kTests[i]);
+ registerMockedHttpURLLoad(kTests[i]);
+ FrameTestHelpers::loadFrame(webView->mainFrame(), m_baseURL + kTests[i]);
+ Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
+
+ webView->resize(WebSize(200, 200));
+ webView->layout();
+
+ // Change height.
+ WebCore::FrameView* frameView = webView->mainFrameImpl()->frameView();
+ frameView->setTracksRepaints(true);
+ webView->resize(WebSize(200, 300));
+ webView->layout();
+ WebCore::IntRect repaintRect = WebCore::intersection(WebCore::IntRect(0, 0, 200, 300), WebCore::unionRect(frameView->trackedRepaintRects()));
+ EXPECT_EQ_RECT(kExpectedRepaintOnHeightChange[i], repaintRect);
+
+ // Change width.
+ frameView->setTracksRepaints(true);
+ webView->resize(WebSize(300, 300));
+ webView->layout();
+ repaintRect = WebCore::intersection(WebCore::IntRect(0, 0, 300, 300), WebCore::unionRect(frameView->trackedRepaintRects()));
+ EXPECT_EQ_RECT(kExpectedRepaintOnWidthChange[i], repaintRect);
+ frameView->setTracksRepaints(false);
+ }
+}
+
TEST_F(WebFrameTest, fixedPositionInFixedViewport)
{
UseMockScrollbarSettings mockScrollbarSettings;
« no previous file with comments | « Source/core/frame/FrameView.cpp ('k') | Source/web/tests/data/repaint/size-change-repaint1.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698