| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
| 3 * | 3 * |
| 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 5 * | 5 * |
| 6 * Other contributors: | 6 * Other contributors: |
| 7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
| 8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
| 9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
| 10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
| (...skipping 1714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1725 result.moveBy(delta); | 1725 result.moveBy(delta); |
| 1726 return result; | 1726 return result; |
| 1727 } | 1727 } |
| 1728 | 1728 |
| 1729 bool RenderLayer::paintsWithTransform() const | 1729 bool RenderLayer::paintsWithTransform() const |
| 1730 { | 1730 { |
| 1731 // FIXME(sky): Remove | 1731 // FIXME(sky): Remove |
| 1732 return transform(); | 1732 return transform(); |
| 1733 } | 1733 } |
| 1734 | 1734 |
| 1735 bool RenderLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect)
const | |
| 1736 { | |
| 1737 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) | |
| 1738 return false; | |
| 1739 | |
| 1740 if (isTransparent()) | |
| 1741 return false; | |
| 1742 | |
| 1743 if (paintsWithFilters() && renderer()->style()->filter().hasFilterThatAffect
sOpacity()) | |
| 1744 return false; | |
| 1745 | |
| 1746 // FIXME: Handle simple transforms. | |
| 1747 if (paintsWithTransform()) | |
| 1748 return false; | |
| 1749 | |
| 1750 // FIXME: Remove this check. | |
| 1751 // This function should not be called when layer-lists are dirty. | |
| 1752 // It is somehow getting triggered during style update. | |
| 1753 if (m_stackingNode->zOrderListsDirty() || m_stackingNode->normalFlowListDirt
y()) | |
| 1754 return false; | |
| 1755 | |
| 1756 // FIXME: We currently only check the immediate renderer, | |
| 1757 // which will miss many cases. | |
| 1758 if (renderer()->backgroundIsKnownToBeOpaqueInRect(localRect)) | |
| 1759 return true; | |
| 1760 | |
| 1761 // We can't consult child layers if we clip, since they might cover | |
| 1762 // parts of the rect that are clipped out. | |
| 1763 if (renderer()->hasOverflowClip()) | |
| 1764 return false; | |
| 1765 | |
| 1766 return childBackgroundIsKnownToBeOpaqueInRect(localRect); | |
| 1767 } | |
| 1768 | |
| 1769 bool RenderLayer::childBackgroundIsKnownToBeOpaqueInRect(const LayoutRect& local
Rect) const | |
| 1770 { | |
| 1771 RenderLayerStackingNodeReverseIterator revertseIterator(*m_stackingNode, Pos
itiveZOrderChildren | NormalFlowChildren | NegativeZOrderChildren); | |
| 1772 while (RenderLayerStackingNode* child = revertseIterator.next()) { | |
| 1773 const RenderLayer* childLayer = child->layer(); | |
| 1774 if (!childLayer->canUseConvertToLayerCoords()) | |
| 1775 continue; | |
| 1776 | |
| 1777 LayoutPoint childOffset; | |
| 1778 LayoutRect childLocalRect(localRect); | |
| 1779 childLayer->convertToLayerCoords(this, childOffset); | |
| 1780 childLocalRect.moveBy(-childOffset); | |
| 1781 | |
| 1782 if (childLayer->backgroundIsKnownToBeOpaqueInRect(childLocalRect)) | |
| 1783 return true; | |
| 1784 } | |
| 1785 return false; | |
| 1786 } | |
| 1787 | |
| 1788 bool RenderLayer::shouldBeSelfPaintingLayer() const | 1735 bool RenderLayer::shouldBeSelfPaintingLayer() const |
| 1789 { | 1736 { |
| 1790 return m_layerType == NormalLayer | 1737 return m_layerType == NormalLayer |
| 1791 || (m_scrollableArea && m_scrollableArea->hasOverlayScrollbars()) | 1738 || (m_scrollableArea && m_scrollableArea->hasOverlayScrollbars()) |
| 1792 || needsCompositedScrolling(); | 1739 || needsCompositedScrolling(); |
| 1793 } | 1740 } |
| 1794 | 1741 |
| 1795 void RenderLayer::updateSelfPaintingLayer() | 1742 void RenderLayer::updateSelfPaintingLayer() |
| 1796 { | 1743 { |
| 1797 bool isSelfPaintingLayer = shouldBeSelfPaintingLayer(); | 1744 bool isSelfPaintingLayer = shouldBeSelfPaintingLayer(); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1941 } | 1888 } |
| 1942 } | 1889 } |
| 1943 | 1890 |
| 1944 void showLayerTree(const blink::RenderObject* renderer) | 1891 void showLayerTree(const blink::RenderObject* renderer) |
| 1945 { | 1892 { |
| 1946 if (!renderer) | 1893 if (!renderer) |
| 1947 return; | 1894 return; |
| 1948 showLayerTree(renderer->enclosingLayer()); | 1895 showLayerTree(renderer->enclosingLayer()); |
| 1949 } | 1896 } |
| 1950 #endif | 1897 #endif |
| OLD | NEW |