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

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 2643243002: Remove RenderWidgetHostImpl::SuppressEventsUntilKeyDown() (Closed)
Patch Set: 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/browser/renderer_host/render_widget_host_impl.h" 5 #include "content/browser/renderer_host/render_widget_host_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <set> 9 #include <set>
10 #include <tuple> 10 #include <tuple>
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 #include "gpu/command_buffer/service/gpu_switches.h" 76 #include "gpu/command_buffer/service/gpu_switches.h"
77 #include "gpu/ipc/common/gpu_messages.h" 77 #include "gpu/ipc/common/gpu_messages.h"
78 #include "net/base/filename_util.h" 78 #include "net/base/filename_util.h"
79 #include "skia/ext/image_operations.h" 79 #include "skia/ext/image_operations.h"
80 #include "skia/ext/platform_canvas.h" 80 #include "skia/ext/platform_canvas.h"
81 #include "storage/browser/fileapi/isolated_context.h" 81 #include "storage/browser/fileapi/isolated_context.h"
82 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" 82 #include "third_party/WebKit/public/web/WebCompositionUnderline.h"
83 #include "ui/base/clipboard/clipboard.h" 83 #include "ui/base/clipboard/clipboard.h"
84 #include "ui/events/blink/web_input_event_traits.h" 84 #include "ui/events/blink/web_input_event_traits.h"
85 #include "ui/events/event.h" 85 #include "ui/events/event.h"
86 #include "ui/events/keycodes/dom/dom_code.h"
87 #include "ui/events/keycodes/keyboard_codes.h" 86 #include "ui/events/keycodes/keyboard_codes.h"
88 #include "ui/gfx/color_space.h" 87 #include "ui/gfx/color_space.h"
89 #include "ui/gfx/geometry/size_conversions.h" 88 #include "ui/gfx/geometry/size_conversions.h"
90 #include "ui/gfx/geometry/vector2d_conversions.h" 89 #include "ui/gfx/geometry/vector2d_conversions.h"
91 #include "ui/gfx/image/image_skia.h" 90 #include "ui/gfx/image/image_skia.h"
92 #include "ui/gfx/skbitmap_operations.h" 91 #include "ui/gfx/skbitmap_operations.h"
93 #include "ui/snapshot/snapshot.h" 92 #include "ui/snapshot/snapshot.h"
94 93
95 #if defined(OS_ANDROID) 94 #if defined(OS_ANDROID)
96 #include "ui/android/view_android.h" 95 #include "ui/android/view_android.h"
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 if (!view_) 446 if (!view_)
448 return; 447 return;
449 448
450 last_view_screen_rect_ = view_->GetViewBounds(); 449 last_view_screen_rect_ = view_->GetViewBounds();
451 last_window_screen_rect_ = view_->GetBoundsInRootWindow(); 450 last_window_screen_rect_ = view_->GetBoundsInRootWindow();
452 Send(new ViewMsg_UpdateScreenRects( 451 Send(new ViewMsg_UpdateScreenRects(
453 GetRoutingID(), last_view_screen_rect_, last_window_screen_rect_)); 452 GetRoutingID(), last_view_screen_rect_, last_window_screen_rect_));
454 waiting_for_screen_rects_ack_ = true; 453 waiting_for_screen_rects_ack_ = true;
455 } 454 }
456 455
457 void RenderWidgetHostImpl::SuppressEventsUntilKeyDown() {
458 suppress_events_until_keydown_ = true;
459 }
460
461 void RenderWidgetHostImpl::FlushInput() { 456 void RenderWidgetHostImpl::FlushInput() {
462 input_router_->RequestNotificationWhenFlushed(); 457 input_router_->RequestNotificationWhenFlushed();
463 if (synthetic_gesture_controller_) 458 if (synthetic_gesture_controller_)
464 synthetic_gesture_controller_->Flush(base::TimeTicks::Now()); 459 synthetic_gesture_controller_->Flush(base::TimeTicks::Now());
465 } 460 }
466 461
467 void RenderWidgetHostImpl::SetNeedsFlush() { 462 void RenderWidgetHostImpl::SetNeedsFlush() {
468 if (view_) 463 if (view_)
469 view_->OnSetNeedsFlushInput(); 464 view_->OnSetNeedsFlushInput();
470 } 465 }
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 if (key_event.type() == WebKeyboardEvent::RawKeyDown) 1197 if (key_event.type() == WebKeyboardEvent::RawKeyDown)
1203 suppress_events_until_keydown_ = true; 1198 suppress_events_until_keydown_ = true;
1204 return; 1199 return;
1205 } 1200 }
1206 1201
1207 // Double check the type to make sure caller hasn't sent us nonsense that 1202 // Double check the type to make sure caller hasn't sent us nonsense that
1208 // will mess up our key queue. 1203 // will mess up our key queue.
1209 if (!WebInputEvent::isKeyboardEventType(key_event.type())) 1204 if (!WebInputEvent::isKeyboardEventType(key_event.type()))
1210 return; 1205 return;
1211 1206
1212 // For PrintScreen, a lone KeyUp event arrives. Bypass the suppression in this 1207 if (suppress_events_until_keydown_) {
1213 // case, as a |SuppressEventsUntilKeyDown()| call otherwise causes the keyup
1214 // events to go missing.
1215 // TODO(foolip): Remove this special case by instead removing the
1216 // |SuppressEventsUntilKeyDown()| call. https://crbug.com/668969
1217 bool is_print_screen =
1218 static_cast<ui::DomCode>(key_event.domCode) == ui::DomCode::PRINT_SCREEN;
1219 if (suppress_events_until_keydown_ && !is_print_screen) {
1220 // If the preceding RawKeyDown event was handled by the browser, then we 1208 // If the preceding RawKeyDown event was handled by the browser, then we
1221 // need to suppress all events generated by it until the next RawKeyDown or 1209 // need to suppress all events generated by it until the next RawKeyDown or
1222 // KeyDown event. 1210 // KeyDown event.
1223 if (key_event.type() == WebKeyboardEvent::KeyUp || 1211 if (key_event.type() == WebKeyboardEvent::KeyUp ||
1224 key_event.type() == WebKeyboardEvent::Char) 1212 key_event.type() == WebKeyboardEvent::Char)
1225 return; 1213 return;
1226 DCHECK(key_event.type() == WebKeyboardEvent::RawKeyDown || 1214 DCHECK(key_event.type() == WebKeyboardEvent::RawKeyDown ||
1227 key_event.type() == WebKeyboardEvent::KeyDown); 1215 key_event.type() == WebKeyboardEvent::KeyDown);
1228 suppress_events_until_keydown_ = false; 1216 suppress_events_until_keydown_ = false;
1229 } 1217 }
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after
2534 // different from the receiver's. 2522 // different from the receiver's.
2535 file_system_file.url = 2523 file_system_file.url =
2536 GURL(storage::GetIsolatedFileSystemRootURIString( 2524 GURL(storage::GetIsolatedFileSystemRootURIString(
2537 file_system_url.origin(), filesystem_id, std::string()) 2525 file_system_url.origin(), filesystem_id, std::string())
2538 .append(register_name)); 2526 .append(register_name));
2539 file_system_file.filesystem_id = filesystem_id; 2527 file_system_file.filesystem_id = filesystem_id;
2540 } 2528 }
2541 } 2529 }
2542 2530
2543 } // namespace content 2531 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698