| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 #include "platform/graphics/paint/TransformDisplayItem.h" | 64 #include "platform/graphics/paint/TransformDisplayItem.h" |
| 65 #include "wtf/CurrentTime.h" | 65 #include "wtf/CurrentTime.h" |
| 66 #include "wtf/text/StringBuilder.h" | 66 #include "wtf/text/StringBuilder.h" |
| 67 | 67 |
| 68 namespace blink { | 68 namespace blink { |
| 69 | 69 |
| 70 using namespace HTMLNames; | 70 using namespace HTMLNames; |
| 71 | 71 |
| 72 static IntRect clipBox(RenderBox* renderer); | 72 static IntRect clipBox(RenderBox* renderer); |
| 73 | 73 |
| 74 static IntRect contentsRect(const RenderObject* renderer) | 74 static IntRect contentsRect(const LayoutObject* renderer) |
| 75 { | 75 { |
| 76 if (!renderer->isBox()) | 76 if (!renderer->isBox()) |
| 77 return IntRect(); | 77 return IntRect(); |
| 78 | 78 |
| 79 return renderer->isVideo() ? | 79 return renderer->isVideo() ? |
| 80 toRenderVideo(renderer)->videoBox() : | 80 toRenderVideo(renderer)->videoBox() : |
| 81 pixelSnappedIntRect(toRenderBox(renderer)->contentBoxRect()); | 81 pixelSnappedIntRect(toRenderBox(renderer)->contentBoxRect()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 static IntRect backgroundRect(const RenderObject* renderer) | 84 static IntRect backgroundRect(const LayoutObject* renderer) |
| 85 { | 85 { |
| 86 if (!renderer->isBox()) | 86 if (!renderer->isBox()) |
| 87 return IntRect(); | 87 return IntRect(); |
| 88 | 88 |
| 89 LayoutRect rect; | 89 LayoutRect rect; |
| 90 const RenderBox* box = toRenderBox(renderer); | 90 const RenderBox* box = toRenderBox(renderer); |
| 91 EFillBox clip = box->style()->backgroundClip(); | 91 EFillBox clip = box->style()->backgroundClip(); |
| 92 switch (clip) { | 92 switch (clip) { |
| 93 case BorderFillBox: | 93 case BorderFillBox: |
| 94 rect = box->borderBoxRect(); | 94 rect = box->borderBoxRect(); |
| 95 break; | 95 break; |
| 96 case PaddingFillBox: | 96 case PaddingFillBox: |
| 97 rect = box->paddingBoxRect(); | 97 rect = box->paddingBoxRect(); |
| 98 break; | 98 break; |
| 99 case ContentFillBox: | 99 case ContentFillBox: |
| 100 rect = box->contentBoxRect(); | 100 rect = box->contentBoxRect(); |
| 101 break; | 101 break; |
| 102 case TextFillBox: | 102 case TextFillBox: |
| 103 break; | 103 break; |
| 104 } | 104 } |
| 105 | 105 |
| 106 return pixelSnappedIntRect(rect); | 106 return pixelSnappedIntRect(rect); |
| 107 } | 107 } |
| 108 | 108 |
| 109 static inline bool isAcceleratedCanvas(const RenderObject* renderer) | 109 static inline bool isAcceleratedCanvas(const LayoutObject* renderer) |
| 110 { | 110 { |
| 111 if (renderer->isCanvas()) { | 111 if (renderer->isCanvas()) { |
| 112 HTMLCanvasElement* canvas = toHTMLCanvasElement(renderer->node()); | 112 HTMLCanvasElement* canvas = toHTMLCanvasElement(renderer->node()); |
| 113 if (CanvasRenderingContext* context = canvas->renderingContext()) | 113 if (CanvasRenderingContext* context = canvas->renderingContext()) |
| 114 return context->isAccelerated(); | 114 return context->isAccelerated(); |
| 115 } | 115 } |
| 116 return false; | 116 return false; |
| 117 } | 117 } |
| 118 | 118 |
| 119 static bool hasBoxDecorationsOrBackgroundImage(const RenderStyle* style) | 119 static bool hasBoxDecorationsOrBackgroundImage(const RenderStyle* style) |
| 120 { | 120 { |
| 121 return style->hasBoxDecorations() || style->hasBackgroundImage(); | 121 return style->hasBoxDecorations() || style->hasBackgroundImage(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 static bool contentLayerSupportsDirectBackgroundComposition(const RenderObject*
renderer) | 124 static bool contentLayerSupportsDirectBackgroundComposition(const LayoutObject*
renderer) |
| 125 { | 125 { |
| 126 // No support for decorations - border, border-radius or outline. | 126 // No support for decorations - border, border-radius or outline. |
| 127 // Only simple background - solid color or transparent. | 127 // Only simple background - solid color or transparent. |
| 128 if (hasBoxDecorationsOrBackgroundImage(renderer->style())) | 128 if (hasBoxDecorationsOrBackgroundImage(renderer->style())) |
| 129 return false; | 129 return false; |
| 130 | 130 |
| 131 // If there is no background, there is nothing to support. | 131 // If there is no background, there is nothing to support. |
| 132 if (!renderer->style()->hasBackground()) | 132 if (!renderer->style()->hasBackground()) |
| 133 return true; | 133 return true; |
| 134 | 134 |
| 135 // Simple background that is contained within the contents rect. | 135 // Simple background that is contained within the contents rect. |
| 136 return contentsRect(renderer).contains(backgroundRect(renderer)); | 136 return contentsRect(renderer).contains(backgroundRect(renderer)); |
| 137 } | 137 } |
| 138 | 138 |
| 139 static WebLayer* platformLayerForPlugin(RenderObject* renderer) | 139 static WebLayer* platformLayerForPlugin(LayoutObject* renderer) |
| 140 { | 140 { |
| 141 if (!renderer->isEmbeddedObject()) | 141 if (!renderer->isEmbeddedObject()) |
| 142 return 0; | 142 return 0; |
| 143 Widget* widget = toRenderEmbeddedObject(renderer)->widget(); | 143 Widget* widget = toRenderEmbeddedObject(renderer)->widget(); |
| 144 if (!widget || !widget->isPluginView()) | 144 if (!widget || !widget->isPluginView()) |
| 145 return 0; | 145 return 0; |
| 146 return toPluginView(widget)->platformLayer(); | 146 return toPluginView(widget)->platformLayer(); |
| 147 | 147 |
| 148 } | 148 } |
| 149 | 149 |
| 150 static inline bool isAcceleratedContents(RenderObject* renderer) | 150 static inline bool isAcceleratedContents(LayoutObject* renderer) |
| 151 { | 151 { |
| 152 return isAcceleratedCanvas(renderer) | 152 return isAcceleratedCanvas(renderer) |
| 153 || (renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->re
quiresAcceleratedCompositing()) | 153 || (renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->re
quiresAcceleratedCompositing()) |
| 154 || renderer->isVideo(); | 154 || renderer->isVideo(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 // Get the scrolling coordinator in a way that works inside CompositedLayerMappi
ng's destructor. | 157 // Get the scrolling coordinator in a way that works inside CompositedLayerMappi
ng's destructor. |
| 158 static ScrollingCoordinator* scrollingCoordinatorFromLayer(Layer& layer) | 158 static ScrollingCoordinator* scrollingCoordinatorFromLayer(Layer& layer) |
| 159 { | 159 { |
| 160 Page* page = layer.renderer()->frame()->page(); | 160 Page* page = layer.renderer()->frame()->page(); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 | 359 |
| 360 bool CompositedLayerMapping::owningLayerClippedByLayerNotAboveCompositedAncestor
() | 360 bool CompositedLayerMapping::owningLayerClippedByLayerNotAboveCompositedAncestor
() |
| 361 { | 361 { |
| 362 if (!m_owningLayer.parent()) | 362 if (!m_owningLayer.parent()) |
| 363 return false; | 363 return false; |
| 364 | 364 |
| 365 const Layer* compositingAncestor = m_owningLayer.enclosingLayerWithComposite
dLayerMapping(ExcludeSelf); | 365 const Layer* compositingAncestor = m_owningLayer.enclosingLayerWithComposite
dLayerMapping(ExcludeSelf); |
| 366 if (!compositingAncestor) | 366 if (!compositingAncestor) |
| 367 return false; | 367 return false; |
| 368 | 368 |
| 369 const RenderObject* clippingContainer = m_owningLayer.clippingContainer(); | 369 const LayoutObject* clippingContainer = m_owningLayer.clippingContainer(); |
| 370 if (!clippingContainer) | 370 if (!clippingContainer) |
| 371 return false; | 371 return false; |
| 372 | 372 |
| 373 if (compositingAncestor->renderer()->isDescendantOf(clippingContainer)) | 373 if (compositingAncestor->renderer()->isDescendantOf(clippingContainer)) |
| 374 return false; | 374 return false; |
| 375 | 375 |
| 376 // We ignore overflow clip here; we want composited overflow content to | 376 // We ignore overflow clip here; we want composited overflow content to |
| 377 // behave as if it lives in an unclipped universe so it can prepaint, etc. | 377 // behave as if it lives in an unclipped universe so it can prepaint, etc. |
| 378 // This means that we need to check if we are actually clipped before | 378 // This means that we need to check if we are actually clipped before |
| 379 // setting up m_ancestorClippingLayer otherwise | 379 // setting up m_ancestorClippingLayer otherwise |
| (...skipping 14 matching lines...) Expand all Loading... |
| 394 // Note carefully: here we assume that the compositing state of all descenda
nts have been updated already, | 394 // Note carefully: here we assume that the compositing state of all descenda
nts have been updated already, |
| 395 // so it is legitimate to compute and cache the composited bounds for this l
ayer. | 395 // so it is legitimate to compute and cache the composited bounds for this l
ayer. |
| 396 updateCompositedBounds(); | 396 updateCompositedBounds(); |
| 397 | 397 |
| 398 if (LayerReflectionInfo* reflection = m_owningLayer.reflectionInfo()) { | 398 if (LayerReflectionInfo* reflection = m_owningLayer.reflectionInfo()) { |
| 399 if (reflection->reflectionLayer()->hasCompositedLayerMapping()) | 399 if (reflection->reflectionLayer()->hasCompositedLayerMapping()) |
| 400 reflection->reflectionLayer()->compositedLayerMapping()->updateCompo
sitedBounds(); | 400 reflection->reflectionLayer()->compositedLayerMapping()->updateCompo
sitedBounds(); |
| 401 } | 401 } |
| 402 | 402 |
| 403 LayerCompositor* compositor = this->compositor(); | 403 LayerCompositor* compositor = this->compositor(); |
| 404 RenderObject* renderer = this->renderer(); | 404 LayoutObject* renderer = this->renderer(); |
| 405 | 405 |
| 406 bool layerConfigChanged = false; | 406 bool layerConfigChanged = false; |
| 407 setBackgroundLayerPaintsFixedRootBackground(compositor->needsFixedRootBackgr
oundLayer(&m_owningLayer)); | 407 setBackgroundLayerPaintsFixedRootBackground(compositor->needsFixedRootBackgr
oundLayer(&m_owningLayer)); |
| 408 | 408 |
| 409 // The background layer is currently only used for fixed root backgrounds. | 409 // The background layer is currently only used for fixed root backgrounds. |
| 410 if (updateBackgroundLayer(m_backgroundLayerPaintsFixedRootBackground)) | 410 if (updateBackgroundLayer(m_backgroundLayerPaintsFixedRootBackground)) |
| 411 layerConfigChanged = true; | 411 layerConfigChanged = true; |
| 412 | 412 |
| 413 if (updateForegroundLayer(compositor->needsContentsCompositingLayer(&m_ownin
gLayer))) | 413 if (updateForegroundLayer(compositor->needsContentsCompositingLayer(&m_ownin
gLayer))) |
| 414 layerConfigChanged = true; | 414 layerConfigChanged = true; |
| (...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1721 break; | 1721 break; |
| 1722 | 1722 |
| 1723 finalOpacity *= curr->renderer()->opacity(); | 1723 finalOpacity *= curr->renderer()->opacity(); |
| 1724 } | 1724 } |
| 1725 | 1725 |
| 1726 return finalOpacity; | 1726 return finalOpacity; |
| 1727 } | 1727 } |
| 1728 | 1728 |
| 1729 Color CompositedLayerMapping::rendererBackgroundColor() const | 1729 Color CompositedLayerMapping::rendererBackgroundColor() const |
| 1730 { | 1730 { |
| 1731 RenderObject* backgroundRenderer = renderer(); | 1731 LayoutObject* backgroundRenderer = renderer(); |
| 1732 if (backgroundRenderer->isDocumentElement()) | 1732 if (backgroundRenderer->isDocumentElement()) |
| 1733 backgroundRenderer = backgroundRenderer->rendererForRootBackground(); | 1733 backgroundRenderer = backgroundRenderer->rendererForRootBackground(); |
| 1734 | 1734 |
| 1735 return backgroundRenderer->resolveColor(CSSPropertyBackgroundColor); | 1735 return backgroundRenderer->resolveColor(CSSPropertyBackgroundColor); |
| 1736 } | 1736 } |
| 1737 | 1737 |
| 1738 void CompositedLayerMapping::updateBackgroundColor() | 1738 void CompositedLayerMapping::updateBackgroundColor() |
| 1739 { | 1739 { |
| 1740 m_graphicsLayer->setBackgroundColor(rendererBackgroundColor()); | 1740 m_graphicsLayer->setBackgroundColor(rendererBackgroundColor()); |
| 1741 } | 1741 } |
| 1742 | 1742 |
| 1743 bool CompositedLayerMapping::paintsChildren() const | 1743 bool CompositedLayerMapping::paintsChildren() const |
| 1744 { | 1744 { |
| 1745 if (m_owningLayer.hasVisibleContent() && m_owningLayer.hasNonEmptyChildRende
rers()) | 1745 if (m_owningLayer.hasVisibleContent() && m_owningLayer.hasNonEmptyChildRende
rers()) |
| 1746 return true; | 1746 return true; |
| 1747 | 1747 |
| 1748 if (hasVisibleNonCompositingDescendant(&m_owningLayer)) | 1748 if (hasVisibleNonCompositingDescendant(&m_owningLayer)) |
| 1749 return true; | 1749 return true; |
| 1750 | 1750 |
| 1751 return false; | 1751 return false; |
| 1752 } | 1752 } |
| 1753 | 1753 |
| 1754 static bool isCompositedPlugin(RenderObject* renderer) | 1754 static bool isCompositedPlugin(LayoutObject* renderer) |
| 1755 { | 1755 { |
| 1756 return renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->req
uiresAcceleratedCompositing(); | 1756 return renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->req
uiresAcceleratedCompositing(); |
| 1757 } | 1757 } |
| 1758 | 1758 |
| 1759 bool CompositedLayerMapping::hasVisibleNonCompositingDescendant(Layer* parent) | 1759 bool CompositedLayerMapping::hasVisibleNonCompositingDescendant(Layer* parent) |
| 1760 { | 1760 { |
| 1761 if (!parent->hasVisibleDescendant()) | 1761 if (!parent->hasVisibleDescendant()) |
| 1762 return false; | 1762 return false; |
| 1763 | 1763 |
| 1764 // FIXME: We shouldn't be called with a stale z-order lists. See bug 85512. | 1764 // FIXME: We shouldn't be called with a stale z-order lists. See bug 85512. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1781 } | 1781 } |
| 1782 | 1782 |
| 1783 bool CompositedLayerMapping::containsPaintedContent() const | 1783 bool CompositedLayerMapping::containsPaintedContent() const |
| 1784 { | 1784 { |
| 1785 if (m_owningLayer.isReflection()) | 1785 if (m_owningLayer.isReflection()) |
| 1786 return false; | 1786 return false; |
| 1787 | 1787 |
| 1788 if (renderer()->isImage() && isDirectlyCompositedImage()) | 1788 if (renderer()->isImage() && isDirectlyCompositedImage()) |
| 1789 return false; | 1789 return false; |
| 1790 | 1790 |
| 1791 RenderObject* renderObject = renderer(); | 1791 LayoutObject* layoutObject = renderer(); |
| 1792 // FIXME: we could optimize cases where the image, video or canvas is known
to fill the border box entirely, | 1792 // FIXME: we could optimize cases where the image, video or canvas is known
to fill the border box entirely, |
| 1793 // and set background color on the layer in that case, instead of allocating
backing store and painting. | 1793 // and set background color on the layer in that case, instead of allocating
backing store and painting. |
| 1794 if (renderObject->isVideo() && toRenderVideo(renderer())->shouldDisplayVideo
()) | 1794 if (layoutObject->isVideo() && toRenderVideo(renderer())->shouldDisplayVideo
()) |
| 1795 return m_owningLayer.hasBoxDecorationsOrBackground(); | 1795 return m_owningLayer.hasBoxDecorationsOrBackground(); |
| 1796 | 1796 |
| 1797 if (m_owningLayer.hasVisibleBoxDecorations()) | 1797 if (m_owningLayer.hasVisibleBoxDecorations()) |
| 1798 return true; | 1798 return true; |
| 1799 | 1799 |
| 1800 if (renderObject->hasMask()) // masks require special treatment | 1800 if (layoutObject->hasMask()) // masks require special treatment |
| 1801 return true; | 1801 return true; |
| 1802 | 1802 |
| 1803 if (renderObject->isReplaced() && !isCompositedPlugin(renderObject)) | 1803 if (layoutObject->isReplaced() && !isCompositedPlugin(layoutObject)) |
| 1804 return true; | 1804 return true; |
| 1805 | 1805 |
| 1806 if (renderObject->isRenderRegion()) | 1806 if (layoutObject->isRenderRegion()) |
| 1807 return true; | 1807 return true; |
| 1808 | 1808 |
| 1809 if (renderObject->node() && renderObject->node()->isDocumentNode()) { | 1809 if (layoutObject->node() && layoutObject->node()->isDocumentNode()) { |
| 1810 // Look to see if the root object has a non-simple background | 1810 // Look to see if the root object has a non-simple background |
| 1811 RenderObject* rootObject = renderObject->document().documentElement() ?
renderObject->document().documentElement()->renderer() : 0; | 1811 LayoutObject* rootObject = layoutObject->document().documentElement() ?
layoutObject->document().documentElement()->renderer() : 0; |
| 1812 // Reject anything that has a border, a border-radius or outline, | 1812 // Reject anything that has a border, a border-radius or outline, |
| 1813 // or is not a simple background (no background, or solid color). | 1813 // or is not a simple background (no background, or solid color). |
| 1814 if (rootObject && hasBoxDecorationsOrBackgroundImage(rootObject->style()
)) | 1814 if (rootObject && hasBoxDecorationsOrBackgroundImage(rootObject->style()
)) |
| 1815 return true; | 1815 return true; |
| 1816 | 1816 |
| 1817 // Now look at the body's renderer. | 1817 // Now look at the body's renderer. |
| 1818 HTMLElement* body = renderObject->document().body(); | 1818 HTMLElement* body = layoutObject->document().body(); |
| 1819 RenderObject* bodyObject = isHTMLBodyElement(body) ? body->renderer() :
0; | 1819 LayoutObject* bodyObject = isHTMLBodyElement(body) ? body->renderer() :
0; |
| 1820 if (bodyObject && hasBoxDecorationsOrBackgroundImage(bodyObject->style()
)) | 1820 if (bodyObject && hasBoxDecorationsOrBackgroundImage(bodyObject->style()
)) |
| 1821 return true; | 1821 return true; |
| 1822 } | 1822 } |
| 1823 | 1823 |
| 1824 // FIXME: it's O(n^2). A better solution is needed. | 1824 // FIXME: it's O(n^2). A better solution is needed. |
| 1825 return paintsChildren(); | 1825 return paintsChildren(); |
| 1826 } | 1826 } |
| 1827 | 1827 |
| 1828 // An image can be directly compositing if it's the sole content of the layer, a
nd has no box decorations | 1828 // An image can be directly compositing if it's the sole content of the layer, a
nd has no box decorations |
| 1829 // that require painting. Direct compositing saves backing store. | 1829 // that require painting. Direct compositing saves backing store. |
| 1830 bool CompositedLayerMapping::isDirectlyCompositedImage() const | 1830 bool CompositedLayerMapping::isDirectlyCompositedImage() const |
| 1831 { | 1831 { |
| 1832 ASSERT(renderer()->isImage()); | 1832 ASSERT(renderer()->isImage()); |
| 1833 | 1833 |
| 1834 RenderObject* renderObject = renderer(); | 1834 LayoutObject* layoutObject = renderer(); |
| 1835 if (m_owningLayer.hasBoxDecorationsOrBackground() || renderObject->hasClip()
|| renderObject->hasClipPath()) | 1835 if (m_owningLayer.hasBoxDecorationsOrBackground() || layoutObject->hasClip()
|| layoutObject->hasClipPath()) |
| 1836 return false; | 1836 return false; |
| 1837 | 1837 |
| 1838 RenderImage* imageRenderer = toRenderImage(renderObject); | 1838 RenderImage* imageRenderer = toRenderImage(layoutObject); |
| 1839 if (ImageResource* cachedImage = imageRenderer->cachedImage()) { | 1839 if (ImageResource* cachedImage = imageRenderer->cachedImage()) { |
| 1840 if (!cachedImage->hasImage()) | 1840 if (!cachedImage->hasImage()) |
| 1841 return false; | 1841 return false; |
| 1842 | 1842 |
| 1843 Image* image = cachedImage->imageForRenderer(imageRenderer); | 1843 Image* image = cachedImage->imageForRenderer(imageRenderer); |
| 1844 return image->isBitmapImage(); | 1844 return image->isBitmapImage(); |
| 1845 } | 1845 } |
| 1846 | 1846 |
| 1847 return false; | 1847 return false; |
| 1848 } | 1848 } |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2025 void CompositedLayerMapping::setContentsNeedDisplayInRect(const LayoutRect& r, P
aintInvalidationReason invalidationReason) | 2025 void CompositedLayerMapping::setContentsNeedDisplayInRect(const LayoutRect& r, P
aintInvalidationReason invalidationReason) |
| 2026 { | 2026 { |
| 2027 // FIXME: need to split out paint invalidations for the background. | 2027 // FIXME: need to split out paint invalidations for the background. |
| 2028 SetContentsNeedsDisplayInRectFunctor functor = { | 2028 SetContentsNeedsDisplayInRectFunctor functor = { |
| 2029 pixelSnappedIntRect(r.location() + m_owningLayer.subpixelAccumulation(),
r.size()), | 2029 pixelSnappedIntRect(r.location() + m_owningLayer.subpixelAccumulation(),
r.size()), |
| 2030 invalidationReason | 2030 invalidationReason |
| 2031 }; | 2031 }; |
| 2032 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers); | 2032 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers); |
| 2033 } | 2033 } |
| 2034 | 2034 |
| 2035 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co
nst RenderObject* renderObject, const Vector<GraphicsLayerPaintInfo>& layers, un
signed maxSquashedLayerIndex) | 2035 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co
nst LayoutObject* layoutObject, const Vector<GraphicsLayerPaintInfo>& layers, un
signed maxSquashedLayerIndex) |
| 2036 { | 2036 { |
| 2037 for (size_t i = 0; i < layers.size() && i < maxSquashedLayerIndex; ++i) { | 2037 for (size_t i = 0; i < layers.size() && i < maxSquashedLayerIndex; ++i) { |
| 2038 if (renderObject->isDescendantOf(layers[i].renderLayer->renderer())) | 2038 if (layoutObject->isDescendantOf(layers[i].renderLayer->renderer())) |
| 2039 return &layers[i]; | 2039 return &layers[i]; |
| 2040 } | 2040 } |
| 2041 return 0; | 2041 return 0; |
| 2042 } | 2042 } |
| 2043 | 2043 |
| 2044 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co
nst RenderObject* renderObject, unsigned maxSquashedLayerIndex) | 2044 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co
nst LayoutObject* layoutObject, unsigned maxSquashedLayerIndex) |
| 2045 { | 2045 { |
| 2046 return CompositedLayerMapping::containingSquashedLayer(renderObject, m_squas
hedLayers, maxSquashedLayerIndex); | 2046 return CompositedLayerMapping::containingSquashedLayer(layoutObject, m_squas
hedLayers, maxSquashedLayerIndex); |
| 2047 } | 2047 } |
| 2048 | 2048 |
| 2049 IntRect CompositedLayerMapping::localClipRectForSquashedLayer(const Layer& refer
enceLayer, const GraphicsLayerPaintInfo& paintInfo, const Vector<GraphicsLayerPa
intInfo>& layers) | 2049 IntRect CompositedLayerMapping::localClipRectForSquashedLayer(const Layer& refer
enceLayer, const GraphicsLayerPaintInfo& paintInfo, const Vector<GraphicsLayerPa
intInfo>& layers) |
| 2050 { | 2050 { |
| 2051 const RenderObject* clippingContainer = paintInfo.renderLayer->clippingConta
iner(); | 2051 const LayoutObject* clippingContainer = paintInfo.renderLayer->clippingConta
iner(); |
| 2052 if (clippingContainer == referenceLayer.clippingContainer()) | 2052 if (clippingContainer == referenceLayer.clippingContainer()) |
| 2053 return LayoutRect::infiniteIntRect(); | 2053 return LayoutRect::infiniteIntRect(); |
| 2054 | 2054 |
| 2055 ASSERT(clippingContainer); | 2055 ASSERT(clippingContainer); |
| 2056 | 2056 |
| 2057 const GraphicsLayerPaintInfo* ancestorPaintInfo = containingSquashedLayer(cl
ippingContainer, layers, layers.size()); | 2057 const GraphicsLayerPaintInfo* ancestorPaintInfo = containingSquashedLayer(cl
ippingContainer, layers, layers.size()); |
| 2058 // Must be there, otherwise CompositingLayerAssigner::canSquashIntoCurrentSq
uashingOwner would have disallowed squashing. | 2058 // Must be there, otherwise CompositingLayerAssigner::canSquashIntoCurrentSq
uashingOwner would have disallowed squashing. |
| 2059 ASSERT(ancestorPaintInfo); | 2059 ASSERT(ancestorPaintInfo); |
| 2060 | 2060 |
| 2061 // FIXME: this is a potential performance issue. We should consider caching
these clip rects or otherwise optimizing. | 2061 // FIXME: this is a potential performance issue. We should consider caching
these clip rects or otherwise optimizing. |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2336 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { | 2336 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
| 2337 name = "Scrolling Block Selection Layer"; | 2337 name = "Scrolling Block Selection Layer"; |
| 2338 } else { | 2338 } else { |
| 2339 ASSERT_NOT_REACHED(); | 2339 ASSERT_NOT_REACHED(); |
| 2340 } | 2340 } |
| 2341 | 2341 |
| 2342 return name; | 2342 return name; |
| 2343 } | 2343 } |
| 2344 | 2344 |
| 2345 } // namespace blink | 2345 } // namespace blink |
| OLD | NEW |