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