COMMIT_MESSAGE

 1[Qt] When a layer is really opaque (ie has a background color that has 255 alpha) we should fill the layer with that color to tell Qt that the pixemap has no alpha. bug - 40380
 2

WebCore/ChangeLog

 12010-06-09 Sam Magnuson <smagnuson@netflix.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 [Qt] When a layer is really opaque (ie has a background color that
 6 has 255 alpha) we should fill the layer with that color to tell Qt
 7 that the pixemap has no alpha.
 8 https://bugs.webkit.org/show_bug.cgi?id=40380
 9
 10 Adding support for setBackgroundColor/clearBackground color and
 11 using it in QGraphicsLayer to pre-fill the pixmap cache.
 12
 13 No new tests. (OOPS!)
 14
 15 * platform/graphics/qt/GraphicsLayerQt.cpp:
 16 (WebCore::GraphicsLayerQtImpl::recache):
 17 (WebCore::GraphicsLayerQtImpl::paint):
 18 * rendering/RenderLayerBacking.cpp:
 19 (WebCore::is3DCanvas):
 20 (WebCore::RenderLayerBacking::createGraphicsLayer):
 21 (WebCore::RenderLayerBacking::updateLayerTransform):
 22 (WebCore::RenderLayerBacking::updateAfterLayout):
 23 (WebCore::RenderLayerBacking::updateGraphicsLayerConfiguration):
 24 (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
 25 (WebCore::RenderLayerBacking::updateClippingLayers):
 26 (WebCore::RenderLayerBacking::compositingOpacity):
 27 (WebCore::RenderLayerBacking::rendererHasBackground):
 28 (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):
 29 (WebCore::RenderLayerBacking::hasNonCompositingContent):
 30 (WebCore::RenderLayerBacking::rendererContentChanged):
 31 (WebCore::RenderLayerBacking::updateImageContents):
 32 (WebCore::RenderLayerBacking::setContentsNeedDisplay):
 33 (WebCore::RenderLayerBacking::paintIntoLayer):
 34 (WebCore::RenderLayerBacking::paintContents):
 35 (WebCore::RenderLayerBacking::startAnimation):
 36 (WebCore::RenderLayerBacking::startTransition):
 37
1382010-06-07 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
239
340 Reviewed by Simon Hausmann.

WebCore/platform/graphics/qt/GraphicsLayerQt.cpp

@@QPixmap GraphicsLayerQtImpl::recache(const QRegion& regionToUpdate)
309309 QRegion region = regionToUpdate;
310310 QPixmap pixmap;
311311
 312 QColor background = m_currentContent.backgroundColor;
 313 if (!background.isValid())
 314 background = Qt::transparent;
 315
312316 // We might be drawing into an existing cache.
313317 if (!QPixmapCache::find(m_backingStoreKey, &pixmap))
314318 region = QRegion(QRect(0, 0, m_size.width(), m_size.height()));

@@QPixmap GraphicsLayerQtImpl::recache(const QRegion& regionToUpdate)
316320 if (m_size != pixmap.size()) {
317321 pixmap = QPixmap(m_size.toSize());
318322 if (!m_layer->contentsOpaque())
319  pixmap.fill(Qt::transparent);
 323 pixmap.fill(background);
320324 m_pendingContent.regionToUpdate = QRegion(QRect(QPoint(0, 0), m_size.toSize()));
321325 }
322326

@@QPixmap GraphicsLayerQtImpl::recache(const QRegion& regionToUpdate)
324328 GraphicsContext gc(&painter);
325329
326330 // Clear the area in cache that we're drawing into
327  painter.setCompositionMode(QPainter::CompositionMode_Clear);
328  painter.fillRect(region.boundingRect(), Qt::transparent);
 331 if ( background == Qt::transparent )
 332 painter.setCompositionMode(QPainter::CompositionMode_Clear);
 333 else
 334 painter.setCompositionMode(QPainter::CompositionMode_Source);
 335 painter.fillRect(region.boundingRect(), background);
329336
330337 // Render the actual contents into the cache
331338 painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
332339 m_layer->paintGraphicsLayerContents(gc, region.boundingRect());
333340
334  m_backingStoreKey = QPixmapCache::insert(pixmap);
 341 m_backingStoreKey = QPixmapCache::insert(pixmap);
335342 return pixmap;
336343}
337344

