2009-02-05 Simon Fraser <simon.fraser@apple.com>
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Feb 2009 04:30:51 +0000 (04:30 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Feb 2009 04:30:51 +0000 (04:30 +0000)
        Fix build when ACCELERATED_COMPOSITING is turned on.

        Give RenderLayerBacking some love after the great
        RenderBoxModelObject split.

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

WebCore/ChangeLog
WebCore/rendering/RenderLayerBacking.cpp
WebCore/rendering/RenderLayerBacking.h

index 112e841..3b2d257 100644 (file)
@@ -1,6 +1,23 @@
 2009-02-05  Simon Fraser  <simon.fraser@apple.com>
 
         Fix build when ACCELERATED_COMPOSITING is turned on.
+       
+        Give RenderLayerBacking some love after the great
+        RenderBoxModelObject split.
+        
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateLayerTransform):
+        (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
+        (WebCore::RenderLayerBacking::contentsBox):
+        (WebCore::RenderLayerBacking::paintIntoLayer):
+        (WebCore::RenderLayerBacking::startAnimation):
+        (WebCore::RenderLayerBacking::startTransition):
+        * rendering/RenderLayerBacking.h:
+        (WebCore::RenderLayerBacking::renderer):
+
+2009-02-05  Simon Fraser  <simon.fraser@apple.com>
+
+        Fix build when ACCELERATED_COMPOSITING is turned on.
         
         writeIndent() needs to be static to avoid warnings on some OSes,
         and remove unused CAToTransform3D() method.
index b5d8060..9415e98 100644 (file)
@@ -116,7 +116,7 @@ void RenderLayerBacking::updateLayerTransform()
     // baked into it, and we don't want that.
     TransformationMatrix t;
     if (m_owningLayer->hasTransform())
-        style->applyTransform(t, renderer()->borderBoxRect().size(), RenderStyle::ExcludeTransformOrigin);
+        style->applyTransform(t, toRenderBox(renderer())->borderBoxRect().size(), RenderStyle::ExcludeTransformOrigin);
     
     m_graphicsLayer->setTransform(t);
 }
