| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 #if !OS(ANDROID) | 205 #if !OS(ANDROID) |
| 206 if (m_isMainFrameRenderViewLayer) | 206 if (m_isMainFrameRenderViewLayer) |
| 207 m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(true
); | 207 m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(true
); |
| 208 #endif | 208 #endif |
| 209 | 209 |
| 210 updateOpacity(renderer()->style()); | 210 updateOpacity(renderer()->style()); |
| 211 updateTransform(renderer()->style()); | 211 updateTransform(renderer()->style()); |
| 212 updateFilters(renderer()->style()); | 212 updateFilters(renderer()->style()); |
| 213 | 213 |
| 214 if (RuntimeEnabledFeatures::cssCompositingEnabled()) | 214 if (RuntimeEnabledFeatures::cssCompositingEnabled()) { |
| 215 updateLayerBlendMode(renderer()->style()); | 215 updateLayerBlendMode(renderer()->style()); |
| 216 updateIsRootForIsolatedGroup(); |
| 217 } |
| 216 } | 218 } |
| 217 | 219 |
| 218 void CompositedLayerMapping::destroyGraphicsLayers() | 220 void CompositedLayerMapping::destroyGraphicsLayers() |
| 219 { | 221 { |
| 220 if (m_graphicsLayer) | 222 if (m_graphicsLayer) |
| 221 m_graphicsLayer->removeFromParent(); | 223 m_graphicsLayer->removeFromParent(); |
| 222 | 224 |
| 223 m_ancestorClippingLayer = nullptr; | 225 m_ancestorClippingLayer = nullptr; |
| 224 m_graphicsLayer = nullptr; | 226 m_graphicsLayer = nullptr; |
| 225 m_foregroundLayer = nullptr; | 227 m_foregroundLayer = nullptr; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 // | 264 // |
| 263 // Similarly, if filters used to be painted in the compositor and are no
w painted in software, we need to: | 265 // Similarly, if filters used to be painted in the compositor and are no
w painted in software, we need to: |
| 264 // (1) Create a FilterEffectRenderer. | 266 // (1) Create a FilterEffectRenderer. |
| 265 // (2) Repaint the layer contents to apply a software filter because the
compositor won't apply it. | 267 // (2) Repaint the layer contents to apply a software filter because the
compositor won't apply it. |
| 266 // | 268 // |
| 267 m_owningLayer->updateOrRemoveFilterEffectRenderer(); | 269 m_owningLayer->updateOrRemoveFilterEffectRenderer(); |
| 268 setContentsNeedDisplay(); | 270 setContentsNeedDisplay(); |
| 269 } | 271 } |
| 270 } | 272 } |
| 271 | 273 |
| 272 void CompositedLayerMapping::updateLayerBlendMode(const RenderStyle*) | 274 void CompositedLayerMapping::updateLayerBlendMode(const RenderStyle* style) |
| 273 { | 275 { |
| 276 setBlendMode(style->blendMode()); |
| 277 } |
| 278 |
| 279 void CompositedLayerMapping::updateIsRootForIsolatedGroup() |
| 280 { |
| 281 bool isolate = m_owningLayer->shouldIsolateCompositedDescendants(); |
| 282 |
| 283 // non stacking context layers should never isolate |
| 284 ASSERT(m_owningLayer->stackingNode()->isStackingContext() || !isolate); |
| 285 |
| 286 m_graphicsLayer->setIsRootForIsolatedGroup(isolate); |
| 274 } | 287 } |
| 275 | 288 |
| 276 void CompositedLayerMapping::updateContentsOpaque() | 289 void CompositedLayerMapping::updateContentsOpaque() |
| 277 { | 290 { |
| 278 // For non-root layers, background is always painted by the primary graphics
layer. | 291 // For non-root layers, background is always painted by the primary graphics
layer. |
| 279 ASSERT(m_isMainFrameRenderViewLayer || !m_backgroundLayer); | 292 ASSERT(m_isMainFrameRenderViewLayer || !m_backgroundLayer); |
| 280 if (m_backgroundLayer) { | 293 if (m_backgroundLayer) { |
| 281 m_graphicsLayer->setContentsOpaque(false); | 294 m_graphicsLayer->setContentsOpaque(false); |
| 282 m_backgroundLayer->setContentsOpaque(m_owningLayer->backgroundIsKnownToB
eOpaqueInRect(compositedBounds())); | 295 m_backgroundLayer->setContentsOpaque(m_owningLayer->backgroundIsKnownToB
eOpaqueInRect(compositedBounds())); |
| 283 } else { | 296 } else { |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 ? !hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyWebkitTransfo
rm) | 543 ? !hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyWebkitTransfo
rm) |
| 531 : !renderer()->animation().isRunningAcceleratedAnimationOnRenderer(rende
rer(), CSSPropertyWebkitTransform)) | 544 : !renderer()->animation().isRunningAcceleratedAnimationOnRenderer(rende
rer(), CSSPropertyWebkitTransform)) |
| 532 updateTransform(renderer()->style()); | 545 updateTransform(renderer()->style()); |
| 533 | 546 |
| 534 // Set opacity, if it is not animating. | 547 // Set opacity, if it is not animating. |
| 535 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled() | 548 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled() |
| 536 ? !hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyOpacity) | 549 ? !hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyOpacity) |
| 537 : !renderer()->animation().isRunningAcceleratedAnimationOnRenderer(rende
rer(), CSSPropertyOpacity)) | 550 : !renderer()->animation().isRunningAcceleratedAnimationOnRenderer(rende
rer(), CSSPropertyOpacity)) |
| 538 updateOpacity(renderer()->style()); | 551 updateOpacity(renderer()->style()); |
| 539 | 552 |
| 540 if (RuntimeEnabledFeatures::cssCompositingEnabled()) | |
| 541 updateLayerBlendMode(renderer()->style()); | |
| 542 | |
| 543 bool isSimpleContainer = isSimpleContainerCompositingLayer(); | 553 bool isSimpleContainer = isSimpleContainerCompositingLayer(); |
| 544 | 554 |
| 545 m_owningLayer->updateDescendantDependentFlags(); | 555 m_owningLayer->updateDescendantDependentFlags(); |
| 546 | 556 |
| 547 // m_graphicsLayer is the corresponding GraphicsLayer for this RenderLayer a
nd its non-compositing | 557 // m_graphicsLayer is the corresponding GraphicsLayer for this RenderLayer a
nd its non-compositing |
| 548 // descendants. So, the visibility flag for m_graphicsLayer should be true i
f there are any | 558 // descendants. So, the visibility flag for m_graphicsLayer should be true i
f there are any |
| 549 // non-compositing visible layers. | 559 // non-compositing visible layers. |
| 550 bool contentsVisible = m_owningLayer->hasVisibleContent() || hasVisibleNonCo
mpositingDescendantLayers(); | 560 bool contentsVisible = m_owningLayer->hasVisibleContent() || hasVisibleNonCo
mpositingDescendantLayers(); |
| 551 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && renderer()->i
sVideo()) { | 561 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && renderer()->i
sVideo()) { |
| 552 HTMLMediaElement* mediaElement = toHTMLMediaElement(renderer()->node()); | 562 HTMLMediaElement* mediaElement = toHTMLMediaElement(renderer()->node()); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 } | 790 } |
| 781 } | 791 } |
| 782 | 792 |
| 783 if (m_owningLayer->scrollableArea()) | 793 if (m_owningLayer->scrollableArea()) |
| 784 m_owningLayer->scrollableArea()->positionOverflowControls(); | 794 m_owningLayer->scrollableArea()->positionOverflowControls(); |
| 785 | 795 |
| 786 // We can't make this call in RenderLayerCompositor::allocateOrClearComposit
edLayerMapping | 796 // We can't make this call in RenderLayerCompositor::allocateOrClearComposit
edLayerMapping |
| 787 // since it depends on whether compAncestor draws content, which gets update
d later. | 797 // since it depends on whether compAncestor draws content, which gets update
d later. |
| 788 updateRequiresOwnBackingStoreForAncestorReasons(compAncestor); | 798 updateRequiresOwnBackingStoreForAncestorReasons(compAncestor); |
| 789 | 799 |
| 800 if (RuntimeEnabledFeatures::cssCompositingEnabled()) { |
| 801 updateLayerBlendMode(style); |
| 802 updateIsRootForIsolatedGroup(); |
| 803 } |
| 804 |
| 790 updateContentsRect(isSimpleContainer); | 805 updateContentsRect(isSimpleContainer); |
| 791 updateBackgroundColor(isSimpleContainer); | 806 updateBackgroundColor(isSimpleContainer); |
| 792 updateDrawsContent(isSimpleContainer); | 807 updateDrawsContent(isSimpleContainer); |
| 793 updateContentsOpaque(); | 808 updateContentsOpaque(); |
| 794 updateAfterWidgetResize(); | 809 updateAfterWidgetResize(); |
| 795 registerScrollingLayers(); | 810 registerScrollingLayers(); |
| 796 | 811 |
| 797 updateCompositingReasons(); | 812 updateCompositingReasons(); |
| 798 } | 813 } |
| 799 | 814 |
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1582 void CompositedLayerMapping::paintsIntoCompositedAncestorChanged() | 1597 void CompositedLayerMapping::paintsIntoCompositedAncestorChanged() |
| 1583 { | 1598 { |
| 1584 // The answer to paintsIntoCompositedAncestor() affects cached clip rects, s
o when | 1599 // The answer to paintsIntoCompositedAncestor() affects cached clip rects, s
o when |
| 1585 // it changes we have to clear clip rects on descendants. | 1600 // it changes we have to clear clip rects on descendants. |
| 1586 m_owningLayer->clipper().clearClipRectsIncludingDescendants(PaintingClipRect
s); | 1601 m_owningLayer->clipper().clearClipRectsIncludingDescendants(PaintingClipRect
s); |
| 1587 m_owningLayer->repainter().computeRepaintRectsIncludingDescendants(); | 1602 m_owningLayer->repainter().computeRepaintRectsIncludingDescendants(); |
| 1588 | 1603 |
| 1589 compositor()->repaintInCompositedAncestor(m_owningLayer, compositedBounds())
; | 1604 compositor()->repaintInCompositedAncestor(m_owningLayer, compositedBounds())
; |
| 1590 } | 1605 } |
| 1591 | 1606 |
| 1592 void CompositedLayerMapping::setBlendMode(blink::WebBlendMode) | 1607 void CompositedLayerMapping::setBlendMode(blink::WebBlendMode blendMode) |
| 1593 { | 1608 { |
| 1609 if (m_ancestorClippingLayer) { |
| 1610 ASSERT(childForSuperlayers() == m_ancestorClippingLayer.get()); |
| 1611 m_graphicsLayer->setBlendMode(blink::WebBlendModeNormal); |
| 1612 } else { |
| 1613 ASSERT(childForSuperlayers() == m_graphicsLayer.get()); |
| 1614 } |
| 1615 childForSuperlayers()->setBlendMode(blendMode); |
| 1594 } | 1616 } |
| 1595 | 1617 |
| 1596 void CompositedLayerMapping::setContentsNeedDisplay() | 1618 void CompositedLayerMapping::setContentsNeedDisplay() |
| 1597 { | 1619 { |
| 1598 ASSERT(!paintsIntoCompositedAncestor()); | 1620 ASSERT(!paintsIntoCompositedAncestor()); |
| 1599 | 1621 |
| 1600 if (m_graphicsLayer && m_graphicsLayer->drawsContent()) | 1622 if (m_graphicsLayer && m_graphicsLayer->drawsContent()) |
| 1601 m_graphicsLayer->setNeedsDisplay(); | 1623 m_graphicsLayer->setNeedsDisplay(); |
| 1602 | 1624 |
| 1603 if (m_foregroundLayer && m_foregroundLayer->drawsContent()) | 1625 if (m_foregroundLayer && m_foregroundLayer->drawsContent()) |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2026 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2048 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
| 2027 name = "Scrolling Contents Layer"; | 2049 name = "Scrolling Contents Layer"; |
| 2028 } else { | 2050 } else { |
| 2029 ASSERT_NOT_REACHED(); | 2051 ASSERT_NOT_REACHED(); |
| 2030 } | 2052 } |
| 2031 | 2053 |
| 2032 return name; | 2054 return name; |
| 2033 } | 2055 } |
| 2034 | 2056 |
| 2035 } // namespace WebCore | 2057 } // namespace WebCore |
| OLD | NEW |