@@QRectF GraphicsLayerQtImpl::boundingRect() const
438445
439446void GraphicsLayerQtImpl::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
440447{
441  if (m_currentContent.backgroundColor.isValid())
442  painter->fillRect(option->rect, QColor(m_currentContent.backgroundColor));
443 
444448 switch (m_currentContent.contentType) {
445449 case HTMLContentType:
446450 if (m_state.drawsContent) {

@@void GraphicsLayerQtImpl::paint(QPainter* painter, const QStyleOptionGraphicsIte
452456 }
453457 break;
454458 case PixmapContentType:
 459 if (m_currentContent.backgroundColor.isValid())
 460 painter->fillRect(option->rect, QColor(m_currentContent.backgroundColor));
455461 painter->drawPixmap(m_state.contentsRect, m_currentContent.pixmap);
456462 break;
457463 case ColorContentType:
 464 if (m_currentContent.backgroundColor.isValid())
 465 painter->fillRect(option->rect, QColor(m_currentContent.backgroundColor));
458466 painter->fillRect(m_state.contentsRect, m_currentContent.contentsBackgroundColor);
459467 break;
460468 case MediaContentType:

@@afterLayerChanges:
654662 updateTransform();
655663
656664 if (!recursive)
657  return;
 665 return;
658666
659667 QList<QGraphicsItem*> children = childItems();
660668 if (m_state.maskLayer)

@@void GraphicsLayerQt::setContentsToImage(Image* image)
928936 m_impl->m_pendingContent.pixmap = *pxm;
929937 m_impl->m_pendingContent.contentType = GraphicsLayerQtImpl::PixmapContentType;
930938 return;
931  }
 939 }
932940 }
933941 m_impl->m_pendingContent.pixmap = QPixmap();
934942}

WebCore/rendering/RenderLayerBacking.cpp

2020 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
2121 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2222 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2424 */
2525
2626#include "config.h"
2727
2828#if USE(ACCELERATED_COMPOSITING)
2929
 30#include "RenderLayerBacking.h"
 31
3032#include "AnimationController.h"
31 #if ENABLE(3D_CANVAS)
 33#if ENABLE(3D_CANVAS)
3234#include "WebGLRenderingContext.h"
3335#endif
3436#include "CSSPropertyNames.h"

4446#include "KeyframeList.h"
4547#include "PluginWidget.h"
4648#include "RenderBox.h"
 49#include "RenderEmbeddedObject.h"
4750#include "RenderImage.h"
4851#include "RenderLayerCompositor.h"
49 #include "RenderEmbeddedObject.h"
5052#include "RenderVideo.h"
5153#include "RenderView.h"
5254#include "Settings.h"
5355
54 #include "RenderLayerBacking.h"
5556
5657using namespace std;
5758

