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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 2556353003: Ensure Char events sent to pepper indicate the correct timestamp seconds. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | no next file » | 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/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 6445 matching lines...) Expand 10 before | Expand all | Expand 10 after
6456 return; 6456 return;
6457 6457
6458 if (!IsPepperAcceptingCompositionEvents()) { 6458 if (!IsPepperAcceptingCompositionEvents()) {
6459 // For pepper plugins unable to handle IME events, send the plugin a 6459 // For pepper plugins unable to handle IME events, send the plugin a
6460 // sequence of characters instead. 6460 // sequence of characters instead.
6461 base::i18n::UTF16CharIterator iterator(&text); 6461 base::i18n::UTF16CharIterator iterator(&text);
6462 int32_t i = 0; 6462 int32_t i = 0;
6463 while (iterator.Advance()) { 6463 while (iterator.Advance()) {
6464 blink::WebKeyboardEvent char_event; 6464 blink::WebKeyboardEvent char_event;
6465 char_event.type = blink::WebInputEvent::Char; 6465 char_event.type = blink::WebInputEvent::Char;
6466 char_event.timeStampSeconds = base::Time::Now().ToDoubleT(); 6466 char_event.timeStampSeconds =
6467 (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF();
majidvp 2016/12/08 20:26:33 nit: Please use ui::EventTimeStampToSeconds to mak
6467 char_event.modifiers = 0; 6468 char_event.modifiers = 0;
6468 char_event.windowsKeyCode = text[i]; 6469 char_event.windowsKeyCode = text[i];
6469 char_event.nativeKeyCode = text[i]; 6470 char_event.nativeKeyCode = text[i];
6470 6471
6471 const int32_t char_start = i; 6472 const int32_t char_start = i;
6472 for (; i < iterator.array_pos(); ++i) { 6473 for (; i < iterator.array_pos(); ++i) {
6473 char_event.text[i - char_start] = text[i]; 6474 char_event.text[i - char_start] = text[i];
6474 char_event.unmodifiedText[i - char_start] = text[i]; 6475 char_event.unmodifiedText[i - char_start] = text[i];
6475 } 6476 }
6476 6477
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
6671 // event target. Potentially a Pepper plugin will receive the event. 6672 // event target. Potentially a Pepper plugin will receive the event.
6672 // In order to tell whether a plugin gets the last mouse event and which it 6673 // In order to tell whether a plugin gets the last mouse event and which it
6673 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6674 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6674 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6675 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6675 // |pepper_last_mouse_event_target_|. 6676 // |pepper_last_mouse_event_target_|.
6676 pepper_last_mouse_event_target_ = nullptr; 6677 pepper_last_mouse_event_target_ = nullptr;
6677 #endif 6678 #endif
6678 } 6679 }
6679 6680
6680 } // namespace content 6681 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698