Fix the ACCELERATED_COMPOSITING code to not expose RenderLayer outside rendering
authorjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Apr 2012 21:51:22 +0000 (21:51 +0000)
committerjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Apr 2012 21:51:22 +0000 (21:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=83816

Reviewed by James Robinson.

No change in behavior expected.

This code adds several functions on RenderBoxModelObject to forward
to the associated layer. This removes the RenderLayer dependencies
at the call sites.

Currently only RenderBoxModelObject can be hardware accelerated as
we need a RenderLayer, this looks like the best place to put those
new functions.

* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::contentChanged):
(WebCore::RenderBoxModelObject::hasAcceleratedCompositing):
(WebCore::RenderBoxModelObject::startTransition):
(WebCore::RenderBoxModelObject::transitionPaused):
(WebCore::RenderBoxModelObject::transitionFinished):
(WebCore::RenderBoxModelObject::startAnimation):
(WebCore::RenderBoxModelObject::animationPaused):
(WebCore::RenderBoxModelObject::animationFinished):
(WebCore::RenderBoxModelObject::suspendAnimations):
* rendering/RenderBoxModelObject.h:
Added the previous functions to hide the layer need.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::hasAcceleratedCompositing):
* rendering/RenderLayer.h:
Removed the previous method as it was superseeded by the
one on RenderBoxModelObject. Also moved the ContentChangeType
enumaration.

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::contentChanged):
* rendering/RenderLayerBacking.h:
(RenderLayerBacking):
Updated after the ContentChangeType enumaration move.

* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::reset):
(WebCore::HTMLCanvasElement::paintsIntoCanvasBuffer):
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::didDraw):
* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::markContextChanged):
(WebCore::WebGLRenderingContext::reshape):
* page/animation/AnimationBase.cpp:
(WebCore::AnimationBase::freezeAtTime):
* page/animation/ImplicitAnimation.cpp:
(WebCore::ImplicitAnimation::startAnimation):
(WebCore::ImplicitAnimation::pauseAnimation):
(WebCore::ImplicitAnimation::endAnimation):
* page/animation/KeyframeAnimation.cpp:
(WebCore::KeyframeAnimation::startAnimation):
(WebCore::KeyframeAnimation::pauseAnimation):
(WebCore::KeyframeAnimation::endAnimation):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::imageChanged):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::imageDimensionsChanged):
(WebCore::RenderImage::notifyFinished):
* rendering/RenderVideo.cpp:
(WebCore::RenderVideo::updatePlayer):
Updated all those call sites to use the new functions. Also
removed unneeded RenderLayer.h include as we went.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114437 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLCanvasElement.cpp
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
Source/WebCore/html/canvas/WebGLRenderingContext.cpp
Source/WebCore/page/animation/AnimationBase.cpp
Source/WebCore/page/animation/ImplicitAnimation.cpp
Source/WebCore/page/animation/KeyframeAnimation.cpp
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBoxModelObject.cpp
Source/WebCore/rendering/RenderBoxModelObject.h
Source/WebCore/rendering/RenderImage.cpp
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayer.h
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderLayerBacking.h
Source/WebCore/rendering/RenderVideo.cpp

