| 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..ca7400736409d5054df1c206c0be915bf6b9d3c8 100644
|
| --- a/content/renderer/pepper/pepper_plugin_instance_impl.cc
|
| +++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc
|
| @@ -807,19 +807,38 @@ bool PepperPluginInstanceImpl::Initialize(
|
| if (!render_frame_)
|
| return false;
|
|
|
| + // Get plugin dimensions directly.
|
| + blink::WebElement element = container()->element();
|
| + blink::WebRect bounds = element.boundsInViewportSpace();
|
| + int width = bounds.width;
|
| + int height = 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();
|
| +
|
| + if (bounds.width < width)
|
| + width = bounds.width;
|
| + if (bounds.height < height)
|
| + height = bounds.height;
|
| +
|
| + node = node.parentNode();
|
| + }
|
| +
|
| 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(width, height);
|
| }
|
|
|
| if (throttler) {
|
| throttler_ = throttler.Pass();
|
| throttler_->AddObserver(this);
|
| throttler_->Initialize(render_frame_, plugin_url_.GetOrigin(),
|
| - module()->name(),
|
| - container()->element().boundsInViewportSpace());
|
| + module()->name(), width, height);
|
| }
|
|
|
| message_channel_ = MessageChannel::Create(this, &message_channel_object_);
|
|
|