@@ -238,7 +238,7 @@ void RenderLayerBacking::updateGraphicsLayerGeometry()
     }
     
     if (m_owningLayer->hasTransform()) {
-        const IntRect borderBox = renderer()->borderBoxRect();
+        const IntRect borderBox = toRenderBox(renderer())->borderBoxRect();
 
         IntRect layerBounds = IntRect(m_owningLayer->xPos(), m_owningLayer->yPos(), borderBox.width(), borderBox.height());
         // Convert to absolute coords to match bbox.
@@ -594,7 +594,10 @@ IntSize RenderLayerBacking::contentOffsetInCompostingLayer()
 
 IntRect RenderLayerBacking::contentsBox(const GraphicsLayer*)
 {
-    IntRect contentsRect = renderer()->contentBoxRect();
+    if (!renderer()->isBox())
+        return IntRect();
+
+    IntRect contentsRect = toRenderBox(renderer())->contentBoxRect();
     IntSize contentOffset = contentOffsetInCompostingLayer();
     contentsRect.move(contentOffset);
     return contentsRect;
@@ -676,8 +679,8 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*
     
     int x = layerBounds.x();        // layerBounds is computed relative to rootLayer
     int y = layerBounds.y();
-    int tx = x - renderer()->x();
-    int ty = y - renderer()->y();
+    int tx = x - toRenderBox(renderer())->x();
+    int ty = y - toRenderBox(renderer())->y();
 
     // If this layer's renderer is a child of the paintingRoot, we render unconditionally, which
     // is done by passing a nil paintingRoot down to our renderer (as if no paintingRoot was ever set).
@@ -692,24 +695,26 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*
         // because we'll be painting the background as well (see RenderBox::paintRootBoxDecorations()).
         IntRect paintBox = clipRectToApply;
         
+        // FIXME: do we need this code?
         if (renderer()->node()->isDocumentNode() && renderer()->document()->isHTMLDocument()) {
-            int w = renderer()->width();
-            int h = renderer()->height();
+            RenderBox* box = toRenderBox(renderer());
+            int w = box->width();
+            int h = box->height();
             
             int rw;
             int rh;
-            if (renderer()->view()->frameView()) {
-                rw = renderer()->view()->frameView()->contentsWidth();
-                rh = renderer()->view()->frameView()->contentsHeight();
+            if (box->view()->frameView()) {
+                rw = box->view()->frameView()->contentsWidth();
+                rh = box->view()->frameView()->contentsHeight();
             } else {
-                rw = renderer()->view()->width();
-                rh = renderer()->view()->height();
+                rw = box->view()->width();
+                rh = box->view()->height();
             }
             
-            int bx = tx - renderer()->marginLeft();
-            int by = ty - renderer()->marginTop();
-            int bw = max(w + renderer()->marginLeft() + renderer()->marginRight() + renderer()->borderLeft() + renderer()->borderRight(), rw);
-            int bh = max(h + renderer()->marginTop() + renderer()->marginBottom() + renderer()->borderTop() + renderer()->borderBottom(), rh);
+            int bx = tx - box->marginLeft();
+            int by = ty - box->marginTop();
+            int bw = max(w + box->marginLeft() + box->marginRight() + box->borderLeft() + box->borderRight(), rw);
+            int bh = max(h + box->marginTop() + box->marginBottom() + box->borderTop() + box->borderBottom(), rh);
             paintBox = IntRect(bx, by, bw, bh);
         }
 
@@ -852,7 +857,7 @@ bool RenderLayerBacking::startAnimation(double beginTime, const Animation* anim,
     bool didAnimateTransform = !hasTransform;
     bool didAnimateOpacity = !hasOpacity;
     
-    if (hasTransform && m_graphicsLayer->animateTransform(transformVector, renderer()->borderBoxRect().size(), anim, beginTime, false))
+    if (hasTransform && m_graphicsLayer->animateTransform(transformVector, toRenderBox(renderer())->borderBoxRect().size(), anim, beginTime, false))
         didAnimateTransform = true;
 
     if (hasOpacity && m_graphicsLayer->animateFloat(AnimatedPropertyOpacity, opacityVector, anim, beginTime))
@@ -888,7 +893,7 @@ bool RenderLayerBacking::startTransition(double beginTime, int property, const R
             GraphicsLayer::TransformValueList transformVector;
             transformVector.insert(0, &fromStyle->transform(), 0);        
             transformVector.insert(1, &toStyle->transform(), 0);        
-            if (m_graphicsLayer->animateTransform(transformVector, renderer()->borderBoxRect().size(), transformAnim, beginTime, true))
+            if (m_graphicsLayer->animateTransform(transformVector, toRenderBox(renderer())->borderBoxRect().size(), transformAnim, beginTime, true))
                 didAnimate = true;
         }
     }
@@ -896,11 +901,6 @@ bool RenderLayerBacking::startTransition(double beginTime, int property, const R
     return didAnimate;
 }
 
-void RenderLayerBacking::notifyTransitionStarted(const GraphicsLayer*, AnimatedPropertyID property, double time)
-{
-    renderer()->animation()->notifyTransitionStarted(renderer(), graphicsLayerToCSSProperty(property), time);
-}
-
 void RenderLayerBacking::notifyAnimationStarted(const GraphicsLayer*, double time)
 {
     renderer()->animation()->notifyAnimationStarted(renderer(), time);
index 7f7cca5..bc4cf97 100644 (file)
@@ -37,6 +37,7 @@
 
 namespace WebCore {
 
+class KeyframeList;
 class RenderLayerCompositor;
 
 // RenderLayerBacking controls the compositing behavior for a single RenderLayer.
@@ -116,7 +117,7 @@ private:
     void createGraphicsLayer();
     void destroyGraphicsLayer();
 
-    RenderBox* renderer() const { return m_owningLayer->renderer(); }
+    RenderBoxModelObject* renderer() const { return m_owningLayer->renderer(); }
     RenderLayerCompositor* compositor() const { return m_owningLayer->compositor(); }
 
     bool updateClippingLayers(bool needsAncestorClip, bool needsDescendantClip);