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

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

Issue 213103003: Optimize repaint on FrameView resize (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update FIXME Created 6 years, 8 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 5265 matching lines...) Expand 10 before | Expand all | Expand 10 after
5276 TEST_F(WebFrameTest, CreateChildFrameFailure) 5276 TEST_F(WebFrameTest, CreateChildFrameFailure)
5277 { 5277 {
5278 registerMockedHttpURLLoad("create_child_frame_fail.html"); 5278 registerMockedHttpURLLoad("create_child_frame_fail.html");
5279 FailCreateChildFrame client; 5279 FailCreateChildFrame client;
5280 FrameTestHelpers::WebViewHelper webViewHelper; 5280 FrameTestHelpers::WebViewHelper webViewHelper;
5281 webViewHelper.initializeAndLoad(m_baseURL + "create_child_frame_fail.html", true, &client); 5281 webViewHelper.initializeAndLoad(m_baseURL + "create_child_frame_fail.html", true, &client);
5282 5282
5283 EXPECT_EQ(1, client.callCount()); 5283 EXPECT_EQ(1, client.callCount());
5284 } 5284 }
5285 5285
5286 TEST_F(WebFrameTest, sizeChangeRepaint)
5287 {
5288 const char* kTests[] = {
5289 "repaint/size-change-repaint1.html",
5290 "repaint/size-change-repaint2.html",
5291 "repaint/size-change-repaint3.html",
5292 "repaint/size-change-repaint4.html",
5293 "repaint/size-change-repaint5.html",
5294 "repaint/size-change-repaint6.html",
5295 "repaint/size-change-repaint7.html",
5296 "repaint/size-change-repaint8.html",
5297 "repaint/size-change-repaint9.html",
5298 "repaint/size-change-repaint10.html",
5299 };
5300
5301 const WebCore::IntRect kExpectedRepaintOnHeightChange[] = {
5302 WebCore::IntRect(0, 200, 200, 100),
5303 WebCore::IntRect(0, 200, 200, 100),
5304 WebCore::IntRect(0, 200, 200, 100),
5305 WebCore::IntRect(0, 0, 200, 300),
5306 WebCore::IntRect(0, 0, 200, 300),
5307 WebCore::IntRect(0, 0, 200, 300),
5308 WebCore::IntRect(0, 100, 200, 200),
5309 WebCore::IntRect(0, 100, 200, 200),
5310 WebCore::IntRect(0, 160, 200, 140),
5311 WebCore::IntRect(0, 50, 200, 250),
5312 };
5313
5314 const WebCore::IntRect kExpectedRepaintOnWidthChange[] = {
5315 WebCore::IntRect(0, 0, 300, 300),
5316 WebCore::IntRect(0, 0, 300, 300),
5317 WebCore::IntRect(0, 0, 300, 300),
5318 WebCore::IntRect(0, 0, 300, 300),
5319 WebCore::IntRect(0, 0, 300, 300),
5320 WebCore::IntRect(0, 0, 300, 300),
5321 WebCore::IntRect(0, 0, 300, 300),
5322 WebCore::IntRect(0, 0, 300, 300),
5323 WebCore::IntRect(0, 0, 300, 300),
5324 WebCore::IntRect(0, 0, 300, 300),
5325 };
5326
5327 UseMockScrollbarSettings mockScrollbarSettings;
5328
5329 FrameTestHelpers::WebViewHelper webViewHelper;
5330 WebViewImpl* webView = webViewHelper.initialize(true);
5331
5332 for (size_t i = 0; i < arraysize(kTests); ++i) {
5333 SCOPED_TRACE(kTests[i]);
5334 registerMockedHttpURLLoad(kTests[i]);
5335 FrameTestHelpers::loadFrame(webView->mainFrame(), m_baseURL + kTests[i]) ;
5336 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests( );
5337
5338 webView->resize(WebSize(200, 200));
5339 webView->layout();
5340
5341 // Change height.
5342 WebCore::FrameView* frameView = webView->mainFrameImpl()->frameView();
5343 frameView->setTracksRepaints(true);
5344 webView->resize(WebSize(200, 300));
5345 webView->layout();
5346 WebCore::IntRect repaintRect = WebCore::intersection(WebCore::IntRect(0, 0, 200, 300), WebCore::unionRect(frameView->trackedRepaintRects()));
5347 EXPECT_EQ_RECT(kExpectedRepaintOnHeightChange[i], repaintRect);
5348
5349 // Change width.
5350 frameView->setTracksRepaints(true);
5351 webView->resize(WebSize(300, 300));
5352 webView->layout();
5353 repaintRect = WebCore::intersection(WebCore::IntRect(0, 0, 300, 300), We bCore::unionRect(frameView->trackedRepaintRects()));
5354 EXPECT_EQ_RECT(kExpectedRepaintOnWidthChange[i], repaintRect);
5355 frameView->setTracksRepaints(false);
5356 }
5357 }
5358
5286 TEST_F(WebFrameTest, fixedPositionInFixedViewport) 5359 TEST_F(WebFrameTest, fixedPositionInFixedViewport)
5287 { 5360 {
5288 UseMockScrollbarSettings mockScrollbarSettings; 5361 UseMockScrollbarSettings mockScrollbarSettings;
5289 registerMockedHttpURLLoad("fixed-position-in-fixed-viewport.html"); 5362 registerMockedHttpURLLoad("fixed-position-in-fixed-viewport.html");
5290 FrameTestHelpers::WebViewHelper webViewHelper; 5363 FrameTestHelpers::WebViewHelper webViewHelper;
5291 webViewHelper.initializeAndLoad(m_baseURL + "fixed-position-in-fixed-viewpor t.html", true, 0, 0, enableViewportSettings); 5364 webViewHelper.initializeAndLoad(m_baseURL + "fixed-position-in-fixed-viewpor t.html", true, 0, 0, enableViewportSettings);
5292 5365
5293 WebView* webView = webViewHelper.webView(); 5366 WebView* webView = webViewHelper.webView();
5294 webView->resize(WebSize(100, 100)); 5367 webView->resize(WebSize(100, 100));
5295 webView->layout(); 5368 webView->layout();
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
5389 EXPECT_EQ(2U, container->percentHeightDescendants()->size()); 5462 EXPECT_EQ(2U, container->percentHeightDescendants()->size());
5390 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightInA nonymous)); 5463 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightInA nonymous));
5391 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightDir ectChild)); 5464 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightDir ectChild));
5392 5465
5393 WebCore::RenderBlock* anonymousBlock = percentHeightInAnonymous->containingB lock(); 5466 WebCore::RenderBlock* anonymousBlock = percentHeightInAnonymous->containingB lock();
5394 EXPECT_TRUE(anonymousBlock->isAnonymous()); 5467 EXPECT_TRUE(anonymousBlock->isAnonymous());
5395 EXPECT_FALSE(anonymousBlock->hasPercentHeightDescendants()); 5468 EXPECT_FALSE(anonymousBlock->hasPercentHeightDescendants());
5396 } 5469 }
5397 5470
5398 } // namespace 5471 } // namespace
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderObject.h ('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