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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 void RenderLayerCompositor::didChangeVisibleRect() | 298 void RenderLayerCompositor::didChangeVisibleRect() |
299 { | 299 { |
300 GraphicsLayer* rootLayer = rootGraphicsLayer(); | 300 GraphicsLayer* rootLayer = rootGraphicsLayer(); |
301 if (!rootLayer) | 301 if (!rootLayer) |
302 return; | 302 return; |
303 | 303 |
304 FrameView* frameView = m_renderView ? m_renderView->frameView() : 0; | 304 FrameView* frameView = m_renderView ? m_renderView->frameView() : 0; |
305 if (!frameView) | 305 if (!frameView) |
306 return; | 306 return; |
307 | 307 |
308 IntRect visibleRect = m_clipLayer ? IntRect(IntPoint(), frameView->contentsS
ize()) : frameView->visibleContentRect(); | 308 IntRect visibleRect = m_containerLayer ? IntRect(IntPoint(), frameView->cont
entsSize()) : frameView->visibleContentRect(); |
309 if (rootLayer->visibleRectChangeRequiresFlush(visibleRect)) { | 309 if (rootLayer->visibleRectChangeRequiresFlush(visibleRect)) { |
310 if (Page* page = this->page()) | 310 if (Page* page = this->page()) |
311 page->chrome().client()->scheduleCompositingLayerFlush(); | 311 page->chrome().client()->scheduleCompositingLayerFlush(); |
312 } | 312 } |
313 } | 313 } |
314 | 314 |
315 bool RenderLayerCompositor::hasAnyAdditionalCompositedLayers(const RenderLayer*
rootLayer) const | 315 bool RenderLayerCompositor::hasAnyAdditionalCompositedLayers(const RenderLayer*
rootLayer) const |
316 { | 316 { |
317 return m_compositedLayerCount > (rootLayer->isComposited() ? 1 : 0); | 317 return m_compositedLayerCount > (rootLayer->isComposited() ? 1 : 0); |
318 } | 318 } |
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1125 } | 1125 } |
1126 | 1126 |
1127 void RenderLayerCompositor::frameViewDidChangeLocation(const IntPoint& contentsO
ffset) | 1127 void RenderLayerCompositor::frameViewDidChangeLocation(const IntPoint& contentsO
ffset) |
1128 { | 1128 { |
1129 if (m_overflowControlsHostLayer) | 1129 if (m_overflowControlsHostLayer) |
1130 m_overflowControlsHostLayer->setPosition(contentsOffset); | 1130 m_overflowControlsHostLayer->setPosition(contentsOffset); |
1131 } | 1131 } |
1132 | 1132 |
1133 void RenderLayerCompositor::frameViewDidChangeSize() | 1133 void RenderLayerCompositor::frameViewDidChangeSize() |
1134 { | 1134 { |
1135 if (m_clipLayer) { | 1135 if (m_containerLayer) { |
1136 FrameView* frameView = m_renderView->frameView(); | 1136 FrameView* frameView = m_renderView->frameView(); |
1137 m_clipLayer->setSize(frameView->unscaledVisibleContentSize()); | 1137 m_containerLayer->setSize(frameView->unscaledVisibleContentSize()); |
1138 | 1138 |
1139 frameViewDidScroll(); | 1139 frameViewDidScroll(); |
1140 updateOverflowControlsLayers(); | 1140 updateOverflowControlsLayers(); |
1141 | 1141 |
1142 #if ENABLE(RUBBER_BANDING) | 1142 #if ENABLE(RUBBER_BANDING) |
1143 if (m_layerForOverhangAreas) | 1143 if (m_layerForOverhangAreas) |
1144 m_layerForOverhangAreas->setSize(frameView->frameRect().size()); | 1144 m_layerForOverhangAreas->setSize(frameView->frameRect().size()); |
1145 #endif | 1145 #endif |
1146 } | 1146 } |
1147 } | 1147 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 // + Frame clip | 1187 // + Frame clip |
1188 // + (Fixed root background) <-- Here. | 1188 // + (Fixed root background) <-- Here. |
1189 // + Frame scroll | 1189 // + Frame scroll |
1190 // + Root content layer | 1190 // + Root content layer |
1191 // + Scrollbars | 1191 // + Scrollbars |
1192 // | 1192 // |
1193 // That is, it needs to be the first child of the frame clip, the sibling of | 1193 // That is, it needs to be the first child of the frame clip, the sibling of |
1194 // the frame scroll layer. The compositor does not own the background layer,
it | 1194 // the frame scroll layer. The compositor does not own the background layer,
it |
1195 // just positions it (like the foreground layer). | 1195 // just positions it (like the foreground layer). |
1196 if (GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer()) | 1196 if (GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer()) |
1197 m_clipLayer->addChildBelow(backgroundLayer, m_scrollLayer.get()); | 1197 m_containerLayer->addChildBelow(backgroundLayer, m_scrollLayer.get()); |
1198 } | 1198 } |
1199 | 1199 |
1200 bool RenderLayerCompositor::scrollingLayerDidChange(RenderLayer* layer) | 1200 bool RenderLayerCompositor::scrollingLayerDidChange(RenderLayer* layer) |
1201 { | 1201 { |
1202 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(
)) | 1202 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(
)) |
1203 return scrollingCoordinator->scrollableAreaScrollLayerDidChange(layer); | 1203 return scrollingCoordinator->scrollableAreaScrollLayerDidChange(layer); |
1204 return false; | 1204 return false; |
1205 } | 1205 } |
1206 | 1206 |
1207 String RenderLayerCompositor::layerTreeAsText(LayerTreeFlags flags) | 1207 String RenderLayerCompositor::layerTreeAsText(LayerTreeFlags flags) |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1484 clearBackingForLayerIncludingDescendants(m_renderView->layer()); | 1484 clearBackingForLayerIncludingDescendants(m_renderView->layer()); |
1485 } | 1485 } |
1486 | 1486 |
1487 void RenderLayerCompositor::updateRootLayerPosition() | 1487 void RenderLayerCompositor::updateRootLayerPosition() |
1488 { | 1488 { |
1489 if (m_rootContentLayer) { | 1489 if (m_rootContentLayer) { |
1490 const IntRect& documentRect = m_renderView->documentRect(); | 1490 const IntRect& documentRect = m_renderView->documentRect(); |
1491 m_rootContentLayer->setSize(documentRect.size()); | 1491 m_rootContentLayer->setSize(documentRect.size()); |
1492 m_rootContentLayer->setPosition(documentRect.location()); | 1492 m_rootContentLayer->setPosition(documentRect.location()); |
1493 } | 1493 } |
1494 if (m_clipLayer) { | 1494 if (m_containerLayer) { |
1495 FrameView* frameView = m_renderView->frameView(); | 1495 FrameView* frameView = m_renderView->frameView(); |
1496 m_clipLayer->setSize(frameView->unscaledVisibleContentSize()); | 1496 m_containerLayer->setSize(frameView->unscaledVisibleContentSize()); |
1497 } | 1497 } |
1498 | 1498 |
1499 #if ENABLE(RUBBER_BANDING) | 1499 #if ENABLE(RUBBER_BANDING) |
1500 if (m_contentShadowLayer) { | 1500 if (m_contentShadowLayer) { |
1501 m_contentShadowLayer->setPosition(m_rootContentLayer->position()); | 1501 m_contentShadowLayer->setPosition(m_rootContentLayer->position()); |
1502 | 1502 |
1503 FloatSize rootContentLayerSize = m_rootContentLayer->size(); | 1503 FloatSize rootContentLayerSize = m_rootContentLayer->size(); |
1504 if (m_contentShadowLayer->size() != rootContentLayerSize) { | 1504 if (m_contentShadowLayer->size() != rootContentLayerSize) { |
1505 m_contentShadowLayer->setSize(rootContentLayerSize); | 1505 m_contentShadowLayer->setSize(rootContentLayerSize); |
1506 ScrollbarTheme::theme()->setUpContentShadowLayer(m_contentShadowLaye
r.get()); | 1506 ScrollbarTheme::theme()->setUpContentShadowLayer(m_contentShadowLaye
r.get()); |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2272 if (!m_layerForOverhangAreas) { | 2272 if (!m_layerForOverhangAreas) { |
2273 m_layerForOverhangAreas = GraphicsLayer::create(graphicsLayerFactory
(), this); | 2273 m_layerForOverhangAreas = GraphicsLayer::create(graphicsLayerFactory
(), this); |
2274 #ifndef NDEBUG | 2274 #ifndef NDEBUG |
2275 m_layerForOverhangAreas->setName("overhang areas"); | 2275 m_layerForOverhangAreas->setName("overhang areas"); |
2276 #endif | 2276 #endif |
2277 m_layerForOverhangAreas->setDrawsContent(false); | 2277 m_layerForOverhangAreas->setDrawsContent(false); |
2278 m_layerForOverhangAreas->setSize(m_renderView->frameView()->frameRec
t().size()); | 2278 m_layerForOverhangAreas->setSize(m_renderView->frameView()->frameRec
t().size()); |
2279 | 2279 |
2280 // We want the overhang areas layer to be positioned below the frame
contents, | 2280 // We want the overhang areas layer to be positioned below the frame
contents, |
2281 // so insert it below the clip layer. | 2281 // so insert it below the clip layer. |
2282 m_overflowControlsHostLayer->addChildBelow(m_layerForOverhangAreas.g
et(), m_clipLayer.get()); | 2282 m_overflowControlsHostLayer->addChildBelow(m_layerForOverhangAreas.g
et(), m_containerLayer.get()); |
2283 } | 2283 } |
2284 } else if (m_layerForOverhangAreas) { | 2284 } else if (m_layerForOverhangAreas) { |
2285 m_layerForOverhangAreas->removeFromParent(); | 2285 m_layerForOverhangAreas->removeFromParent(); |
2286 m_layerForOverhangAreas = nullptr; | 2286 m_layerForOverhangAreas = nullptr; |
2287 } | 2287 } |
2288 | 2288 |
2289 if (requiresContentShadowLayer()) { | 2289 if (requiresContentShadowLayer()) { |
2290 if (!m_contentShadowLayer) { | 2290 if (!m_contentShadowLayer) { |
2291 m_contentShadowLayer = GraphicsLayer::create(graphicsLayerFactory(),
this); | 2291 m_contentShadowLayer = GraphicsLayer::create(graphicsLayerFactory(),
this); |
2292 #ifndef NDEBUG | 2292 #ifndef NDEBUG |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2372 IntRect overflowRect = m_renderView->pixelSnappedLayoutOverflowRect(); | 2372 IntRect overflowRect = m_renderView->pixelSnappedLayoutOverflowRect(); |
2373 m_rootContentLayer->setSize(FloatSize(overflowRect.maxX(), overflowRect.
maxY())); | 2373 m_rootContentLayer->setSize(FloatSize(overflowRect.maxX(), overflowRect.
maxY())); |
2374 m_rootContentLayer->setPosition(FloatPoint()); | 2374 m_rootContentLayer->setPosition(FloatPoint()); |
2375 | 2375 |
2376 // Need to clip to prevent transformed content showing outside this fram
e | 2376 // Need to clip to prevent transformed content showing outside this fram
e |
2377 m_rootContentLayer->setMasksToBounds(true); | 2377 m_rootContentLayer->setMasksToBounds(true); |
2378 } | 2378 } |
2379 | 2379 |
2380 if (!m_overflowControlsHostLayer) { | 2380 if (!m_overflowControlsHostLayer) { |
2381 ASSERT(!m_scrollLayer); | 2381 ASSERT(!m_scrollLayer); |
2382 ASSERT(!m_clipLayer); | 2382 ASSERT(!m_containerLayer); |
2383 | 2383 |
2384 // Create a layer to host the clipping layer and the overflow controls l
ayers. | 2384 // Create a layer to host the clipping layer and the overflow controls l
ayers. |
2385 m_overflowControlsHostLayer = GraphicsLayer::create(graphicsLayerFactory
(), this); | 2385 m_overflowControlsHostLayer = GraphicsLayer::create(graphicsLayerFactory
(), this); |
2386 #ifndef NDEBUG | 2386 #ifndef NDEBUG |
2387 m_overflowControlsHostLayer->setName("overflow controls host"); | 2387 m_overflowControlsHostLayer->setName("overflow controls host"); |
2388 #endif | 2388 #endif |
2389 | 2389 |
2390 // Create a clipping layer if this is an iframe | 2390 // Create a clipping layer if this is an iframe |
2391 m_clipLayer = GraphicsLayer::create(graphicsLayerFactory(), this); | 2391 m_containerLayer = GraphicsLayer::create(graphicsLayerFactory(), this); |
2392 #ifndef NDEBUG | 2392 #ifndef NDEBUG |
2393 m_clipLayer->setName("frame clipping"); | 2393 m_containerLayer->setName("frame clipping"); |
2394 #endif | 2394 #endif |
2395 m_clipLayer->setMasksToBounds(true); | 2395 if (!isMainFrame()) |
| 2396 m_containerLayer->setMasksToBounds(true); |
2396 | 2397 |
2397 m_scrollLayer = GraphicsLayer::create(graphicsLayerFactory(), this); | 2398 m_scrollLayer = GraphicsLayer::create(graphicsLayerFactory(), this); |
2398 #ifndef NDEBUG | 2399 #ifndef NDEBUG |
2399 m_scrollLayer->setName("frame scrolling"); | 2400 m_scrollLayer->setName("frame scrolling"); |
2400 #endif | 2401 #endif |
2401 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) | 2402 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) |
2402 scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(m_sc
rollLayer.get(), true); | 2403 scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(m_sc
rollLayer.get(), true); |
2403 | 2404 |
2404 // Hook them up | 2405 // Hook them up |
2405 m_overflowControlsHostLayer->addChild(m_clipLayer.get()); | 2406 m_overflowControlsHostLayer->addChild(m_containerLayer.get()); |
2406 m_clipLayer->addChild(m_scrollLayer.get()); | 2407 m_containerLayer->addChild(m_scrollLayer.get()); |
2407 m_scrollLayer->addChild(m_rootContentLayer.get()); | 2408 m_scrollLayer->addChild(m_rootContentLayer.get()); |
2408 | 2409 |
2409 frameViewDidChangeSize(); | 2410 frameViewDidChangeSize(); |
2410 frameViewDidScroll(); | 2411 frameViewDidScroll(); |
2411 } | 2412 } |
2412 | 2413 |
2413 // Check to see if we have to change the attachment | 2414 // Check to see if we have to change the attachment |
2414 if (m_rootLayerAttachment != RootLayerUnattached) | 2415 if (m_rootLayerAttachment != RootLayerUnattached) |
2415 detachRootLayer(); | 2416 detachRootLayer(); |
2416 | 2417 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2449 m_renderView->frameView()->invalidateScrollbar(verticalScrollbar, In
tRect(IntPoint(0, 0), verticalScrollbar->frameRect().size())); | 2450 m_renderView->frameView()->invalidateScrollbar(verticalScrollbar, In
tRect(IntPoint(0, 0), verticalScrollbar->frameRect().size())); |
2450 } | 2451 } |
2451 | 2452 |
2452 if (m_layerForScrollCorner) { | 2453 if (m_layerForScrollCorner) { |
2453 m_layerForScrollCorner = nullptr; | 2454 m_layerForScrollCorner = nullptr; |
2454 m_renderView->frameView()->invalidateScrollCorner(m_renderView->frameVie
w()->scrollCornerRect()); | 2455 m_renderView->frameView()->invalidateScrollCorner(m_renderView->frameVie
w()->scrollCornerRect()); |
2455 } | 2456 } |
2456 | 2457 |
2457 if (m_overflowControlsHostLayer) { | 2458 if (m_overflowControlsHostLayer) { |
2458 m_overflowControlsHostLayer = nullptr; | 2459 m_overflowControlsHostLayer = nullptr; |
2459 m_clipLayer = nullptr; | 2460 m_containerLayer = nullptr; |
2460 m_scrollLayer = nullptr; | 2461 m_scrollLayer = nullptr; |
2461 } | 2462 } |
2462 ASSERT(!m_scrollLayer); | 2463 ASSERT(!m_scrollLayer); |
2463 m_rootContentLayer = nullptr; | 2464 m_rootContentLayer = nullptr; |
2464 } | 2465 } |
2465 | 2466 |
2466 void RenderLayerCompositor::attachRootLayer(RootLayerAttachment attachment) | 2467 void RenderLayerCompositor::attachRootLayer(RootLayerAttachment attachment) |
2467 { | 2468 { |
2468 if (!m_rootContentLayer) | 2469 if (!m_rootContentLayer) |
2469 return; | 2470 return; |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2721 return frame->page(); | 2722 return frame->page(); |
2722 | 2723 |
2723 return 0; | 2724 return 0; |
2724 } | 2725 } |
2725 | 2726 |
2726 void RenderLayerCompositor::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo
) const | 2727 void RenderLayerCompositor::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo
) const |
2727 { | 2728 { |
2728 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Rendering)
; | 2729 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Rendering)
; |
2729 info.addWeakPointer(m_renderView); | 2730 info.addWeakPointer(m_renderView); |
2730 info.addMember(m_rootContentLayer, "rootContentLayer"); | 2731 info.addMember(m_rootContentLayer, "rootContentLayer"); |
2731 info.addMember(m_clipLayer, "clipLayer"); | 2732 info.addMember(m_containerLayer, "containerLayer"); |
2732 info.addMember(m_scrollLayer, "scrollLayer"); | 2733 info.addMember(m_scrollLayer, "scrollLayer"); |
2733 info.addMember(m_viewportConstrainedLayers, "viewportConstrainedLayers"); | 2734 info.addMember(m_viewportConstrainedLayers, "viewportConstrainedLayers"); |
2734 info.addMember(m_overflowControlsHostLayer, "overflowControlsHostLayer"); | 2735 info.addMember(m_overflowControlsHostLayer, "overflowControlsHostLayer"); |
2735 info.addMember(m_layerForHorizontalScrollbar, "layerForHorizontalScrollbar")
; | 2736 info.addMember(m_layerForHorizontalScrollbar, "layerForHorizontalScrollbar")
; |
2736 info.addMember(m_layerForVerticalScrollbar, "layerForVerticalScrollbar"); | 2737 info.addMember(m_layerForVerticalScrollbar, "layerForVerticalScrollbar"); |
2737 info.addMember(m_layerForScrollCorner, "layerForScrollCorner"); | 2738 info.addMember(m_layerForScrollCorner, "layerForScrollCorner"); |
2738 #if ENABLE(RUBBER_BANDING) | 2739 #if ENABLE(RUBBER_BANDING) |
2739 info.addMember(m_layerForOverhangAreas, "layerForOverhangAreas"); | 2740 info.addMember(m_layerForOverhangAreas, "layerForOverhangAreas"); |
2740 info.addMember(m_contentShadowLayer, "contentShadowLayer"); | 2741 info.addMember(m_contentShadowLayer, "contentShadowLayer"); |
2741 info.addMember(m_layerForTopOverhangArea, "layerForTopOverhangArea"); | 2742 info.addMember(m_layerForTopOverhangArea, "layerForTopOverhangArea"); |
2742 info.addMember(m_layerForBottomOverhangArea, "layerForBottomOverhangArea"); | 2743 info.addMember(m_layerForBottomOverhangArea, "layerForBottomOverhangArea"); |
2743 #endif | 2744 #endif |
2744 } | 2745 } |
2745 | 2746 |
2746 } // namespace WebCore | 2747 } // namespace WebCore |
OLD | NEW |