Index: WebCore/rendering/RenderLayerCompositor.cpp |
=================================================================== |
--- WebCore/rendering/RenderLayerCompositor.cpp (revision 73142) |
+++ WebCore/rendering/RenderLayerCompositor.cpp (working copy) |
@@ -94,6 +94,7 @@ |
, m_rootPlatformLayer(0) |
, m_updateCompositingLayersTimer(this, &RenderLayerCompositor::updateCompositingLayersTimerFired) |
, m_hasAcceleratedCompositing(true) |
+ , m_compositingTriggers(static_cast<ChromeClient::CompositingTriggerFlags>(ChromeClient::AllTriggers)) |
, m_showDebugBorders(false) |
, m_showRepaintCounter(false) |
, m_compositingConsultsOverlap(true) |
@@ -130,7 +131,7 @@ |
bool hasAcceleratedCompositing = false; |
bool showDebugBorders = false; |
bool showRepaintCounter = false; |
- |
+ |
if (Settings* settings = m_renderView->document()->settings()) { |
hasAcceleratedCompositing = settings->acceleratedCompositingEnabled(); |
showDebugBorders = settings->showDebugBorders(); |
@@ -142,18 +143,26 @@ |
if (hasAcceleratedCompositing) { |
Frame* frame = m_renderView->frameView()->frame(); |
Page* page = frame ? frame->page() : 0; |
- if (page) |
- hasAcceleratedCompositing = page->chrome()->client()->allowsAcceleratedCompositing(); |
+ if (page) { |
+ ChromeClient* chromeClient = page->chrome()->client(); |
+ m_compositingTriggers = chromeClient->allowedCompositingTriggers(); |
+ hasAcceleratedCompositing = m_compositingTriggers; |
+ } |
} |
if (hasAcceleratedCompositing != m_hasAcceleratedCompositing || showDebugBorders != m_showDebugBorders || showRepaintCounter != m_showRepaintCounter) |
setCompositingLayersNeedRebuild(); |
- |
+ |
m_hasAcceleratedCompositing = hasAcceleratedCompositing; |
m_showDebugBorders = showDebugBorders; |
m_showRepaintCounter = showRepaintCounter; |
} |
+bool RenderLayerCompositor::canRender3DTransforms() const |
+{ |
+ return hasAcceleratedCompositing() && (m_compositingTriggers & ChromeClient::ThreeDTransformTrigger); |
+} |
+ |
void RenderLayerCompositor::setCompositingLayersNeedRebuild(bool needRebuild) |
{ |
if (inCompositingMode()) |
@@ -1127,7 +1136,7 @@ |
|| requiresCompositingForCanvas(renderer) |
|| requiresCompositingForPlugin(renderer) |
|| requiresCompositingForIFrame(renderer) |
- || renderer->style()->backfaceVisibility() == BackfaceVisibilityHidden |
+ || (canRender3DTransforms() && renderer->style()->backfaceVisibility() == BackfaceVisibilityHidden) |
|| clipsCompositingDescendants(layer) |
|| requiresCompositingForAnimation(renderer); |
} |
@@ -1183,6 +1192,9 @@ |
bool RenderLayerCompositor::requiresCompositingForTransform(RenderObject* renderer) const |
{ |
+ if (!(m_compositingTriggers & ChromeClient::ThreeDTransformTrigger)) |
+ return false; |
+ |
RenderStyle* style = renderer->style(); |
// Note that we ask the renderer if it has a transform, because the style may have transforms, |
// but the renderer may be an inline that doesn't suppport them. |
@@ -1191,6 +1203,8 @@ |
bool RenderLayerCompositor::requiresCompositingForVideo(RenderObject* renderer) const |
{ |
+ if (!(m_compositingTriggers & ChromeClient::VideoTrigger)) |
+ return false; |
#if ENABLE(VIDEO) |
if (renderer->isVideo()) { |
RenderVideo* video = toRenderVideo(renderer); |
@@ -1217,6 +1231,9 @@ |
bool RenderLayerCompositor::requiresCompositingForCanvas(RenderObject* renderer) const |
{ |
+ if (!(m_compositingTriggers & ChromeClient::CanvasTrigger)) |
+ return false; |
+ |
if (renderer->isCanvas()) { |
HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(renderer->node()); |
return canvas->renderingContext() && canvas->renderingContext()->isAccelerated(); |
@@ -1226,6 +1243,9 @@ |
bool RenderLayerCompositor::requiresCompositingForPlugin(RenderObject* renderer) const |
{ |
+ if (!(m_compositingTriggers & ChromeClient::PluginTrigger)) |
+ return false; |
+ |
bool composite = (renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->allowsAcceleratedCompositing()) |
|| (renderer->isApplet() && toRenderApplet(renderer)->allowsAcceleratedCompositing()); |
if (!composite) |
@@ -1270,6 +1290,9 @@ |
bool RenderLayerCompositor::requiresCompositingForAnimation(RenderObject* renderer) const |
{ |
+ if (!(m_compositingTriggers & ChromeClient::AnimationTrigger)) |
+ return false; |
+ |
if (AnimationController* animController = renderer->animation()) { |
return (animController->isRunningAnimationOnRenderer(renderer, CSSPropertyOpacity) && inCompositingMode()) |
|| animController->isRunningAnimationOnRenderer(renderer, CSSPropertyWebkitTransform); |