OLD | NEW |
---|---|
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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 #import <QuartzCore/QuartzCore.h> | 6 #import <QuartzCore/QuartzCore.h> |
7 | 7 |
8 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | 8 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
513 // If we get an event before we've set up the plugin, bail. | 513 // If we get an event before we've set up the plugin, bail. |
514 if (!have_called_set_window_) | 514 if (!have_called_set_window_) |
515 return false; | 515 return false; |
516 #ifndef NP_NO_CARBON | 516 #ifndef NP_NO_CARBON |
517 if (instance()->event_model() == NPEventModelCarbon && | 517 if (instance()->event_model() == NPEventModelCarbon && |
518 !np_cg_context_.context) { | 518 !np_cg_context_.context) { |
519 return false; | 519 return false; |
520 } | 520 } |
521 #endif | 521 #endif |
522 | 522 |
523 // WebKit sometimes sends spurious mouse move events when the window doesn't | |
524 // have focus; Cocoa event model plugins don't expect to recieve mouse move | |
Avi (use Gerrit)
2012/04/20 14:44:01
s/recieve/receive/
stuartmorgan
2012/04/20 15:14:57
Done.
| |
525 // events when they are in a background window, so drop those events. | |
526 if (!containing_window_has_focus_ && | |
527 instance()->event_model() == NPEventModelCocoa && | |
Avi (use Gerrit)
2012/04/20 14:44:01
Only the Cocoa event model?
stuartmorgan
2012/04/20 15:14:57
The Carbon event model is a cesspool. There are no
| |
528 (event.type == WebInputEvent::MouseMove || | |
529 event.type == WebInputEvent::MouseEnter || | |
530 event.type == WebInputEvent::MouseLeave)) { | |
531 return false; | |
532 } | |
533 | |
523 if (WebInputEvent::isMouseEventType(event.type) || | 534 if (WebInputEvent::isMouseEventType(event.type) || |
524 event.type == WebInputEvent::MouseWheel) { | 535 event.type == WebInputEvent::MouseWheel) { |
525 // Check our plugin location before we send the event to the plugin, just | 536 // Check our plugin location before we send the event to the plugin, just |
526 // in case we somehow missed a plugin frame change. | 537 // in case we somehow missed a plugin frame change. |
527 const WebMouseEvent* mouse_event = | 538 const WebMouseEvent* mouse_event = |
528 static_cast<const WebMouseEvent*>(&event); | 539 static_cast<const WebMouseEvent*>(&event); |
529 gfx::Point content_origin( | 540 gfx::Point content_origin( |
530 mouse_event->globalX - mouse_event->x - window_rect_.x(), | 541 mouse_event->globalX - mouse_event->x - window_rect_.x(), |
531 mouse_event->globalY - mouse_event->y - window_rect_.y()); | 542 mouse_event->globalY - mouse_event->y - window_rect_.y()); |
532 if (content_origin.x() != content_area_origin_.x() || | 543 if (content_origin.x() != content_area_origin_.x() || |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1239 qd_manager_->SetFastPathEnabled(enabled); | 1250 qd_manager_->SetFastPathEnabled(enabled); |
1240 qd_port_.port = qd_manager_->port(); | 1251 qd_port_.port = qd_manager_->port(); |
1241 WindowlessSetWindow(); | 1252 WindowlessSetWindow(); |
1242 // Send a paint event so that the new buffer gets updated immediately. | 1253 // Send a paint event so that the new buffer gets updated immediately. |
1243 WindowlessPaint(buffer_context_, clip_rect_); | 1254 WindowlessPaint(buffer_context_, clip_rect_); |
1244 } | 1255 } |
1245 #endif // !NP_NO_QUICKDRAW | 1256 #endif // !NP_NO_QUICKDRAW |
1246 | 1257 |
1247 } // namespace npapi | 1258 } // namespace npapi |
1248 } // namespace webkit | 1259 } // namespace webkit |
OLD | NEW |