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

Side by Side Diff: content/renderer/gpu/gpu_benchmarking_extension.cc

Issue 2569273002: Add constructors to WebInputEvents and setters so we can work at cleaning up these public structs. (Closed)
Patch Set: Rebase 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer/gpu/gpu_benchmarking_extension.h" 5 #include "content/renderer/gpu/gpu_benchmarking_extension.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "third_party/skia/include/core/SkData.h" 44 #include "third_party/skia/include/core/SkData.h"
45 #include "third_party/skia/include/core/SkGraphics.h" 45 #include "third_party/skia/include/core/SkGraphics.h"
46 #include "third_party/skia/include/core/SkPicture.h" 46 #include "third_party/skia/include/core/SkPicture.h"
47 #include "third_party/skia/include/core/SkPictureRecorder.h" 47 #include "third_party/skia/include/core/SkPictureRecorder.h"
48 #include "third_party/skia/include/core/SkPixelRef.h" 48 #include "third_party/skia/include/core/SkPixelRef.h"
49 #include "third_party/skia/include/core/SkPixelSerializer.h" 49 #include "third_party/skia/include/core/SkPixelSerializer.h"
50 #include "third_party/skia/include/core/SkStream.h" 50 #include "third_party/skia/include/core/SkStream.h"
51 // Note that headers in third_party/skia/src are fragile. This is 51 // Note that headers in third_party/skia/src are fragile. This is
52 // an experimental, fragile, and diagnostic-only document type. 52 // an experimental, fragile, and diagnostic-only document type.
53 #include "third_party/skia/src/utils/SkMultiPictureDocument.h" 53 #include "third_party/skia/src/utils/SkMultiPictureDocument.h"
54 #include "ui/events/base_event_utils.h"
54 #include "ui/gfx/codec/png_codec.h" 55 #include "ui/gfx/codec/png_codec.h"
55 #include "v8/include/v8.h" 56 #include "v8/include/v8.h"
56 57
57 using blink::WebCanvas; 58 using blink::WebCanvas;
58 using blink::WebLocalFrame; 59 using blink::WebLocalFrame;
59 using blink::WebImageCache; 60 using blink::WebImageCache;
60 using blink::WebPrivatePtr; 61 using blink::WebPrivatePtr;
61 using blink::WebSize; 62 using blink::WebSize;
62 using blink::WebView; 63 using blink::WebView;
63 64
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 338
338 // Convert coordinates from CSS pixels to density independent pixels (DIPs). 339 // Convert coordinates from CSS pixels to density independent pixels (DIPs).
339 float page_scale_factor = context.web_view()->pageScaleFactor(); 340 float page_scale_factor = context.web_view()->pageScaleFactor();
340 341
341 if (gesture_source_type == SyntheticGestureParams::MOUSE_INPUT) { 342 if (gesture_source_type == SyntheticGestureParams::MOUSE_INPUT) {
342 // Ensure the mouse is centered and visible, in case it will 343 // Ensure the mouse is centered and visible, in case it will
343 // trigger any hover or mousemove effects. 344 // trigger any hover or mousemove effects.
344 context.web_view()->setIsActive(true); 345 context.web_view()->setIsActive(true);
345 blink::WebRect contentRect = 346 blink::WebRect contentRect =
346 context.web_view()->mainFrame()->visibleContentRect(); 347 context.web_view()->mainFrame()->visibleContentRect();
347 blink::WebMouseEvent mouseMove; 348 blink::WebMouseEvent mouseMove(
348 mouseMove.type = blink::WebInputEvent::MouseMove; 349 blink::WebInputEvent::MouseMove, blink::WebInputEvent::NoModifiers,
350 ui::EventTimeStampToSeconds(ui::EventTimeForNow()));
349 mouseMove.x = (contentRect.x + contentRect.width / 2) * page_scale_factor; 351 mouseMove.x = (contentRect.x + contentRect.width / 2) * page_scale_factor;
350 mouseMove.y = (contentRect.y + contentRect.height / 2) * page_scale_factor; 352 mouseMove.y = (contentRect.y + contentRect.height / 2) * page_scale_factor;
351 context.web_view()->handleInputEvent(mouseMove); 353 context.web_view()->handleInputEvent(mouseMove);
352 context.web_view()->setCursorVisibilityState(true); 354 context.web_view()->setCursorVisibilityState(true);
353 } 355 }
354 356
355 scoped_refptr<CallbackAndContext> callback_and_context = 357 scoped_refptr<CallbackAndContext> callback_and_context =
356 new CallbackAndContext( 358 new CallbackAndContext(
357 isolate, callback, context.web_frame()->mainWorldScriptContext()); 359 isolate, callback, context.web_frame()->mainWorldScriptContext());
358 360
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 &gpu_driver_bug_workarounds))) { 1044 &gpu_driver_bug_workarounds))) {
1043 return; 1045 return;
1044 } 1046 }
1045 1047
1046 v8::Local<v8::Value> result; 1048 v8::Local<v8::Value> result;
1047 if (gin::TryConvertToV8(args->isolate(), gpu_driver_bug_workarounds, &result)) 1049 if (gin::TryConvertToV8(args->isolate(), gpu_driver_bug_workarounds, &result))
1048 args->Return(result); 1050 args->Return(result);
1049 } 1051 }
1050 1052
1051 } // namespace content 1053 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698