@@static bool hasBoxDecorationsOrBackgroundImage(const RenderStyle*);
6566
6667static inline bool is3DCanvas(RenderObject* renderer)
6768{
68 #if ENABLE(3D_CANVAS)
 69#if ENABLE(3D_CANVAS)
6970 if (renderer->isCanvas())
7071 return static_cast<HTMLCanvasElement*>(renderer->node())->is3D();
7172#else

@@RenderLayerBacking::~RenderLayerBacking()
9293void RenderLayerBacking::createGraphicsLayer()
9394{
9495 m_graphicsLayer = GraphicsLayer::create(this);
95 
 96
9697#ifndef NDEBUG
9798 if (renderer()->node()) {
9899 if (renderer()->node()->isDocumentNode())

@@void RenderLayerBacking::createGraphicsLayer()
107108 m_graphicsLayer->setName("Reflection");
108109 else
109110 m_graphicsLayer->setName("Anonymous Node");
110 #endif // NDEBUG
 111#endif // NDEBUG
111112
112113 updateLayerOpacity(renderer()->style());
113114 updateLayerTransform(renderer()->style());

@@void RenderLayerBacking::updateLayerTransform(const RenderStyle* style)
138139 style->applyTransform(t, toRenderBox(renderer())->borderBoxRect().size(), RenderStyle::ExcludeTransformOrigin);
139140 makeMatrixRenderable(t, compositor()->hasAcceleratedCompositing());
140141 }
141 
 142
142143 m_graphicsLayer->setTransform(t);
143144}
144145

@@void RenderLayerBacking::updateAfterLayout(UpdateDepth updateDepth, bool isUpdat
172173 if (!layerCompositor->compositingLayersNeedRebuild()) {
173174 // Calling updateGraphicsLayerGeometry() here gives incorrect results, because the
174175 // position of this layer's GraphicsLayer depends on the position of our compositing
175  // ancestor's GraphicsLayer. That cannot be determined until all the descendant
 176 // ancestor's GraphicsLayer. That cannot be determined until all the descendant
176177 // RenderLayers of that ancestor have been processed via updateLayerPositions().
177178 //
178179 // The solution is to update compositing children of this layer here,
179180 // via updateCompositingChildrenGeometry().
180181 updateCompositedBounds();
181182 layerCompositor->updateCompositingDescendantGeometry(m_owningLayer, m_owningLayer, updateDepth);
182 
 183
183184 if (isUpdateRoot) {
184185 updateGraphicsLayerGeometry();
185186 layerCompositor->updateRootLayerPosition();

@@bool RenderLayerBacking::updateGraphicsLayerConfiguration()
194195 bool layerConfigChanged = false;
195196 if (updateForegroundLayer(compositor->needsContentsCompositingLayer(m_owningLayer)))
196197 layerConfigChanged = true;
197 
 198
198199 if (updateClippingLayers(compositor->clippedByAncestor(m_owningLayer), compositor->clipsCompositingDescendants(m_owningLayer)))
199200 layerConfigChanged = true;
200201

@@bool RenderLayerBacking::updateGraphicsLayerConfiguration()
222223 m_graphicsLayer->setContentsToMedia(mediaElement->platformLayer());
223224 }
224225#endif
225 #if ENABLE(3D_CANVAS)
 226#if ENABLE(3D_CANVAS)
226227 else if (is3DCanvas(renderer())) {
227228 HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(renderer()->node());
228229 WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(canvas->renderingContext());

@@void RenderLayerBacking::updateGraphicsLayerGeometry()
248249 // Set opacity, if it is not animating.
249250 if (!renderer()->animation()->isAnimatingPropertyOnRenderer(renderer(), CSSPropertyOpacity))
250251 updateLayerOpacity(renderer()->style());
251 
 252
252253 RenderStyle* style = renderer()->style();
253254 m_graphicsLayer->setPreserves3D(style->transformStyle3D() == TransformStyle3DPreserve3D && !renderer()->hasReflection());
254255 m_graphicsLayer->setBackfaceVisibility(style->backfaceVisibility() == BackfaceVisibilityVisible);
255256
256257 RenderLayer* compAncestor = m_owningLayer->ancestorCompositingLayer();
257 
 258
258259 // We compute everything relative to the enclosing compositing layer.
259260 IntRect ancestorCompositingBounds;
260261 if (compAncestor) {

@@void RenderLayerBacking::updateGraphicsLayerGeometry()
276277 graphicsLayerParentLocation = toRenderBox(compAncestor->renderer())->overflowClipRect(0, 0).location();
277278 } else
278279 graphicsLayerParentLocation = ancestorCompositingBounds.location();
279 
 280
 281 if ( rendererHasBackground() ) {
 282 const Color &bgColor = rendererBackgroundColor();
 283 m_graphicsLayer->setBackgroundColor(bgColor);
 284 } else
 285 m_graphicsLayer->clearBackgroundColor();
 286
280287 if (compAncestor && m_ancestorClippingLayer) {
281288 // Call calculateRects to get the backgroundRect which is what is used to clip the contents of this
282289 // layer. Note that we call it with temporaryClipRects = true because normally when computing clip rects

@@void RenderLayerBacking::updateGraphicsLayerGeometry()
295302
296303 m_graphicsLayer->setPosition(FloatPoint() + (relativeCompositingBounds.location() - graphicsLayerParentLocation));
297304 m_graphicsLayer->setOffsetFromRenderer(localCompositingBounds.location() - IntPoint());
298 
 305
299306 FloatSize oldSize = m_graphicsLayer->size();
300307 FloatSize newSize = relativeCompositingBounds.size();
301308 if (oldSize != newSize) {

@@void RenderLayerBacking::updateGraphicsLayerGeometry()
314321 m_clippingLayer->setSize(clippingBox.size());
315322 m_clippingLayer->setOffsetFromRenderer(clippingBox.location() - IntPoint());
316323 }
317 
 324
318325 if (m_maskLayer) {
319326 m_maskLayer->setSize(m_graphicsLayer->size());
320327 m_maskLayer->setPosition(FloatPoint());
321328 }
322 
 329
323330 if (m_owningLayer->hasTransform()) {
324331 const IntRect borderBox = toRenderBox(renderer())->borderBoxRect();
325332

@@void RenderLayerBacking::updateGraphicsLayerGeometry()
337344 RenderStyle* style = renderer()->style();
338345 if (style->hasPerspective()) {
339346 TransformationMatrix t = owningLayer()->perspectiveTransform();
340 
 347
341348 if (m_clippingLayer) {
342349 m_clippingLayer->setChildrenTransform(t);
343350 m_graphicsLayer->setChildrenTransform(TransformationMatrix());
344  }
345  else
 351 } else
346352 m_graphicsLayer->setChildrenTransform(t);
347353 } else {
348354 if (m_clippingLayer)

@@void RenderLayerBacking::updateGraphicsLayerGeometry()
374380 if (m_owningLayer->reflectionLayer() && m_owningLayer->reflectionLayer()->isComposited()) {
375381 RenderLayerBacking* reflectionBacking = m_owningLayer->reflectionLayer()->backing();
376382 reflectionBacking->updateGraphicsLayerGeometry();
377 
 383
378384 // The reflection layer has the bounds of m_owningLayer->reflectionLayer(),
379385 // but the reflected layer is the bounds of this layer, so we need to position it appropriately.
380386 FloatRect layerBounds = compositedBounds();

@@bool RenderLayerBacking::updateClippingLayers(bool needsAncestorClip, bool needs
421427 m_ancestorClippingLayer = 0;
422428 layersChanged = true;
423429 }
424 
 430
425431 if (needsDescendantClip) {
426432 if (!m_clippingLayer) {
427433 m_clippingLayer = GraphicsLayer::create(this);

@@bool RenderLayerBacking::updateClippingLayers(bool needsAncestorClip, bool needs
436442 m_clippingLayer = 0;
437443 layersChanged = true;
438444 }
439 
 445
440446 if (layersChanged)
441447 updateInternalHierarchy();
442448

@@GraphicsLayerPaintingPhase RenderLayerBacking::paintingPhaseForPrimaryLayer() co
506512float RenderLayerBacking::compositingOpacity(float rendererOpacity) const
507513{
508514 float finalOpacity = rendererOpacity;
509 
 515
510516 for (RenderLayer* curr = m_owningLayer->parent(); curr; curr = curr->parent()) {
511517 // We only care about parents that are stacking contexts.
512518 // Recall that opacity creates stacking context.
513519 if (!curr->isStackingContext())
514520 continue;
515 
 521
516522 // If we found a compositing layer, we want to compute opacity
517523 // relative to it. So we can break here.
518524 if (curr->isComposited())
519525 break;
520 
 526
521527 finalOpacity *= curr->renderer()->opacity();
522528 }
523529

@@bool RenderLayerBacking::rendererHasBackground() const
546552 RenderObject* htmlObject = renderer()->firstChild();
547553 if (!htmlObject)
548554 return false;
549 
 555
550556 RenderStyle* style = htmlObject->style();
551557 if (style->hasBackground())
552558 return true;
553 
 559
554560 RenderObject* bodyObject = htmlObject->firstChild();
555561 if (!bodyObject)
556562 return false;
557 
 563
558564 style = bodyObject->style();
559565 return style->hasBackground();
560566 }
561 
 567
562568 return renderer()->style()->hasBackground();
563569}
564570

@@const Color& RenderLayerBacking::rendererBackgroundColor() const
585591bool RenderLayerBacking::isSimpleContainerCompositingLayer() const
586592{
587593 RenderObject* renderObject = renderer();
588  if (renderObject->isReplaced() || // replaced objects are not containers
589  renderObject->hasMask()) // masks require special treatment
 594 if (renderObject->isReplaced() // replaced objects are not containers
 595 || renderObject->hasMask()) // masks require special treatment
590596 return false;
591597
592598 RenderStyle* style = renderObject->style();

@@bool RenderLayerBacking::isSimpleContainerCompositingLayer() const
600606 // If we have got this far and the renderer has no children, then we're ok.
601607 if (!renderObject->firstChild())
602608 return true;
603 
 609
604610 if (renderObject->node() && renderObject->node()->isDocumentNode()) {
605611 // Look to see if the root object has a non-simple backgound
606612 RenderObject* rootObject = renderObject->document()->documentElement()->renderer();
607613 if (!rootObject)
608614 return false;
609 
 615
610616 style = rootObject->style();
611 
 617
612618 // Reject anything that has a border, a border-radius or outline,
613619 // or is not a simple background (no background, or solid color).
614620 if (hasBoxDecorationsOrBackgroundImage(style))
615621 return false;
616 
 622
617623 // Now look at the body's renderer.
618624 HTMLElement* body = renderObject->document()->body();
619625 RenderObject* bodyObject = (body && body->hasLocalName(bodyTag)) ? body->renderer() : 0;
620626 if (!bodyObject)
621627 return false;
622 
 628
623629 style = bodyObject->style();
624 
 630
625631 if (hasBoxDecorationsOrBackgroundImage(style))
626632 return false;
627633
628634 // Ceck to see if all the body's children are compositing layers.
629635 if (hasNonCompositingContent())
630636 return false;
631 
 637
632638 return true;
633639 }
634640
635641 // Check to see if all the renderer's children are compositing layers.
636642 if (hasNonCompositingContent())
637643 return false;
638 
 644
639645 return true;
640646}
641647

@@bool RenderLayerBacking::hasNonCompositingContent() const
644650{
645651 if (m_owningLayer->hasOverflowControls())
646652 return true;
647 
 653
648654 // Some HTML can cause whitespace text nodes to have renderers, like:
649655 // <div>
650656 // <img src=...>

@@bool RenderLayerBacking::hasNonCompositingContent() const
654660 if (!child->hasLayer()) {
655661 if (child->isRenderInline() || !child->isBox())
656662 return true;
657 
 663
658664 if (toRenderBox(child)->width() > 0 || toRenderBox(child)->height() > 0)
659665 return true;
660666 }

@@void RenderLayerBacking::rendererContentChanged()
724730 return;
725731 }
726732
727 #if ENABLE(3D_CANVAS)
 733#if ENABLE(3D_CANVAS)
728734 if (is3DCanvas(renderer())) {
729735 m_graphicsLayer->setGraphicsContext3DNeedsDisplay();
730736 return;

@@void RenderLayerBacking::updateImageContents()
751757
752758 // This is a no-op if the layer doesn't have an inner layer for the image.
753759 m_graphicsLayer->setContentsToImage(image);
754 
 760
755761 // Image animation is "lazy", in that it automatically stops unless someone is drawing
756762 // the image. So we have to kick the animation each time; this has the downside that the
757763 // image will keep animating, even if its layer is not visible.

@@void RenderLayerBacking::setContentsNeedDisplay()
830836{
831837 if (m_graphicsLayer && m_graphicsLayer->drawsContent())
832838 m_graphicsLayer->setNeedsDisplay();
833 
 839
834840 if (m_foregroundLayer && m_foregroundLayer->drawsContent())
835841 m_foregroundLayer->setNeedsDisplay();
836842

@@static void restoreClip(GraphicsContext* p, const IntRect& paintDirtyRect, const
877883
878884// Share this with RenderLayer::paintLayer, which would have to be educated about GraphicsLayerPaintingPhase?
879885void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext* context,
880  const IntRect& paintDirtyRect, // in the coords of rootLayer
 886 const IntRect& paintDirtyRect, // in the coords of rootLayer
881887 PaintBehavior paintBehavior, GraphicsLayerPaintingPhase paintingPhase,
882888 RenderObject* paintingRoot)
883889{

@@void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*
885891 ASSERT_NOT_REACHED();
886892 return;
887893 }
888 
 894
889895 m_owningLayer->updateLayerListsIfNeeded();
890 
 896
891897 // Calculate the clip rects we should use.
892898 IntRect layerBounds, damageRect, clipRectToApply, outlineRect;
893899 m_owningLayer->calculateRects(rootLayer, paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect);
894 
895  int x = layerBounds.x(); // layerBounds is computed relative to rootLayer
 900
 901 int x = layerBounds.x(); // layerBounds is computed relative to rootLayer
896902 int y = layerBounds.y();
897903 int tx = x - m_owningLayer->renderBoxX();
898904 int ty = y - m_owningLayer->renderBoxY();

@@void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*
901907 // is done by passing a nil paintingRoot down to our renderer (as if no paintingRoot was ever set).
902908 // Else, our renderer tree may or may not contain the painting root, so we pass that root along
903909 // so it will be tested against as we decend through the renderers.
904  RenderObject *paintingRootForRenderer = 0;
 910 RenderObject* paintingRootForRenderer = 0;
905911 if (paintingRoot && !renderer()->isDescendantOf(paintingRoot))
906912 paintingRootForRenderer = paintingRoot;
907913

@@void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*
911917 // If this is the root then we need to send in a bigger bounding box
912918 // because we'll be painting the background as well (see RenderBox::paintRootBoxDecorations()).
913919 IntRect paintBox = clipRectToApply;
914 
 920
915921 // FIXME: do we need this code?
916922 if (renderer()->node() && renderer()->node()->isDocumentNode() && renderer()->document()->isHTMLDocument()) {
917923 RenderBox* box = toRenderBox(renderer());
918924 int w = box->width();
919925 int h = box->height();
920 
 926
921927 int rw;
922928 int rh;
923929 if (FrameView* frameView = box->view()->frameView()) {

@@void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*
927933 rw = box->view()->width();
928934 rh = box->view()->height();
929935 }
930 
 936
931937 int bx = tx - box->marginLeft();
932938 int by = ty - box->marginTop();
933939 int bw = max(w + box->marginLeft() + box->marginRight() + box->borderLeft() + box->borderRight(), rw);

@@void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*
938944 // Paint our background first, before painting any child layers.
939945 // Establish the clip used to paint our background.
940946 setClip(context, paintDirtyRect, damageRect);
941 
 947
942948 RenderObject::PaintInfo info(context, paintBox, PaintPhaseBlockBackground, false, paintingRootForRenderer, 0);
943949 renderer()->paint(info, tx, ty);
944950

@@void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*
946952 // z-index. We paint after we painted the background/border, so that the scrollbars will
947953 // sit above the background/border.
948954 m_owningLayer->paintOverflowControls(context, x, y, damageRect);
949 
 955
950956 // Restore the clip.
951957 restoreClip(context, paintDirtyRect, damageRect);
952958 }
953 
 959
954960 bool forceBlackText = paintBehavior & PaintBehaviorForceBlackText;
955961 bool selectionOnly = paintBehavior & PaintBehaviorSelectionOnly;
956962

@@void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*
965971
966972 // Set up the clip used when painting our children.
967973 setClip(context, paintDirtyRect, clipRectToApply);
968  RenderObject::PaintInfo paintInfo(context, clipRectToApply,
 974 RenderObject::PaintInfo paintInfo(context, clipRectToApply,
969975 selectionOnly ? PaintPhaseSelection : PaintPhaseChildBlockBackgrounds,
970976 forceBlackText, paintingRootForRenderer, 0);
971977 renderer()->paint(paintInfo, tx, ty);

@@void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*
10061012 it[0]->paintLayer(rootLayer, context, paintDirtyRect, paintBehavior, paintingRoot);
10071013 }
10081014 }
1009 
 1015
10101016 if (shouldPaint && (paintingPhase & GraphicsLayerPaintMask)) {
10111017 if (renderer()->hasMask() && !selectionOnly && !damageRect.isEmpty()) {
10121018 setClip(context, paintDirtyRect, damageRect);

@@void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*
10141020 // Paint the mask.
10151021 RenderObject::PaintInfo paintInfo(context, damageRect, PaintPhaseMask, false, paintingRootForRenderer, 0);
10161022 renderer()->paint(paintInfo, tx, ty);
1017 
 1023
10181024 // Restore the clip.
10191025 restoreClip(context, paintDirtyRect, damageRect);
10201026 }

@@void RenderLayerBacking::paintContents(const GraphicsLayer*, GraphicsContext& co
10491055 IntRect enclosingBBox = compositedBounds();
10501056
10511057 IntRect clipRect(clip);
1052 
 1058
10531059 // Set up the coordinate space to be in the layer's rendering coordinates.
10541060 context.translate(-enclosingBBox.x(), -enclosingBBox.y());
10551061
10561062 // Offset the clip.
10571063 clipRect.move(enclosingBBox.x(), enclosingBBox.y());
1058 
 1064
10591065 // The dirtyRect is in the coords of the painting root.
10601066 IntRect dirtyRect = enclosingBBox;
10611067 dirtyRect.intersect(clipRect);

@@bool RenderLayerBacking::startAnimation(double timeOffset, const Animation* anim
10821088{
10831089 bool hasOpacity = keyframes.containsProperty(CSSPropertyOpacity);
10841090 bool hasTransform = keyframes.containsProperty(CSSPropertyWebkitTransform);
1085 
 1091
10861092 if (!hasOpacity && !hasTransform)
10871093 return false;
1088 
 1094
10891095 KeyframeValueList transformVector(AnimatedPropertyWebkitTransform);
10901096 KeyframeValueList opacityVector(AnimatedPropertyOpacity);
10911097

@@bool RenderLayerBacking::startAnimation(double timeOffset, const Animation* anim
10951101
10961102 if (!keyframeStyle)
10971103 continue;
1098 
 1104
10991105 // get timing function
11001106 const TimingFunction* tf = keyframeStyle->hasAnimations() ? &((*keyframeStyle->animations()).animation(0)->timingFunction()) : 0;
1101 
 1107
11021108 if (hasTransform)
11031109 transformVector.insert(new TransformAnimationValue(key, &(keyframeStyle->transform()), tf));
1104 
 1110
11051111 if (hasOpacity)
11061112 opacityVector.insert(new FloatAnimationValue(key, keyframeStyle->opacity(), tf));
11071113 }
11081114
11091115 bool didAnimateTransform = !hasTransform;
11101116 bool didAnimateOpacity = !hasOpacity;
1111 
 1117
11121118 if (hasTransform && m_graphicsLayer->addAnimation(transformVector, toRenderBox(renderer())->borderBoxRect().size(), anim, keyframes.animationName(), timeOffset))
11131119 didAnimateTransform = true;
11141120
11151121 if (hasOpacity && m_graphicsLayer->addAnimation(opacityVector, IntSize(), anim, keyframes.animationName(), timeOffset))
11161122 didAnimateOpacity = true;
1117 
 1123
11181124 bool runningAcceleratedAnimation = didAnimateTransform && didAnimateOpacity;
11191125 if (runningAcceleratedAnimation)
11201126 compositor()->didStartAcceleratedAnimation();

@@bool RenderLayerBacking::startTransition(double timeOffset, int property, const
11581164
11591165 if (didAnimate)
11601166 compositor()->didStartAcceleratedAnimation();
1161 
 1167
11621168 return didAnimate;
11631169}
11641170

@@int RenderLayerBacking::graphicsLayerToCSSProperty(AnimatedPropertyID property)
12141220{
12151221 int cssProperty = CSSPropertyInvalid;
12161222 switch (property) {
1217  case AnimatedPropertyWebkitTransform:
1218  cssProperty = CSSPropertyWebkitTransform;
1219  break;
1220  case AnimatedPropertyOpacity:
1221  cssProperty = CSSPropertyOpacity;
1222  break;
1223  case AnimatedPropertyBackgroundColor:
1224  cssProperty = CSSPropertyBackgroundColor;
1225  break;
1226  case AnimatedPropertyInvalid:
1227  ASSERT_NOT_REACHED();
 1223 case AnimatedPropertyWebkitTransform:
 1224 cssProperty = CSSPropertyWebkitTransform;
 1225 break;
 1226 case AnimatedPropertyOpacity:
 1227 cssProperty = CSSPropertyOpacity;
 1228 break;
 1229 case AnimatedPropertyBackgroundColor:
 1230 cssProperty = CSSPropertyBackgroundColor;
 1231 break;
 1232 case AnimatedPropertyInvalid:
 1233 ASSERT_NOT_REACHED();
12281234 }
12291235 return cssProperty;
12301236}

@@int RenderLayerBacking::graphicsLayerToCSSProperty(AnimatedPropertyID property)
12321238AnimatedPropertyID RenderLayerBacking::cssToGraphicsLayerProperty(int cssProperty)
12331239{
12341240 switch (cssProperty) {
1235  case CSSPropertyWebkitTransform:
1236  return AnimatedPropertyWebkitTransform;
1237  case CSSPropertyOpacity:
1238  return AnimatedPropertyOpacity;
1239  case CSSPropertyBackgroundColor:
1240  return AnimatedPropertyBackgroundColor;
 1241 case CSSPropertyWebkitTransform:
 1242 return AnimatedPropertyWebkitTransform;
 1243 case CSSPropertyOpacity:
 1244 return AnimatedPropertyOpacity;
 1245 case CSSPropertyBackgroundColor:
 1246 return AnimatedPropertyBackgroundColor;
12411247 // It's fine if we see other css properties here; they are just not accelerated.
12421248 }
12431249 return AnimatedPropertyInvalid;