index cc0d0a817f069dfbb202778e451b43dfe40c1aef..cf6fb5aab8c9881b6ffa5f715c52815d8c569194 100644 (file)
@@ -1,3 +1,74 @@
+2012-04-17  Julien Chaffraix  <jchaffraix@webkit.org>
+
+        Fix the ACCELERATED_COMPOSITING code to not expose RenderLayer outside rendering
+        https://bugs.webkit.org/show_bug.cgi?id=83816
+
+        Reviewed by James Robinson.
+
+        No change in behavior expected.
+
+        This code adds several functions on RenderBoxModelObject to forward
+        to the associated layer. This removes the RenderLayer dependencies
+        at the call sites.
+
+        Currently only RenderBoxModelObject can be hardware accelerated as
+        we need a RenderLayer, this looks like the best place to put those
+        new functions.
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::contentChanged):
+        (WebCore::RenderBoxModelObject::hasAcceleratedCompositing):
+        (WebCore::RenderBoxModelObject::startTransition):
+        (WebCore::RenderBoxModelObject::transitionPaused):
+        (WebCore::RenderBoxModelObject::transitionFinished):
+        (WebCore::RenderBoxModelObject::startAnimation):
+        (WebCore::RenderBoxModelObject::animationPaused):
+        (WebCore::RenderBoxModelObject::animationFinished):
+        (WebCore::RenderBoxModelObject::suspendAnimations):
+        * rendering/RenderBoxModelObject.h:
+        Added the previous functions to hide the layer need.
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::hasAcceleratedCompositing):
+        * rendering/RenderLayer.h:
+        Removed the previous method as it was superseeded by the
+        one on RenderBoxModelObject. Also moved the ContentChangeType
+        enumaration.
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::contentChanged):
+        * rendering/RenderLayerBacking.h:
+        (RenderLayerBacking):
+        Updated after the ContentChangeType enumaration move.
+
+        * html/HTMLCanvasElement.cpp:
+        (WebCore::HTMLCanvasElement::reset):
+        (WebCore::HTMLCanvasElement::paintsIntoCanvasBuffer):
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::didDraw):
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore::WebGLRenderingContext::markContextChanged):
+        (WebCore::WebGLRenderingContext::reshape):
+        * page/animation/AnimationBase.cpp:
+        (WebCore::AnimationBase::freezeAtTime):
+        * page/animation/ImplicitAnimation.cpp:
+        (WebCore::ImplicitAnimation::startAnimation):
+        (WebCore::ImplicitAnimation::pauseAnimation):
+        (WebCore::ImplicitAnimation::endAnimation):
+        * page/animation/KeyframeAnimation.cpp:
+        (WebCore::KeyframeAnimation::startAnimation):
+        (WebCore::KeyframeAnimation::pauseAnimation):
+        (WebCore::KeyframeAnimation::endAnimation):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::imageChanged):
+        * rendering/RenderImage.cpp:
+        (WebCore::RenderImage::imageDimensionsChanged):
+        (WebCore::RenderImage::notifyFinished):
+        * rendering/RenderVideo.cpp:
+        (WebCore::RenderVideo::updatePlayer):
+        Updated all those call sites to use the new functions. Also
+        removed unneeded RenderLayer.h include as we went.
+
 2012-04-16  Andy Estes  <aestes@apple.com>
 
         -webkit-mask-box-image does not draw when layer tree flattening is enabled
index 7fc75eebd055c3e01fe5dc3b3e52d43e0cf846c1..ed0330ce0bb000615ae19c8622d8531ceed1bbc2 100644 (file)
@@ -45,7 +45,6 @@
 #include "MIMETypeRegistry.h"
 #include "Page.h"
 #include "RenderHTMLCanvas.h"
-#include "RenderLayer.h"
 #include "Settings.h"
 #include <math.h>
 #include <stdio.h>
@@ -280,8 +279,8 @@ void HTMLCanvasElement::reset()
             if (oldSize != size()) {
                 toRenderHTMLCanvas(renderer)->canvasSizeChanged();
 #if USE(ACCELERATED_COMPOSITING)
-                if (renderBox() && renderBox()->hasLayer() && renderBox()->layer()->hasAcceleratedCompositing())
-                    renderBox()->layer()->contentChanged(RenderLayer::CanvasChanged);
+                if (renderBox() && renderBox()->hasAcceleratedCompositing())
+                    renderBox()->contentChanged(CanvasChanged);
 #endif
             }
             if (hadImageBuffer)
@@ -306,7 +305,7 @@ bool HTMLCanvasElement::paintsIntoCanvasBuffer() const
     if (!m_context->isAccelerated())
         return true;
 
-    if (renderBox() && renderBox()->hasLayer() && renderBox()->layer()->hasAcceleratedCompositing())
+    if (renderBox() && renderBox()->hasAcceleratedCompositing())
         return false;
 #endif
     return true;
