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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 static inline bool isAcceleratedCanvas(const LayoutObject* layoutObject) | 115 static inline bool isAcceleratedCanvas(const LayoutObject* layoutObject) |
116 { | 116 { |
117 if (layoutObject->isCanvas()) { | 117 if (layoutObject->isCanvas()) { |
118 HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject->node()); | 118 HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject->node()); |
119 if (CanvasRenderingContext* context = canvas->renderingContext()) | 119 if (CanvasRenderingContext* context = canvas->renderingContext()) |
120 return context->isAccelerated(); | 120 return context->isAccelerated(); |
121 } | 121 } |
122 return false; | 122 return false; |
123 } | 123 } |
124 | 124 |
125 static bool hasBoxDecorationsOrBackgroundImage(const ComputedStyle& style) | 125 static bool hasBoxDecorationsOrBackgroundImageOrBackdropFilter(const ComputedSty
le& style) |
126 { | 126 { |
127 return style.hasBoxDecorations() || style.hasBackgroundImage(); | 127 return style.hasBoxDecorations() || style.hasBackgroundImageOrBackdropFilter
(); |
128 } | 128 } |
129 | 129 |
130 static bool contentLayerSupportsDirectBackgroundComposition(const LayoutObject*
layoutObject) | 130 static bool contentLayerSupportsDirectBackgroundComposition(const LayoutObject*
layoutObject) |
131 { | 131 { |
132 // No support for decorations - border, border-radius or outline. | 132 // No support for decorations - border, border-radius or outline. |
133 // Only simple background - solid color or transparent. | 133 // Only simple background - solid color or transparent. |
134 if (hasBoxDecorationsOrBackgroundImage(layoutObject->styleRef())) | 134 if (hasBoxDecorationsOrBackgroundImageOrBackdropFilter(layoutObject->styleRe
f())) |
135 return false; | 135 return false; |
136 | 136 |
137 // If there is no background, there is nothing to support. | 137 // If there is no background, there is nothing to support. |
138 if (!layoutObject->style()->hasBackground()) | 138 if (!layoutObject->style()->hasBackground()) |
139 return true; | 139 return true; |
140 | 140 |
141 // Simple background that is contained within the contents rect. | 141 // Simple background that is contained within the contents rect. |
142 return contentsRect(layoutObject).contains(backgroundRect(layoutObject)); | 142 return contentsRect(layoutObject).contains(backgroundRect(layoutObject)); |
143 } | 143 } |
144 | 144 |
(...skipping 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1880 return true; | 1880 return true; |
1881 | 1881 |
1882 if (layoutObject->isLayoutMultiColumnSet()) | 1882 if (layoutObject->isLayoutMultiColumnSet()) |
1883 return true; | 1883 return true; |
1884 | 1884 |
1885 if (layoutObject->node() && layoutObject->node()->isDocumentNode()) { | 1885 if (layoutObject->node() && layoutObject->node()->isDocumentNode()) { |
1886 // Look to see if the root object has a non-simple background | 1886 // Look to see if the root object has a non-simple background |
1887 LayoutObject* rootObject = layoutObject->document().documentElement() ?
layoutObject->document().documentElement()->layoutObject() : 0; | 1887 LayoutObject* rootObject = layoutObject->document().documentElement() ?
layoutObject->document().documentElement()->layoutObject() : 0; |
1888 // Reject anything that has a border, a border-radius or outline, | 1888 // Reject anything that has a border, a border-radius or outline, |
1889 // or is not a simple background (no background, or solid color). | 1889 // or is not a simple background (no background, or solid color). |
1890 if (rootObject && hasBoxDecorationsOrBackgroundImage(rootObject->styleRe
f())) | 1890 if (rootObject && hasBoxDecorationsOrBackgroundImageOrBackdropFilter(roo
tObject->styleRef())) |
1891 return true; | 1891 return true; |
1892 | 1892 |
1893 // Now look at the body's layoutObject. | 1893 // Now look at the body's layoutObject. |
1894 HTMLElement* body = layoutObject->document().body(); | 1894 HTMLElement* body = layoutObject->document().body(); |
1895 LayoutObject* bodyObject = isHTMLBodyElement(body) ? body->layoutObject(
) : 0; | 1895 LayoutObject* bodyObject = isHTMLBodyElement(body) ? body->layoutObject(
) : 0; |
1896 if (bodyObject && hasBoxDecorationsOrBackgroundImage(bodyObject->styleRe
f())) | 1896 if (bodyObject && hasBoxDecorationsOrBackgroundImageOrBackdropFilter(bod
yObject->styleRef())) |
1897 return true; | 1897 return true; |
1898 } | 1898 } |
1899 | 1899 |
1900 // FIXME: it's O(n^2). A better solution is needed. | 1900 // FIXME: it's O(n^2). A better solution is needed. |
1901 return paintsChildren(); | 1901 return paintsChildren(); |
1902 } | 1902 } |
1903 | 1903 |
1904 // An image can be directly composited if it's the sole content of the layer, | 1904 // An image can be directly composited if it's the sole content of the layer, |
1905 // and has no box decorations or clipping that require painting. Direct | 1905 // and has no box decorations or clipping that require painting. Direct |
1906 // compositing saves a backing store. | 1906 // compositing saves a backing store. |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2582 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { | 2582 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
2583 name = "Scrolling Block Selection Layer"; | 2583 name = "Scrolling Block Selection Layer"; |
2584 } else { | 2584 } else { |
2585 ASSERT_NOT_REACHED(); | 2585 ASSERT_NOT_REACHED(); |
2586 } | 2586 } |
2587 | 2587 |
2588 return name; | 2588 return name; |
2589 } | 2589 } |
2590 | 2590 |
2591 } // namespace blink | 2591 } // namespace blink |
OLD | NEW |