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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebViewTest.cpp

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: Clean up comments, fix mac build Created 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 453
454 // Set WebView background to green with alpha. 454 // Set WebView background to green with alpha.
455 webView->setBaseBackgroundColor(kAlphaGreen); 455 webView->setBaseBackgroundColor(kAlphaGreen);
456 webView->settings()->setShouldClearDocumentBackground(false); 456 webView->settings()->setShouldClearDocumentBackground(false);
457 webView->resize(WebSize(kWidth, kHeight)); 457 webView->resize(WebSize(kWidth, kHeight));
458 webView->updateAllLifecyclePhases(); 458 webView->updateAllLifecyclePhases();
459 459
460 // Set canvas background to red with alpha. 460 // Set canvas background to red with alpha.
461 SkBitmap bitmap; 461 SkBitmap bitmap;
462 bitmap.allocN32Pixels(kWidth, kHeight); 462 bitmap.allocN32Pixels(kWidth, kHeight);
463 SkCanvas canvas(bitmap); 463 SkCanvas bitmapCanvas(bitmap);
464 canvas.clear(kAlphaRed); 464 bitmapCanvas.clear(kAlphaRed);
465
466 PaintCanvasPassThrough canvas(&bitmapCanvas);
465 467
466 SkPictureBuilder pictureBuilder(FloatRect(0, 0, kWidth, kHeight)); 468 SkPictureBuilder pictureBuilder(FloatRect(0, 0, kWidth, kHeight));
467 469
468 // Paint the root of the main frame in the way that CompositedLayerMapping 470 // Paint the root of the main frame in the way that CompositedLayerMapping
469 // would. 471 // would.
470 FrameView* view = m_webViewHelper.webView()->mainFrameImpl()->frameView(); 472 FrameView* view = m_webViewHelper.webView()->mainFrameImpl()->frameView();
471 PaintLayer* rootLayer = view->layoutViewItem().layer(); 473 PaintLayer* rootLayer = view->layoutViewItem().layer();
472 LayoutRect paintRect(0, 0, kWidth, kHeight); 474 LayoutRect paintRect(0, 0, kWidth, kHeight);
473 PaintLayerPaintingInfo paintingInfo(rootLayer, paintRect, 475 PaintLayerPaintingInfo paintingInfo(rootLayer, paintRect,
474 GlobalPaintNormalPhase, LayoutSize()); 476 GlobalPaintNormalPhase, LayoutSize());
475 PaintLayerPainter(*rootLayer) 477 PaintLayerPainter(*rootLayer)
476 .paintLayerContents(pictureBuilder.context(), paintingInfo, 478 .paintLayerContents(pictureBuilder.context(), paintingInfo,
477 PaintLayerPaintingCompositingAllPhases); 479 PaintLayerPaintingCompositingAllPhases);
478
479 pictureBuilder.endRecording()->playback(&canvas); 480 pictureBuilder.endRecording()->playback(&canvas);
480 481
481 // The result should be a blend of red and green. 482 // The result should be a blend of red and green.
482 SkColor color = bitmap.getColor(kWidth / 2, kHeight / 2); 483 SkColor color = bitmap.getColor(kWidth / 2, kHeight / 2);
483 EXPECT_TRUE(redChannel(color)); 484 EXPECT_TRUE(redChannel(color));
484 EXPECT_TRUE(greenChannel(color)); 485 EXPECT_TRUE(greenChannel(color));
485 } 486 }
486 487
487 TEST_P(WebViewTest, FocusIsInactive) { 488 TEST_P(WebViewTest, FocusIsInactive) {
488 URLTestHelpers::registerMockedURLFromBaseURL( 489 URLTestHelpers::registerMockedURLFromBaseURL(
(...skipping 3886 matching lines...) Expand 10 before | Expand all | Expand 10 after
4375 EXPECT_EQ(expectedWidth, vwElement->offsetWidth()); 4376 EXPECT_EQ(expectedWidth, vwElement->offsetWidth());
4376 EXPECT_EQ(expectedHeight, vwElement->offsetHeight()); 4377 EXPECT_EQ(expectedHeight, vwElement->offsetHeight());
4377 4378
4378 webView->resize(WebSize(800, 600)); 4379 webView->resize(WebSize(800, 600));
4379 frame->printEnd(); 4380 frame->printEnd();
4380 4381
4381 EXPECT_EQ(800, vwElement->offsetWidth()); 4382 EXPECT_EQ(800, vwElement->offsetWidth());
4382 } 4383 }
4383 4384
4384 } // namespace blink 4385 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698