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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 if (m_owningLayer.reflectionInfo()->reflectionLayer()->hasCompositedLaye
rMapping()) { | 450 if (m_owningLayer.reflectionInfo()->reflectionLayer()->hasCompositedLaye
rMapping()) { |
451 GraphicsLayer* reflectionLayer = m_owningLayer.reflectionInfo()->ref
lectionLayer()->compositedLayerMapping()->mainGraphicsLayer(); | 451 GraphicsLayer* reflectionLayer = m_owningLayer.reflectionInfo()->ref
lectionLayer()->compositedLayerMapping()->mainGraphicsLayer(); |
452 m_graphicsLayer->setReplicatedByLayer(reflectionLayer); | 452 m_graphicsLayer->setReplicatedByLayer(reflectionLayer); |
453 } | 453 } |
454 } else { | 454 } else { |
455 m_graphicsLayer->setReplicatedByLayer(0); | 455 m_graphicsLayer->setReplicatedByLayer(0); |
456 } | 456 } |
457 | 457 |
458 updateBackgroundColor(); | 458 updateBackgroundColor(); |
459 | 459 |
460 if (renderer->isImage() && isDirectlyCompositedImage()) | 460 if (isDirectlyCompositedImage()) |
461 updateImageContents(); | 461 updateImageContents(); |
462 | 462 |
463 if (WebLayer* layer = platformLayerForPlugin(renderer)) { | 463 if (WebLayer* layer = platformLayerForPlugin(renderer)) { |
464 m_graphicsLayer->setContentsToPlatformLayer(layer); | 464 m_graphicsLayer->setContentsToPlatformLayer(layer); |
465 } else if (renderer->node() && renderer->node()->isFrameOwnerElement() && to
HTMLFrameOwnerElement(renderer->node())->contentFrame()) { | 465 } else if (renderer->node() && renderer->node()->isFrameOwnerElement() && to
HTMLFrameOwnerElement(renderer->node())->contentFrame()) { |
466 WebLayer* layer = toHTMLFrameOwnerElement(renderer->node())->contentFram
e()->remotePlatformLayer(); | 466 WebLayer* layer = toHTMLFrameOwnerElement(renderer->node())->contentFram
e()->remotePlatformLayer(); |
467 if (layer) | 467 if (layer) |
468 m_graphicsLayer->setContentsToPlatformLayer(layer); | 468 m_graphicsLayer->setContentsToPlatformLayer(layer); |
469 } else if (renderer->isVideo()) { | 469 } else if (renderer->isVideo()) { |
470 HTMLMediaElement* mediaElement = toHTMLMediaElement(renderer->node()); | 470 HTMLMediaElement* mediaElement = toHTMLMediaElement(renderer->node()); |
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1691 } | 1691 } |
1692 | 1692 |
1693 return false; | 1693 return false; |
1694 } | 1694 } |
1695 | 1695 |
1696 bool CompositedLayerMapping::containsPaintedContent() const | 1696 bool CompositedLayerMapping::containsPaintedContent() const |
1697 { | 1697 { |
1698 if (paintsIntoCompositedAncestor() || m_owningLayer.isReflection()) | 1698 if (paintsIntoCompositedAncestor() || m_owningLayer.isReflection()) |
1699 return false; | 1699 return false; |
1700 | 1700 |
1701 if (renderer()->isImage() && isDirectlyCompositedImage()) | 1701 if (isDirectlyCompositedImage()) |
1702 return false; | 1702 return false; |
1703 | 1703 |
1704 RenderObject* renderObject = renderer(); | 1704 RenderObject* renderObject = renderer(); |
1705 // FIXME: we could optimize cases where the image, video or canvas is known
to fill the border box entirely, | 1705 // FIXME: we could optimize cases where the image, video or canvas is known
to fill the border box entirely, |
1706 // and set background color on the layer in that case, instead of allocating
backing store and painting. | 1706 // and set background color on the layer in that case, instead of allocating
backing store and painting. |
1707 if (renderObject->isVideo() && toRenderVideo(renderer())->shouldDisplayVideo
()) | 1707 if (renderObject->isVideo() && toRenderVideo(renderer())->shouldDisplayVideo
()) |
1708 return m_owningLayer.hasBoxDecorationsOrBackground(); | 1708 return m_owningLayer.hasBoxDecorationsOrBackground(); |
1709 | 1709 |
1710 if (m_owningLayer.hasVisibleBoxDecorations()) | 1710 if (m_owningLayer.hasVisibleBoxDecorations()) |
1711 return true; | 1711 return true; |
(...skipping 23 matching lines...) Expand all Loading... |
1735 } | 1735 } |
1736 | 1736 |
1737 // FIXME: it's O(n^2). A better solution is needed. | 1737 // FIXME: it's O(n^2). A better solution is needed. |
1738 return paintsChildren(); | 1738 return paintsChildren(); |
1739 } | 1739 } |
1740 | 1740 |
1741 // An image can be directly compositing if it's the sole content of the layer, a
nd has no box decorations | 1741 // An image can be directly compositing if it's the sole content of the layer, a
nd has no box decorations |
1742 // that require painting. Direct compositing saves backing store. | 1742 // that require painting. Direct compositing saves backing store. |
1743 bool CompositedLayerMapping::isDirectlyCompositedImage() const | 1743 bool CompositedLayerMapping::isDirectlyCompositedImage() const |
1744 { | 1744 { |
1745 ASSERT(renderer()->isImage()); | 1745 RenderObject* renderObject = renderer(); |
1746 | 1746 |
1747 RenderObject* renderObject = renderer(); | 1747 if (!renderObject->isImage() || m_owningLayer.hasBoxDecorationsOrBackground(
) || renderObject->hasClip()) |
1748 if (m_owningLayer.hasBoxDecorationsOrBackground() || renderObject->hasClip()
) | |
1749 return false; | 1748 return false; |
1750 | 1749 |
1751 RenderImage* imageRenderer = toRenderImage(renderObject); | 1750 RenderImage* imageRenderer = toRenderImage(renderObject); |
1752 if (ImageResource* cachedImage = imageRenderer->cachedImage()) { | 1751 if (ImageResource* cachedImage = imageRenderer->cachedImage()) { |
1753 if (!cachedImage->hasImage()) | 1752 if (!cachedImage->hasImage()) |
1754 return false; | 1753 return false; |
1755 | 1754 |
1756 Image* image = cachedImage->imageForRenderer(imageRenderer); | 1755 Image* image = cachedImage->imageForRenderer(imageRenderer); |
1757 return image->isBitmapImage(); | 1756 return image->isBitmapImage(); |
1758 } | 1757 } |
(...skipping 26 matching lines...) Expand all Loading... |
1785 Image* image = cachedImage->imageForRenderer(imageRenderer); | 1784 Image* image = cachedImage->imageForRenderer(imageRenderer); |
1786 if (!image) | 1785 if (!image) |
1787 return; | 1786 return; |
1788 | 1787 |
1789 // We have to wait until the image is fully loaded before setting it on the
layer. | 1788 // We have to wait until the image is fully loaded before setting it on the
layer. |
1790 if (!cachedImage->isLoaded()) | 1789 if (!cachedImage->isLoaded()) |
1791 return; | 1790 return; |
1792 | 1791 |
1793 // This is a no-op if the layer doesn't have an inner layer for the image. | 1792 // This is a no-op if the layer doesn't have an inner layer for the image. |
1794 m_graphicsLayer->setContentsToImage(image); | 1793 m_graphicsLayer->setContentsToImage(image); |
1795 | |
1796 // Prevent double-drawing: https://bugs.webkit.org/show_bug.cgi?id=58632 | |
1797 updateDrawsContent(); | 1794 updateDrawsContent(); |
1798 | 1795 |
1799 // Image animation is "lazy", in that it automatically stops unless someone
is drawing | 1796 // Image animation is "lazy", in that it automatically stops unless someone
is drawing |
1800 // the image. So we have to kick the animation each time; this has the downs
ide that the | 1797 // the image. So we have to kick the animation each time; this has the downs
ide that the |
1801 // image will keep animating, even if its layer is not visible. | 1798 // image will keep animating, even if its layer is not visible. |
1802 image->startAnimation(); | 1799 image->startAnimation(); |
1803 } | 1800 } |
1804 | 1801 |
1805 FloatPoint3D CompositedLayerMapping::computeTransformOrigin(const IntRect& borde
rBox) const | 1802 FloatPoint3D CompositedLayerMapping::computeTransformOrigin(const IntRect& borde
rBox) const |
1806 { | 1803 { |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2281 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { | 2278 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
2282 name = "Scrolling Block Selection Layer"; | 2279 name = "Scrolling Block Selection Layer"; |
2283 } else { | 2280 } else { |
2284 ASSERT_NOT_REACHED(); | 2281 ASSERT_NOT_REACHED(); |
2285 } | 2282 } |
2286 | 2283 |
2287 return name; | 2284 return name; |
2288 } | 2285 } |
2289 | 2286 |
2290 } // namespace blink | 2287 } // namespace blink |
OLD | NEW |