OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 188 |
189 void RenderLayerBacking::createPrimaryGraphicsLayer() | 189 void RenderLayerBacking::createPrimaryGraphicsLayer() |
190 { | 190 { |
191 String layerName; | 191 String layerName; |
192 #ifndef NDEBUG | 192 #ifndef NDEBUG |
193 layerName = m_owningLayer->debugName(); | 193 layerName = m_owningLayer->debugName(); |
194 #endif | 194 #endif |
195 | 195 |
196 m_graphicsLayer = createGraphicsLayer(layerName, m_owningLayer->compositingR
easons()); | 196 m_graphicsLayer = createGraphicsLayer(layerName, m_owningLayer->compositingR
easons()); |
197 | 197 |
| 198 #if !OS(ANDROID) |
198 if (m_isMainFrameRenderViewLayer) | 199 if (m_isMainFrameRenderViewLayer) |
199 m_graphicsLayer->setContentsOpaque(true); | 200 m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(true
); |
| 201 #endif |
200 | 202 |
201 updateOpacity(renderer()->style()); | 203 updateOpacity(renderer()->style()); |
202 updateTransform(renderer()->style()); | 204 updateTransform(renderer()->style()); |
203 updateFilters(renderer()->style()); | 205 updateFilters(renderer()->style()); |
204 | 206 |
205 if (RuntimeEnabledFeatures::cssCompositingEnabled()) | 207 if (RuntimeEnabledFeatures::cssCompositingEnabled()) |
206 updateLayerBlendMode(renderer()->style()); | 208 updateLayerBlendMode(renderer()->style()); |
207 } | 209 } |
208 | 210 |
209 void RenderLayerBacking::destroyGraphicsLayers() | 211 void RenderLayerBacking::destroyGraphicsLayers() |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 // | 263 // |
262 m_owningLayer->updateOrRemoveFilterEffectRenderer(); | 264 m_owningLayer->updateOrRemoveFilterEffectRenderer(); |
263 setContentsNeedDisplay(); | 265 setContentsNeedDisplay(); |
264 } | 266 } |
265 } | 267 } |
266 | 268 |
267 void RenderLayerBacking::updateLayerBlendMode(const RenderStyle*) | 269 void RenderLayerBacking::updateLayerBlendMode(const RenderStyle*) |
268 { | 270 { |
269 } | 271 } |
270 | 272 |
| 273 void RenderLayerBacking::updateContentsOpaque() |
| 274 { |
| 275 // For non-root layers, background is always painted by the primary graphics
layer. |
| 276 ASSERT(m_isMainFrameRenderViewLayer || !m_backgroundLayer); |
| 277 m_graphicsLayer->setContentsOpaque(m_owningLayer->backgroundIsKnownToBeOpaqu
eInRect(compositedBounds())); |
| 278 } |
| 279 |
271 static bool hasNonZeroTransformOrigin(const RenderObject* renderer) | 280 static bool hasNonZeroTransformOrigin(const RenderObject* renderer) |
272 { | 281 { |
273 RenderStyle* style = renderer->style(); | 282 RenderStyle* style = renderer->style(); |
274 return (style->transformOriginX().type() == Fixed && style->transformOriginX
().value()) | 283 return (style->transformOriginX().type() == Fixed && style->transformOriginX
().value()) |
275 || (style->transformOriginY().type() == Fixed && style->transformOriginY
().value()); | 284 || (style->transformOriginY().type() == Fixed && style->transformOriginY
().value()); |
276 } | 285 } |
277 | 286 |
278 static bool layerOrAncestorIsTransformedOrUsingCompositedScrolling(RenderLayer*
layer) | 287 static bool layerOrAncestorIsTransformedOrUsingCompositedScrolling(RenderLayer*
layer) |
279 { | 288 { |
280 for (RenderLayer* curr = layer; curr; curr = curr->parent()) { | 289 for (RenderLayer* curr = layer; curr; curr = curr->parent()) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 381 |
373 if (flags & IsUpdateRoot) { | 382 if (flags & IsUpdateRoot) { |
374 updateGraphicsLayerGeometry(); | 383 updateGraphicsLayerGeometry(); |
375 layerCompositor->updateRootLayerPosition(); | 384 layerCompositor->updateRootLayerPosition(); |
376 RenderLayer* stackingContainer = m_owningLayer->enclosingStackingCon
tainer(); | 385 RenderLayer* stackingContainer = m_owningLayer->enclosingStackingCon
tainer(); |
377 if (!layerCompositor->compositingLayersNeedRebuild() && stackingCont
ainer && (stackingContainer != m_owningLayer)) | 386 if (!layerCompositor->compositingLayersNeedRebuild() && stackingCont
ainer && (stackingContainer != m_owningLayer)) |
378 layerCompositor->updateCompositingDescendantGeometry(stackingCon
tainer, stackingContainer, flags & CompositingChildrenOnly); | 387 layerCompositor->updateCompositingDescendantGeometry(stackingCon
tainer, stackingContainer, flags & CompositingChildrenOnly); |
379 } | 388 } |
380 } | 389 } |
381 | 390 |
382 if (flags & NeedsFullRepaint && !paintsIntoWindow() && !paintsIntoComposited
Ancestor()) | 391 if (flags & NeedsFullRepaint && !paintsIntoCompositedAncestor()) |
383 setContentsNeedDisplay(); | 392 setContentsNeedDisplay(); |
384 } | 393 } |
385 | 394 |
386 bool RenderLayerBacking::updateGraphicsLayerConfiguration() | 395 bool RenderLayerBacking::updateGraphicsLayerConfiguration() |
387 { | 396 { |
388 RenderLayerCompositor* compositor = this->compositor(); | 397 RenderLayerCompositor* compositor = this->compositor(); |
389 RenderObject* renderer = this->renderer(); | 398 RenderObject* renderer = this->renderer(); |
390 | 399 |
391 m_owningLayer->updateDescendantDependentFlags(); | 400 m_owningLayer->updateDescendantDependentFlags(); |
392 m_owningLayer->updateZOrderLists(); | 401 m_owningLayer->updateZOrderLists(); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 | 574 |
566 FloatSize oldSize = m_graphicsLayer->size(); | 575 FloatSize oldSize = m_graphicsLayer->size(); |
567 if (oldSize != contentsSize) { | 576 if (oldSize != contentsSize) { |
568 m_graphicsLayer->setSize(contentsSize); | 577 m_graphicsLayer->setSize(contentsSize); |
569 // Usually invalidation will happen via layout etc, but if we've affecte
d the layer | 578 // Usually invalidation will happen via layout etc, but if we've affecte
d the layer |
570 // size by constraining relative to a clipping ancestor or the viewport,
we | 579 // size by constraining relative to a clipping ancestor or the viewport,
we |
571 // have to invalidate to avoid showing stretched content. | 580 // have to invalidate to avoid showing stretched content. |
572 if (m_boundsConstrainedByClipping) | 581 if (m_boundsConstrainedByClipping) |
573 m_graphicsLayer->setNeedsDisplay(); | 582 m_graphicsLayer->setNeedsDisplay(); |
574 } | 583 } |
575 if (!m_isMainFrameRenderViewLayer) { | |
576 // For non-root layers, background is always painted by the primary grap
hics layer. | |
577 ASSERT(!m_backgroundLayer); | |
578 m_graphicsLayer->setContentsOpaque(m_owningLayer->backgroundIsKnownToBeO
paqueInRect(localCompositingBounds)); | |
579 } | |
580 | 584 |
581 // If we have a layer that clips children, position it. | 585 // If we have a layer that clips children, position it. |
582 IntRect clippingBox; | 586 IntRect clippingBox; |
583 if (GraphicsLayer* clipLayer = clippingLayer()) { | 587 if (GraphicsLayer* clipLayer = clippingLayer()) { |
584 clippingBox = clipBox(toRenderBox(renderer())); | 588 clippingBox = clipBox(toRenderBox(renderer())); |
585 clipLayer->setPosition(FloatPoint(clippingBox.location() - localComposit
ingBounds.location())); | 589 clipLayer->setPosition(FloatPoint(clippingBox.location() - localComposit
ingBounds.location())); |
586 clipLayer->setSize(clippingBox.size()); | 590 clipLayer->setSize(clippingBox.size()); |
587 clipLayer->setOffsetFromRenderer(toIntSize(clippingBox.location())); | 591 clipLayer->setOffsetFromRenderer(toIntSize(clippingBox.location())); |
588 } | 592 } |
589 | 593 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 m_foregroundLayer->setOffsetFromRenderer(m_scrollingContentsLayer->o
ffsetFromRenderer()); | 723 m_foregroundLayer->setOffsetFromRenderer(m_scrollingContentsLayer->o
ffsetFromRenderer()); |
720 } | 724 } |
721 } | 725 } |
722 | 726 |
723 // If this layer was created just for clipping or to apply perspective, it d
oesn't need its own backing store. | 727 // If this layer was created just for clipping or to apply perspective, it d
oesn't need its own backing store. |
724 setRequiresOwnBackingStore(compositor()->requiresOwnBackingStore(m_owningLay
er, compAncestor)); | 728 setRequiresOwnBackingStore(compositor()->requiresOwnBackingStore(m_owningLay
er, compAncestor)); |
725 | 729 |
726 updateContentsRect(isSimpleContainer); | 730 updateContentsRect(isSimpleContainer); |
727 updateBackgroundColor(isSimpleContainer); | 731 updateBackgroundColor(isSimpleContainer); |
728 updateDrawsContent(isSimpleContainer); | 732 updateDrawsContent(isSimpleContainer); |
| 733 updateContentsOpaque(); |
729 updateAfterWidgetResize(); | 734 updateAfterWidgetResize(); |
730 registerScrollingLayers(); | 735 registerScrollingLayers(); |
731 | 736 |
732 updateCompositingReasons(); | 737 updateCompositingReasons(); |
733 } | 738 } |
734 | 739 |
735 void RenderLayerBacking::registerScrollingLayers() | 740 void RenderLayerBacking::registerScrollingLayers() |
736 { | 741 { |
737 // Register fixed position layers and their containers with the scrolling co
ordinator. | 742 // Register fixed position layers and their containers with the scrolling co
ordinator. |
738 ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m
_owningLayer); | 743 ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m
_owningLayer); |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1323 } | 1328 } |
1324 | 1329 |
1325 // Conservative test for having no rendered children. | 1330 // Conservative test for having no rendered children. |
1326 bool RenderLayerBacking::hasVisibleNonCompositingDescendantLayers() const | 1331 bool RenderLayerBacking::hasVisibleNonCompositingDescendantLayers() const |
1327 { | 1332 { |
1328 return hasVisibleNonCompositingDescendant(m_owningLayer); | 1333 return hasVisibleNonCompositingDescendant(m_owningLayer); |
1329 } | 1334 } |
1330 | 1335 |
1331 bool RenderLayerBacking::containsPaintedContent() const | 1336 bool RenderLayerBacking::containsPaintedContent() const |
1332 { | 1337 { |
1333 if (isSimpleContainerCompositingLayer() || paintsIntoWindow() || paintsIntoC
ompositedAncestor() || m_artificiallyInflatedBounds || m_owningLayer->isReflecti
on()) | 1338 if (isSimpleContainerCompositingLayer() || paintsIntoCompositedAncestor() ||
m_artificiallyInflatedBounds || m_owningLayer->isReflection()) |
1334 return false; | 1339 return false; |
1335 | 1340 |
1336 if (isDirectlyCompositedImage()) | 1341 if (isDirectlyCompositedImage()) |
1337 return false; | 1342 return false; |
1338 | 1343 |
1339 // FIXME: we could optimize cases where the image, video or canvas is known
to fill the border box entirely, | 1344 // FIXME: we could optimize cases where the image, video or canvas is known
to fill the border box entirely, |
1340 // and set background color on the layer in that case, instead of allocating
backing store and painting. | 1345 // and set background color on the layer in that case, instead of allocating
backing store and painting. |
1341 if (renderer()->isVideo() && toRenderVideo(renderer())->shouldDisplayVideo()
) | 1346 if (renderer()->isVideo() && toRenderVideo(renderer())->shouldDisplayVideo()
) |
1342 return m_owningLayer->hasBoxDecorationsOrBackground(); | 1347 return m_owningLayer->hasBoxDecorationsOrBackground(); |
1343 | 1348 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1506 { | 1511 { |
1507 if (m_ancestorClippingLayer) | 1512 if (m_ancestorClippingLayer) |
1508 return m_ancestorClippingLayer.get(); | 1513 return m_ancestorClippingLayer.get(); |
1509 | 1514 |
1510 if (m_contentsContainmentLayer) | 1515 if (m_contentsContainmentLayer) |
1511 return m_contentsContainmentLayer.get(); | 1516 return m_contentsContainmentLayer.get(); |
1512 | 1517 |
1513 return m_graphicsLayer.get(); | 1518 return m_graphicsLayer.get(); |
1514 } | 1519 } |
1515 | 1520 |
1516 bool RenderLayerBacking::paintsIntoWindow() const | |
1517 { | |
1518 if (m_owningLayer->isRootLayer()) { | |
1519 return compositor()->rootLayerAttachment() != RenderLayerCompositor::Roo
tLayerAttachedViaEnclosingFrame; | |
1520 } | |
1521 | |
1522 return false; | |
1523 } | |
1524 | |
1525 void RenderLayerBacking::setRequiresOwnBackingStore(bool requiresOwnBacking) | 1521 void RenderLayerBacking::setRequiresOwnBackingStore(bool requiresOwnBacking) |
1526 { | 1522 { |
1527 if (requiresOwnBacking == m_requiresOwnBackingStore) | 1523 if (requiresOwnBacking == m_requiresOwnBackingStore) |
1528 return; | 1524 return; |
1529 | 1525 |
1530 m_requiresOwnBackingStore = requiresOwnBacking; | 1526 m_requiresOwnBackingStore = requiresOwnBacking; |
1531 | 1527 |
1532 // This affects the answer to paintsIntoCompositedAncestor(), which in turn
affects | 1528 // This affects the answer to paintsIntoCompositedAncestor(), which in turn
affects |
1533 // cached clip rects, so when it changes we have to clear clip rects on desc
endants. | 1529 // cached clip rects, so when it changes we have to clear clip rects on desc
endants. |
1534 m_owningLayer->clearClipRectsIncludingDescendants(PaintingClipRects); | 1530 m_owningLayer->clearClipRectsIncludingDescendants(PaintingClipRects); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1595 IntRect layerDirtyRect = r; | 1591 IntRect layerDirtyRect = r; |
1596 layerDirtyRect.move(-m_scrollingContentsLayer->offsetFromRenderer()); | 1592 layerDirtyRect.move(-m_scrollingContentsLayer->offsetFromRenderer()); |
1597 m_scrollingContentsLayer->setNeedsDisplayInRect(layerDirtyRect); | 1593 m_scrollingContentsLayer->setNeedsDisplayInRect(layerDirtyRect); |
1598 } | 1594 } |
1599 } | 1595 } |
1600 | 1596 |
1601 void RenderLayerBacking::paintIntoLayer(const GraphicsLayer* graphicsLayer, Grap
hicsContext* context, | 1597 void RenderLayerBacking::paintIntoLayer(const GraphicsLayer* graphicsLayer, Grap
hicsContext* context, |
1602 const IntRect& paintDirtyRect, // In the coords of rootLayer
. | 1598 const IntRect& paintDirtyRect, // In the coords of rootLayer
. |
1603 PaintBehavior paintBehavior, GraphicsLayerPaintingPhase pain
tingPhase) | 1599 PaintBehavior paintBehavior, GraphicsLayerPaintingPhase pain
tingPhase) |
1604 { | 1600 { |
1605 if (paintsIntoWindow() || paintsIntoCompositedAncestor()) { | 1601 if (paintsIntoCompositedAncestor()) { |
1606 ASSERT_NOT_REACHED(); | 1602 ASSERT_NOT_REACHED(); |
1607 return; | 1603 return; |
1608 } | 1604 } |
1609 | 1605 |
1610 FontCachePurgePreventer fontCachePurgePreventer; | 1606 FontCachePurgePreventer fontCachePurgePreventer; |
1611 | 1607 |
1612 RenderLayer::PaintLayerFlags paintFlags = 0; | 1608 RenderLayer::PaintLayerFlags paintFlags = 0; |
1613 if (paintingPhase & GraphicsLayerPaintBackground) | 1609 if (paintingPhase & GraphicsLayerPaintBackground) |
1614 paintFlags |= RenderLayer::PaintLayerPaintingCompositingBackgroundPhase; | 1610 paintFlags |= RenderLayer::PaintLayerPaintingCompositingBackgroundPhase; |
1615 if (paintingPhase & GraphicsLayerPaintForeground) | 1611 if (paintingPhase & GraphicsLayerPaintForeground) |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1967 info.addMember(m_childContainmentLayer, "childContainmentLayer"); | 1963 info.addMember(m_childContainmentLayer, "childContainmentLayer"); |
1968 info.addMember(m_maskLayer, "maskLayer"); | 1964 info.addMember(m_maskLayer, "maskLayer"); |
1969 info.addMember(m_layerForHorizontalScrollbar, "layerForHorizontalScrollbar")
; | 1965 info.addMember(m_layerForHorizontalScrollbar, "layerForHorizontalScrollbar")
; |
1970 info.addMember(m_layerForVerticalScrollbar, "layerForVerticalScrollbar"); | 1966 info.addMember(m_layerForVerticalScrollbar, "layerForVerticalScrollbar"); |
1971 info.addMember(m_layerForScrollCorner, "layerForScrollCorner"); | 1967 info.addMember(m_layerForScrollCorner, "layerForScrollCorner"); |
1972 info.addMember(m_scrollingLayer, "scrollingLayer"); | 1968 info.addMember(m_scrollingLayer, "scrollingLayer"); |
1973 info.addMember(m_scrollingContentsLayer, "scrollingContentsLayer"); | 1969 info.addMember(m_scrollingContentsLayer, "scrollingContentsLayer"); |
1974 } | 1970 } |
1975 | 1971 |
1976 } // namespace WebCore | 1972 } // namespace WebCore |
OLD | NEW |