| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/layout/compositing/CompositingReasonFinder.h" | 5 #include "core/layout/compositing/CompositingReasonFinder.h" |
| 6 | 6 |
| 7 #include "core/CSSPropertyNames.h" | 7 #include "core/CSSPropertyNames.h" |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
| 10 #include "core/frame/Settings.h" | 10 #include "core/frame/Settings.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // but the layoutObject may be an inline that doesn't support them. | 136 // but the layoutObject may be an inline that doesn't support them. |
| 137 return layoutObject->hasTransformRelatedProperty() && | 137 return layoutObject->hasTransformRelatedProperty() && |
| 138 layoutObject->style()->has3DTransform(); | 138 layoutObject->style()->has3DTransform(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 CompositingReasons CompositingReasonFinder::nonStyleDeterminedDirectReasons( | 141 CompositingReasons CompositingReasonFinder::nonStyleDeterminedDirectReasons( |
| 142 const PaintLayer* layer) const { | 142 const PaintLayer* layer) const { |
| 143 CompositingReasons directReasons = CompositingReasonNone; | 143 CompositingReasons directReasons = CompositingReasonNone; |
| 144 LayoutObject* layoutObject = layer->layoutObject(); | 144 LayoutObject* layoutObject = layer->layoutObject(); |
| 145 | 145 |
| 146 if (layer->needsCompositedScrolling()) | 146 bool checkForClipParent = |
| 147 (m_compositingTriggers & OverflowScrollTrigger) && |
| 148 layer->ancestorScrollingLayer() && |
| 149 layer->ancestorScrollingLayer()->compositingState() == |
| 150 PaintsIntoOwnBacking; |
| 151 if (layer->needsCompositedScrolling()) { |
| 152 checkForClipParent = true; |
| 147 directReasons |= CompositingReasonOverflowScrollingTouch; | 153 directReasons |= CompositingReasonOverflowScrollingTouch; |
| 154 } |
| 155 if (checkForClipParent && layer->clipParent()) |
| 156 directReasons |= CompositingReasonOutOfFlowClipping; |
| 148 | 157 |
| 149 // Composite |layer| if it is inside of an ancestor scrolling layer, but that | 158 // Composite |layer| if it is inside of an ancestor scrolling layer, but that |
| 150 // scrolling layer is not on the stacking context ancestor chain of |layer|. | 159 // scrolling layer is not on the stacking context ancestor chain of |layer|. |
| 151 // See the definition of the scrollParent property in Layer for more detail. | 160 // See the definition of the scrollParent property in Layer for more detail. |
| 152 if (const PaintLayer* scrollingAncestor = layer->ancestorScrollingLayer()) { | 161 if (const PaintLayer* scrollingAncestor = layer->ancestorScrollingLayer()) { |
| 153 if (scrollingAncestor->needsCompositedScrolling() && layer->scrollParent()) | 162 if (scrollingAncestor->needsCompositedScrolling() && layer->scrollParent()) |
| 154 directReasons |= CompositingReasonOverflowScrollingParent; | 163 directReasons |= CompositingReasonOverflowScrollingParent; |
| 155 } | 164 } |
| 156 | 165 |
| 157 // TODO(flackr): Rename functions and variables to include sticky position (i.
e. ScrollDependentPosition rather than PositionFixed). | 166 // TODO(flackr): Rename functions and variables to include sticky position (i.
e. ScrollDependentPosition rather than PositionFixed). |
| (...skipping 28 matching lines...) Expand all Loading... |
| 186 } | 195 } |
| 187 // Don't promote fixed position elements that are descendants of a non-view co
ntainer, e.g. transformed elements. | 196 // Don't promote fixed position elements that are descendants of a non-view co
ntainer, e.g. transformed elements. |
| 188 // They will stay fixed wrt the container rather than the enclosing frame. | 197 // They will stay fixed wrt the container rather than the enclosing frame. |
| 189 if (layer->scrollsWithViewport()) | 198 if (layer->scrollsWithViewport()) |
| 190 return m_layoutView.frameView()->isScrollable(); | 199 return m_layoutView.frameView()->isScrollable(); |
| 191 return layer->layoutObject()->style()->position() == StickyPosition && | 200 return layer->layoutObject()->style()->position() == StickyPosition && |
| 192 layer->ancestorOverflowLayer()->scrollsOverflow(); | 201 layer->ancestorOverflowLayer()->scrollsOverflow(); |
| 193 } | 202 } |
| 194 | 203 |
| 195 } // namespace blink | 204 } // namespace blink |
| OLD | NEW |