diff options
author | raymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-04 08:41:11 +0000 |
---|---|---|
committer | raymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-04 08:41:11 +0000 |
commit | 9824fc54128a85c3d373370d0ec3bcd9ec59e9db (patch) | |
tree | 992a3bf2b051d7b10866f67d13df6f51c199d953 /content/renderer/pepper | |
parent | 64e0b0256a9b537e2bb2d133634596f67960eedd (diff) | |
download | chromium_src-9824fc54128a85c3d373370d0ec3bcd9ec59e9db.zip chromium_src-9824fc54128a85c3d373370d0ec3bcd9ec59e9db.tar.gz chromium_src-9824fc54128a85c3d373370d0ec3bcd9ec59e9db.tar.bz2 |
Disable UpdateLayerTransform on PepperPluginInstanceImpl
This disables layer transforms that were applied as a result of SetOffset
and SetResizeMode in PPB_Graphics2D_Dev. These transforms are not currently
being used.
This fixes a regression introduced in r235581/https://codereview.chromium.org/25661002
which was caused due to the fact that an intermediate cc layer was added.
This resulted in certain properties (namely visibility) not being applied to the
child layer correctly.
The remainder of this CL will also be reverted since it's not currently being used
but this CL is designed to be merged, which is why it is being kept small.
BUG=348694
Review URL: https://codereview.chromium.org/183923022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@254732 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/pepper')
-rw-r--r-- | content/renderer/pepper/pepper_graphics_2d_host.cc | 5 | ||||
-rw-r--r-- | content/renderer/pepper/pepper_plugin_instance_impl.cc | 46 | ||||
-rw-r--r-- | content/renderer/pepper/pepper_plugin_instance_impl.h | 3 |
3 files changed, 1 insertions, 53 deletions
diff --git a/content/renderer/pepper/pepper_graphics_2d_host.cc b/content/renderer/pepper/pepper_graphics_2d_host.cc index 6e799b5..9657d82 100644 --- a/content/renderer/pepper/pepper_graphics_2d_host.cc +++ b/content/renderer/pepper/pepper_graphics_2d_host.cc @@ -424,8 +424,6 @@ void PepperGraphics2DHost::ViewFlushedPaint() { void PepperGraphics2DHost::DidChangeView(const ppapi::ViewData& view_data) { gfx::Size old_plugin_size = current_plugin_size_; current_plugin_size_ = PP_ToGfxSize(view_data.rect.size); - if (bound_instance_) - bound_instance_->UpdateLayerTransform(); } void PepperGraphics2DHost::SetScale(float scale) { @@ -740,9 +738,6 @@ int32_t PepperGraphics2DHost::Flush(PP_Resource* old_image_data, queued_operations_.clear(); flushed_plugin_size_ = flushed_plugin_size; - if (bound_instance_) - bound_instance_->UpdateLayerTransform(); - if (!bound_instance_) { // As promised in the API, we always schedule callback when unbound. ScheduleOffscreenFlushAck(); diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc index 72d9d2a..3080155 100644 --- a/content/renderer/pepper/pepper_plugin_instance_impl.cc +++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc @@ -115,11 +115,9 @@ #include "third_party/skia/include/core/SkRect.h" #include "ui/gfx/image/image_skia.h" #include "ui/gfx/image/image_skia_rep.h" -#include "ui/gfx/point_conversions.h" #include "ui/gfx/range/range.h" #include "ui/gfx/rect_conversions.h" #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" -#include "ui/gfx/size_conversions.h" #include "v8/include/v8.h" #include "webkit/renderer/compositor_bindings/web_layer_impl.h" @@ -1936,7 +1934,6 @@ void PepperPluginInstanceImpl::UpdateLayer() { if ((want_layer == !!texture_layer_.get()) && (want_3d_layer == layer_is_hardware_) && layer_bound_to_fullscreen_ == !!fullscreen_container_) { - UpdateLayerTransform(); return; } @@ -1950,7 +1947,6 @@ void PepperPluginInstanceImpl::UpdateLayer() { } if (want_layer) { bool opaque = false; - scoped_refptr<cc::Layer> plugin_layer; if (want_3d_layer) { DCHECK(bound_graphics_3d_.get()); texture_layer_ = cc::TextureLayer::CreateForMailbox(NULL); @@ -1958,24 +1954,14 @@ void PepperPluginInstanceImpl::UpdateLayer() { texture_layer_->SetTextureMailbox( cc::TextureMailbox(mailbox, GL_TEXTURE_2D, 0), cc::SingleReleaseCallback::Create(base::Bind(&IgnoreCallback))); - plugin_layer = texture_layer_; } else { DCHECK(bound_graphics_2d_platform_); texture_layer_ = cc::TextureLayer::CreateForMailbox(this); bound_graphics_2d_platform_->AttachedToNewLayer(); opaque = bound_graphics_2d_platform_->IsAlwaysOpaque(); texture_layer_->SetFlipped(false); - texture_layer_->SetBounds(bound_graphics_2d_platform_->Size()); - texture_layer_->SetIsDrawable(true); - // WebLayer sets the bounds of its containing layer to be the same size as - // the plugin DOM element. Because we want to allow scaling/positioning of - // the layer in the 2D case (for SetOffset) we need to add this - // intermediate layer. If we wanted to support this functionality for the - // 3D case, we would need an intermediate layer in that case also. - plugin_layer = cc::Layer::Create(); - plugin_layer->AddChild(texture_layer_); } - web_layer_.reset(new webkit::WebLayerImpl(plugin_layer)); + web_layer_.reset(new webkit::WebLayerImpl(texture_layer_)); if (fullscreen_container_) { fullscreen_container_->SetLayer(web_layer_.get()); // Ignore transparency in fullscreen, since that's what Flash always @@ -1989,7 +1975,6 @@ void PepperPluginInstanceImpl::UpdateLayer() { } layer_bound_to_fullscreen_ = !!fullscreen_container_; layer_is_hardware_ = want_3d_layer; - UpdateLayerTransform(); } unsigned PepperPluginInstanceImpl::PrepareTexture() { @@ -2010,35 +1995,6 @@ void PepperPluginInstanceImpl::OnDestruct() { render_frame_ = NULL; } -void PepperPluginInstanceImpl::UpdateLayerTransform() { - if (!bound_graphics_2d_platform_ || !texture_layer_) { - // Currently the transform is only applied for Graphics2D. - return; - } - - gfx::RectF backing_store(bound_graphics_2d_platform_->plugin_offset(), - bound_graphics_2d_platform_->Size()); - gfx::PointF scale = gfx::ScalePoint( - bound_graphics_2d_platform_->GetResizeScale(), - bound_graphics_2d_platform_->GetScale()); - backing_store = ScaleRect(backing_store, scale.x(), scale.y()); - - gfx::Rect layer_rect(ToEnclosingRect(backing_store)); - gfx::Size plugin_size(PP_ToGfxSize(view_data_.rect.size)); - layer_rect.Intersect(gfx::Rect(plugin_size)); - texture_layer_->SetPosition(layer_rect.origin()); - texture_layer_->SetBounds(layer_rect.size()); - - gfx::PointF u(PointAtOffsetFromOrigin( - layer_rect.origin() - backing_store.origin())); - gfx::PointF v(PointAtOffsetFromOrigin( - layer_rect.bottom_right() - backing_store.origin())); - gfx::RectF uv(BoundingRect(u, v)); - if (!backing_store.IsEmpty()) - uv.Scale(1.0f / backing_store.width(), 1.0f / backing_store.height()); - texture_layer_->SetUV(uv.origin(), uv.bottom_right()); -} - void PepperPluginInstanceImpl::AddPluginObject(PluginObject* plugin_object) { DCHECK(live_plugin_objects_.find(plugin_object) == live_plugin_objects_.end()); diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.h b/content/renderer/pepper/pepper_plugin_instance_impl.h index c113139..3dcf2d4 100644 --- a/content/renderer/pepper/pepper_plugin_instance_impl.h +++ b/content/renderer/pepper/pepper_plugin_instance_impl.h @@ -514,9 +514,6 @@ class CONTENT_EXPORT PepperPluginInstanceImpl // RenderFrameObserver virtual void OnDestruct() OVERRIDE; - // Update any transforms that should be applied to the texture layer. - void UpdateLayerTransform(); - private: friend class base::RefCounted<PepperPluginInstanceImpl>; friend class PpapiUnittest; |