diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-15 00:03:35 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-15 00:03:35 +0000 |
commit | 2e4361ae9dfaff3359914a89e2ff66771a10c955 (patch) | |
tree | 73567e3307c6cf2f64e7322ac4678278a1486fce /webkit | |
parent | e5aea01b2a4bf4363be6b77995c388202038018c (diff) | |
download | chromium_src-2e4361ae9dfaff3359914a89e2ff66771a10c955.zip chromium_src-2e4361ae9dfaff3359914a89e2ff66771a10c955.tar.gz chromium_src-2e4361ae9dfaff3359914a89e2ff66771a10c955.tar.bz2 |
Rev the Flash interface to add new functionality.
This adds support for IDL in the private directory. Some of the interfaces there don't actually work, they were a work in progress and this breaks everything, so I moved the broken files to a new subdirectory. Everything left in the api/private directory can be autogenerated now.
BUG=
TEST=
Review URL: http://codereview.chromium.org/8930023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114534 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/plugins/ppapi/plugin_module.cc | 6 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_flash_impl.cc | 76 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_flash_impl.h | 3 |
3 files changed, 67 insertions, 18 deletions
diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc index 1b723a6..d86c222 100644 --- a/webkit/plugins/ppapi/plugin_module.cc +++ b/webkit/plugins/ppapi/plugin_module.cc @@ -286,8 +286,10 @@ const void* GetInterface(const char* name) { return &core_interface; if (strcmp(name, PPB_FILECHOOSER_TRUSTED_INTERFACE) == 0) return ::ppapi::thunk::GetPPB_FileChooser_Trusted_Thunk(); - if (strcmp(name, PPB_FLASH_INTERFACE) == 0) - return PPB_Flash_Impl::GetInterface(); + if (strcmp(name, PPB_FLASH_INTERFACE_11_0) == 0) + return PPB_Flash_Impl::GetInterface11(); + if (strcmp(name, PPB_FLASH_INTERFACE_12_0) == 0) + return PPB_Flash_Impl::GetInterface12(); if (strcmp(name, PPB_FLASH_CLIPBOARD_INTERFACE) == 0) return ::ppapi::thunk::GetPPB_Flash_Clipboard_Thunk(); if (strcmp(name, PPB_FLASH_CLIPBOARD_INTERFACE_3_LEGACY) == 0) diff --git a/webkit/plugins/ppapi/ppb_flash_impl.cc b/webkit/plugins/ppapi/ppb_flash_impl.cc index a9e244d..0314a6b 100644 --- a/webkit/plugins/ppapi/ppb_flash_impl.cc +++ b/webkit/plugins/ppapi/ppb_flash_impl.cc @@ -55,9 +55,10 @@ PP_Bool DrawGlyphs(PP_Instance, PP_Resource pp_image_data, const PP_FontDescription_Dev* font_desc, uint32_t color, - PP_Point position, - PP_Rect clip, + const PP_Point* position, + const PP_Rect* clip, const float transformation[3][3], + PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const PP_Point glyph_advances[]) { @@ -91,9 +92,9 @@ PP_Bool DrawGlyphs(PP_Instance, canvas->save(); // Clip is applied in pixels before the transform. - SkRect clip_rect = { clip.point.x, clip.point.y, - clip.point.x + clip.size.width, - clip.point.y + clip.size.height }; + SkRect clip_rect = { clip->point.x, clip->point.y, + clip->point.x + clip->size.width, + clip->point.y + clip->size.height }; canvas->clipRect(clip_rect); // -- Do not return early below this. The canvas needs restoring and the @@ -120,11 +121,13 @@ PP_Bool DrawGlyphs(PP_Instance, paint.setHinting(SkPaint::kFull_Hinting); paint.setTextSize(SkIntToScalar(font_desc->size)); paint.setTypeface(typeface); // Takes a ref and manages lifetime. - paint.setSubpixelText(true); - paint.setLCDRenderText(true); + if (allow_subpixel_aa) { + paint.setSubpixelText(true); + paint.setLCDRenderText(true); + } - SkScalar x = SkIntToScalar(position.x); - SkScalar y = SkIntToScalar(position.y); + SkScalar x = SkIntToScalar(position->x); + SkScalar y = SkIntToScalar(position->y); // Build up the skia advances. if (glyph_count == 0) @@ -144,6 +147,21 @@ PP_Bool DrawGlyphs(PP_Instance, return PP_TRUE; } +PP_Bool DrawGlyphs11(PP_Instance instance, + PP_Resource pp_image_data, + const PP_FontDescription_Dev* font_desc, + uint32_t color, + PP_Point position, + PP_Rect clip, + const float transformation[3][3], + uint32_t glyph_count, + const uint16_t glyph_indices[], + const PP_Point glyph_advances[]) { + return DrawGlyphs(instance, pp_image_data, font_desc, color, &position, + &clip, transformation, PP_TRUE, glyph_count, + glyph_indices, glyph_advances); +} + PP_Var GetProxyForURL(PP_Instance pp_instance, const char* url) { PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance); if (!instance) @@ -161,7 +179,7 @@ PP_Var GetProxyForURL(PP_Instance pp_instance, const char* url) { int32_t Navigate(PP_Resource request_id, const char* target, - bool from_user_action) { + PP_Bool from_user_action) { EnterResource<PPB_URLRequestInfo_API> enter(request_id, true); if (enter.failed()) return PP_ERROR_BADRESOURCE; @@ -174,7 +192,14 @@ int32_t Navigate(PP_Resource request_id, PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(request); if (!plugin_instance) return PP_ERROR_FAILED; - return plugin_instance->Navigate(request, target, from_user_action); + return plugin_instance->Navigate(request, target, + PP_ToBool(from_user_action)); +} + +int32_t Navigate11(PP_Resource request_id, + const char* target, + bool from_user_action) { + return Navigate(request_id, target, PP_FromBool(from_user_action)); } void RunMessageLoop(PP_Instance instance) { @@ -219,7 +244,22 @@ PP_Var GetCommandLineArgs(PP_Module pp_module) { return StringVar::StringToPPVar(args); } -const PPB_Flash ppb_flash = { +void PreLoadFontInWindows(const void* logfontw) { + // TODO(brettw) implement this. +} + +const PPB_Flash_11 ppb_flash_11 = { + &SetInstanceAlwaysOnTop, + &DrawGlyphs11, + &GetProxyForURL, + &Navigate11, + &RunMessageLoop, + &QuitMessageLoop, + &GetLocalTimeZoneOffset, + &GetCommandLineArgs +}; + +const PPB_Flash ppb_flash_12 = { &SetInstanceAlwaysOnTop, &DrawGlyphs, &GetProxyForURL, @@ -227,14 +267,20 @@ const PPB_Flash ppb_flash = { &RunMessageLoop, &QuitMessageLoop, &GetLocalTimeZoneOffset, - &GetCommandLineArgs + &GetCommandLineArgs, + &PreLoadFontInWindows }; } // namespace // static -const PPB_Flash* PPB_Flash_Impl::GetInterface() { - return &ppb_flash; +const PPB_Flash_11* PPB_Flash_Impl::GetInterface11() { + return &ppb_flash_11; +} + +// static +const PPB_Flash* PPB_Flash_Impl::GetInterface12() { + return &ppb_flash_12; } } // namespace ppapi diff --git a/webkit/plugins/ppapi/ppb_flash_impl.h b/webkit/plugins/ppapi/ppb_flash_impl.h index 28faacd..b9b00aa 100644 --- a/webkit/plugins/ppapi/ppb_flash_impl.h +++ b/webkit/plugins/ppapi/ppb_flash_impl.h @@ -18,7 +18,8 @@ class PPB_Flash_Impl { public: // Returns a pointer to the interface implementing PPB_Flash that is // exposed to the plugin. - static const PPB_Flash* GetInterface(); + static const PPB_Flash_11* GetInterface11(); + static const PPB_Flash* GetInterface12(); private: DISALLOW_COPY_AND_ASSIGN(PPB_Flash_Impl); |