Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 5 * | 5 * |
| 6 * Other contributors: | 6 * Other contributors: |
| 7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
| 8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
| 9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
| 10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 : m_inResizeMode(false) | 127 : m_inResizeMode(false) |
| 128 , m_scrollDimensionsDirty(true) | 128 , m_scrollDimensionsDirty(true) |
| 129 , m_normalFlowListDirty(true) | 129 , m_normalFlowListDirty(true) |
| 130 , m_hasSelfPaintingLayerDescendant(false) | 130 , m_hasSelfPaintingLayerDescendant(false) |
| 131 , m_hasSelfPaintingLayerDescendantDirty(false) | 131 , m_hasSelfPaintingLayerDescendantDirty(false) |
| 132 , m_hasOutOfFlowPositionedDescendant(false) | 132 , m_hasOutOfFlowPositionedDescendant(false) |
| 133 , m_hasOutOfFlowPositionedDescendantDirty(true) | 133 , m_hasOutOfFlowPositionedDescendantDirty(true) |
| 134 , m_hasUnclippedDescendant(false) | 134 , m_hasUnclippedDescendant(false) |
| 135 , m_isUnclippedDescendant(false) | 135 , m_isUnclippedDescendant(false) |
| 136 , m_needsCompositedScrolling(false) | 136 , m_needsCompositedScrolling(false) |
| 137 , m_needsToBeStackingContainer(false) | |
| 137 , m_canBePromotedToStackingContainer(false) | 138 , m_canBePromotedToStackingContainer(false) |
| 138 , m_canBePromotedToStackingContainerDirty(true) | 139 , m_canBePromotedToStackingContainerDirty(true) |
| 139 , m_isRootLayer(renderer->isRenderView()) | 140 , m_isRootLayer(renderer->isRenderView()) |
| 140 , m_usedTransparency(false) | 141 , m_usedTransparency(false) |
| 141 , m_paintingInsideReflection(false) | 142 , m_paintingInsideReflection(false) |
| 142 , m_inOverflowRelayout(false) | 143 , m_inOverflowRelayout(false) |
| 143 , m_repaintStatus(NeedsNormalRepaint) | 144 , m_repaintStatus(NeedsNormalRepaint) |
| 144 , m_visibleContentStatusDirty(true) | 145 , m_visibleContentStatusDirty(true) |
| 145 , m_hasVisibleContent(false) | 146 , m_hasVisibleContent(false) |
| 146 , m_visibleDescendantStatusDirty(false) | 147 , m_visibleDescendantStatusDirty(false) |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 470 } | 471 } |
| 471 } | 472 } |
| 472 } | 473 } |
| 473 | 474 |
| 474 bool RenderLayer::acceleratedCompositingForOverflowScrollEnabled() const | 475 bool RenderLayer::acceleratedCompositingForOverflowScrollEnabled() const |
| 475 { | 476 { |
| 476 const Settings* settings = renderer()->document()->settings(); | 477 const Settings* settings = renderer()->document()->settings(); |
| 477 return settings && settings->acceleratedCompositingForOverflowScrollEnabled( ); | 478 return settings && settings->acceleratedCompositingForOverflowScrollEnabled( ); |
| 478 } | 479 } |
| 479 | 480 |
| 481 bool RenderLayer::useCompositorDrivenAcceleratedScrolling() const | |
| 482 { | |
| 483 TRACE_EVENT0("comp-scroll", "RenderLayer::useCompositorDrivenAcceleratedScro lling"); | |
|
Ian Vollick
2013/08/29 03:05:01
Can you ditch the printf-y trace events for now? I
hartmanng
2013/09/05 20:43:58
Done.
| |
| 484 | |
| 485 if (!compositorDrivenAcceleratedScrollingEnabled()) | |
| 486 return false; | |
| 487 | |
| 488 const RenderLayer* scrollingLayer = ancestorScrollingLayer(); | |
| 489 if (!scrollingLayer || scrollingLayer->isStackingContainer()) | |
| 490 return false; | |
| 491 | |
| 492 if (scrollingLayer->m_canBePromotedToStackingContainerDirty) { | |
| 493 // We don't know if it's safe to promote to stacking container, and | |
| 494 // aren't in a position to find out, so we have to assume the worst. | |
| 495 return true; | |
| 496 } | |
| 497 | |
| 498 return !scrollingLayer->canBeStackingContainer(); | |
| 499 } | |
| 500 | |
| 480 // FIXME: This is a temporary flag and should be removed once accelerated | 501 // FIXME: This is a temporary flag and should be removed once accelerated |
| 481 // overflow scroll is ready (crbug.com/254111). | 502 // overflow scroll is ready (crbug.com/254111). |
| 482 bool RenderLayer::compositorDrivenAcceleratedScrollingEnabled() const | 503 bool RenderLayer::compositorDrivenAcceleratedScrollingEnabled() const |
| 483 { | 504 { |
| 484 if (!acceleratedCompositingForOverflowScrollEnabled()) | 505 if (!acceleratedCompositingForOverflowScrollEnabled()) |
| 485 return false; | 506 return false; |
| 486 | 507 |
| 487 const Settings* settings = renderer()->document()->settings(); | 508 const Settings* settings = renderer()->document()->settings(); |
| 488 return settings && settings->isCompositorDrivenAcceleratedScrollingEnabled() ; | 509 return settings && settings->isCompositorDrivenAcceleratedScrollingEnabled() ; |
| 489 } | 510 } |
| (...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2046 | 2067 |
| 2047 // Scroll form controls on the main thread so they exhibit correct touch scr oll event bubbling | 2068 // Scroll form controls on the main thread so they exhibit correct touch scr oll event bubbling |
| 2048 if (box && (box->isIntristicallyScrollable(VerticalScrollbar) || box->isIntr isticallyScrollable(HorizontalScrollbar))) | 2069 if (box && (box->isIntristicallyScrollable(VerticalScrollbar) || box->isIntr isticallyScrollable(HorizontalScrollbar))) |
| 2049 return false; | 2070 return false; |
| 2050 | 2071 |
| 2051 return isComposited() && backing()->scrollingLayer(); | 2072 return isComposited() && backing()->scrollingLayer(); |
| 2052 } | 2073 } |
| 2053 | 2074 |
| 2054 bool RenderLayer::needsCompositedScrolling() const | 2075 bool RenderLayer::needsCompositedScrolling() const |
| 2055 { | 2076 { |
| 2056 if (!compositorDrivenAcceleratedScrollingEnabled()) | |
| 2057 return needsToBeStackingContainer(); | |
| 2058 if (FrameView* frameView = renderer()->view()->frameView()) | |
| 2059 return frameView->containsScrollableArea(scrollableArea()); | |
| 2060 return false; | |
| 2061 } | |
| 2062 | |
| 2063 bool RenderLayer::needsToBeStackingContainer() const | |
| 2064 { | |
| 2065 switch (m_forceNeedsCompositedScrolling) { | 2077 switch (m_forceNeedsCompositedScrolling) { |
| 2066 case DoNotForceCompositedScrolling: | 2078 case DoNotForceCompositedScrolling: |
| 2067 return m_needsCompositedScrolling; | 2079 return m_needsCompositedScrolling; |
| 2068 case CompositedScrollingAlwaysOn: | 2080 case CompositedScrollingAlwaysOn: |
| 2069 return true; | 2081 return true; |
| 2070 case CompositedScrollingAlwaysOff: | 2082 case CompositedScrollingAlwaysOff: |
| 2071 return false; | 2083 return false; |
| 2072 } | 2084 } |
| 2073 | 2085 |
| 2074 ASSERT_NOT_REACHED(); | 2086 ASSERT_NOT_REACHED(); |
| 2075 return m_needsCompositedScrolling; | 2087 return m_needsCompositedScrolling; |
| 2076 } | 2088 } |
| 2077 | 2089 |
| 2090 bool RenderLayer::needsToBeStackingContainer() const | |
| 2091 { | |
|
Ian Vollick
2013/08/29 03:05:01
Repeating the switch is a bummer. Maybe we could h
hartmanng
2013/09/05 20:43:58
Done.
| |
| 2092 switch (m_forceNeedsCompositedScrolling) { | |
| 2093 case DoNotForceCompositedScrolling: | |
| 2094 return m_needsToBeStackingContainer; | |
| 2095 case CompositedScrollingAlwaysOn: | |
| 2096 return true; | |
| 2097 case CompositedScrollingAlwaysOff: | |
| 2098 return false; | |
| 2099 } | |
| 2100 | |
| 2101 ASSERT_NOT_REACHED(); | |
| 2102 return m_needsToBeStackingContainer; | |
| 2103 } | |
| 2104 | |
| 2078 void RenderLayer::updateNeedsCompositedScrolling() | 2105 void RenderLayer::updateNeedsCompositedScrolling() |
| 2079 { | 2106 { |
| 2080 TRACE_EVENT0("comp-scroll", "RenderLayer::updateNeedsCompositedScrolling"); | 2107 TRACE_EVENT0("comp-scroll", "RenderLayer::updateNeedsCompositedScrolling"); |
| 2081 | 2108 |
| 2082 updateCanBeStackingContainer(); | 2109 updateCanBeStackingContainer(); |
| 2083 updateDescendantDependentFlags(); | 2110 updateDescendantDependentFlags(); |
| 2084 | 2111 |
| 2085 ASSERT(renderer()->view()->frameView() && renderer()->view()->frameView()->c ontainsScrollableArea(scrollableArea())); | 2112 ASSERT(renderer()->view()->frameView() && renderer()->view()->frameView()->c ontainsScrollableArea(scrollableArea())); |
| 2086 bool needsCompositedScrolling = acceleratedCompositingForOverflowScrollEnabl ed() | 2113 const bool needsToBeStackingContainer = acceleratedCompositingForOverflowScr ollEnabled() |
| 2087 && canBeStackingContainer() | 2114 && canBeStackingContainer() |
| 2088 && !hasUnclippedDescendant(); | 2115 && !hasUnclippedDescendant(); |
| 2089 | 2116 |
| 2117 setNeedsToBeStackingContainer(needsToBeStackingContainer); | |
| 2118 | |
| 2119 const bool needsCompositedScrolling = needsToBeStackingContainer | |
| 2120 || (compositorDrivenAcceleratedScrollingEnabled() | |
| 2121 && renderer()->view()->frameView()->containsScrollableArea(scrollabl eArea())); | |
|
Ian Vollick
2013/08/29 03:05:01
We've already asserted that renderer()->view()->fr
hartmanng
2013/09/05 20:43:58
Done.
| |
| 2122 | |
| 2090 // We gather a boolean value for use with Google UMA histograms to | 2123 // We gather a boolean value for use with Google UMA histograms to |
| 2091 // quantify the actual effects of a set of patches attempting to | 2124 // quantify the actual effects of a set of patches attempting to |
| 2092 // relax composited scrolling requirements, thereby increasing the | 2125 // relax composited scrolling requirements, thereby increasing the |
| 2093 // number of composited overflow divs. | 2126 // number of composited overflow divs. |
| 2094 if (acceleratedCompositingForOverflowScrollEnabled()) | 2127 if (acceleratedCompositingForOverflowScrollEnabled()) |
| 2095 HistogramSupport::histogramEnumeration("Renderer.NeedsCompositedScrollin g", needsCompositedScrolling, 2); | 2128 HistogramSupport::histogramEnumeration("Renderer.NeedsCompositedScrollin g", needsCompositedScrolling, 2); |
| 2096 | 2129 |
| 2097 setNeedsCompositedScrolling(needsCompositedScrolling); | 2130 setNeedsCompositedScrolling(needsCompositedScrolling); |
| 2098 } | 2131 } |
| 2099 | 2132 |
| (...skipping 4419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6519 } | 6552 } |
| 6520 } | 6553 } |
| 6521 | 6554 |
| 6522 void showLayerTree(const WebCore::RenderObject* renderer) | 6555 void showLayerTree(const WebCore::RenderObject* renderer) |
| 6523 { | 6556 { |
| 6524 if (!renderer) | 6557 if (!renderer) |
| 6525 return; | 6558 return; |
| 6526 showLayerTree(renderer->enclosingLayer()); | 6559 showLayerTree(renderer->enclosingLayer()); |
| 6527 } | 6560 } |
| 6528 #endif | 6561 #endif |
| OLD | NEW |