Chromium Code Reviews| Index: content/renderer/pepper/pepper_plugin_instance_impl.cc |
| diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc |
| index 4e051349df677dd1cd701dbbb682effbd3b8a8b3..b18c5a8ecaa64e748726f1f2d20411db8c1e18f9 100644 |
| --- a/content/renderer/pepper/pepper_plugin_instance_impl.cc |
| +++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc |
| @@ -807,19 +807,32 @@ bool PepperPluginInstanceImpl::Initialize( |
| if (!render_frame_) |
| return false; |
| + // Get plugin dimensions directly. |
| + blink::WebElement element = container()->element(); |
| + blink::WebRect bounds = element.boundsInViewportSpace(); |
| + gfx::Size size(bounds.width, bounds.height); |
| + |
| + // Plugins are sometimes only partially visible. This is to support content |
| + // that may expand. Walk up the DOM tree here to find a parent container |
| + // that is smaller, and use that as the plugin's effective visible size. |
| + blink::WebNode node = element.parentNode(); |
| + while (!node.isNull() && node.isElementNode()) { |
| + blink::WebRect bounds = node.to<WebElement>().boundsInViewportSpace(); |
| + size.SetToMin(gfx::Size(bounds.width, bounds.height)); |
| + node = node.parentNode(); |
| + } |
|
piman
2015/03/18 01:58:57
This seems crazy. It's also most likely wrong beca
tommycli
2015/03/19 22:10:13
Hi piman,
The clip rect passed to ViewChanged was
|
| + |
| if (is_flash_plugin_ && RenderThread::Get()) { |
| RenderThread::Get()->RecordAction( |
| base::UserMetricsAction("Flash.PluginInstanceCreated")); |
| - blink::WebRect bounds = container()->element().boundsInViewportSpace(); |
| - RecordFlashSizeMetric(bounds.width, bounds.height); |
| + RecordFlashSizeMetric(size.width(), size.height()); |
| } |
| if (throttler) { |
| throttler_ = throttler.Pass(); |
| throttler_->AddObserver(this); |
| throttler_->Initialize(render_frame_, plugin_url_.GetOrigin(), |
| - module()->name(), |
| - container()->element().boundsInViewportSpace()); |
| + module()->name(), size); |
| } |
| message_channel_ = MessageChannel::Create(this, &message_channel_object_); |