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

Side by Side Diff: webkit/tools/test_shell/mac/webwidget_host.mm

Issue 183027: A quick fix for Issue 20161... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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 | Annotate | Revision Log
« 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 (c) 2008-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008-2009 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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "webkit/tools/test_shell/webwidget_host.h" 7 #include "webkit/tools/test_shell/webwidget_host.h"
8 8
9 #include "base/gfx/rect.h" 9 #include "base/gfx/rect.h"
10 #include "base/gfx/size.h" 10 #include "base/gfx/size.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 } 248 }
249 webwidget_->handleInputEvent(web_event); 249 webwidget_->handleInputEvent(web_event);
250 } 250 }
251 251
252 void WebWidgetHost::WheelEvent(NSEvent *event) { 252 void WebWidgetHost::WheelEvent(NSEvent *event) {
253 webwidget_->handleInputEvent( 253 webwidget_->handleInputEvent(
254 WebInputEventFactory::mouseWheelEvent(event, view_)); 254 WebInputEventFactory::mouseWheelEvent(event, view_));
255 } 255 }
256 256
257 void WebWidgetHost::KeyEvent(NSEvent *event) { 257 void WebWidgetHost::KeyEvent(NSEvent *event) {
258 webwidget_->handleInputEvent(WebInputEventFactory::keyboardEvent(event)); 258 WebKeyboardEvent keyboard_event(WebInputEventFactory::keyboardEvent(event));
259 webwidget_->handleInputEvent(keyboard_event);
260 if ([event type] == NSKeyDown) {
261 // Send a Char event here to emulate the keyboard events.
262 // TODO(hbono): Bug 20852 <http://crbug.com/20852> implement the
263 // NSTextInput protocol and remove this code.
264 keyboard_event.type = WebInputEvent::Char;
265 webwidget_->handleInputEvent(keyboard_event);
266 }
259 } 267 }
260 268
261 void WebWidgetHost::SetFocus(bool enable) { 269 void WebWidgetHost::SetFocus(bool enable) {
262 // Ignore focus calls in layout test mode so that tests don't mess with each 270 // Ignore focus calls in layout test mode so that tests don't mess with each
263 // other's focus when running in parallel. 271 // other's focus when running in parallel.
264 if (!TestShell::layout_test_mode()) 272 if (!TestShell::layout_test_mode())
265 webwidget_->setFocus(enable); 273 webwidget_->setFocus(enable);
266 } 274 }
267 275
268 void WebWidgetHost::TrackMouseLeave(bool track) { 276 void WebWidgetHost::TrackMouseLeave(bool track) {
269 } 277 }
270 278
271 void WebWidgetHost::ResetScrollRect() { 279 void WebWidgetHost::ResetScrollRect() {
272 scroll_rect_ = gfx::Rect(); 280 scroll_rect_ = gfx::Rect();
273 scroll_dx_ = 0; 281 scroll_dx_ = 0;
274 scroll_dy_ = 0; 282 scroll_dy_ = 0;
275 } 283 }
276 284
277 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { 285 void WebWidgetHost::PaintRect(const gfx::Rect& rect) {
278 #ifndef NDEBUG 286 #ifndef NDEBUG
279 DCHECK(!painting_); 287 DCHECK(!painting_);
280 #endif 288 #endif
281 DCHECK(canvas_.get()); 289 DCHECK(canvas_.get());
282 290
283 set_painting(true); 291 set_painting(true);
284 webwidget_->paint(webkit_glue::ToWebCanvas(canvas_.get()), rect); 292 webwidget_->paint(webkit_glue::ToWebCanvas(canvas_.get()), rect);
285 set_painting(false); 293 set_painting(false);
286 } 294 }
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