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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 CompositedLayerMapping::CompositedLayerMapping(RenderLayer& layer) | 169 CompositedLayerMapping::CompositedLayerMapping(RenderLayer& layer) |
170 : m_owningLayer(layer) | 170 : m_owningLayer(layer) |
171 , m_artificiallyInflatedBounds(false) | 171 , m_artificiallyInflatedBounds(false) |
172 , m_isMainFrameRenderViewLayer(false) | 172 , m_isMainFrameRenderViewLayer(false) |
173 , m_requiresOwnBackingStoreForIntrinsicReasons(true) | 173 , m_requiresOwnBackingStoreForIntrinsicReasons(true) |
174 , m_requiresOwnBackingStoreForAncestorReasons(true) | 174 , m_requiresOwnBackingStoreForAncestorReasons(true) |
175 , m_canCompositeFilters(false) | 175 , m_canCompositeFilters(false) |
176 , m_backgroundLayerPaintsFixedRootBackground(false) | 176 , m_backgroundLayerPaintsFixedRootBackground(false) |
177 , m_needToUpdateGraphicsLayer(false) | 177 , m_needToUpdateGraphicsLayer(false) |
178 , m_needToUpdateGraphicsLayerOfAllDecendants(false) | 178 , m_needToUpdateGraphicsLayerOfAllDecendants(false) |
| 179 , m_scrollingContentsAreEmpty(false) |
179 { | 180 { |
180 if (layer.isRootLayer() && renderer()->frame()->isMainFrame()) | 181 if (layer.isRootLayer() && renderer()->frame()->isMainFrame()) |
181 m_isMainFrameRenderViewLayer = true; | 182 m_isMainFrameRenderViewLayer = true; |
182 | 183 |
183 createPrimaryGraphicsLayer(); | 184 createPrimaryGraphicsLayer(); |
184 } | 185 } |
185 | 186 |
186 CompositedLayerMapping::~CompositedLayerMapping() | 187 CompositedLayerMapping::~CompositedLayerMapping() |
187 { | 188 { |
188 // Hits in compositing/squashing/squash-onto-nephew.html. | 189 // Hits in compositing/squashing/squash-onto-nephew.html. |
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 paintPhase |= GraphicsLayerPaintForeground; | 1050 paintPhase |= GraphicsLayerPaintForeground; |
1050 m_scrollingContentsLayer->setPaintingPhase(paintPhase); | 1051 m_scrollingContentsLayer->setPaintingPhase(paintPhase); |
1051 } | 1052 } |
1052 } | 1053 } |
1053 | 1054 |
1054 void CompositedLayerMapping::updateContentsRect() | 1055 void CompositedLayerMapping::updateContentsRect() |
1055 { | 1056 { |
1056 m_graphicsLayer->setContentsRect(pixelSnappedIntRect(contentsBox())); | 1057 m_graphicsLayer->setContentsRect(pixelSnappedIntRect(contentsBox())); |
1057 } | 1058 } |
1058 | 1059 |
| 1060 void CompositedLayerMapping::updateScrollingContentsForSelectionGaps() |
| 1061 { |
| 1062 if (!m_scrollingContentsAreEmpty || !m_scrollingContentsLayer) |
| 1063 return; |
| 1064 |
| 1065 // FIXME: in this case, the scrolling contents layer doesn't need to be full
size. We should position and size |
| 1066 // it more conservatively. See crbug.com/381187. |
| 1067 m_scrollingContentsLayer->setDrawsContent(m_owningLayer.rendererHasBlockSele
ctionGaps() == RenderLayer::LayerHasBlockSelectionGaps); |
| 1068 } |
| 1069 |
1059 void CompositedLayerMapping::updateDrawsContent() | 1070 void CompositedLayerMapping::updateDrawsContent() |
1060 { | 1071 { |
1061 if (m_scrollingLayer) { | 1072 if (m_scrollingLayer) { |
1062 // We don't have to consider overflow controls, because we know that the
scrollbars are drawn elsewhere. | 1073 // We don't have to consider overflow controls, because we know that the
scrollbars are drawn elsewhere. |
1063 // m_graphicsLayer only needs backing store if the non-scrolling parts (
background, outlines, borders, shadows etc) need to paint. | 1074 // m_graphicsLayer only needs backing store if the non-scrolling parts (
background, outlines, borders, shadows etc) need to paint. |
1064 // m_scrollingLayer never has backing store. | 1075 // m_scrollingLayer never has backing store. |
1065 // m_scrollingContentsLayer only needs backing store if the scrolled con
tents need to paint. | 1076 // m_scrollingContentsLayer only needs backing store if the scrolled con
tents need to paint. |
1066 bool hasNonScrollingPaintedContent = m_owningLayer.hasVisibleContent() &
& m_owningLayer.hasBoxDecorationsOrBackground(); | 1077 bool hasNonScrollingPaintedContent = m_owningLayer.hasVisibleContent() &
& m_owningLayer.hasBoxDecorationsOrBackground(); |
1067 m_graphicsLayer->setDrawsContent(hasNonScrollingPaintedContent); | 1078 m_graphicsLayer->setDrawsContent(hasNonScrollingPaintedContent); |
1068 | 1079 |
1069 bool hasScrollingPaintedContent = m_owningLayer.hasVisibleContent() && (
renderer()->hasBackground() || paintsChildren()); | 1080 bool hasScrollingPaintedContent = m_owningLayer.hasVisibleContent() && (
renderer()->hasBackground() || paintsChildren()); |
1070 m_scrollingContentsLayer->setDrawsContent(hasScrollingPaintedContent); | 1081 m_scrollingContentsAreEmpty = !hasScrollingPaintedContent; |
| 1082 |
| 1083 RenderLayer::PresenceOfBlockSelectionGaps hasBlockSelectionGaps = owning
Layer().rendererHasBlockSelectionGaps(); |
| 1084 bool shouldDrawContent = !m_scrollingContentsAreEmpty || hasBlockSelecti
onGaps == RenderLayer::LayerHasBlockSelectionGaps; |
| 1085 m_scrollingContentsLayer->setDrawsContent(shouldDrawContent); |
1071 return; | 1086 return; |
1072 } | 1087 } |
1073 | 1088 |
1074 bool hasPaintedContent = containsPaintedContent(); | 1089 bool hasPaintedContent = containsPaintedContent(); |
1075 if (hasPaintedContent && isAcceleratedCanvas(renderer())) { | 1090 if (hasPaintedContent && isAcceleratedCanvas(renderer())) { |
1076 CanvasRenderingContext* context = toHTMLCanvasElement(renderer()->node()
)->renderingContext(); | 1091 CanvasRenderingContext* context = toHTMLCanvasElement(renderer()->node()
)->renderingContext(); |
1077 // Content layer may be null if context is lost. | 1092 // Content layer may be null if context is lost. |
1078 if (blink::WebLayer* contentLayer = context->platformLayer()) { | 1093 if (blink::WebLayer* contentLayer = context->platformLayer()) { |
1079 Color bgColor(Color::transparent); | 1094 Color bgColor(Color::transparent); |
1080 if (contentLayerSupportsDirectBackgroundComposition(renderer())) { | 1095 if (contentLayerSupportsDirectBackgroundComposition(renderer())) { |
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2255 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2270 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
2256 name = "Scrolling Contents Layer"; | 2271 name = "Scrolling Contents Layer"; |
2257 } else { | 2272 } else { |
2258 ASSERT_NOT_REACHED(); | 2273 ASSERT_NOT_REACHED(); |
2259 } | 2274 } |
2260 | 2275 |
2261 return name; | 2276 return name; |
2262 } | 2277 } |
2263 | 2278 |
2264 } // namespace WebCore | 2279 } // namespace WebCore |
OLD | NEW |