Commit caa15536 authored by ojan@chromium.org's avatar ojan@chromium.org

Don't do a style recalc when updating the composited layer of a plugin.

Since the renderer for the plugin always gets either a NormalLayer
or a ForcedLayer, it will have a RenderLayer whether it's composited
or not, so all we have to do is update it's self painting layer bit.

This is a followup to https://codereview.chromium.org/328553004.

Review URL: https://codereview.chromium.org/322193002

git-svn-id: svn://svn.chromium.org/blink/trunk@175942 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 8ac77356
......@@ -65,6 +65,7 @@
#include "core/plugins/PluginOcclusionSupport.h"
#include "core/rendering/HitTestResult.h"
#include "core/rendering/RenderBox.h"
#include "core/rendering/RenderLayer.h"
#include "platform/HostWindow.h"
#include "platform/KeyboardCodes.h"
#include "platform/PlatformGestureEvent.h"
......@@ -288,20 +289,27 @@ void WebPluginContainerImpl::setWebLayer(WebLayer* layer)
if (m_webLayer == layer)
return;
// If anyone of the layers is null we need to switch between hardware
// and software compositing.
if (!m_webLayer || !layer) {
m_element->setNeedsCompositingUpdate();
// Trigger a style recalc so we update the
// requiresAcceleratedCompositingForExternalReasons bit in
// RenderStyle and thus give the plugin a NormalLayer RenderLayer.
m_element->setNeedsStyleRecalc(LocalStyleChange);
}
if (m_webLayer)
GraphicsLayer::unregisterContentsLayer(m_webLayer);
if (layer)
GraphicsLayer::registerContentsLayer(layer);
// If either of the layers is null we need to switch between hardware
// and software compositing.
bool needsCompositingUpdate = !m_webLayer || !layer;
m_webLayer = layer;
if (!needsCompositingUpdate)
return;
m_element->setNeedsCompositingUpdate();
// Being composited or not affects the self painting layer bit
// on the RenderLayer.
if (RenderPart* renderer = m_element->renderPart()) {
ASSERT(renderer->hasLayer());
renderer->layer()->updateSelfPaintingLayer();
}
}
bool WebPluginContainerImpl::supportsPaginatedPrint() const
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment