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 2012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2023 } | 2023 } |
2024 | 2024 |
2025 // If an element has negative z-index children, those children render in front o
f the | 2025 // If an element has negative z-index children, those children render in front o
f the |
2026 // layer background, so we need an extra 'contents' layer for the foreground of
the layer | 2026 // layer background, so we need an extra 'contents' layer for the foreground of
the layer |
2027 // object. | 2027 // object. |
2028 bool RenderLayerCompositor::needsContentsCompositingLayer(const RenderLayer* lay
er) const | 2028 bool RenderLayerCompositor::needsContentsCompositingLayer(const RenderLayer* lay
er) const |
2029 { | 2029 { |
2030 return layer->hasNegativeZOrderList(); | 2030 return layer->hasNegativeZOrderList(); |
2031 } | 2031 } |
2032 | 2032 |
2033 bool RenderLayerCompositor::requiresScrollLayer(RootLayerAttachment attachment)
const | |
2034 { | |
2035 // This applies when the application UI handles scrolling, in which case Ren
derLayerCompositor doesn't need to manage it. | |
2036 if (m_renderView->frameView()->delegatesScrolling()) | |
2037 return false; | |
2038 | |
2039 return true; | |
2040 } | |
2041 | |
2042 static void paintScrollbar(Scrollbar* scrollbar, GraphicsContext& context, const
IntRect& clip) | 2033 static void paintScrollbar(Scrollbar* scrollbar, GraphicsContext& context, const
IntRect& clip) |
2043 { | 2034 { |
2044 if (!scrollbar) | 2035 if (!scrollbar) |
2045 return; | 2036 return; |
2046 | 2037 |
2047 context.save(); | 2038 context.save(); |
2048 const IntRect& scrollbarRect = scrollbar->frameRect(); | 2039 const IntRect& scrollbarRect = scrollbar->frameRect(); |
2049 context.translate(-scrollbarRect.x(), -scrollbarRect.y()); | 2040 context.translate(-scrollbarRect.x(), -scrollbarRect.y()); |
2050 IntRect transformedClip = clip; | 2041 IntRect transformedClip = clip; |
2051 transformedClip.moveBy(scrollbarRect.location()); | 2042 transformedClip.moveBy(scrollbarRect.location()); |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2459 m_rootContentLayer->setName("content root"); | 2450 m_rootContentLayer->setName("content root"); |
2460 #endif | 2451 #endif |
2461 IntRect overflowRect = m_renderView->pixelSnappedLayoutOverflowRect(); | 2452 IntRect overflowRect = m_renderView->pixelSnappedLayoutOverflowRect(); |
2462 m_rootContentLayer->setSize(FloatSize(overflowRect.maxX(), overflowRect.
maxY())); | 2453 m_rootContentLayer->setSize(FloatSize(overflowRect.maxX(), overflowRect.
maxY())); |
2463 m_rootContentLayer->setPosition(FloatPoint()); | 2454 m_rootContentLayer->setPosition(FloatPoint()); |
2464 | 2455 |
2465 // Need to clip to prevent transformed content showing outside this fram
e | 2456 // Need to clip to prevent transformed content showing outside this fram
e |
2466 m_rootContentLayer->setMasksToBounds(true); | 2457 m_rootContentLayer->setMasksToBounds(true); |
2467 } | 2458 } |
2468 | 2459 |
2469 if (requiresScrollLayer(expectedAttachment)) { | 2460 if (!m_overflowControlsHostLayer) { |
2470 if (!m_overflowControlsHostLayer) { | 2461 ASSERT(!m_scrollLayer); |
2471 ASSERT(!m_scrollLayer); | 2462 ASSERT(!m_clipLayer); |
2472 ASSERT(!m_clipLayer); | |
2473 | 2463 |
2474 // Create a layer to host the clipping layer and the overflow contro
ls layers. | 2464 // Create a layer to host the clipping layer and the overflow controls l
ayers. |
2475 m_overflowControlsHostLayer = GraphicsLayer::create(graphicsLayerFac
tory(), this); | 2465 m_overflowControlsHostLayer = GraphicsLayer::create(graphicsLayerFactory
(), this); |
2476 #ifndef NDEBUG | 2466 #ifndef NDEBUG |
2477 m_overflowControlsHostLayer->setName("overflow controls host"); | 2467 m_overflowControlsHostLayer->setName("overflow controls host"); |
2478 #endif | 2468 #endif |
2479 | 2469 |
2480 // Create a clipping layer if this is an iframe | 2470 // Create a clipping layer if this is an iframe |
2481 m_clipLayer = GraphicsLayer::create(graphicsLayerFactory(), this); | 2471 m_clipLayer = GraphicsLayer::create(graphicsLayerFactory(), this); |
2482 #ifndef NDEBUG | 2472 #ifndef NDEBUG |
2483 m_clipLayer->setName("frame clipping"); | 2473 m_clipLayer->setName("frame clipping"); |
2484 #endif | 2474 #endif |
2485 m_clipLayer->setMasksToBounds(true); | 2475 m_clipLayer->setMasksToBounds(true); |
2486 | 2476 |
2487 m_scrollLayer = GraphicsLayer::create(graphicsLayerFactory(), this); | 2477 m_scrollLayer = GraphicsLayer::create(graphicsLayerFactory(), this); |
2488 #ifndef NDEBUG | 2478 #ifndef NDEBUG |
2489 m_scrollLayer->setName("frame scrolling"); | 2479 m_scrollLayer->setName("frame scrolling"); |
2490 #endif | 2480 #endif |
2491 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoor
dinator()) | 2481 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) |
2492 scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(
m_scrollLayer.get(), true); | 2482 scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(m_sc
rollLayer.get(), true); |
2493 | 2483 |
2494 // Hook them up | 2484 // Hook them up |
2495 m_overflowControlsHostLayer->addChild(m_clipLayer.get()); | 2485 m_overflowControlsHostLayer->addChild(m_clipLayer.get()); |
2496 m_clipLayer->addChild(m_scrollLayer.get()); | 2486 m_clipLayer->addChild(m_scrollLayer.get()); |
2497 m_scrollLayer->addChild(m_rootContentLayer.get()); | 2487 m_scrollLayer->addChild(m_rootContentLayer.get()); |
2498 | 2488 |
2499 frameViewDidChangeSize(); | 2489 frameViewDidChangeSize(); |
2500 frameViewDidScroll(); | 2490 frameViewDidScroll(); |
2501 } | |
2502 } else { | |
2503 if (m_overflowControlsHostLayer) { | |
2504 m_overflowControlsHostLayer = nullptr; | |
2505 m_clipLayer = nullptr; | |
2506 m_scrollLayer = nullptr; | |
2507 } | |
2508 } | 2491 } |
2509 | 2492 |
2510 // Check to see if we have to change the attachment | 2493 // Check to see if we have to change the attachment |
2511 if (m_rootLayerAttachment != RootLayerUnattached) | 2494 if (m_rootLayerAttachment != RootLayerUnattached) |
2512 detachRootLayer(); | 2495 detachRootLayer(); |
2513 | 2496 |
2514 attachRootLayer(expectedAttachment); | 2497 attachRootLayer(expectedAttachment); |
2515 } | 2498 } |
2516 | 2499 |
2517 void RenderLayerCompositor::destroyRootLayer() | 2500 void RenderLayerCompositor::destroyRootLayer() |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2859 info.addMember(m_layerForOverhangAreas, "layerForOverhangAreas"); | 2842 info.addMember(m_layerForOverhangAreas, "layerForOverhangAreas"); |
2860 info.addMember(m_contentShadowLayer, "contentShadowLayer"); | 2843 info.addMember(m_contentShadowLayer, "contentShadowLayer"); |
2861 info.addMember(m_layerForTopOverhangArea, "layerForTopOverhangArea"); | 2844 info.addMember(m_layerForTopOverhangArea, "layerForTopOverhangArea"); |
2862 info.addMember(m_layerForBottomOverhangArea, "layerForBottomOverhangArea"); | 2845 info.addMember(m_layerForBottomOverhangArea, "layerForBottomOverhangArea"); |
2863 info.addMember(m_layerForHeader, "layerForHeader"); | 2846 info.addMember(m_layerForHeader, "layerForHeader"); |
2864 info.addMember(m_layerForFooter, "layerForFooter"); | 2847 info.addMember(m_layerForFooter, "layerForFooter"); |
2865 #endif | 2848 #endif |
2866 } | 2849 } |
2867 | 2850 |
2868 } // namespace WebCore | 2851 } // namespace WebCore |
OLD | NEW |