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 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1622 updateLayerForHeader(m_layerForHeader); | 1622 updateLayerForHeader(m_layerForHeader); |
1623 updateLayerForFooter(m_layerForFooter); | 1623 updateLayerForFooter(m_layerForFooter); |
1624 #endif | 1624 #endif |
1625 } | 1625 } |
1626 | 1626 |
1627 bool RenderLayerCompositor::has3DContent() const | 1627 bool RenderLayerCompositor::has3DContent() const |
1628 { | 1628 { |
1629 return layerHas3DContent(rootRenderLayer()); | 1629 return layerHas3DContent(rootRenderLayer()); |
1630 } | 1630 } |
1631 | 1631 |
1632 bool RenderLayerCompositor::allowsIndependentlyCompositedFrames(const FrameView*
view) | |
1633 { | |
1634 #if PLATFORM(MAC) | |
1635 // frames are only independently composited in Mac pre-WebKit2. | |
1636 return view->platformWidget(); | |
1637 #else | |
1638 UNUSED_PARAM(view); | |
1639 #endif | |
1640 return false; | |
1641 } | |
1642 | |
1643 bool RenderLayerCompositor::shouldPropagateCompositingToEnclosingFrame() const | 1632 bool RenderLayerCompositor::shouldPropagateCompositingToEnclosingFrame() const |
1644 { | 1633 { |
1645 // Parent document content needs to be able to render on top of a composited
frame, so correct behavior | 1634 // Parent document content needs to be able to render on top of a composited
frame, so correct behavior |
1646 // is to have the parent document become composited too. However, this can c
ause problems on platforms that | 1635 // is to have the parent document become composited too. However, this can c
ause problems on platforms that |
1647 // use native views for frames (like Mac), so disable that behavior on those
platforms for now. | 1636 // use native views for frames (like Mac), so disable that behavior on those
platforms for now. |
1648 HTMLFrameOwnerElement* ownerElement = m_renderView->document()->ownerElement
(); | 1637 HTMLFrameOwnerElement* ownerElement = m_renderView->document()->ownerElement
(); |
1649 RenderObject* renderer = ownerElement ? ownerElement->renderer() : 0; | |
1650 | 1638 |
1651 // If we are the top-level frame, don't propagate. | 1639 // If we are the top-level frame, don't propagate. |
1652 if (!ownerElement) | 1640 return ownerElement; |
1653 return false; | |
1654 | |
1655 if (!allowsIndependentlyCompositedFrames(m_renderView->frameView())) | |
1656 return true; | |
1657 | |
1658 if (!renderer || !renderer->isRenderPart()) | |
1659 return false; | |
1660 | |
1661 // On Mac, only propagate compositing if the frame is overlapped in the pare
nt | |
1662 // document, or the parent is already compositing, or the main frame is scal
ed. | |
1663 Page* page = this->page(); | |
1664 if (page && page->pageScaleFactor() != 1) | |
1665 return true; | |
1666 | |
1667 RenderPart* frameRenderer = toRenderPart(renderer); | |
1668 if (frameRenderer->widget()) { | |
1669 ASSERT(frameRenderer->widget()->isFrameView()); | |
1670 FrameView* view = toFrameView(frameRenderer->widget()); | |
1671 if (view->isOverlappedIncludingAncestors() || view->hasCompositingAncest
or()) | |
1672 return true; | |
1673 } | |
1674 | |
1675 return false; | |
1676 } | 1641 } |
1677 | 1642 |
1678 bool RenderLayerCompositor::needsToBeComposited(const RenderLayer* layer, Render
Layer::ViewportConstrainedNotCompositedReason* viewportConstrainedNotCompositedR
eason) const | 1643 bool RenderLayerCompositor::needsToBeComposited(const RenderLayer* layer, Render
Layer::ViewportConstrainedNotCompositedReason* viewportConstrainedNotCompositedR
eason) const |
1679 { | 1644 { |
1680 if (!canBeComposited(layer)) | 1645 if (!canBeComposited(layer)) |
1681 return false; | 1646 return false; |
1682 | 1647 |
1683 return requiresCompositingLayer(layer, viewportConstrainedNotCompositedReaso
n) || layer->mustCompositeForIndirectReasons() || (inCompositingMode() && layer-
>isRootLayer()); | 1648 return requiresCompositingLayer(layer, viewportConstrainedNotCompositedReaso
n) || layer->mustCompositeForIndirectReasons() || (inCompositingMode() && layer-
>isRootLayer()); |
1684 } | 1649 } |
1685 | 1650 |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2238 { | 2203 { |
2239 return layer->hasNegativeZOrderList(); | 2204 return layer->hasNegativeZOrderList(); |
2240 } | 2205 } |
2241 | 2206 |
2242 bool RenderLayerCompositor::requiresScrollLayer(RootLayerAttachment attachment)
const | 2207 bool RenderLayerCompositor::requiresScrollLayer(RootLayerAttachment attachment)
const |
2243 { | 2208 { |
2244 // This applies when the application UI handles scrolling, in which case Ren
derLayerCompositor doesn't need to manage it. | 2209 // This applies when the application UI handles scrolling, in which case Ren
derLayerCompositor doesn't need to manage it. |
2245 if (m_renderView->frameView()->delegatesScrolling()) | 2210 if (m_renderView->frameView()->delegatesScrolling()) |
2246 return false; | 2211 return false; |
2247 | 2212 |
2248 // We need to handle our own scrolling if we're: | 2213 return true; |
2249 return !m_renderView->frameView()->platformWidget() // viewless (i.e. non-Ma
c, or Mac in WebKit2) | |
2250 || attachment == RootLayerAttachedViaEnclosingFrame; // a composited fra
me on Mac | |
2251 } | 2214 } |
2252 | 2215 |
2253 static void paintScrollbar(Scrollbar* scrollbar, GraphicsContext& context, const
IntRect& clip) | 2216 static void paintScrollbar(Scrollbar* scrollbar, GraphicsContext& context, const
IntRect& clip) |
2254 { | 2217 { |
2255 if (!scrollbar) | 2218 if (!scrollbar) |
2256 return; | 2219 return; |
2257 | 2220 |
2258 context.save(); | 2221 context.save(); |
2259 const IntRect& scrollbarRect = scrollbar->frameRect(); | 2222 const IntRect& scrollbarRect = scrollbar->frameRect(); |
2260 context.translate(-scrollbarRect.x(), -scrollbarRect.y()); | 2223 context.translate(-scrollbarRect.x(), -scrollbarRect.y()); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2364 } | 2327 } |
2365 | 2328 |
2366 bool RenderLayerCompositor::keepLayersPixelAligned() const | 2329 bool RenderLayerCompositor::keepLayersPixelAligned() const |
2367 { | 2330 { |
2368 // When scaling, attempt to align compositing layers to pixel boundaries. | 2331 // When scaling, attempt to align compositing layers to pixel boundaries. |
2369 return true; | 2332 return true; |
2370 } | 2333 } |
2371 | 2334 |
2372 static bool shouldCompositeOverflowControls(FrameView* view) | 2335 static bool shouldCompositeOverflowControls(FrameView* view) |
2373 { | 2336 { |
2374 if (view->platformWidget()) | |
2375 return false; | |
2376 | |
2377 if (Page* page = view->frame()->page()) { | 2337 if (Page* page = view->frame()->page()) { |
2378 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina
tor()) | 2338 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina
tor()) |
2379 if (scrollingCoordinator->coordinatesScrollingForFrameView(view)) | 2339 if (scrollingCoordinator->coordinatesScrollingForFrameView(view)) |
2380 return true; | 2340 return true; |
2381 } | 2341 } |
2382 | 2342 |
2383 #if !PLATFORM(CHROMIUM) | 2343 #if !PLATFORM(CHROMIUM) |
2384 if (!view->hasOverlayScrollbars()) | 2344 if (!view->hasOverlayScrollbars()) |
2385 return false; | 2345 return false; |
2386 #endif | 2346 #endif |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3157 info.addMember(m_layerForBottomOverhangArea, "layerForBottomOverhangArea"); | 3117 info.addMember(m_layerForBottomOverhangArea, "layerForBottomOverhangArea"); |
3158 info.addMember(m_layerForHeader, "layerForHeader"); | 3118 info.addMember(m_layerForHeader, "layerForHeader"); |
3159 info.addMember(m_layerForFooter, "layerForFooter"); | 3119 info.addMember(m_layerForFooter, "layerForFooter"); |
3160 #endif | 3120 #endif |
3161 info.addMember(m_layerUpdater, "layerUpdater"); | 3121 info.addMember(m_layerUpdater, "layerUpdater"); |
3162 } | 3122 } |
3163 | 3123 |
3164 } // namespace WebCore | 3124 } // namespace WebCore |
3165 | 3125 |
3166 #endif // USE(ACCELERATED_COMPOSITING) | 3126 #endif // USE(ACCELERATED_COMPOSITING) |
OLD | NEW |