Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010 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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 311 void RenderLayerCompositor::didChangeVisibleRect() | 311 void RenderLayerCompositor::didChangeVisibleRect() |
| 312 { | 312 { |
| 313 GraphicsLayer* rootLayer = rootGraphicsLayer(); | 313 GraphicsLayer* rootLayer = rootGraphicsLayer(); |
| 314 if (!rootLayer) | 314 if (!rootLayer) |
| 315 return; | 315 return; |
| 316 | 316 |
| 317 FrameView* frameView = m_renderView ? m_renderView->frameView() : 0; | 317 FrameView* frameView = m_renderView ? m_renderView->frameView() : 0; |
| 318 if (!frameView) | 318 if (!frameView) |
| 319 return; | 319 return; |
| 320 | 320 |
| 321 IntRect visibleRect = m_clipLayer ? IntRect(IntPoint(), frameView->contentsS ize()) : frameView->visibleContentRect(); | 321 IntRect visibleRect = m_innerViewportClipLayer ? IntRect(IntPoint(), frameVi ew->contentsSize()) : frameView->visibleContentRect(); |
| 322 if (rootLayer->visibleRectChangeRequiresFlush(visibleRect)) { | 322 if (rootLayer->visibleRectChangeRequiresFlush(visibleRect)) { |
| 323 if (Page* page = this->page()) | 323 if (Page* page = this->page()) |
| 324 page->chrome().client()->scheduleCompositingLayerFlush(); | 324 page->chrome().client()->scheduleCompositingLayerFlush(); |
| 325 } | 325 } |
| 326 } | 326 } |
| 327 | 327 |
| 328 bool RenderLayerCompositor::hasAnyAdditionalCompositedLayers(const RenderLayer* rootLayer) const | 328 bool RenderLayerCompositor::hasAnyAdditionalCompositedLayers(const RenderLayer* rootLayer) const |
| 329 { | 329 { |
| 330 return m_compositedLayerCount > (rootLayer->isComposited() ? 1 : 0); | 330 return m_compositedLayerCount > (rootLayer->isComposited() ? 1 : 0); |
| 331 } | 331 } |
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1110 } | 1110 } |
| 1111 | 1111 |
| 1112 void RenderLayerCompositor::frameViewDidChangeLocation(const IntPoint& contentsO ffset) | 1112 void RenderLayerCompositor::frameViewDidChangeLocation(const IntPoint& contentsO ffset) |
| 1113 { | 1113 { |
| 1114 if (m_overflowControlsHostLayer) | 1114 if (m_overflowControlsHostLayer) |
| 1115 m_overflowControlsHostLayer->setPosition(contentsOffset); | 1115 m_overflowControlsHostLayer->setPosition(contentsOffset); |
| 1116 } | 1116 } |
| 1117 | 1117 |
| 1118 void RenderLayerCompositor::frameViewDidChangeSize() | 1118 void RenderLayerCompositor::frameViewDidChangeSize() |
| 1119 { | 1119 { |
| 1120 if (m_clipLayer) { | 1120 if (m_innerViewportClipLayer) { |
| 1121 FrameView* frameView = m_renderView->frameView(); | 1121 FrameView* frameView = m_renderView->frameView(); |
| 1122 m_clipLayer->setSize(frameView->unscaledVisibleContentSize()); | 1122 FloatSize unscaledVisibleContentSize = frameView->unscaledVisibleContent Size(); |
| 1123 m_innerViewportClipLayer->setSize(frameView->frameRect().size()); | |
| 1124 if (m_outerViewportClipLayer) { | |
| 1125 FloatSize visibleContentSize(unscaledVisibleContentSize); | |
| 1126 visibleContentSize.scale(frameView->visibleContentScaleFactor()); | |
| 1127 m_outerViewportClipLayer->setSize(visibleContentSize); | |
| 1128 } | |
| 1123 | 1129 |
| 1124 frameViewDidScroll(); | 1130 frameViewDidScroll(); |
| 1125 updateOverflowControlsLayers(); | 1131 updateOverflowControlsLayers(); |
| 1126 | 1132 |
| 1127 #if ENABLE(RUBBER_BANDING) | 1133 #if ENABLE(RUBBER_BANDING) |
| 1128 if (m_layerForOverhangAreas) | 1134 if (m_layerForOverhangAreas) |
| 1129 m_layerForOverhangAreas->setSize(frameView->frameRect().size()); | 1135 m_layerForOverhangAreas->setSize(frameView->frameRect().size()); |
| 1130 #endif | 1136 #endif |
| 1131 } | 1137 } |
| 1132 } | 1138 } |
| 1133 | 1139 |
| 1134 void RenderLayerCompositor::frameViewDidScroll() | 1140 void RenderLayerCompositor::frameViewDidScroll() |
| 1135 { | 1141 { |
| 1136 FrameView* frameView = m_renderView->frameView(); | 1142 FrameView* frameView = m_renderView->frameView(); |
| 1137 IntPoint scrollPosition = frameView->scrollPosition(); | 1143 IntPoint scrollPosition = frameView->scrollPosition(); |
| 1138 | 1144 |
| 1139 if (!m_scrollLayer) | 1145 if (!m_innerViewportScrollLayer) |
| 1140 return; | 1146 return; |
| 1141 | 1147 |
| 1142 // If there's a scrolling coordinator that manages scrolling for this frame view, | 1148 // If there's a scrolling coordinator that manages scrolling for this frame view, |
| 1143 // it will also manage updating the scroll layer position. | 1149 // it will also manage updating the scroll layer position. |
| 1144 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) { | 1150 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) { |
| 1145 if (scrollingCoordinator->coordinatesScrollingForFrameView(frameView)) | 1151 if (scrollingCoordinator->coordinatesScrollingForFrameView(frameView)) |
| 1146 return; | 1152 return; |
| 1147 if (Settings* settings = m_renderView->document()->settings()) { | 1153 if (Settings* settings = m_renderView->document()->settings()) { |
| 1148 if (settings->compositedScrollingForFramesEnabled()) | 1154 if (settings->compositedScrollingForFramesEnabled()) |
| 1149 scrollingCoordinator->scrollableAreaScrollLayerDidChange(frameVi ew); | 1155 scrollingCoordinator->scrollableAreaScrollLayerDidChange(frameVi ew); |
| 1150 } | 1156 } |
| 1151 } | 1157 } |
| 1152 | 1158 |
| 1153 m_scrollLayer->setPosition(FloatPoint(-scrollPosition.x(), -scrollPosition.y ())); | 1159 m_innerViewportScrollLayer->setPosition(FloatPoint(-scrollPosition.x(), -scr ollPosition.y())); |
| 1154 | 1160 |
| 1155 if (GraphicsLayer* fixedBackgroundLayer = fixedRootBackgroundLayer()) | 1161 if (GraphicsLayer* fixedBackgroundLayer = fixedRootBackgroundLayer()) |
| 1156 fixedBackgroundLayer->setPosition(IntPoint(frameView->scrollOffsetForFix edPosition())); | 1162 fixedBackgroundLayer->setPosition(IntPoint(frameView->scrollOffsetForFix edPosition())); |
| 1157 } | 1163 } |
| 1158 | 1164 |
| 1159 void RenderLayerCompositor::frameViewDidLayout() | 1165 void RenderLayerCompositor::frameViewDidLayout() |
| 1160 { | 1166 { |
| 1161 } | 1167 } |
| 1162 | 1168 |
| 1163 void RenderLayerCompositor::rootFixedBackgroundsChanged() | 1169 void RenderLayerCompositor::rootFixedBackgroundsChanged() |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1408 | 1414 |
| 1409 GraphicsLayer* RenderLayerCompositor::rootGraphicsLayer() const | 1415 GraphicsLayer* RenderLayerCompositor::rootGraphicsLayer() const |
| 1410 { | 1416 { |
| 1411 if (m_overflowControlsHostLayer) | 1417 if (m_overflowControlsHostLayer) |
| 1412 return m_overflowControlsHostLayer.get(); | 1418 return m_overflowControlsHostLayer.get(); |
| 1413 return m_rootContentLayer.get(); | 1419 return m_rootContentLayer.get(); |
| 1414 } | 1420 } |
| 1415 | 1421 |
| 1416 GraphicsLayer* RenderLayerCompositor::scrollLayer() const | 1422 GraphicsLayer* RenderLayerCompositor::scrollLayer() const |
| 1417 { | 1423 { |
| 1418 return m_scrollLayer.get(); | 1424 return m_innerViewportScrollLayer.get(); |
| 1419 } | 1425 } |
| 1420 | 1426 |
| 1421 void RenderLayerCompositor::setIsInWindow(bool isInWindow) | 1427 void RenderLayerCompositor::setIsInWindow(bool isInWindow) |
| 1422 { | 1428 { |
| 1423 if (!inCompositingMode()) | 1429 if (!inCompositingMode()) |
| 1424 return; | 1430 return; |
| 1425 | 1431 |
| 1426 if (isInWindow) { | 1432 if (isInWindow) { |
| 1427 if (m_rootLayerAttachment != RootLayerUnattached) | 1433 if (m_rootLayerAttachment != RootLayerUnattached) |
| 1428 return; | 1434 return; |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 1456 clearBackingForLayerIncludingDescendants(m_renderView->layer()); | 1462 clearBackingForLayerIncludingDescendants(m_renderView->layer()); |
| 1457 } | 1463 } |
| 1458 | 1464 |
| 1459 void RenderLayerCompositor::updateRootLayerPosition() | 1465 void RenderLayerCompositor::updateRootLayerPosition() |
| 1460 { | 1466 { |
| 1461 if (m_rootContentLayer) { | 1467 if (m_rootContentLayer) { |
| 1462 const IntRect& documentRect = m_renderView->documentRect(); | 1468 const IntRect& documentRect = m_renderView->documentRect(); |
| 1463 m_rootContentLayer->setSize(documentRect.size()); | 1469 m_rootContentLayer->setSize(documentRect.size()); |
| 1464 m_rootContentLayer->setPosition(documentRect.location()); | 1470 m_rootContentLayer->setPosition(documentRect.location()); |
| 1465 } | 1471 } |
| 1466 if (m_clipLayer) { | 1472 if (m_innerViewportClipLayer) { |
| 1467 FrameView* frameView = m_renderView->frameView(); | 1473 FrameView* frameView = m_renderView->frameView(); |
| 1468 m_clipLayer->setSize(frameView->unscaledVisibleContentSize()); | 1474 m_innerViewportClipLayer->setSize(frameView->frameRect().size()); |
| 1475 if (m_outerViewportClipLayer) | |
| 1476 m_outerViewportClipLayer->setSize(frameView->unscaledVisibleContentS ize()); | |
| 1469 } | 1477 } |
| 1470 | 1478 |
| 1471 #if ENABLE(RUBBER_BANDING) | 1479 #if ENABLE(RUBBER_BANDING) |
| 1472 if (m_contentShadowLayer) { | 1480 if (m_contentShadowLayer) { |
| 1473 m_contentShadowLayer->setPosition(m_rootContentLayer->position()); | 1481 m_contentShadowLayer->setPosition(m_rootContentLayer->position()); |
| 1474 | 1482 |
| 1475 FloatSize rootContentLayerSize = m_rootContentLayer->size(); | 1483 FloatSize rootContentLayerSize = m_rootContentLayer->size(); |
| 1476 if (m_contentShadowLayer->size() != rootContentLayerSize) { | 1484 if (m_contentShadowLayer->size() != rootContentLayerSize) { |
| 1477 m_contentShadowLayer->setSize(rootContentLayerSize); | 1485 m_contentShadowLayer->setSize(rootContentLayerSize); |
| 1478 ScrollbarTheme::theme()->setUpContentShadowLayer(m_contentShadowLaye r.get()); | 1486 ScrollbarTheme::theme()->setUpContentShadowLayer(m_contentShadowLaye r.get()); |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2196 m_layerForTopOverhangArea = nullptr; | 2204 m_layerForTopOverhangArea = nullptr; |
| 2197 } | 2205 } |
| 2198 return 0; | 2206 return 0; |
| 2199 } | 2207 } |
| 2200 | 2208 |
| 2201 if (!m_layerForTopOverhangArea) { | 2209 if (!m_layerForTopOverhangArea) { |
| 2202 m_layerForTopOverhangArea = GraphicsLayer::create(graphicsLayerFactory() , this); | 2210 m_layerForTopOverhangArea = GraphicsLayer::create(graphicsLayerFactory() , this); |
| 2203 #ifndef NDEBUG | 2211 #ifndef NDEBUG |
| 2204 m_layerForTopOverhangArea->setName("top overhang area"); | 2212 m_layerForTopOverhangArea->setName("top overhang area"); |
| 2205 #endif | 2213 #endif |
| 2206 m_scrollLayer->addChildBelow(m_layerForTopOverhangArea.get(), m_rootCont entLayer.get()); | 2214 // FIXME: When the pinch virtual viewport is enabled, do we really want |
|
enne (OOO)
2013/05/30 21:03:31
This is wrong, but this patch doesn't make it any
wjmaclean
2013/05/31 18:21:10
Yes. Even better, it can be immortalized with a DC
| |
| 2215 // to be applying the page scale to the bottom overhang layer? Will it h urt anything? | |
| 2216 if (!m_outerViewportScrollLayer) | |
| 2217 m_innerViewportScrollLayer->addChildBelow(m_layerForTopOverhangArea. get(), m_rootContentLayer.get()); | |
| 2218 else | |
| 2219 m_outerViewportScrollLayer->addChildBelow(m_layerForTopOverhangArea. get(), m_rootContentLayer.get()); | |
| 2207 } | 2220 } |
| 2208 | 2221 |
| 2209 return m_layerForTopOverhangArea.get(); | 2222 return m_layerForTopOverhangArea.get(); |
| 2210 } | 2223 } |
| 2211 | 2224 |
| 2212 GraphicsLayer* RenderLayerCompositor::updateLayerForBottomOverhangArea(bool want sLayer) | 2225 GraphicsLayer* RenderLayerCompositor::updateLayerForBottomOverhangArea(bool want sLayer) |
| 2213 { | 2226 { |
| 2214 if (!isMainFrame()) | 2227 if (!isMainFrame()) |
| 2215 return 0; | 2228 return 0; |
| 2216 | 2229 |
| 2217 if (!wantsLayer) { | 2230 if (!wantsLayer) { |
| 2218 if (m_layerForBottomOverhangArea) { | 2231 if (m_layerForBottomOverhangArea) { |
| 2219 m_layerForBottomOverhangArea->removeFromParent(); | 2232 m_layerForBottomOverhangArea->removeFromParent(); |
| 2220 m_layerForBottomOverhangArea = nullptr; | 2233 m_layerForBottomOverhangArea = nullptr; |
| 2221 } | 2234 } |
| 2222 return 0; | 2235 return 0; |
| 2223 } | 2236 } |
| 2224 | 2237 |
| 2225 if (!m_layerForBottomOverhangArea) { | 2238 if (!m_layerForBottomOverhangArea) { |
| 2226 m_layerForBottomOverhangArea = GraphicsLayer::create(graphicsLayerFactor y(), this); | 2239 m_layerForBottomOverhangArea = GraphicsLayer::create(graphicsLayerFactor y(), this); |
| 2227 #ifndef NDEBUG | 2240 #ifndef NDEBUG |
| 2228 m_layerForBottomOverhangArea->setName("bottom overhang area"); | 2241 m_layerForBottomOverhangArea->setName("bottom overhang area"); |
| 2229 #endif | 2242 #endif |
| 2230 m_scrollLayer->addChildBelow(m_layerForBottomOverhangArea.get(), m_rootC ontentLayer.get()); | 2243 // FIXME: When the pinch virtual viewport is enabled, do we really want |
| 2244 // to be applying the page scale to the bottom overhang layer? Will it h urt anything? | |
| 2245 if (!m_outerViewportScrollLayer) | |
| 2246 m_innerViewportScrollLayer->addChildBelow(m_layerForBottomOverhangAr ea.get(), m_rootContentLayer.get()); | |
| 2247 else | |
| 2248 m_outerViewportScrollLayer->addChildBelow(m_layerForBottomOverhangAr ea.get(), m_rootContentLayer.get()); | |
| 2231 } | 2249 } |
| 2232 | 2250 |
| 2233 m_layerForBottomOverhangArea->setPosition(FloatPoint(0, m_rootContentLayer-> size().height())); | 2251 m_layerForBottomOverhangArea->setPosition(FloatPoint(0, m_rootContentLayer-> size().height())); |
| 2234 return m_layerForBottomOverhangArea.get(); | 2252 return m_layerForBottomOverhangArea.get(); |
| 2235 } | 2253 } |
| 2236 | 2254 |
| 2237 #endif | 2255 #endif |
| 2238 | 2256 |
| 2239 bool RenderLayerCompositor::viewHasTransparentBackground(Color* backgroundColor) const | 2257 bool RenderLayerCompositor::viewHasTransparentBackground(Color* backgroundColor) const |
| 2240 { | 2258 { |
| 2241 FrameView* frameView = m_renderView->frameView(); | 2259 FrameView* frameView = m_renderView->frameView(); |
| 2242 if (frameView->isTransparent()) { | 2260 if (frameView->isTransparent()) { |
| 2243 if (backgroundColor) | 2261 if (backgroundColor) |
| 2244 *backgroundColor = Color(); // Return an invalid color. | 2262 *backgroundColor = Color(); // Return an invalid color. |
| 2245 return true; | 2263 return true; |
| 2246 } | 2264 } |
| 2247 | 2265 |
| 2248 Color documentBackgroundColor = frameView->documentBackgroundColor(); | 2266 Color documentBackgroundColor = frameView->documentBackgroundColor(); |
| 2249 if (!documentBackgroundColor.isValid()) | 2267 if (!documentBackgroundColor.isValid()) |
| 2250 documentBackgroundColor = Color::white; | 2268 documentBackgroundColor = Color::white; |
| 2251 | 2269 |
| 2252 if (backgroundColor) | 2270 if (backgroundColor) |
| 2253 *backgroundColor = documentBackgroundColor; | 2271 *backgroundColor = documentBackgroundColor; |
| 2254 | 2272 |
| 2255 return documentBackgroundColor.hasAlpha(); | 2273 return documentBackgroundColor.hasAlpha(); |
| 2256 } | 2274 } |
| 2257 | 2275 |
| 2258 void RenderLayerCompositor::updateOverflowControlsLayers() | 2276 void RenderLayerCompositor::updateOverflowControlsLayers() |
| 2259 { | 2277 { |
| 2278 GraphicsLayer* hostLayerForOverflowControls = m_outerViewportClipLayer ? | |
| 2279 m_innerViewportScrollLayer.get() : m_innerViewportClipLayer.get(); | |
| 2260 #if ENABLE(RUBBER_BANDING) | 2280 #if ENABLE(RUBBER_BANDING) |
| 2261 if (requiresOverhangAreasLayer()) { | 2281 if (requiresOverhangAreasLayer()) { |
| 2262 if (!m_layerForOverhangAreas) { | 2282 if (!m_layerForOverhangAreas) { |
| 2263 m_layerForOverhangAreas = GraphicsLayer::create(graphicsLayerFactory (), this); | 2283 m_layerForOverhangAreas = GraphicsLayer::create(graphicsLayerFactory (), this); |
| 2264 #ifndef NDEBUG | 2284 #ifndef NDEBUG |
| 2265 m_layerForOverhangAreas->setName("overhang areas"); | 2285 m_layerForOverhangAreas->setName("overhang areas"); |
| 2266 #endif | 2286 #endif |
| 2267 m_layerForOverhangAreas->setDrawsContent(false); | 2287 m_layerForOverhangAreas->setDrawsContent(false); |
| 2268 m_layerForOverhangAreas->setSize(m_renderView->frameView()->frameRec t().size()); | 2288 m_layerForOverhangAreas->setSize(m_renderView->frameView()->frameRec t().size()); |
| 2269 | 2289 |
| 2270 // We want the overhang areas layer to be positioned below the frame contents, | 2290 // We want the overhang areas layer to be positioned below the frame contents, |
| 2271 // so insert it below the clip layer. | 2291 // so insert it below the clip layer. |
| 2272 m_overflowControlsHostLayer->addChildBelow(m_layerForOverhangAreas.g et(), m_clipLayer.get()); | 2292 m_overflowControlsHostLayer->addChildBelow(m_layerForOverhangAreas.g et(), m_innerViewportClipLayer.get()); |
| 2273 } | 2293 } |
| 2274 } else if (m_layerForOverhangAreas) { | 2294 } else if (m_layerForOverhangAreas) { |
| 2275 m_layerForOverhangAreas->removeFromParent(); | 2295 m_layerForOverhangAreas->removeFromParent(); |
| 2276 m_layerForOverhangAreas = nullptr; | 2296 m_layerForOverhangAreas = nullptr; |
| 2277 } | 2297 } |
| 2278 | 2298 |
| 2279 if (requiresContentShadowLayer()) { | 2299 if (requiresContentShadowLayer()) { |
| 2280 if (!m_contentShadowLayer) { | 2300 if (!m_contentShadowLayer) { |
| 2281 m_contentShadowLayer = GraphicsLayer::create(graphicsLayerFactory(), this); | 2301 m_contentShadowLayer = GraphicsLayer::create(graphicsLayerFactory(), this); |
| 2282 #ifndef NDEBUG | 2302 #ifndef NDEBUG |
| 2283 m_contentShadowLayer->setName("content shadow"); | 2303 m_contentShadowLayer->setName("content shadow"); |
| 2284 #endif | 2304 #endif |
| 2285 m_contentShadowLayer->setSize(m_rootContentLayer->size()); | 2305 m_contentShadowLayer->setSize(m_rootContentLayer->size()); |
| 2286 m_contentShadowLayer->setPosition(m_rootContentLayer->position()); | 2306 m_contentShadowLayer->setPosition(m_rootContentLayer->position()); |
| 2287 ScrollbarTheme::theme()->setUpContentShadowLayer(m_contentShadowLaye r.get()); | 2307 ScrollbarTheme::theme()->setUpContentShadowLayer(m_contentShadowLaye r.get()); |
| 2288 | 2308 |
| 2289 m_scrollLayer->addChildBelow(m_contentShadowLayer.get(), m_rootConte ntLayer.get()); | 2309 if (!m_outerViewportScrollLayer) |
| 2310 m_innerViewportScrollLayer->addChildBelow(m_contentShadowLayer.g et(), m_rootContentLayer.get()); | |
| 2311 else | |
| 2312 m_outerViewportScrollLayer->addChildBelow(m_contentShadowLayer.g et(), m_rootContentLayer.get()); | |
| 2290 } | 2313 } |
| 2291 } else if (m_contentShadowLayer) { | 2314 } else if (m_contentShadowLayer) { |
| 2292 m_contentShadowLayer->removeFromParent(); | 2315 m_contentShadowLayer->removeFromParent(); |
| 2293 m_contentShadowLayer = nullptr; | 2316 m_contentShadowLayer = nullptr; |
| 2294 } | 2317 } |
| 2295 #endif | 2318 #endif |
| 2296 | 2319 |
| 2297 if (requiresHorizontalScrollbarLayer()) { | 2320 if (requiresHorizontalScrollbarLayer()) { |
| 2298 if (!m_layerForHorizontalScrollbar) { | 2321 if (!m_layerForHorizontalScrollbar) { |
| 2299 m_layerForHorizontalScrollbar = GraphicsLayer::create(graphicsLayerF actory(), this); | 2322 m_layerForHorizontalScrollbar = GraphicsLayer::create(graphicsLayerF actory(), this); |
| 2300 m_layerForHorizontalScrollbar->setShowDebugBorder(m_showDebugBorders ); | 2323 m_layerForHorizontalScrollbar->setShowDebugBorder(m_showDebugBorders ); |
| 2301 #ifndef NDEBUG | 2324 #ifndef NDEBUG |
| 2302 m_layerForHorizontalScrollbar->setName("horizontal scrollbar"); | 2325 m_layerForHorizontalScrollbar->setName("horizontal scrollbar"); |
| 2303 #endif | 2326 #endif |
| 2304 m_overflowControlsHostLayer->addChild(m_layerForHorizontalScrollbar. get()); | 2327 hostLayerForOverflowControls->addChild(m_layerForHorizontalScrollbar .get()); |
| 2305 | 2328 |
| 2306 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoor dinator()) | 2329 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoor dinator()) |
| 2307 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_re nderView->frameView(), HorizontalScrollbar); | 2330 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_re nderView->frameView(), HorizontalScrollbar); |
| 2308 } | 2331 } |
| 2309 } else if (m_layerForHorizontalScrollbar) { | 2332 } else if (m_layerForHorizontalScrollbar) { |
| 2310 m_layerForHorizontalScrollbar->removeFromParent(); | 2333 m_layerForHorizontalScrollbar->removeFromParent(); |
| 2311 m_layerForHorizontalScrollbar = nullptr; | 2334 m_layerForHorizontalScrollbar = nullptr; |
| 2312 | 2335 |
| 2313 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina tor()) | 2336 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina tor()) |
| 2314 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_render View->frameView(), HorizontalScrollbar); | 2337 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_render View->frameView(), HorizontalScrollbar); |
| 2315 } | 2338 } |
| 2316 | 2339 |
| 2317 if (requiresVerticalScrollbarLayer()) { | 2340 if (requiresVerticalScrollbarLayer()) { |
| 2318 if (!m_layerForVerticalScrollbar) { | 2341 if (!m_layerForVerticalScrollbar) { |
| 2319 m_layerForVerticalScrollbar = GraphicsLayer::create(graphicsLayerFac tory(), this); | 2342 m_layerForVerticalScrollbar = GraphicsLayer::create(graphicsLayerFac tory(), this); |
| 2320 m_layerForVerticalScrollbar->setShowDebugBorder(m_showDebugBorders); | 2343 m_layerForVerticalScrollbar->setShowDebugBorder(m_showDebugBorders); |
| 2321 #ifndef NDEBUG | 2344 #ifndef NDEBUG |
| 2322 m_layerForVerticalScrollbar->setName("vertical scrollbar"); | 2345 m_layerForVerticalScrollbar->setName("vertical scrollbar"); |
| 2323 #endif | 2346 #endif |
| 2324 m_overflowControlsHostLayer->addChild(m_layerForVerticalScrollbar.ge t()); | 2347 hostLayerForOverflowControls->addChild(m_layerForVerticalScrollbar.g et()); |
| 2325 | 2348 |
| 2326 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoor dinator()) | 2349 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoor dinator()) |
| 2327 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_re nderView->frameView(), VerticalScrollbar); | 2350 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_re nderView->frameView(), VerticalScrollbar); |
| 2328 } | 2351 } |
| 2329 } else if (m_layerForVerticalScrollbar) { | 2352 } else if (m_layerForVerticalScrollbar) { |
| 2330 m_layerForVerticalScrollbar->removeFromParent(); | 2353 m_layerForVerticalScrollbar->removeFromParent(); |
| 2331 m_layerForVerticalScrollbar = nullptr; | 2354 m_layerForVerticalScrollbar = nullptr; |
| 2332 | 2355 |
| 2333 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina tor()) | 2356 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina tor()) |
| 2334 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_render View->frameView(), VerticalScrollbar); | 2357 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_render View->frameView(), VerticalScrollbar); |
| 2335 } | 2358 } |
| 2336 | 2359 |
| 2337 if (requiresScrollCornerLayer()) { | 2360 if (requiresScrollCornerLayer()) { |
| 2338 if (!m_layerForScrollCorner) { | 2361 if (!m_layerForScrollCorner) { |
| 2339 m_layerForScrollCorner = GraphicsLayer::create(graphicsLayerFactory( ), this); | 2362 m_layerForScrollCorner = GraphicsLayer::create(graphicsLayerFactory( ), this); |
| 2340 m_layerForScrollCorner->setShowDebugBorder(m_showDebugBorders); | 2363 m_layerForScrollCorner->setShowDebugBorder(m_showDebugBorders); |
| 2341 #ifndef NDEBUG | 2364 #ifndef NDEBUG |
| 2342 m_layerForScrollCorner->setName("scroll corner"); | 2365 m_layerForScrollCorner->setName("scroll corner"); |
| 2343 #endif | 2366 #endif |
| 2344 m_overflowControlsHostLayer->addChild(m_layerForScrollCorner.get()); | 2367 hostLayerForOverflowControls->addChild(m_layerForScrollCorner.get()) ; |
| 2345 } | 2368 } |
| 2346 } else if (m_layerForScrollCorner) { | 2369 } else if (m_layerForScrollCorner) { |
| 2347 m_layerForScrollCorner->removeFromParent(); | 2370 m_layerForScrollCorner->removeFromParent(); |
| 2348 m_layerForScrollCorner = nullptr; | 2371 m_layerForScrollCorner = nullptr; |
| 2349 } | 2372 } |
| 2350 | 2373 |
| 2351 m_renderView->frameView()->positionScrollbarLayers(); | 2374 m_renderView->frameView()->positionScrollbarLayers(); |
| 2352 } | 2375 } |
| 2353 | 2376 |
| 2354 void RenderLayerCompositor::ensureRootLayer() | 2377 void RenderLayerCompositor::ensureRootLayer() |
| 2355 { | 2378 { |
| 2356 RootLayerAttachment expectedAttachment = isMainFrame() ? RootLayerAttachedVi aChromeClient : RootLayerAttachedViaEnclosingFrame; | 2379 RootLayerAttachment expectedAttachment = isMainFrame() ? RootLayerAttachedVi aChromeClient : RootLayerAttachedViaEnclosingFrame; |
| 2357 if (expectedAttachment == m_rootLayerAttachment) | 2380 if (expectedAttachment == m_rootLayerAttachment) |
| 2358 return; | 2381 return; |
| 2359 | 2382 |
| 2360 if (!m_rootContentLayer) { | 2383 if (!m_rootContentLayer) { |
| 2361 m_rootContentLayer = GraphicsLayer::create(graphicsLayerFactory(), this) ; | 2384 m_rootContentLayer = GraphicsLayer::create(graphicsLayerFactory(), this) ; |
| 2362 #ifndef NDEBUG | 2385 #ifndef NDEBUG |
| 2363 m_rootContentLayer->setName("content root"); | 2386 m_rootContentLayer->setName("content root"); |
| 2364 #endif | 2387 #endif |
| 2365 IntRect overflowRect = m_renderView->pixelSnappedLayoutOverflowRect(); | 2388 IntRect overflowRect = m_renderView->pixelSnappedLayoutOverflowRect(); |
| 2366 m_rootContentLayer->setSize(FloatSize(overflowRect.maxX(), overflowRect. maxY())); | 2389 m_rootContentLayer->setSize(FloatSize(overflowRect.maxX(), overflowRect. maxY())); |
| 2367 m_rootContentLayer->setPosition(FloatPoint()); | 2390 m_rootContentLayer->setPosition(FloatPoint()); |
| 2368 | 2391 |
| 2369 // Need to clip to prevent transformed content showing outside this fram e | 2392 // Need to clip to prevent transformed content showing outside this fram e |
| 2370 m_rootContentLayer->setMasksToBounds(true); | 2393 m_rootContentLayer->setMasksToBounds(true); |
| 2371 } | 2394 } |
| 2372 | 2395 |
| 2373 if (!m_overflowControlsHostLayer) { | 2396 if (!m_overflowControlsHostLayer) { |
| 2374 ASSERT(!m_scrollLayer); | 2397 ASSERT(!m_innerViewportScrollLayer); |
| 2375 ASSERT(!m_clipLayer); | 2398 ASSERT(!m_innerViewportClipLayer); |
| 2376 | 2399 |
| 2377 // Create a layer to host the clipping layer and the overflow controls l ayers. | 2400 // Create a layer to host the clipping layer and the overflow controls l ayers. |
| 2378 m_overflowControlsHostLayer = GraphicsLayer::create(graphicsLayerFactory (), this); | 2401 m_overflowControlsHostLayer = GraphicsLayer::create(graphicsLayerFactory (), this); |
| 2379 #ifndef NDEBUG | 2402 #ifndef NDEBUG |
| 2380 m_overflowControlsHostLayer->setName("overflow controls host"); | 2403 m_overflowControlsHostLayer->setName("overflow controls host"); |
| 2381 #endif | 2404 #endif |
| 2382 | 2405 |
| 2383 // Create a clipping layer if this is an iframe | 2406 // Create a clipping layer if this is an iframe |
|
enne (OOO)
2013/05/30 21:03:31
Is this comment true?
wjmaclean
2013/05/31 18:21:10
Hmm, not sure. The line below got changed in a sea
| |
| 2384 m_clipLayer = GraphicsLayer::create(graphicsLayerFactory(), this); | 2407 m_innerViewportClipLayer = GraphicsLayer::create(graphicsLayerFactory(), this); |
| 2385 #ifndef NDEBUG | 2408 #ifndef NDEBUG |
| 2386 m_clipLayer->setName("frame clipping"); | 2409 m_innerViewportClipLayer->setName("inner viewport clipping"); |
| 2387 #endif | 2410 #endif |
| 2388 m_clipLayer->setMasksToBounds(true); | 2411 m_innerViewportClipLayer->setMasksToBounds(true); |
| 2389 | 2412 |
| 2390 m_scrollLayer = GraphicsLayer::create(graphicsLayerFactory(), this); | 2413 m_innerViewportScrollLayer = GraphicsLayer::create(graphicsLayerFactory( ), this); |
| 2391 #ifndef NDEBUG | 2414 #ifndef NDEBUG |
| 2392 m_scrollLayer->setName("frame scrolling"); | 2415 m_innerViewportScrollLayer->setName("inner viewport scrolling"); |
| 2393 #endif | 2416 #endif |
| 2394 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina tor()) | 2417 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina tor()) |
| 2395 scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(m_sc rollLayer.get(), true); | 2418 scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(m_in nerViewportScrollLayer.get(), true); |
| 2419 // Hook them up | |
| 2420 if (isMainFrame() && m_renderView->document()->settings()->pinchVirtualV iewportEnabled()) { | |
| 2421 // When using the pinch virtual viewport, the layer hierarchy looks like this: | |
|
enne (OOO)
2013/05/30 21:03:31
Can you add overhang layers too?
wjmaclean
2013/05/31 18:21:10
Will do.
| |
| 2422 // | |
| 2423 // overflowControlsHostLayer | |
| 2424 // innerViewportClipLayer (fixed pos container) | |
| 2425 // pageScaleLayer | |
| 2426 // innerViewportScrollLayer | |
| 2427 // outerViewportClipLayer (fixed pos container) | |
| 2428 // outerViewportScrollLayer | |
| 2429 // horizontal ScrollbarLayer (non-overlay) | |
| 2430 // verticalScrollbarLayer (non-overlay) | |
| 2431 // scroll corner (non-overlay) | |
| 2432 // horizontalScrollbarLayer (overlay) | |
| 2433 // verticalScrollbarLayer (overlay) | |
| 2434 // | |
| 2435 m_outerViewportClipLayer = GraphicsLayer::create(graphicsLayerFactor y(), this); | |
| 2436 m_outerViewportClipLayer->setMasksToBounds(true); | |
| 2396 | 2437 |
| 2397 // Hook them up | 2438 m_outerViewportScrollLayer = GraphicsLayer::create(graphicsLayerFact ory(), this); |
| 2398 m_overflowControlsHostLayer->addChild(m_clipLayer.get()); | 2439 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoor dinator()) |
| 2399 m_clipLayer->addChild(m_scrollLayer.get()); | 2440 scrollingCoordinator->setLayerIsContainerForFixedPositionLayers( m_outerViewportScrollLayer.get(), true); |
| 2400 m_scrollLayer->addChild(m_rootContentLayer.get()); | 2441 |
| 2442 m_pageScaleLayer = GraphicsLayer::create(graphicsLayerFactory(), thi s); | |
| 2443 | |
| 2444 #ifndef NDEBUG | |
| 2445 m_pageScaleLayer->setName("page scale layer"); | |
| 2446 m_outerViewportClipLayer->setName("outer viewport clip"); | |
| 2447 m_outerViewportScrollLayer->setName("outer viewport scrolling"); | |
| 2448 #endif | |
| 2449 | |
| 2450 m_overflowControlsHostLayer->addChild(m_innerViewportClipLayer.get() ); | |
| 2451 m_innerViewportClipLayer->addChild(m_pageScaleLayer.get()); | |
| 2452 m_pageScaleLayer->addChild(m_innerViewportScrollLayer.get()); | |
| 2453 m_innerViewportScrollLayer->addChild(m_outerViewportClipLayer.get()) ; | |
| 2454 m_outerViewportClipLayer->addChild(m_outerViewportScrollLayer.get()) ; | |
| 2455 m_outerViewportScrollLayer->addChild(m_rootContentLayer.get()); | |
| 2456 } else { | |
| 2457 // When not using the pinch virtual viewport, the layer hierarchy lo oks like this: | |
| 2458 // | |
| 2459 // overflowControlsHostLayer | |
| 2460 // innerViewportClipLayer (fixed pos container) | |
| 2461 // innerViewportScrollLayer | |
| 2462 // horizontalScrollbarLayer (overlay/non-overlay) | |
| 2463 // verticalScrollbarLayer (overlay/non-overlay) | |
| 2464 // | |
| 2465 m_overflowControlsHostLayer->addChild(m_innerViewportClipLayer.get() ); | |
| 2466 m_innerViewportClipLayer->addChild(m_innerViewportScrollLayer.get()) ; | |
| 2467 m_innerViewportScrollLayer->addChild(m_rootContentLayer.get()); | |
| 2468 } | |
| 2401 | 2469 |
| 2402 frameViewDidChangeSize(); | 2470 frameViewDidChangeSize(); |
| 2403 frameViewDidScroll(); | 2471 frameViewDidScroll(); |
| 2404 } | 2472 } |
| 2405 | 2473 |
| 2406 // Check to see if we have to change the attachment | 2474 // Check to see if we have to change the attachment |
| 2407 if (m_rootLayerAttachment != RootLayerUnattached) | 2475 if (m_rootLayerAttachment != RootLayerUnattached) |
| 2408 detachRootLayer(); | 2476 detachRootLayer(); |
| 2409 | 2477 |
| 2410 attachRootLayer(expectedAttachment); | 2478 attachRootLayer(expectedAttachment); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2442 m_renderView->frameView()->invalidateScrollbar(verticalScrollbar, In tRect(IntPoint(0, 0), verticalScrollbar->frameRect().size())); | 2510 m_renderView->frameView()->invalidateScrollbar(verticalScrollbar, In tRect(IntPoint(0, 0), verticalScrollbar->frameRect().size())); |
| 2443 } | 2511 } |
| 2444 | 2512 |
| 2445 if (m_layerForScrollCorner) { | 2513 if (m_layerForScrollCorner) { |
| 2446 m_layerForScrollCorner = nullptr; | 2514 m_layerForScrollCorner = nullptr; |
| 2447 m_renderView->frameView()->invalidateScrollCorner(m_renderView->frameVie w()->scrollCornerRect()); | 2515 m_renderView->frameView()->invalidateScrollCorner(m_renderView->frameVie w()->scrollCornerRect()); |
| 2448 } | 2516 } |
| 2449 | 2517 |
| 2450 if (m_overflowControlsHostLayer) { | 2518 if (m_overflowControlsHostLayer) { |
| 2451 m_overflowControlsHostLayer = nullptr; | 2519 m_overflowControlsHostLayer = nullptr; |
| 2452 m_clipLayer = nullptr; | 2520 m_innerViewportClipLayer = nullptr; |
| 2453 m_scrollLayer = nullptr; | 2521 m_innerViewportScrollLayer = nullptr; |
| 2522 m_outerViewportClipLayer = nullptr; | |
| 2523 m_outerViewportScrollLayer = nullptr; | |
| 2524 m_pageScaleLayer = nullptr; | |
| 2454 } | 2525 } |
| 2455 ASSERT(!m_scrollLayer); | 2526 ASSERT(!m_innerViewportScrollLayer); |
| 2456 m_rootContentLayer = nullptr; | 2527 m_rootContentLayer = nullptr; |
| 2457 } | 2528 } |
| 2458 | 2529 |
| 2459 void RenderLayerCompositor::attachRootLayer(RootLayerAttachment attachment) | 2530 void RenderLayerCompositor::attachRootLayer(RootLayerAttachment attachment) |
| 2460 { | 2531 { |
| 2461 if (!m_rootContentLayer) | 2532 if (!m_rootContentLayer) |
| 2462 return; | 2533 return; |
| 2463 | 2534 |
| 2464 switch (attachment) { | 2535 switch (attachment) { |
| 2465 case RootLayerUnattached: | 2536 case RootLayerUnattached: |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2725 return frame->page(); | 2796 return frame->page(); |
| 2726 | 2797 |
| 2727 return 0; | 2798 return 0; |
| 2728 } | 2799 } |
| 2729 | 2800 |
| 2730 void RenderLayerCompositor::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo ) const | 2801 void RenderLayerCompositor::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo ) const |
| 2731 { | 2802 { |
| 2732 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Rendering) ; | 2803 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Rendering) ; |
| 2733 info.addWeakPointer(m_renderView); | 2804 info.addWeakPointer(m_renderView); |
| 2734 info.addMember(m_rootContentLayer, "rootContentLayer"); | 2805 info.addMember(m_rootContentLayer, "rootContentLayer"); |
| 2735 info.addMember(m_clipLayer, "clipLayer"); | 2806 info.addMember(m_innerViewportClipLayer, "innerViewportClipLayer"); |
| 2736 info.addMember(m_scrollLayer, "scrollLayer"); | 2807 info.addMember(m_innerViewportScrollLayer, "innerViewportScrollLayer"); |
| 2808 info.addMember(m_outerViewportClipLayer, "outerViewportClipLayer"); | |
| 2809 info.addMember(m_outerViewportScrollLayer, "outerViewportScrollLayer"); | |
| 2810 info.addMember(m_pageScaleLayer, "pageScaleLayer"); | |
| 2737 info.addMember(m_viewportConstrainedLayers, "viewportConstrainedLayers"); | 2811 info.addMember(m_viewportConstrainedLayers, "viewportConstrainedLayers"); |
| 2738 info.addMember(m_overflowControlsHostLayer, "overflowControlsHostLayer"); | 2812 info.addMember(m_overflowControlsHostLayer, "overflowControlsHostLayer"); |
| 2739 info.addMember(m_layerForHorizontalScrollbar, "layerForHorizontalScrollbar") ; | 2813 info.addMember(m_layerForHorizontalScrollbar, "layerForHorizontalScrollbar") ; |
| 2740 info.addMember(m_layerForVerticalScrollbar, "layerForVerticalScrollbar"); | 2814 info.addMember(m_layerForVerticalScrollbar, "layerForVerticalScrollbar"); |
| 2741 info.addMember(m_layerForScrollCorner, "layerForScrollCorner"); | 2815 info.addMember(m_layerForScrollCorner, "layerForScrollCorner"); |
| 2742 #if ENABLE(RUBBER_BANDING) | 2816 #if ENABLE(RUBBER_BANDING) |
| 2743 info.addMember(m_layerForOverhangAreas, "layerForOverhangAreas"); | 2817 info.addMember(m_layerForOverhangAreas, "layerForOverhangAreas"); |
| 2744 info.addMember(m_contentShadowLayer, "contentShadowLayer"); | 2818 info.addMember(m_contentShadowLayer, "contentShadowLayer"); |
| 2745 info.addMember(m_layerForTopOverhangArea, "layerForTopOverhangArea"); | 2819 info.addMember(m_layerForTopOverhangArea, "layerForTopOverhangArea"); |
| 2746 info.addMember(m_layerForBottomOverhangArea, "layerForBottomOverhangArea"); | 2820 info.addMember(m_layerForBottomOverhangArea, "layerForBottomOverhangArea"); |
| 2747 #endif | 2821 #endif |
| 2748 } | 2822 } |
| 2749 | 2823 |
| 2750 } // namespace WebCore | 2824 } // namespace WebCore |
| OLD | NEW |