OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/test_runner/pixel_dump.h" | 5 #include "components/test_runner/pixel_dump.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 178 |
179 void CopyImageAtAndCapturePixels( | 179 void CopyImageAtAndCapturePixels( |
180 blink::WebView* web_view, | 180 blink::WebView* web_view, |
181 int x, | 181 int x, |
182 int y, | 182 int y, |
183 const base::Callback<void(const SkBitmap&)>& callback) { | 183 const base::Callback<void(const SkBitmap&)>& callback) { |
184 DCHECK(!callback.is_null()); | 184 DCHECK(!callback.is_null()); |
185 uint64_t sequence_number = | 185 uint64_t sequence_number = |
186 blink::Platform::current()->clipboard()->sequenceNumber( | 186 blink::Platform::current()->clipboard()->sequenceNumber( |
187 blink::WebClipboard::Buffer()); | 187 blink::WebClipboard::Buffer()); |
188 web_view->copyImageAt(blink::WebPoint(x, y)); | 188 // TODO(lukasza): Support image capture in OOPIFs for |
| 189 // https://crbug.com/477150. |
| 190 web_view->mainFrame()->copyImageAt(blink::WebPoint(x, y)); |
189 if (sequence_number == | 191 if (sequence_number == |
190 blink::Platform::current()->clipboard()->sequenceNumber( | 192 blink::Platform::current()->clipboard()->sequenceNumber( |
191 blink::WebClipboard::Buffer())) { | 193 blink::WebClipboard::Buffer())) { |
192 SkBitmap emptyBitmap; | 194 SkBitmap emptyBitmap; |
193 callback.Run(emptyBitmap); | 195 callback.Run(emptyBitmap); |
194 return; | 196 return; |
195 } | 197 } |
196 | 198 |
197 blink::WebImage image = static_cast<blink::WebMockClipboard*>( | 199 blink::WebImage image = static_cast<blink::WebMockClipboard*>( |
198 blink::Platform::current()->clipboard()) | 200 blink::Platform::current()->clipboard()) |
199 ->readRawImage(blink::WebClipboard::Buffer()); | 201 ->readRawImage(blink::WebClipboard::Buffer()); |
200 const SkBitmap& bitmap = image.getSkBitmap(); | 202 const SkBitmap& bitmap = image.getSkBitmap(); |
201 SkAutoLockPixels autoLock(bitmap); | 203 SkAutoLockPixels autoLock(bitmap); |
202 callback.Run(bitmap); | 204 callback.Run(bitmap); |
203 } | 205 } |
204 | 206 |
205 } // namespace test_runner | 207 } // namespace test_runner |
OLD | NEW |