index ae327fd247037182a0786be171c0cd4c5c1c3bc5..1e2104dc58041abb2eac7d1f08c2187ec5bb530f 100644 (file)
 #include "TextMetrics.h"
 #include "TextRun.h"
 
-#if USE(ACCELERATED_COMPOSITING)
-#include "RenderLayer.h"
-#endif
-
 #include <wtf/ByteArray.h>
 #include <wtf/CheckedArithmetic.h>
 #include <wtf/MathExtras.h>
@@ -1702,8 +1698,8 @@ void CanvasRenderingContext2D::didDraw(const FloatRect& r, unsigned options)
     // If we are drawing to hardware and we have a composited layer, just call contentChanged().
     if (isAccelerated()) {
         RenderBox* renderBox = canvas()->renderBox();
-        if (renderBox && renderBox->hasLayer() && renderBox->layer()->hasAcceleratedCompositing()) {
-            renderBox->layer()->contentChanged(RenderLayer::CanvasChanged);
+        if (renderBox && renderBox->hasAcceleratedCompositing()) {
+            renderBox->contentChanged(CanvasChanged);
             canvas()->clearCopiedImage();
             return;
         }
index 14eccb976008c20641c3efd07e77d1b2ec3dd06a..07a3dd7e3152b0e83a8860697c9bcbae4bab4859 100644 (file)
@@ -51,7 +51,6 @@
 #include "OESVertexArrayObject.h"
 #include "Page.h"
 #include "RenderBox.h"
-#include "RenderLayer.h"
 #include "Settings.h"
 #include "WebGLActiveInfo.h"
 #include "WebGLBuffer.h"
@@ -599,9 +598,9 @@ void WebGLRenderingContext::markContextChanged()
     m_layerCleared = false;
 #if USE(ACCELERATED_COMPOSITING)
     RenderBox* renderBox = canvas()->renderBox();
-    if (renderBox && renderBox->hasLayer() && renderBox->layer()->hasAcceleratedCompositing()) {
+    if (renderBox && renderBox->hasAcceleratedCompositing()) {
         m_markedCanvasDirty = true;
-        renderBox->layer()->contentChanged(RenderLayer::CanvasChanged);
+        renderBox->contentChanged(CanvasChanged);
     } else {
 #endif
         if (!m_markedCanvasDirty) {
@@ -755,8 +754,8 @@ void WebGLRenderingContext::reshape(int width, int height)
     if (m_needsUpdate) {
 #if USE(ACCELERATED_COMPOSITING)
         RenderBox* renderBox = canvas()->renderBox();
-        if (renderBox && renderBox->hasLayer())
-            renderBox->layer()->contentChanged(RenderLayer::CanvasChanged);
+        if (renderBox && renderBox->hasAcceleratedCompositing())
+            renderBox->contentChanged(CanvasChanged);
 #endif
         m_needsUpdate = false;
     }
index a95e4de953f913ac0ca3ce242feb2439ed5e76d0..870311cf5f7f9b56e33bab07f498992b772a6324 100644 (file)
@@ -42,8 +42,6 @@
 #include "MatrixTransformOperation.h"
 #include "Matrix3DTransformOperation.h"
 #include "RenderBox.h"
-#include "RenderLayer.h"
-#include "RenderLayerBacking.h"
 #include "RenderStyle.h"
 #include "StyleCachedImage.h"
 #include "StyleGeneratedImage.h"
@@ -1832,11 +1830,8 @@ void AnimationBase::freezeAtTime(double t)
         m_pauseTime = m_startTime + t - m_animation->delay();
 
 #if USE(ACCELERATED_COMPOSITING)
-    if (m_object && m_object->hasLayer()) {
-        RenderLayer* layer = toRenderBoxModelObject(m_object)->layer();
-        if (layer->isComposited())
-            layer->backing()->suspendAnimations(m_pauseTime);
-    }
+    if (m_object && m_object->isComposited())
+        toRenderBoxModelObject(m_object)->suspendAnimations(m_pauseTime);
 #endif
 }
 
index 4be26ed4078dffbc2bb0a400995e33f6637f37ba..f5d82ac6aae21fc3cbd0e2531245a948d2056726 100644 (file)
@@ -33,8 +33,7 @@
 #include "EventNames.h"
 #include "ImplicitAnimation.h"
 #include "KeyframeAnimation.h"
-#include "RenderLayer.h"
-#include "RenderLayerBacking.h"
+#include "RenderBoxModelObject.h"
 #include <wtf/UnusedParam.h>
 
 namespace WebCore {
@@ -108,11 +107,8 @@ void ImplicitAnimation::getAnimatedStyle(RefPtr<RenderStyle>& animatedStyle)
 bool ImplicitAnimation::startAnimation(double timeOffset)
 {
 #if USE(ACCELERATED_COMPOSITING)
-    if (m_object && m_object->hasLayer()) {
-        RenderLayer* layer = toRenderBoxModelObject(m_object)->layer();
-        if (layer->isComposited())
-            return layer->backing()->startTransition(timeOffset, m_animatingProperty, m_fromStyle.get(), m_toStyle.get());
-    }
+    if (m_object && m_object->isComposited())
+        return toRenderBoxModelObject(m_object)->startTransition(timeOffset, m_animatingProperty, m_fromStyle.get(), m_toStyle.get());
 #else
     UNUSED_PARAM(timeOffset);
 #endif
@@ -125,11 +121,8 @@ void ImplicitAnimation::pauseAnimation(double timeOffset)
         return;
 
 #if USE(ACCELERATED_COMPOSITING)
-    if (m_object->hasLayer()) {
-        RenderLayer* layer = toRenderBoxModelObject(m_object)->layer();
-        if (layer->isComposited())
-            layer->backing()->transitionPaused(timeOffset, m_animatingProperty);
-    }
+    if (m_object->isComposited())
+        toRenderBoxModelObject(m_object)->transitionPaused(timeOffset, m_animatingProperty);
 #else
     UNUSED_PARAM(timeOffset);
 #endif
@@ -141,11 +134,8 @@ void ImplicitAnimation::pauseAnimation(double timeOffset)
 void ImplicitAnimation::endAnimation()
 {
 #if USE(ACCELERATED_COMPOSITING)
-    if (m_object && m_object->hasLayer()) {
-        RenderLayer* layer = toRenderBoxModelObject(m_object)->layer();
-        if (layer->isComposited())
-            layer->backing()->transitionFinished(m_animatingProperty);
-    }
+    if (m_object && m_object->isComposited())
+        toRenderBoxModelObject(m_object)->transitionFinished(m_animatingProperty);
 #endif
 }
 
index fb8b21d55eae4c3ff1fa529f82a61c6c57187f07..06f3023c0d0a949fd9074cfa44aff7ec09d10218 100644 (file)
@@ -34,8 +34,7 @@
 #include "CSSStyleSelector.h"
 #include "CompositeAnimation.h"
 #include "EventNames.h"
-#include "RenderLayer.h"
-#include "RenderLayerBacking.h"
+#include "RenderBoxModelObject.h"
 #include "RenderStyle.h"
 #include <wtf/UnusedParam.h>
 
@@ -233,10 +232,8 @@ bool KeyframeAnimation::hasAnimationForProperty(CSSPropertyID property) const
 bool KeyframeAnimation::startAnimation(double timeOffset)
 {
 #if USE(ACCELERATED_COMPOSITING)
-    if (m_object && m_object->hasLayer()) {
-        RenderLayer* layer = toRenderBoxModelObject(m_object)->layer();
-        if (layer->isComposited())
-            return layer->backing()->startAnimation(timeOffset, m_animation.get(), m_keyframes);
+    if (m_object && m_object->isComposited()) {
+        return toRenderBoxModelObject(m_object)->startAnimation(timeOffset, m_animation.get(), m_keyframes);
     }
 #else
     UNUSED_PARAM(timeOffset);
@@ -250,11 +247,8 @@ void KeyframeAnimation::pauseAnimation(double timeOffset)
         return;
 
 #if USE(ACCELERATED_COMPOSITING)
-    if (m_object->hasLayer()) {
-        RenderLayer* layer = toRenderBoxModelObject(m_object)->layer();
-        if (layer->isComposited())
-            layer->backing()->animationPaused(timeOffset, m_keyframes.animationName());
-    }
+    if (m_object->isComposited())
+        toRenderBoxModelObject(m_object)->animationPaused(timeOffset, m_keyframes.animationName());
 #else
     UNUSED_PARAM(timeOffset);
 #endif
@@ -269,11 +263,8 @@ void KeyframeAnimation::endAnimation()
         return;
 
 #if USE(ACCELERATED_COMPOSITING)
-    if (m_object->hasLayer()) {
-        RenderLayer* layer = toRenderBoxModelObject(m_object)->layer();
-        if (layer->isComposited())
-            layer->backing()->animationFinished(m_keyframes.animationName());
-    }
+    if (m_object->isComposited())
+        toRenderBoxModelObject(m_object)->animationFinished(m_keyframes.animationName());
 #endif
     // Restore the original (unanimated) style
     if (!paused())
index 92eef89c89563380032a4d64abb4f0908de1ed6f..37eca280e2c03005a0596d8e1bcc968cc9be4cf2 100644 (file)
@@ -1161,7 +1161,7 @@ void RenderBox::imageChanged(WrappedImagePtr image, const IntRect*)
 
 #if USE(ACCELERATED_COMPOSITING)
     if (hasLayer() && layer()->hasCompositedMask() && layersUseImage(image, style()->maskLayers()))
-        layer()->contentChanged(RenderLayer::MaskImageChanged);
+        layer()->contentChanged(MaskImageChanged);
 #endif
 }
 
index b7f29ba88c87384e51865200a2f558f93a063248..e7479cc41042e665c30ac5528dfc3504a3323b6a 100644 (file)
 #include "TransformState.h"
 #include <wtf/CurrentTime.h>
 
+#if USE(ACCELERATED_COMPOSITING)
+#include "RenderLayerBacking.h"
+#include "RenderLayerCompositor.h"
+#endif
+
 using namespace std;
 
 namespace WebCore {
@@ -241,6 +246,70 @@ void RenderBoxModelObject::setSelectionState(SelectionState state)
         containingBlock->setSelectionState(state);
 }
 
+#if USE(ACCELERATED_COMPOSITING)
+void RenderBoxModelObject::contentChanged(ContentChangeType changeType)
+{
+    if (!hasLayer())
+        return;
+
+    layer()->contentChanged(changeType);
+}
+
+bool RenderBoxModelObject::hasAcceleratedCompositing() const
+{
+    return view()->compositor()->hasAcceleratedCompositing();
+}
+
+bool RenderBoxModelObject::startTransition(double timeOffset, CSSPropertyID propertyId, const RenderStyle* fromStyle, const RenderStyle* toStyle)
+{
+    ASSERT(hasLayer());
+    ASSERT(isComposited());
+    return layer()->backing()->startTransition(timeOffset, propertyId, fromStyle, toStyle);
+}
+
+void RenderBoxModelObject::transitionPaused(double timeOffset, CSSPropertyID propertyId)
+{
+    ASSERT(hasLayer());
+    ASSERT(isComposited());
+    layer()->backing()->transitionPaused(timeOffset, propertyId);
+}
+
+void RenderBoxModelObject::transitionFinished(CSSPropertyID propertyId)
+{
+    ASSERT(hasLayer());
+    ASSERT(isComposited());
+    layer()->backing()->transitionFinished(propertyId);
+}
+
+bool RenderBoxModelObject::startAnimation(double timeOffset, const Animation* animation, const KeyframeList& keyframes)
+{
+    ASSERT(hasLayer());
+    ASSERT(isComposited());
+    return layer()->backing()->startAnimation(timeOffset, animation, keyframes);
+}
+
+void RenderBoxModelObject::animationPaused(double timeOffset, const String& name)
+{
+    ASSERT(hasLayer());
+    ASSERT(isComposited());
+    layer()->backing()->animationPaused(timeOffset, name);
+}
+
+void RenderBoxModelObject::animationFinished(const String& name)
+{
+    ASSERT(hasLayer());
+    ASSERT(isComposited());
+    layer()->backing()->animationFinished(name);
+}
+
+void RenderBoxModelObject::suspendAnimations(double time)
+{
+    ASSERT(hasLayer());
+    ASSERT(isComposited());
+    layer()->backing()->suspendAnimations(time);
+}
+#endif
+
 bool RenderBoxModelObject::shouldPaintAtLowQuality(GraphicsContext* context, Image* image, const void* layer, const LayoutSize& size)
 {
     return imageQualityController()->shouldPaintAtLowQuality(context, this, image, layer, size);
index 6581bb9bd5f0c0a2d497e21651e85b6997be12da..f918c337fc53f3110160437ef238d628286d7aac 100644 (file)
@@ -40,6 +40,16 @@ enum BackgroundBleedAvoidance {
     BackgroundBleedUseTransparencyLayer
 };
 
+enum ContentChangeType {
+    ImageChanged,
+    MaskImageChanged,
+    CanvasChanged,
+    VideoChanged,
+    FullScreenChanged
+};
+
+class KeyframeList;
+
 // This class is the base for all objects that adhere to the CSS box model as described
 // at http://www.w3.org/TR/CSS21/box.html
 
@@ -155,6 +165,21 @@ public:
 
     virtual void setSelectionState(SelectionState s);
 
+#if USE(ACCELERATED_COMPOSITING)
+    void contentChanged(ContentChangeType);
+    bool hasAcceleratedCompositing() const;
+
+    bool startTransition(double, CSSPropertyID, const RenderStyle* fromStyle, const RenderStyle* toStyle);
+    void transitionPaused(double timeOffset, CSSPropertyID);
+    void transitionFinished(CSSPropertyID);
+
+    bool startAnimation(double timeOffset, const Animation*, const KeyframeList& keyframes);
+    void animationPaused(double timeOffset, const String& name);
+    void animationFinished(const String& name);
+
+    void suspendAnimations(double time = 0);
+#endif
+
 protected:
     virtual void willBeDestroyed();
 
index 9b3757814a55c40778057aac309d1c6c866265b3..35caaff29c4aa6b4c829f4928b396e3c18eb1b83 100644 (file)
@@ -40,7 +40,7 @@
 #include "HTMLNames.h"
 #include "HitTestResult.h"
 #include "Page.h"
-#include "RenderLayer.h"
+#include "PaintInfo.h"
 #include "RenderView.h"
 #include "SVGImage.h"
 #include <wtf/UnusedParam.h>
@@ -227,10 +227,8 @@ void RenderImage::imageDimensionsChanged(bool imageSizeChanged, const IntRect* r
         repaintRectangle(repaintRect);
 
 #if USE(ACCELERATED_COMPOSITING)
-        if (hasLayer()) {
-            // Tell any potential compositing layers that the image needs updating.
-            layer()->contentChanged(RenderLayer::ImageChanged);
-        }
+        // Tell any potential compositing layers that the image needs updating.
+        contentChanged(ImageChanged);
 #endif
     }
 }
@@ -244,10 +242,10 @@ void RenderImage::notifyFinished(CachedResource* newImage)
         return;
 
 #if USE(ACCELERATED_COMPOSITING)
-    if (newImage == m_imageResource->cachedImage() && hasLayer()) {
+    if (newImage == m_imageResource->cachedImage()) {
         // tell any potential compositing layers
         // that the image is done and they can reference it directly.
-        layer()->contentChanged(RenderLayer::ImageChanged);
+        contentChanged(ImageChanged);
     }
 #else
     UNUSED_PARAM(newImage);
index e783c11ddd679b55bb1ea3a371c3b5bbc63e605b..8c06f7b0bf18581d325624b4105be0a212a50a27 100644 (file)
@@ -270,15 +270,6 @@ void RenderLayer::contentChanged(ContentChangeType changeType)
 }
 #endif // USE(ACCELERATED_COMPOSITING)
 
-bool RenderLayer::hasAcceleratedCompositing() const
-{
-#if USE(ACCELERATED_COMPOSITING)
-    return compositor()->hasAcceleratedCompositing();
-#else
-    return false;
-#endif
-}
-
 bool RenderLayer::canRender3DTransforms() const
 {
 #if USE(ACCELERATED_COMPOSITING)
index c5393b4599d48d2f408c50ea21bbd866e025aa6b..60b766d799d52a62de05e7485219cea24eec57ea 100644 (file)
@@ -350,13 +350,9 @@ public:
     
     // Notification from the renderer that its content changed (e.g. current frame of image changed).
     // Allows updates of layer content without repainting.
-    enum ContentChangeType { ImageChanged, MaskImageChanged, CanvasChanged, VideoChanged, FullScreenChanged };
     void contentChanged(ContentChangeType);
 #endif
 
-    // Returns true if the accelerated compositing is enabled
-    bool hasAcceleratedCompositing() const;
-
     bool canRender3DTransforms() const;
 
     void updateLayerPosition();
index 1b4b73015497af8a7afc4a0c123f2a582638267b..25e6ce3ff90d915aa0c2dc9669554d2a272538bd 100644 (file)
@@ -981,14 +981,14 @@ bool RenderLayerBacking::isDirectlyCompositedImage() const
     return false;
 }
 
-void RenderLayerBacking::contentChanged(RenderLayer::ContentChangeType changeType)
+void RenderLayerBacking::contentChanged(ContentChangeType changeType)
 {
-    if ((changeType == RenderLayer::ImageChanged) && isDirectlyCompositedImage()) {
+    if ((changeType == ImageChanged) && isDirectlyCompositedImage()) {
         updateImageContents();
         return;
     }
     
-    if ((changeType == RenderLayer::MaskImageChanged) && m_maskLayer) {
+    if ((changeType == MaskImageChanged) && m_maskLayer) {
         // The composited layer bounds relies on box->maskClipRect(), which changes
         // when the mask image becomes available.
         bool isUpdateRoot = true;
@@ -996,7 +996,7 @@ void RenderLayerBacking::contentChanged(RenderLayer::ContentChangeType changeTyp
     }
 
 #if ENABLE(WEBGL) || ENABLE(ACCELERATED_2D_CANVAS)
-    if ((changeType == RenderLayer::CanvasChanged) && isAcceleratedCanvas(renderer())) {
+    if ((changeType == CanvasChanged) && isAcceleratedCanvas(renderer())) {
         m_graphicsLayer->setContentsNeedsDisplay();
         return;
     }
index c11336c7385843e58e78b99d9ed06e5df15a8711..ccff77315ab632e4179e338a2e304135da36e50a 100644 (file)
@@ -108,7 +108,7 @@ public:
     void setContentsNeedDisplayInRect(const IntRect&);
 
     // Notification from the renderer that its content changed.
-    void contentChanged(RenderLayer::ContentChangeType);
+    void contentChanged(ContentChangeType);
 
     // Interface to start, finish, suspend and resume animations and transitions
     bool startTransition(double, CSSPropertyID, const RenderStyle* fromStyle, const RenderStyle* toStyle);
index 26913799cebf230b9a4744f1c9d068e57c1b8dcf..37f2f0844ce46524eb064a586f8b2dbf693efef0 100644 (file)
 #include "RenderFullScreen.h"
 #endif
 
-#if USE(ACCELERATED_COMPOSITING)
-#include "RenderLayer.h"
-#include "RenderLayerBacking.h"
-#endif
-
-using namespace std;
-
 namespace WebCore {
 
 using namespace HTMLNames;
@@ -262,7 +255,7 @@ void RenderVideo::updatePlayer()
     }
 
 #if USE(ACCELERATED_COMPOSITING)
-    layer()->contentChanged(RenderLayer::VideoChanged);
+    contentChanged(VideoChanged);
 #endif
     
     IntRect videoBounds = videoBox();