Chromium Code Reviews| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 337 if (hasAncestorClippingLayer && clippingAncestorIsScrollParent) | 337 if (hasAncestorClippingLayer && clippingAncestorIsScrollParent) |
| 338 return false; | 338 return false; |
| 339 | 339 |
| 340 return true; | 340 return true; |
| 341 } | 341 } |
| 342 | 342 |
| 343 void CompositedLayerMapping::updateCompositedBounds() | 343 void CompositedLayerMapping::updateCompositedBounds() |
| 344 { | 344 { |
| 345 // We need to know if we draw content in order to update our bounds (this ha s an effect | 345 // We need to know if we draw content in order to update our bounds (this ha s an effect |
| 346 // on whether or not descendands will paint into our backing). Update this v alue now. | 346 // on whether or not descendands will paint into our backing). Update this v alue now. |
| 347 updateDrawsContent(isSimpleContainerCompositingLayer()); | 347 updateDrawsContent(); |
| 348 | 348 |
| 349 LayoutRect layerBounds = compositor()->calculateCompositedBounds(m_owningLay er, m_owningLayer); | 349 LayoutRect layerBounds = compositor()->calculateCompositedBounds(m_owningLay er, m_owningLayer); |
| 350 | 350 |
| 351 // Clip to the size of the document or enclosing overflow-scroll layer. | 351 // Clip to the size of the document or enclosing overflow-scroll layer. |
| 352 // If this or an ancestor is transformed, we can't currently compute the cor rect rect to intersect with. | 352 // If this or an ancestor is transformed, we can't currently compute the cor rect rect to intersect with. |
| 353 // We'd need RenderObject::convertContainerToLocalQuad(), which doesn't yet exist. | 353 // We'd need RenderObject::convertContainerToLocalQuad(), which doesn't yet exist. |
| 354 if (shouldClipCompositedBounds()) { | 354 if (shouldClipCompositedBounds()) { |
| 355 RenderView* view = m_owningLayer->renderer()->view(); | 355 RenderView* view = m_owningLayer->renderer()->view(); |
| 356 RenderLayer* rootLayer = view->layer(); | 356 RenderLayer* rootLayer = view->layer(); |
| 357 | 357 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 505 | 505 |
| 506 if (m_owningLayer->reflectionInfo()) { | 506 if (m_owningLayer->reflectionInfo()) { |
| 507 if (m_owningLayer->reflectionInfo()->reflectionLayer()->hasCompositedLay erMapping()) { | 507 if (m_owningLayer->reflectionInfo()->reflectionLayer()->hasCompositedLay erMapping()) { |
| 508 GraphicsLayer* reflectionLayer = m_owningLayer->reflectionInfo()->re flectionLayer()->compositedLayerMapping()->mainGraphicsLayer(); | 508 GraphicsLayer* reflectionLayer = m_owningLayer->reflectionInfo()->re flectionLayer()->compositedLayerMapping()->mainGraphicsLayer(); |
| 509 m_graphicsLayer->setReplicatedByLayer(reflectionLayer); | 509 m_graphicsLayer->setReplicatedByLayer(reflectionLayer); |
| 510 } | 510 } |
| 511 } else { | 511 } else { |
| 512 m_graphicsLayer->setReplicatedByLayer(0); | 512 m_graphicsLayer->setReplicatedByLayer(0); |
| 513 } | 513 } |
| 514 | 514 |
| 515 updateBackgroundColor(isSimpleContainerCompositingLayer()); | 515 updateBackgroundColor(); |
| 516 | 516 |
| 517 if (isDirectlyCompositedImage()) | 517 if (isDirectlyCompositedImage()) |
| 518 updateImageContents(); | 518 updateImageContents(); |
| 519 | 519 |
| 520 if (renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->allows AcceleratedCompositing()) { | 520 if (renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->allows AcceleratedCompositing()) { |
| 521 PluginView* pluginView = toPluginView(toRenderWidget(renderer)->widget() ); | 521 PluginView* pluginView = toPluginView(toRenderWidget(renderer)->widget() ); |
| 522 m_graphicsLayer->setContentsToPlatformLayer(pluginView->platformLayer()) ; | 522 m_graphicsLayer->setContentsToPlatformLayer(pluginView->platformLayer()) ; |
| 523 } else if (renderer->node() && renderer->node()->isFrameOwnerElement() && to HTMLFrameOwnerElement(renderer->node())->contentFrame()) { | 523 } else if (renderer->node() && renderer->node()->isFrameOwnerElement() && to HTMLFrameOwnerElement(renderer->node())->contentFrame()) { |
| 524 blink::WebLayer* layer = toHTMLFrameOwnerElement(renderer->node())->cont entFrame()->remotePlatformLayer(); | 524 blink::WebLayer* layer = toHTMLFrameOwnerElement(renderer->node())->cont entFrame()->remotePlatformLayer(); |
| 525 if (layer) | 525 if (layer) |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 626 | 626 |
| 627 // Set transform property, if it is not animating. We have to do this here b ecause the transform | 627 // Set transform property, if it is not animating. We have to do this here b ecause the transform |
| 628 // is affected by the layer dimensions. | 628 // is affected by the layer dimensions. |
| 629 if (!hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyWebkitTransform )) | 629 if (!hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyWebkitTransform )) |
| 630 updateTransform(renderer()->style()); | 630 updateTransform(renderer()->style()); |
| 631 | 631 |
| 632 // Set opacity, if it is not animating. | 632 // Set opacity, if it is not animating. |
| 633 if (!hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyOpacity)) | 633 if (!hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyOpacity)) |
| 634 updateOpacity(renderer()->style()); | 634 updateOpacity(renderer()->style()); |
| 635 | 635 |
| 636 bool isSimpleContainer = isSimpleContainerCompositingLayer(); | |
| 637 | |
| 638 m_owningLayer->updateDescendantDependentFlags(); | 636 m_owningLayer->updateDescendantDependentFlags(); |
| 639 | 637 |
| 640 // m_graphicsLayer is the corresponding GraphicsLayer for this RenderLayer a nd its non-compositing | 638 // m_graphicsLayer is the corresponding GraphicsLayer for this RenderLayer a nd its non-compositing |
| 641 // descendants. So, the visibility flag for m_graphicsLayer should be true i f there are any | 639 // descendants. So, the visibility flag for m_graphicsLayer should be true i f there are any |
| 642 // non-compositing visible layers. | 640 // non-compositing visible layers. |
| 643 bool contentsVisible = m_owningLayer->hasVisibleContent() || hasVisibleNonCo mpositingDescendantLayers(); | 641 bool contentsVisible = m_owningLayer->hasVisibleContent() || hasVisibleNonCo mpositingDescendantLayers(); |
| 644 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && renderer()->i sVideo()) { | 642 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && renderer()->i sVideo()) { |
| 645 HTMLMediaElement* mediaElement = toHTMLMediaElement(renderer()->node()); | 643 HTMLMediaElement* mediaElement = toHTMLMediaElement(renderer()->node()); |
| 646 if (mediaElement->isFullscreen()) | 644 if (mediaElement->isFullscreen()) |
| 647 contentsVisible = false; | 645 contentsVisible = false; |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 848 | 846 |
| 849 // We can't make this call in RenderLayerCompositor::allocateOrClearComposit edLayerMapping | 847 // We can't make this call in RenderLayerCompositor::allocateOrClearComposit edLayerMapping |
| 850 // since it depends on whether compAncestor draws content, which gets update d later. | 848 // since it depends on whether compAncestor draws content, which gets update d later. |
| 851 updateRequiresOwnBackingStoreForAncestorReasons(compAncestor); | 849 updateRequiresOwnBackingStoreForAncestorReasons(compAncestor); |
| 852 | 850 |
| 853 if (RuntimeEnabledFeatures::cssCompositingEnabled()) { | 851 if (RuntimeEnabledFeatures::cssCompositingEnabled()) { |
| 854 updateLayerBlendMode(style); | 852 updateLayerBlendMode(style); |
| 855 updateIsRootForIsolatedGroup(); | 853 updateIsRootForIsolatedGroup(); |
| 856 } | 854 } |
| 857 | 855 |
| 858 updateContentsRect(isSimpleContainer); | 856 updateContentsRect(); |
| 859 updateBackgroundColor(isSimpleContainer); | 857 updateBackgroundColor(); |
| 860 updateDrawsContent(isSimpleContainer); | 858 updateDrawsContent(); |
| 861 updateContentsOpaque(); | 859 updateContentsOpaque(); |
| 862 updateAfterWidgetResize(); | 860 updateAfterWidgetResize(); |
| 863 updateRenderingContext(); | 861 updateRenderingContext(); |
| 864 updateShouldFlattenTransform(); | 862 updateShouldFlattenTransform(); |
| 865 updateChildrenTransform(); | 863 updateChildrenTransform(); |
| 866 registerScrollingLayers(); | 864 registerScrollingLayers(); |
| 867 | 865 |
| 868 updateCompositingReasons(); | 866 updateCompositingReasons(); |
| 869 } | 867 } |
| 870 | 868 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 935 | 933 |
| 936 if (m_ancestorClippingLayer) | 934 if (m_ancestorClippingLayer) |
| 937 m_squashingContainmentLayer->addChild(m_ancestorClippingLayer.get()) ; | 935 m_squashingContainmentLayer->addChild(m_ancestorClippingLayer.get()) ; |
| 938 else | 936 else |
| 939 m_squashingContainmentLayer->addChild(m_graphicsLayer.get()); | 937 m_squashingContainmentLayer->addChild(m_graphicsLayer.get()); |
| 940 | 938 |
| 941 m_squashingContainmentLayer->addChild(m_squashingLayer.get()); | 939 m_squashingContainmentLayer->addChild(m_squashingLayer.get()); |
| 942 } | 940 } |
| 943 } | 941 } |
| 944 | 942 |
| 945 void CompositedLayerMapping::updateContentsRect(bool isSimpleContainer) | 943 void CompositedLayerMapping::updateContentsRect() |
| 946 { | 944 { |
| 947 LayoutRect contentsRect; | 945 m_graphicsLayer->setContentsRect(pixelSnappedIntRect(contentsBox())); |
| 948 if (isSimpleContainer && renderer()->hasBackground()) | |
| 949 contentsRect = backgroundBox(); | |
| 950 else | |
| 951 contentsRect = contentsBox(); | |
| 952 | |
| 953 m_graphicsLayer->setContentsRect(pixelSnappedIntRect(contentsRect)); | |
| 954 } | 946 } |
| 955 | 947 |
| 956 void CompositedLayerMapping::updateDrawsContent(bool isSimpleContainer) | 948 void CompositedLayerMapping::updateDrawsContent() |
| 957 { | 949 { |
| 958 if (m_scrollingLayer) { | 950 if (m_scrollingLayer) { |
| 959 // We don't have to consider overflow controls, because we know that the scrollbars are drawn elsewhere. | 951 // We don't have to consider overflow controls, because we know that the scrollbars are drawn elsewhere. |
| 960 // m_graphicsLayer only needs backing store if the non-scrolling parts ( background, outlines, borders, shadows etc) need to paint. | 952 // m_graphicsLayer only needs backing store if the non-scrolling parts ( background, outlines, borders, shadows etc) need to paint. |
| 961 // m_scrollingLayer never has backing store. | 953 // m_scrollingLayer never has backing store. |
| 962 // m_scrollingContentsLayer only needs backing store if the scrolled con tents need to paint. | 954 // m_scrollingContentsLayer only needs backing store if the scrolled con tents need to paint. |
| 963 bool hasNonScrollingPaintedContent = m_owningLayer->hasVisibleContent() && m_owningLayer->hasBoxDecorationsOrBackground(); | 955 bool hasNonScrollingPaintedContent = m_owningLayer->hasVisibleContent() && m_owningLayer->hasBoxDecorationsOrBackground(); |
| 964 m_graphicsLayer->setDrawsContent(hasNonScrollingPaintedContent); | 956 m_graphicsLayer->setDrawsContent(hasNonScrollingPaintedContent); |
| 965 | 957 |
| 966 bool hasScrollingPaintedContent = m_owningLayer->hasVisibleContent() && (renderer()->hasBackground() || paintsChildren()); | 958 bool hasScrollingPaintedContent = m_owningLayer->hasVisibleContent() && (renderer()->hasBackground() || paintsChildren()); |
| 967 m_scrollingContentsLayer->setDrawsContent(hasScrollingPaintedContent); | 959 m_scrollingContentsLayer->setDrawsContent(hasScrollingPaintedContent); |
| 968 return; | 960 return; |
| 969 } | 961 } |
| 970 | 962 |
| 971 bool hasPaintedContent = containsPaintedContent(isSimpleContainer); | 963 bool hasPaintedContent = containsPaintedContent(); |
| 972 if (hasPaintedContent && isAcceleratedCanvas(renderer())) { | 964 if (hasPaintedContent && isAcceleratedCanvas(renderer())) { |
| 973 CanvasRenderingContext* context = toHTMLCanvasElement(renderer()->node() )->renderingContext(); | 965 CanvasRenderingContext* context = toHTMLCanvasElement(renderer()->node() )->renderingContext(); |
| 974 // Content layer may be null if context is lost. | 966 // Content layer may be null if context is lost. |
| 975 if (blink::WebLayer* contentLayer = context->platformLayer()) { | 967 if (blink::WebLayer* contentLayer = context->platformLayer()) { |
| 976 Color bgColor(Color::transparent); | 968 Color bgColor(Color::transparent); |
| 977 if (contentLayerSupportsDirectBackgroundComposition(renderer())) { | 969 if (contentLayerSupportsDirectBackgroundComposition(renderer())) { |
| 978 bgColor = rendererBackgroundColor(); | 970 bgColor = rendererBackgroundColor(); |
| 979 hasPaintedContent = false; | 971 hasPaintedContent = false; |
| 980 } | 972 } |
| 981 contentLayer->setBackgroundColor(bgColor.rgb()); | 973 contentLayer->setBackgroundColor(bgColor.rgb()); |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1495 | 1487 |
| 1496 Color CompositedLayerMapping::rendererBackgroundColor() const | 1488 Color CompositedLayerMapping::rendererBackgroundColor() const |
| 1497 { | 1489 { |
| 1498 RenderObject* backgroundRenderer = renderer(); | 1490 RenderObject* backgroundRenderer = renderer(); |
| 1499 if (backgroundRenderer->isRoot()) | 1491 if (backgroundRenderer->isRoot()) |
| 1500 backgroundRenderer = backgroundRenderer->rendererForRootBackground(); | 1492 backgroundRenderer = backgroundRenderer->rendererForRootBackground(); |
| 1501 | 1493 |
| 1502 return backgroundRenderer->resolveColor(CSSPropertyBackgroundColor); | 1494 return backgroundRenderer->resolveColor(CSSPropertyBackgroundColor); |
| 1503 } | 1495 } |
| 1504 | 1496 |
| 1505 void CompositedLayerMapping::updateBackgroundColor(bool isSimpleContainer) | 1497 void CompositedLayerMapping::updateBackgroundColor() |
| 1506 { | 1498 { |
| 1507 Color backgroundColor = rendererBackgroundColor(); | 1499 m_graphicsLayer->setBackgroundColor(rendererBackgroundColor()); |
| 1508 if (isSimpleContainer) { | |
| 1509 m_graphicsLayer->setContentsToSolidColor(backgroundColor); | |
| 1510 m_graphicsLayer->setBackgroundColor(Color::transparent); | |
| 1511 } else { | |
| 1512 m_graphicsLayer->setContentsToSolidColor(Color::transparent); | |
| 1513 m_graphicsLayer->setBackgroundColor(backgroundColor); | |
| 1514 } | |
| 1515 } | |
| 1516 | |
| 1517 static bool supportsDirectBoxDecorationsComposition(const RenderObject* renderer ) | |
| 1518 { | |
| 1519 if (renderer->hasClip()) | |
| 1520 return false; | |
| 1521 | |
| 1522 if (hasBoxDecorationsOrBackgroundImage(renderer->style())) | |
| 1523 return false; | |
| 1524 | |
| 1525 // FIXME: we should be able to allow backgroundComposite; However since this is not a common use case it has been deferred for now. | |
| 1526 if (renderer->style()->backgroundComposite() != CompositeSourceOver) | |
| 1527 return false; | |
| 1528 | |
| 1529 if (renderer->style()->backgroundClip() == TextFillBox) | |
| 1530 return false; | |
| 1531 | |
| 1532 return true; | |
| 1533 } | |
| 1534 | |
| 1535 bool CompositedLayerMapping::paintsBoxDecorations() const | |
| 1536 { | |
| 1537 if (!m_owningLayer->hasVisibleBoxDecorations()) | |
| 1538 return false; | |
| 1539 | |
| 1540 if (!supportsDirectBoxDecorationsComposition(renderer())) | |
| 1541 return true; | |
| 1542 | |
| 1543 return false; | |
| 1544 } | 1500 } |
| 1545 | 1501 |
| 1546 bool CompositedLayerMapping::paintsChildren() const | 1502 bool CompositedLayerMapping::paintsChildren() const |
| 1547 { | 1503 { |
| 1548 if (m_owningLayer->hasVisibleContent() && m_owningLayer->hasNonEmptyChildRen derers()) | 1504 if (m_owningLayer->hasVisibleContent() && m_owningLayer->hasNonEmptyChildRen derers()) |
| 1549 return true; | 1505 return true; |
| 1550 | 1506 |
| 1551 if (hasVisibleNonCompositingDescendantLayers()) | 1507 if (hasVisibleNonCompositingDescendantLayers()) |
| 1552 return true; | 1508 return true; |
| 1553 | 1509 |
| 1554 return false; | 1510 return false; |
| 1555 } | 1511 } |
| 1556 | 1512 |
| 1557 static bool isCompositedPlugin(RenderObject* renderer) | 1513 static bool isCompositedPlugin(RenderObject* renderer) |
| 1558 { | 1514 { |
| 1559 return renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->all owsAcceleratedCompositing(); | 1515 return renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->all owsAcceleratedCompositing(); |
| 1560 } | 1516 } |
| 1561 | 1517 |
| 1562 // A "simple container layer" is a RenderLayer which has no visible content to r ender. | 1518 // Check if RenderLayer which has visible content to render. |
| 1563 // It may have no children, or all its children may be themselves composited. | 1519 // It may have its own visible content, or its children composited into its own backing store. |
| 1564 // This is a useful optimization, because it allows us to avoid allocating backi ng store. | 1520 bool CompositedLayerMapping::paintsIntoOwningLayer() const |
| 1565 bool CompositedLayerMapping::isSimpleContainerCompositingLayer() const | |
| 1566 { | 1521 { |
| 1567 RenderObject* renderObject = renderer(); | 1522 RenderObject* renderObject = renderer(); |
| 1568 if (renderObject->hasMask()) // masks require special treatment | 1523 if (renderObject->hasMask()) // masks require special treatment |
| 1569 return false; | 1524 return true; |
| 1570 | 1525 |
| 1571 if (renderObject->isReplaced() && !isCompositedPlugin(renderObject)) | 1526 if (renderObject->isReplaced() && !isCompositedPlugin(renderObject)) |
| 1572 return false; | 1527 return true; |
| 1573 | 1528 |
| 1574 if (paintsBoxDecorations() || paintsChildren()) | 1529 if (m_owningLayer->hasVisibleBoxDecorations() || paintsChildren()) |
| 1575 return false; | 1530 return true; |
| 1576 | 1531 |
| 1577 if (renderObject->isRenderRegion()) | 1532 if (renderObject->isRenderRegion()) |
| 1578 return false; | 1533 return true; |
| 1579 | 1534 |
| 1580 if (renderObject->node() && renderObject->node()->isDocumentNode()) { | 1535 if (renderObject->node() && renderObject->node()->isDocumentNode()) { |
| 1581 // Look to see if the root object has a non-simple background | 1536 // Look to see if the root object has a non-simple background |
| 1582 RenderObject* rootObject = renderObject->document().documentElement() ? renderObject->document().documentElement()->renderer() : 0; | 1537 RenderObject* rootObject = renderObject->document().documentElement() ? renderObject->document().documentElement()->renderer() : 0; |
| 1583 if (!rootObject) | 1538 if (!rootObject) |
| 1584 return false; | 1539 return false; |
| 1585 | 1540 |
| 1586 RenderStyle* style = rootObject->style(); | 1541 RenderStyle* style = rootObject->style(); |
| 1587 | 1542 |
| 1588 // Reject anything that has a border, a border-radius or outline, | 1543 // Reject anything that has a border, a border-radius or outline, |
| 1589 // or is not a simple background (no background, or solid color). | 1544 // or is not a simple background (no background, or solid color). |
| 1590 if (hasBoxDecorationsOrBackgroundImage(style)) | 1545 if (hasBoxDecorationsOrBackgroundImage(style)) |
| 1591 return false; | 1546 return true; |
| 1592 | 1547 |
| 1593 // Now look at the body's renderer. | 1548 // Now look at the body's renderer. |
| 1594 HTMLElement* body = renderObject->document().body(); | 1549 HTMLElement* body = renderObject->document().body(); |
| 1595 RenderObject* bodyObject = (body && body->hasLocalName(bodyTag)) ? body- >renderer() : 0; | 1550 RenderObject* bodyObject = (body && body->hasLocalName(bodyTag)) ? body- >renderer() : 0; |
| 1596 if (!bodyObject) | 1551 if (!bodyObject) |
| 1597 return false; | 1552 return false; |
| 1598 | 1553 |
| 1599 style = bodyObject->style(); | 1554 style = bodyObject->style(); |
| 1600 | 1555 |
| 1601 if (hasBoxDecorationsOrBackgroundImage(style)) | 1556 if (hasBoxDecorationsOrBackgroundImage(style)) |
| 1602 return false; | 1557 return true; |
| 1603 } | 1558 } |
| 1604 | 1559 return false; |
| 1605 return true; | |
| 1606 } | 1560 } |
| 1607 | 1561 |
| 1608 static bool hasVisibleNonCompositingDescendant(RenderLayer* parent) | 1562 static bool hasVisibleNonCompositingDescendant(RenderLayer* parent) |
| 1609 { | 1563 { |
| 1610 // FIXME: We shouldn't be called with a stale z-order lists. See bug 85512. | 1564 // FIXME: We shouldn't be called with a stale z-order lists. See bug 85512. |
| 1611 parent->stackingNode()->updateLayerListsIfNeeded(); | 1565 parent->stackingNode()->updateLayerListsIfNeeded(); |
| 1612 | 1566 |
| 1613 #if !ASSERT_DISABLED | 1567 #if !ASSERT_DISABLED |
| 1614 LayerListMutationDetector mutationChecker(parent->stackingNode()); | 1568 LayerListMutationDetector mutationChecker(parent->stackingNode()); |
| 1615 #endif | 1569 #endif |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 1637 } | 1591 } |
| 1638 | 1592 |
| 1639 // FIXME: By name the implementation is correct. But the code that uses this fun ction means something | 1593 // FIXME: By name the implementation is correct. But the code that uses this fun ction means something |
| 1640 // very slightly different - the implementation needs to also include composited descendants that | 1594 // very slightly different - the implementation needs to also include composited descendants that |
| 1641 // don't paint into their own backing, and instead paint into this backing. | 1595 // don't paint into their own backing, and instead paint into this backing. |
| 1642 bool CompositedLayerMapping::hasVisibleNonCompositingDescendantLayers() const | 1596 bool CompositedLayerMapping::hasVisibleNonCompositingDescendantLayers() const |
| 1643 { | 1597 { |
| 1644 return hasVisibleNonCompositingDescendant(m_owningLayer); | 1598 return hasVisibleNonCompositingDescendant(m_owningLayer); |
| 1645 } | 1599 } |
| 1646 | 1600 |
| 1647 bool CompositedLayerMapping::containsPaintedContent(bool isSimpleContainer) cons t | 1601 bool CompositedLayerMapping::containsPaintedContent() const |
| 1648 { | 1602 { |
| 1649 if (isSimpleContainer || paintsIntoCompositedAncestor() || m_artificiallyInf latedBounds || m_owningLayer->isReflection()) | 1603 if (!paintsIntoOwningLayer() || paintsIntoCompositedAncestor() || m_artifici allyInflatedBounds || m_owningLayer->isReflection()) |
|
dshwang
2014/02/25 18:44:49
I guess isSimpleContainerCompositingLayer() was im
| |
| 1650 return false; | 1604 return false; |
| 1651 | 1605 |
| 1652 if (isDirectlyCompositedImage()) | 1606 if (isDirectlyCompositedImage()) |
| 1653 return false; | 1607 return false; |
| 1654 | 1608 |
| 1655 // FIXME: we could optimize cases where the image, video or canvas is known to fill the border box entirely, | 1609 // FIXME: we could optimize cases where the image, video or canvas is known to fill the border box entirely, |
| 1656 // and set background color on the layer in that case, instead of allocating backing store and painting. | 1610 // and set background color on the layer in that case, instead of allocating backing store and painting. |
| 1657 if (renderer()->isVideo() && toRenderVideo(renderer())->shouldDisplayVideo() ) | 1611 if (renderer()->isVideo() && toRenderVideo(renderer())->shouldDisplayVideo() ) |
| 1658 return m_owningLayer->hasBoxDecorationsOrBackground(); | 1612 return m_owningLayer->hasBoxDecorationsOrBackground(); |
| 1659 | 1613 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1706 Image* image = cachedImage->imageForRenderer(imageRenderer); | 1660 Image* image = cachedImage->imageForRenderer(imageRenderer); |
| 1707 if (!image) | 1661 if (!image) |
| 1708 return; | 1662 return; |
| 1709 | 1663 |
| 1710 // We have to wait until the image is fully loaded before setting it on the layer. | 1664 // We have to wait until the image is fully loaded before setting it on the layer. |
| 1711 if (!cachedImage->isLoaded()) | 1665 if (!cachedImage->isLoaded()) |
| 1712 return; | 1666 return; |
| 1713 | 1667 |
| 1714 // This is a no-op if the layer doesn't have an inner layer for the image. | 1668 // This is a no-op if the layer doesn't have an inner layer for the image. |
| 1715 m_graphicsLayer->setContentsToImage(image); | 1669 m_graphicsLayer->setContentsToImage(image); |
| 1716 bool isSimpleContainer = false; | 1670 updateDrawsContent(); |
| 1717 updateDrawsContent(isSimpleContainer); | |
| 1718 | 1671 |
| 1719 // Image animation is "lazy", in that it automatically stops unless someone is drawing | 1672 // Image animation is "lazy", in that it automatically stops unless someone is drawing |
| 1720 // the image. So we have to kick the animation each time; this has the downs ide that the | 1673 // the image. So we have to kick the animation each time; this has the downs ide that the |
| 1721 // image will keep animating, even if its layer is not visible. | 1674 // image will keep animating, even if its layer is not visible. |
| 1722 image->startAnimation(); | 1675 image->startAnimation(); |
| 1723 } | 1676 } |
| 1724 | 1677 |
| 1725 FloatPoint3D CompositedLayerMapping::computeTransformOrigin(const IntRect& borde rBox) const | 1678 FloatPoint3D CompositedLayerMapping::computeTransformOrigin(const IntRect& borde rBox) const |
| 1726 { | 1679 { |
| 1727 RenderStyle* style = renderer()->style(); | 1680 RenderStyle* style = renderer()->style(); |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2179 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2132 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
| 2180 name = "Scrolling Contents Layer"; | 2133 name = "Scrolling Contents Layer"; |
| 2181 } else { | 2134 } else { |
| 2182 ASSERT_NOT_REACHED(); | 2135 ASSERT_NOT_REACHED(); |
| 2183 } | 2136 } |
| 2184 | 2137 |
| 2185 return name; | 2138 return name; |
| 2186 } | 2139 } |
| 2187 | 2140 |
| 2188 } // namespace WebCore | 2141 } // namespace WebCore |
| OLD | NEW |