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

Side by Side Diff: content/shell/renderer/test_runner/WebTestProxy.cpp

Issue 130963002: Revert of Flood-fill the canvas used for layout tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « no previous file | tools/valgrind/memcheck/suppressions.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/shell/renderer/test_runner/WebTestProxy.h" 5 #include "content/shell/renderer/test_runner/WebTestProxy.h"
6 6
7 #include <cctype> 7 #include <cctype>
8 8
9 #include "content/shell/renderer/test_runner/AccessibilityController.h" 9 #include "content/shell/renderer/test_runner/AccessibilityController.h"
10 #include "content/shell/renderer/test_runner/EventSender.h" 10 #include "content/shell/renderer/test_runner/EventSender.h"
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 BLINK_ASSERT(!m_isPainting); 602 BLINK_ASSERT(!m_isPainting);
603 BLINK_ASSERT(canvas()); 603 BLINK_ASSERT(canvas());
604 m_isPainting = true; 604 m_isPainting = true;
605 605
606 WebSize pageSizeInPixels = webWidget()->size(); 606 WebSize pageSizeInPixels = webWidget()->size();
607 WebFrame* webFrame = webView()->mainFrame(); 607 WebFrame* webFrame = webView()->mainFrame();
608 608
609 int pageCount = webFrame->printBegin(pageSizeInPixels); 609 int pageCount = webFrame->printBegin(pageSizeInPixels);
610 int totalHeight = pageCount * (pageSizeInPixels.height + 1) - 1; 610 int totalHeight = pageCount * (pageSizeInPixels.height + 1) - 1;
611 611
612 SkCanvas* testCanvas = skia::TryCreateBitmapCanvas(pageSizeInPixels.width, t otalHeight, false); 612 SkCanvas* testCanvas = skia::TryCreateBitmapCanvas(pageSizeInPixels.width, t otalHeight, true);
613 if (testCanvas) { 613 if (testCanvas) {
614 discardBackingStore(); 614 discardBackingStore();
615 m_canvas.reset(testCanvas); 615 m_canvas.reset(testCanvas);
616 } else { 616 } else {
617 webFrame->printEnd(); 617 webFrame->printEnd();
618 return; 618 return;
619 } 619 }
620 620
621 webFrame->printPagesWithBoundaries(canvas(), pageSizeInPixels); 621 webFrame->printPagesWithBoundaries(canvas(), pageSizeInPixels);
622 webFrame->printEnd(); 622 webFrame->printEnd();
623 623
624 m_isPainting = false; 624 m_isPainting = false;
625 } 625 }
626 626
627 SkCanvas* WebTestProxyBase::canvas() 627 SkCanvas* WebTestProxyBase::canvas()
628 { 628 {
629 if (m_canvas.get()) 629 if (m_canvas.get())
630 return m_canvas.get(); 630 return m_canvas.get();
631 WebSize widgetSize = webWidget()->size(); 631 WebSize widgetSize = webWidget()->size();
632 float deviceScaleFactor = webView()->deviceScaleFactor(); 632 float deviceScaleFactor = webView()->deviceScaleFactor();
633 int scaledWidth = static_cast<int>(ceil(static_cast<float>(widgetSize.width) * deviceScaleFactor)); 633 int scaledWidth = static_cast<int>(ceil(static_cast<float>(widgetSize.width) * deviceScaleFactor));
634 int scaledHeight = static_cast<int>(ceil(static_cast<float>(widgetSize.heigh t) * deviceScaleFactor)); 634 int scaledHeight = static_cast<int>(ceil(static_cast<float>(widgetSize.heigh t) * deviceScaleFactor));
635 // We're allocating the canvas to be non-opaque (third parameter), so we 635 m_canvas.reset(skia::CreateBitmapCanvas(scaledWidth, scaledHeight, true));
636 // don't end up with uninitialized memory if a layout test doesn't damage
637 // the entire view.
638 m_canvas.reset(skia::CreateBitmapCanvas(scaledWidth, scaledHeight, false));
639 return m_canvas.get(); 636 return m_canvas.get();
640 } 637 }
641 638
642 // Paints the entire canvas a semi-transparent black (grayish). This is used 639 // Paints the entire canvas a semi-transparent black (grayish). This is used
643 // by the layout tests in fast/repaint. The alpha value matches upstream. 640 // by the layout tests in fast/repaint. The alpha value matches upstream.
644 void WebTestProxyBase::displayRepaintMask() 641 void WebTestProxyBase::displayRepaintMask()
645 { 642 {
646 canvas()->drawARGB(167, 0, 0, 0); 643 canvas()->drawARGB(167, 0, 0, 0);
647 } 644 }
648 645
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 1358
1362 void WebTestProxyBase::resetInputMethod() 1359 void WebTestProxyBase::resetInputMethod()
1363 { 1360 {
1364 // If a composition text exists, then we need to let the browser process 1361 // If a composition text exists, then we need to let the browser process
1365 // to cancel the input method's ongoing composition session. 1362 // to cancel the input method's ongoing composition session.
1366 if (m_webWidget) 1363 if (m_webWidget)
1367 m_webWidget->confirmComposition(); 1364 m_webWidget->confirmComposition();
1368 } 1365 }
1369 1366
1370 } 1367 }
OLDNEW
« no previous file with comments | « no previous file | tools/valgrind/memcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698