Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 19 matching lines...) Expand all Loading... | |
| 30 #include "webkit/plugins/npapi/webplugin_accelerated_surface_mac.h" | 30 #include "webkit/plugins/npapi/webplugin_accelerated_surface_mac.h" |
| 31 | 31 |
| 32 #ifndef NP_NO_CARBON | 32 #ifndef NP_NO_CARBON |
| 33 #include "webkit/plugins/npapi/carbon_plugin_window_tracker_mac.h" | 33 #include "webkit/plugins/npapi/carbon_plugin_window_tracker_mac.h" |
| 34 #endif | 34 #endif |
| 35 | 35 |
| 36 #ifndef NP_NO_QUICKDRAW | 36 #ifndef NP_NO_QUICKDRAW |
| 37 #include "webkit/plugins/npapi/quickdraw_drawing_manager_mac.h" | 37 #include "webkit/plugins/npapi/quickdraw_drawing_manager_mac.h" |
| 38 #endif | 38 #endif |
| 39 | 39 |
| 40 #if defined(USE_SKIA) | |
| 41 #include "skia/ext/platform_canvas.h" | |
| 42 #include "skia/ext/skia_utils_mac.h" | |
| 43 #endif | |
| 44 | |
| 40 using WebKit::WebCursorInfo; | 45 using WebKit::WebCursorInfo; |
| 41 using WebKit::WebKeyboardEvent; | 46 using WebKit::WebKeyboardEvent; |
| 42 using WebKit::WebInputEvent; | 47 using WebKit::WebInputEvent; |
| 43 using WebKit::WebMouseEvent; | 48 using WebKit::WebMouseEvent; |
| 44 using WebKit::WebMouseWheelEvent; | 49 using WebKit::WebMouseWheelEvent; |
| 45 | 50 |
| 46 // Important implementation notes: The Mac definition of NPAPI, particularly | 51 // Important implementation notes: The Mac definition of NPAPI, particularly |
| 47 // the distinction between windowed and windowless modes, differs from the | 52 // the distinction between windowed and windowless modes, differs from the |
| 48 // Windows and Linux definitions. Most of those differences are | 53 // Windows and Linux definitions. Most of those differences are |
| 49 // accomodated by the WebPluginDelegate class. | 54 // accomodated by the WebPluginDelegate class. |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 462 | 467 |
| 463 #ifndef NP_NO_QUICKDRAW | 468 #ifndef NP_NO_QUICKDRAW |
| 464 // Paint events are our cue to dump the current plugin bits into the buffer | 469 // Paint events are our cue to dump the current plugin bits into the buffer |
| 465 // context if we are dealing with a QuickDraw plugin. | 470 // context if we are dealing with a QuickDraw plugin. |
| 466 if (instance()->drawing_model() == NPDrawingModelQuickDraw) { | 471 if (instance()->drawing_model() == NPDrawingModelQuickDraw) { |
| 467 qd_manager_->UpdateContext(); | 472 qd_manager_->UpdateContext(); |
| 468 } | 473 } |
| 469 #endif | 474 #endif |
| 470 } | 475 } |
| 471 | 476 |
| 477 #if defined(USE_SKIA) | |
| 478 void WebPluginDelegateImpl::Paint(WebKit::WebCanvas* canvas, | |
|
stuartmorgan
2011/04/12 17:35:51
I don't suppose there's a less confusing way to do
_cary
2011/04/12 21:03:55
Done.
| |
| 479 const gfx::Rect& rect) { | |
| 480 gfx::SkiaBitLocker bitLocker(canvas); | |
|
stuartmorgan
2011/04/12 17:35:51
Does this have the same transparency-preserving pr
_cary
2011/04/12 21:03:55
Yes, the Skia bitmap preserves alpha so transparen
| |
| 481 Paint(bitLocker.cgContext(), rect); | |
| 482 } | |
| 483 #endif | |
| 484 | |
| 472 void WebPluginDelegateImpl::Print(CGContextRef context) { | 485 void WebPluginDelegateImpl::Print(CGContextRef context) { |
| 473 NOTIMPLEMENTED(); | 486 NOTIMPLEMENTED(); |
| 474 } | 487 } |
| 475 | 488 |
| 476 bool WebPluginDelegateImpl::PlatformHandleInputEvent( | 489 bool WebPluginDelegateImpl::PlatformHandleInputEvent( |
| 477 const WebInputEvent& event, WebCursorInfo* cursor_info) { | 490 const WebInputEvent& event, WebCursorInfo* cursor_info) { |
| 478 DCHECK(cursor_info != NULL); | 491 DCHECK(cursor_info != NULL); |
| 479 | 492 |
| 480 // If we get an event before we've set up the plugin, bail. | 493 // If we get an event before we've set up the plugin, bail. |
| 481 if (!have_called_set_window_) | 494 if (!have_called_set_window_) |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1178 qd_manager_->SetFastPathEnabled(enabled); | 1191 qd_manager_->SetFastPathEnabled(enabled); |
| 1179 qd_port_.port = qd_manager_->port(); | 1192 qd_port_.port = qd_manager_->port(); |
| 1180 WindowlessSetWindow(); | 1193 WindowlessSetWindow(); |
| 1181 // Send a paint event so that the new buffer gets updated immediately. | 1194 // Send a paint event so that the new buffer gets updated immediately. |
| 1182 WindowlessPaint(buffer_context_, clip_rect_); | 1195 WindowlessPaint(buffer_context_, clip_rect_); |
| 1183 } | 1196 } |
| 1184 #endif // !NP_NO_QUICKDRAW | 1197 #endif // !NP_NO_QUICKDRAW |
| 1185 | 1198 |
| 1186 } // namespace npapi | 1199 } // namespace npapi |
| 1187 } // namespace webkit | 1200 } // namespace webkit |
| OLD | NEW |