OLD | NEW |
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 "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 SkCanvas canvas(bitmap); | 489 SkCanvas canvas(bitmap); |
490 DrawSelectionRect(&canvas); | 490 DrawSelectionRect(&canvas); |
491 DCHECK(!m_compositeAndReadbackCallback.is_null()); | 491 DCHECK(!m_compositeAndReadbackCallback.is_null()); |
492 base::ResetAndReturn(&m_compositeAndReadbackCallback).Run(bitmap); | 492 base::ResetAndReturn(&m_compositeAndReadbackCallback).Run(bitmap); |
493 } | 493 } |
494 | 494 |
495 void WebTestProxyBase::CapturePixelsAsync( | 495 void WebTestProxyBase::CapturePixelsAsync( |
496 base::Callback<void(const SkBitmap&)> callback) { | 496 base::Callback<void(const SkBitmap&)> callback) { |
497 TRACE_EVENT0("shell", "WebTestProxyBase::CapturePixelsAsync"); | 497 TRACE_EVENT0("shell", "WebTestProxyBase::CapturePixelsAsync"); |
498 | 498 |
499 // Do a layout here because it might leave compositing mode! x.x | 499 DCHECK(webWidget()->isAcceleratedCompositingActive()); |
500 // TODO(danakj): Remove this when we have kForceCompositingMode everywhere. | |
501 webWidget()->layout(); | |
502 | |
503 if (!webWidget()->isAcceleratedCompositingActive()) { | |
504 TRACE_EVENT0("shell", | |
505 "WebTestProxyBase::CapturePixelsAsync " | |
506 "isAcceleratedCompositingActive false"); | |
507 callback.Run(SkBitmap()); | |
508 return; | |
509 } | |
510 | |
511 DCHECK(!callback.is_null()); | 500 DCHECK(!callback.is_null()); |
512 DCHECK(m_compositeAndReadbackCallback.is_null()); | 501 DCHECK(m_compositeAndReadbackCallback.is_null()); |
513 m_compositeAndReadbackCallback = callback; | 502 m_compositeAndReadbackCallback = callback; |
514 webWidget()->compositeAndReadbackAsync(this); | 503 webWidget()->compositeAndReadbackAsync(this); |
515 } | 504 } |
516 | 505 |
517 void WebTestProxyBase::setLogConsoleOutput(bool enabled) | 506 void WebTestProxyBase::setLogConsoleOutput(bool enabled) |
518 { | 507 { |
519 m_logConsoleOutput = enabled; | 508 m_logConsoleOutput = enabled; |
520 } | 509 } |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 | 1295 |
1307 void WebTestProxyBase::resetInputMethod() | 1296 void WebTestProxyBase::resetInputMethod() |
1308 { | 1297 { |
1309 // If a composition text exists, then we need to let the browser process | 1298 // If a composition text exists, then we need to let the browser process |
1310 // to cancel the input method's ongoing composition session. | 1299 // to cancel the input method's ongoing composition session. |
1311 if (m_webWidget) | 1300 if (m_webWidget) |
1312 m_webWidget->confirmComposition(); | 1301 m_webWidget->confirmComposition(); |
1313 } | 1302 } |
1314 | 1303 |
1315 } // namespace content | 1304 } // namespace content |
OLD | NEW |