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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 RenderLayer::RenderLayer(RenderLayerModelObject* renderer) | 126 RenderLayer::RenderLayer(RenderLayerModelObject* renderer) |
| 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_isScrollableAreaHasBeenRecorded(false) |
| 137 , m_canBePromotedToStackingContainer(false) | 137 , m_canBePromotedToStackingContainer(false) |
| 138 , m_canBePromotedToStackingContainerDirty(true) | 138 , m_canBePromotedToStackingContainerDirty(true) |
| 139 , m_isRootLayer(renderer->isRenderView()) | 139 , m_isRootLayer(renderer->isRenderView()) |
| 140 , m_usedTransparency(false) | 140 , m_usedTransparency(false) |
| 141 , m_paintingInsideReflection(false) | 141 , m_paintingInsideReflection(false) |
| 142 , m_inOverflowRelayout(false) | 142 , m_inOverflowRelayout(false) |
| 143 , m_repaintStatus(NeedsNormalRepaint) | 143 , m_repaintStatus(NeedsNormalRepaint) |
| 144 , m_visibleContentStatusDirty(true) | 144 , m_visibleContentStatusDirty(true) |
| 145 , m_hasVisibleContent(false) | 145 , m_hasVisibleContent(false) |
| 146 , m_visibleDescendantStatusDirty(false) | 146 , m_visibleDescendantStatusDirty(false) |
| 147 , m_hasVisibleDescendant(false) | 147 , m_hasVisibleDescendant(false) |
| 148 , m_isPaginated(false) | 148 , m_isPaginated(false) |
| 149 , m_3DTransformedDescendantStatusDirty(true) | 149 , m_3DTransformedDescendantStatusDirty(true) |
| 150 , m_has3DTransformedDescendant(false) | 150 , m_has3DTransformedDescendant(false) |
| 151 , m_containsDirtyOverlayScrollbars(false) | 151 , m_containsDirtyOverlayScrollbars(false) |
| 152 #if !ASSERT_DISABLED | 152 #if !ASSERT_DISABLED |
| 153 , m_layerListMutationAllowed(true) | 153 , m_layerListMutationAllowed(true) |
| 154 #endif | 154 #endif |
| 155 , m_canSkipRepaintRectsUpdateOnScroll(renderer->isTableCell()) | 155 , m_canSkipRepaintRectsUpdateOnScroll(renderer->isTableCell()) |
| 156 , m_hasFilterInfo(false) | 156 , m_hasFilterInfo(false) |
| 157 , m_needsCompositedScrolling(MixedTriState) | |
| 157 , m_blendMode(BlendModeNormal) | 158 , m_blendMode(BlendModeNormal) |
| 158 , m_renderer(renderer) | 159 , m_renderer(renderer) |
| 159 , m_parent(0) | 160 , m_parent(0) |
| 160 , m_previous(0) | 161 , m_previous(0) |
| 161 , m_next(0) | 162 , m_next(0) |
| 162 , m_first(0) | 163 , m_first(0) |
| 163 , m_last(0) | 164 , m_last(0) |
| 164 , m_staticInlinePosition(0) | 165 , m_staticInlinePosition(0) |
| 165 , m_staticBlockPosition(0) | 166 , m_staticBlockPosition(0) |
| 166 , m_reflection(0) | 167 , m_reflection(0) |
| (...skipping 1877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2044 return needsToBeStackingContainer(); | 2045 return needsToBeStackingContainer(); |
| 2045 if (FrameView* frameView = renderer()->view()->frameView()) | 2046 if (FrameView* frameView = renderer()->view()->frameView()) |
| 2046 return frameView->containsScrollableArea(scrollableArea()); | 2047 return frameView->containsScrollableArea(scrollableArea()); |
| 2047 return false; | 2048 return false; |
| 2048 } | 2049 } |
| 2049 | 2050 |
| 2050 bool RenderLayer::needsToBeStackingContainer() const | 2051 bool RenderLayer::needsToBeStackingContainer() const |
| 2051 { | 2052 { |
| 2052 switch (m_forceNeedsCompositedScrolling) { | 2053 switch (m_forceNeedsCompositedScrolling) { |
| 2053 case DoNotForceCompositedScrolling: | 2054 case DoNotForceCompositedScrolling: |
| 2054 return m_needsCompositedScrolling; | 2055 return m_needsCompositedScrolling == TrueTriState; |
| 2055 case CompositedScrollingAlwaysOn: | 2056 case CompositedScrollingAlwaysOn: |
| 2056 return true; | 2057 return true; |
| 2057 case CompositedScrollingAlwaysOff: | 2058 case CompositedScrollingAlwaysOff: |
| 2058 return false; | 2059 return false; |
| 2059 } | 2060 } |
| 2060 | 2061 |
| 2061 ASSERT_NOT_REACHED(); | 2062 ASSERT_NOT_REACHED(); |
| 2062 return m_needsCompositedScrolling; | 2063 return m_needsCompositedScrolling == TrueTriState; |
| 2063 } | 2064 } |
| 2064 | 2065 |
| 2065 void RenderLayer::updateNeedsCompositedScrolling() | 2066 void RenderLayer::updateNeedsCompositedScrolling() |
| 2066 { | 2067 { |
| 2067 TRACE_EVENT0("comp-scroll", "RenderLayer::updateNeedsCompositedScrolling"); | 2068 TRACE_EVENT0("comp-scroll", "RenderLayer::updateNeedsCompositedScrolling"); |
| 2068 | 2069 |
| 2069 updateCanBeStackingContainer(); | 2070 updateCanBeStackingContainer(); |
| 2070 updateDescendantDependentFlags(); | 2071 updateDescendantDependentFlags(); |
| 2071 | 2072 |
| 2072 ASSERT(renderer()->view()->frameView() && renderer()->view()->frameView()->c ontainsScrollableArea(scrollableArea())); | 2073 ASSERT(renderer()->view()->frameView() && renderer()->view()->frameView()->c ontainsScrollableArea(scrollableArea())); |
| 2073 bool needsCompositedScrolling = acceleratedCompositingForOverflowScrollEnabl ed() | 2074 bool needsCompositedScrolling = acceleratedCompositingForOverflowScrollEnabl ed() |
| 2074 && canBeStackingContainer() | 2075 && canBeStackingContainer() |
| 2075 && !hasUnclippedDescendant(); | 2076 && !hasUnclippedDescendant(); |
| 2076 | 2077 |
| 2077 // We gather a boolean value for use with Google UMA histograms to | 2078 // We gather a boolean value for use with Google UMA histograms to |
| 2078 // quantify the actual effects of a set of patches attempting to | 2079 // quantify the actual effects of a set of patches attempting to |
| 2079 // relax composited scrolling requirements, thereby increasing the | 2080 // relax composited scrolling requirements, thereby increasing the |
| 2080 // number of composited overflow divs. | 2081 // number of composited overflow divs. |
| 2081 if (acceleratedCompositingForOverflowScrollEnabled()) | 2082 if (acceleratedCompositingForOverflowScrollEnabled()) |
| 2082 HistogramSupport::histogramEnumeration("Renderer.NeedsCompositedScrollin g", needsCompositedScrolling, 2); | 2083 HistogramSupport::histogramEnumeration("Renderer.NeedsCompositedScrollin g", needsCompositedScrolling, 2); |
| 2083 | 2084 |
| 2084 setNeedsCompositedScrolling(needsCompositedScrolling); | 2085 setNeedsCompositedScrolling(needsCompositedScrolling); |
| 2085 } | 2086 } |
| 2086 | 2087 |
| 2087 void RenderLayer::setNeedsCompositedScrolling(bool needsCompositedScrolling) | 2088 void RenderLayer::setNeedsCompositedScrolling(bool needsCompositedScrolling) |
| 2088 { | 2089 { |
| 2089 if (m_needsCompositedScrolling == needsCompositedScrolling) | 2090 const bool neededCompositedScrolling = m_needsCompositedScrolling == TrueTri State; |
| 2091 if (neededCompositedScrolling == needsCompositedScrolling) | |
| 2090 return; | 2092 return; |
| 2091 | 2093 |
| 2092 m_needsCompositedScrolling = needsCompositedScrolling; | 2094 // Count the total number of RenderLayers which need composited scrolling at |
| 2095 // some point. This should be recorded at most once per RenderLayer, so we | |
| 2096 // check if m_needsCompositedScrolling has been set yet. If it hasn't been | |
| 2097 // set, its value will be MixedTriState, but if it has been set, it will be | |
| 2098 // TrueTriState or FalseTriState. | |
| 2099 if (acceleratedCompositingForOverflowScrollEnabled() && m_needsCompositedScr olling == MixedTriState) | |
| 2100 HistogramSupport::histogramEnumeration("Renderer.NeedsToBeStackingContai ner", 1, 2); | |
| 2101 | |
| 2102 m_needsCompositedScrolling = needsCompositedScrolling ? TrueTriState : False TriState; | |
| 2093 | 2103 |
| 2094 // Note, the z-order lists may need to be rebuilt, but our code guarantees | 2104 // Note, the z-order lists may need to be rebuilt, but our code guarantees |
| 2095 // that we have not affected stacking, so we will not dirty | 2105 // that we have not affected stacking, so we will not dirty |
| 2096 // m_canBePromotedToStackingContainer for either us or our stacking context | 2106 // m_canBePromotedToStackingContainer for either us or our stacking context |
| 2097 // or container. | 2107 // or container. |
| 2098 didUpdateNeedsCompositedScrolling(); | 2108 didUpdateNeedsCompositedScrolling(); |
| 2099 } | 2109 } |
| 2100 | 2110 |
| 2101 void RenderLayer::setForceNeedsCompositedScrolling(RenderLayer::ForceNeedsCompos itedScrollingMode mode) | 2111 void RenderLayer::setForceNeedsCompositedScrolling(RenderLayer::ForceNeedsCompos itedScrollingMode mode) |
| 2102 { | 2112 { |
| (...skipping 4077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6180 if (!frameView) | 6190 if (!frameView) |
| 6181 return; | 6191 return; |
| 6182 | 6192 |
| 6183 bool isVisibleToHitTest = renderer()->visibleToHitTesting(); | 6193 bool isVisibleToHitTest = renderer()->visibleToHitTesting(); |
| 6184 if (HTMLFrameOwnerElement* owner = frame->ownerElement()) | 6194 if (HTMLFrameOwnerElement* owner = frame->ownerElement()) |
| 6185 isVisibleToHitTest &= owner->renderer() && owner->renderer()->visibleToH itTesting(); | 6195 isVisibleToHitTest &= owner->renderer() && owner->renderer()->visibleToH itTesting(); |
| 6186 | 6196 |
| 6187 if (hasOverflow && isVisibleToHitTest) { | 6197 if (hasOverflow && isVisibleToHitTest) { |
| 6188 if (frameView->addScrollableArea(scrollableArea())) | 6198 if (frameView->addScrollableArea(scrollableArea())) |
| 6189 compositor()->setNeedsUpdateCompositingRequirementsState(); | 6199 compositor()->setNeedsUpdateCompositingRequirementsState(); |
| 6200 | |
| 6201 // Count the total number of RenderLayers that are scrollable areas for | |
| 6202 // any period. We only want to record this at most once per RenderLayer. | |
| 6203 if (!m_isScrollableAreaHasBeenRecorded) { | |
| 6204 HistogramSupport::histogramEnumeration("Renderer.IsScrollableArea", 1, 2); | |
| 6205 m_isScrollableAreaHasBeenRecorded = true; | |
| 6206 } | |
|
Ian Vollick
2013/09/03 18:28:07
This should happen inside the previous 'if', I thi
hartmanng
2013/09/03 21:26:56
Done.
| |
| 6190 } else { | 6207 } else { |
| 6191 if (frameView->removeScrollableArea(scrollableArea())) | 6208 if (frameView->removeScrollableArea(scrollableArea())) |
| 6192 setNeedsCompositedScrolling(false); | 6209 setNeedsCompositedScrolling(false); |
| 6193 } | 6210 } |
| 6194 } | 6211 } |
| 6195 | 6212 |
| 6196 void RenderLayer::updateScrollCornerStyle() | 6213 void RenderLayer::updateScrollCornerStyle() |
| 6197 { | 6214 { |
| 6198 RenderObject* actualRenderer = rendererForScrollbar(renderer()); | 6215 RenderObject* actualRenderer = rendererForScrollbar(renderer()); |
| 6199 RefPtr<RenderStyle> corner = renderer()->hasOverflowClip() ? actualRenderer- >getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualRenderer->st yle()) : PassRefPtr<RenderStyle>(0); | 6216 RefPtr<RenderStyle> corner = renderer()->hasOverflowClip() ? actualRenderer- >getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualRenderer->st yle()) : PassRefPtr<RenderStyle>(0); |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6473 } | 6490 } |
| 6474 } | 6491 } |
| 6475 | 6492 |
| 6476 void showLayerTree(const WebCore::RenderObject* renderer) | 6493 void showLayerTree(const WebCore::RenderObject* renderer) |
| 6477 { | 6494 { |
| 6478 if (!renderer) | 6495 if (!renderer) |
| 6479 return; | 6496 return; |
| 6480 showLayerTree(renderer->enclosingLayer()); | 6497 showLayerTree(renderer->enclosingLayer()); |
| 6481 } | 6498 } |
| 6482 #endif | 6499 #endif |
| OLD | NEW |