diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-21 04:01:33 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-21 04:01:33 +0000 |
commit | cf295e45ca1bd9e7a09c56fbf292535d5ad99205 (patch) | |
tree | d2c41318e8669d8519c696a85109dbec26b0f5c3 /ppapi/cpp | |
parent | 25c4d391f56b480f78158c57df3b78053e97ed22 (diff) | |
download | chromium_src-cf295e45ca1bd9e7a09c56fbf292535d5ad99205.zip chromium_src-cf295e45ca1bd9e7a09c56fbf292535d5ad99205.tar.gz chromium_src-cf295e45ca1bd9e7a09c56fbf292535d5ad99205.tar.bz2 |
Revert 152495 - Add SetScale to PPB_WidgetDev, use scale for painting
In order to allow for HiDPI-aware scrollbars, this patch allows the plugin to
specify a scale factor used during widget paint operations.
The widgets (of which Scrollbar is the only current instance) will continue to
use the DIP coordinate system for events and sizing, which is consistent with
their WebKit implementation.
This change should maintain backward compat. with existing users of interface
'PPB_Wdiget(Dev);0.3'
BUG=140833
TEST=Run pre-built (with 0.3 interfaces) PDF plugin and verify scrollbars
Review URL: https://chromiumcodereview.appspot.com/10824386
TBR=jhorwich@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10861026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152499 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/cpp')
-rw-r--r-- | ppapi/cpp/dev/widget_dev.cc | 59 | ||||
-rw-r--r-- | ppapi/cpp/dev/widget_dev.h | 1 |
2 files changed, 17 insertions, 43 deletions
diff --git a/ppapi/cpp/dev/widget_dev.cc b/ppapi/cpp/dev/widget_dev.cc index 14efe1d..97d941f 100644 --- a/ppapi/cpp/dev/widget_dev.cc +++ b/ppapi/cpp/dev/widget_dev.cc @@ -16,12 +16,8 @@ namespace pp { namespace { -template <> const char* interface_name<PPB_Widget_Dev_0_3>() { - return PPB_WIDGET_DEV_INTERFACE_0_3; -} - -template <> const char* interface_name<PPB_Widget_Dev_0_4>() { - return PPB_WIDGET_DEV_INTERFACE_0_4; +template <> const char* interface_name<PPB_Widget_Dev>() { + return PPB_WIDGET_DEV_INTERFACE; } } // namespace @@ -33,51 +29,30 @@ Widget_Dev::Widget_Dev(const Widget_Dev& other) : Resource(other) { } bool Widget_Dev::Paint(const Rect& rect, ImageData* image) { - if (has_interface<PPB_Widget_Dev_0_4>()) { - return PP_ToBool(get_interface<PPB_Widget_Dev_0_4>()->Paint( - pp_resource(), &rect.pp_rect(), image->pp_resource())); - } else if (has_interface<PPB_Widget_Dev_0_3>()) { - return PP_ToBool(get_interface<PPB_Widget_Dev_0_3>()->Paint( - pp_resource(), &rect.pp_rect(), image->pp_resource())); - } - return false; + if (!has_interface<PPB_Widget_Dev>()) + return false; + return PP_ToBool(get_interface<PPB_Widget_Dev>()->Paint( + pp_resource(), &rect.pp_rect(), image->pp_resource())); } bool Widget_Dev::HandleEvent(const InputEvent& event) { - if (has_interface<PPB_Widget_Dev_0_4>()) { - return PP_ToBool(get_interface<PPB_Widget_Dev_0_4>()->HandleEvent( - pp_resource(), event.pp_resource())); - } else if (has_interface<PPB_Widget_Dev_0_3>()) { - return PP_ToBool(get_interface<PPB_Widget_Dev_0_3>()->HandleEvent( - pp_resource(), event.pp_resource())); - } - return false; + if (!has_interface<PPB_Widget_Dev>()) + return false; + return PP_ToBool(get_interface<PPB_Widget_Dev>()->HandleEvent( + pp_resource(), event.pp_resource())); } bool Widget_Dev::GetLocation(Rect* location) { - if (has_interface<PPB_Widget_Dev_0_4>()) { - return PP_ToBool(get_interface<PPB_Widget_Dev_0_4>()->GetLocation( - pp_resource(), &location->pp_rect())); - } else if (has_interface<PPB_Widget_Dev_0_3>()) { - return PP_ToBool(get_interface<PPB_Widget_Dev_0_3>()->GetLocation( - pp_resource(), &location->pp_rect())); - } - return false; + if (!has_interface<PPB_Widget_Dev>()) + return false; + return PP_ToBool(get_interface<PPB_Widget_Dev>()->GetLocation( + pp_resource(), &location->pp_rect())); } void Widget_Dev::SetLocation(const Rect& location) { - if (has_interface<PPB_Widget_Dev_0_4>()) { - get_interface<PPB_Widget_Dev_0_4>()->SetLocation(pp_resource(), - &location.pp_rect()); - } else if (has_interface<PPB_Widget_Dev_0_3>()) { - get_interface<PPB_Widget_Dev_0_3>()->SetLocation(pp_resource(), - &location.pp_rect()); - } -} - -void Widget_Dev::SetScale(float scale) { - if (has_interface<PPB_Widget_Dev_0_4>()) - get_interface<PPB_Widget_Dev_0_4>()->SetScale(pp_resource(), scale); + if (has_interface<PPB_Widget_Dev>()) + get_interface<PPB_Widget_Dev>()->SetLocation(pp_resource(), + &location.pp_rect()); } } // namespace pp diff --git a/ppapi/cpp/dev/widget_dev.h b/ppapi/cpp/dev/widget_dev.h index ef14c3c..68988bf 100644 --- a/ppapi/cpp/dev/widget_dev.h +++ b/ppapi/cpp/dev/widget_dev.h @@ -29,7 +29,6 @@ class Widget_Dev : public Resource { bool HandleEvent(const InputEvent& event); bool GetLocation(Rect* location); void SetLocation(const Rect& location); - void SetScale(float scale); }; } // namespace pp |