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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 static inline bool isAcceleratedCanvas(const LayoutObject* layoutObject) | 112 static inline bool isAcceleratedCanvas(const LayoutObject* layoutObject) |
113 { | 113 { |
114 if (layoutObject->isCanvas()) { | 114 if (layoutObject->isCanvas()) { |
115 HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject->node()); | 115 HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject->node()); |
116 if (CanvasRenderingContext* context = canvas->renderingContext()) | 116 if (CanvasRenderingContext* context = canvas->renderingContext()) |
117 return context->isAccelerated(); | 117 return context->isAccelerated(); |
118 } | 118 } |
119 return false; | 119 return false; |
120 } | 120 } |
121 | 121 |
122 static bool hasBoxDecorationsOrBackgroundImage(const ComputedStyle& style) | 122 static bool hasBoxDecorationsOrBackgroundImageOrBackdropFilter(const ComputedSty
le& style) |
123 { | 123 { |
124 return style.hasBoxDecorations() || style.hasBackgroundImage(); | 124 return style.hasBoxDecorations() || style.hasBackgroundImageOrBackdropFilter
(); |
125 } | 125 } |
126 | 126 |
127 static bool contentLayerSupportsDirectBackgroundComposition(const LayoutObject*
layoutObject) | 127 static bool contentLayerSupportsDirectBackgroundComposition(const LayoutObject*
layoutObject) |
128 { | 128 { |
129 // No support for decorations - border, border-radius or outline. | 129 // No support for decorations - border, border-radius or outline. |
130 // Only simple background - solid color or transparent. | 130 // Only simple background - solid color or transparent. |
131 if (hasBoxDecorationsOrBackgroundImage(layoutObject->styleRef())) | 131 if (hasBoxDecorationsOrBackgroundImageOrBackdropFilter(layoutObject->styleRe
f())) |
132 return false; | 132 return false; |
133 | 133 |
134 // If there is no background, there is nothing to support. | 134 // If there is no background, there is nothing to support. |
135 if (!layoutObject->style()->hasBackground()) | 135 if (!layoutObject->style()->hasBackground()) |
136 return true; | 136 return true; |
137 | 137 |
138 // Simple background that is contained within the contents rect. | 138 // Simple background that is contained within the contents rect. |
139 return contentsRect(layoutObject).contains(backgroundRect(layoutObject)); | 139 return contentsRect(layoutObject).contains(backgroundRect(layoutObject)); |
140 } | 140 } |
141 | 141 |
(...skipping 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1823 return true; | 1823 return true; |
1824 | 1824 |
1825 if (layoutObject->isLayoutMultiColumnSet()) | 1825 if (layoutObject->isLayoutMultiColumnSet()) |
1826 return true; | 1826 return true; |
1827 | 1827 |
1828 if (layoutObject->node() && layoutObject->node()->isDocumentNode()) { | 1828 if (layoutObject->node() && layoutObject->node()->isDocumentNode()) { |
1829 // Look to see if the root object has a non-simple background | 1829 // Look to see if the root object has a non-simple background |
1830 LayoutObject* rootObject = layoutObject->document().documentElement() ?
layoutObject->document().documentElement()->layoutObject() : 0; | 1830 LayoutObject* rootObject = layoutObject->document().documentElement() ?
layoutObject->document().documentElement()->layoutObject() : 0; |
1831 // Reject anything that has a border, a border-radius or outline, | 1831 // Reject anything that has a border, a border-radius or outline, |
1832 // or is not a simple background (no background, or solid color). | 1832 // or is not a simple background (no background, or solid color). |
1833 if (rootObject && hasBoxDecorationsOrBackgroundImage(rootObject->styleRe
f())) | 1833 if (rootObject && hasBoxDecorationsOrBackgroundImageOrBackdropFilter(roo
tObject->styleRef())) |
1834 return true; | 1834 return true; |
1835 | 1835 |
1836 // Now look at the body's layoutObject. | 1836 // Now look at the body's layoutObject. |
1837 HTMLElement* body = layoutObject->document().body(); | 1837 HTMLElement* body = layoutObject->document().body(); |
1838 LayoutObject* bodyObject = isHTMLBodyElement(body) ? body->layoutObject(
) : 0; | 1838 LayoutObject* bodyObject = isHTMLBodyElement(body) ? body->layoutObject(
) : 0; |
1839 if (bodyObject && hasBoxDecorationsOrBackgroundImage(bodyObject->styleRe
f())) | 1839 if (bodyObject && hasBoxDecorationsOrBackgroundImageOrBackdropFilter(bod
yObject->styleRef())) |
1840 return true; | 1840 return true; |
1841 } | 1841 } |
1842 | 1842 |
1843 // FIXME: it's O(n^2). A better solution is needed. | 1843 // FIXME: it's O(n^2). A better solution is needed. |
1844 return paintsChildren(); | 1844 return paintsChildren(); |
1845 } | 1845 } |
1846 | 1846 |
1847 // An image can be directly compositing if it's the sole content of the layer, a
nd has no box decorations | 1847 // An image can be directly compositing if it's the sole content of the layer, a
nd has no box decorations |
1848 // that require painting. Direct compositing saves backing store. | 1848 // that require painting. Direct compositing saves backing store. |
1849 bool CompositedDeprecatedPaintLayerMapping::isDirectlyCompositedImage() const | 1849 bool CompositedDeprecatedPaintLayerMapping::isDirectlyCompositedImage() const |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2397 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { | 2397 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
2398 name = "Scrolling Block Selection Layer"; | 2398 name = "Scrolling Block Selection Layer"; |
2399 } else { | 2399 } else { |
2400 ASSERT_NOT_REACHED(); | 2400 ASSERT_NOT_REACHED(); |
2401 } | 2401 } |
2402 | 2402 |
2403 return name; | 2403 return name; |
2404 } | 2404 } |
2405 | 2405 |
2406 } // namespace blink | 2406 } // namespace blink |
OLD | NEW |