| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/rendering/compositing/CompositingReasonFinder.h" | 6 #include "core/rendering/compositing/CompositingReasonFinder.h" |
| 7 | 7 |
| 8 #include "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
| 9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
| 10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 || renderer->document().documentElement()->renderer()->style()->scrollBl
ocksOn() == style->scrollBlocksOn()); | 198 || renderer->document().documentElement()->renderer()->style()->scrollBl
ocksOn() == style->scrollBlocksOn()); |
| 199 | 199 |
| 200 // When a scroll occurs, it's the union of all bits set on the target elemen
t's containing block | 200 // When a scroll occurs, it's the union of all bits set on the target elemen
t's containing block |
| 201 // chain that determines the behavior. Thus we really only need a new layer
if this object contains | 201 // chain that determines the behavior. Thus we really only need a new layer
if this object contains |
| 202 // additional bits from those set by all objects in it's containing block ch
ain. But determining | 202 // additional bits from those set by all objects in it's containing block ch
ain. But determining |
| 203 // this fully is probably more expensive than it's worth. Instead we just h
ave fast-paths here for | 203 // this fully is probably more expensive than it's worth. Instead we just h
ave fast-paths here for |
| 204 // the most common cases of unnecessary layer creation. | 204 // the most common cases of unnecessary layer creation. |
| 205 // Optimizing this fully would avoid layer explosion in pathological cases l
ike '*' rules. | 205 // Optimizing this fully would avoid layer explosion in pathological cases l
ike '*' rules. |
| 206 // We could consider tracking the current state in CompositingRequirementsUp
dater::update. | 206 // We could consider tracking the current state in CompositingRequirementsUp
dater::update. |
| 207 | 207 |
| 208 // Ensure iframes don't get composited when they require no more blocking th
an the root. | 208 // Ensure iframes don't get composited when they require no more blocking th
an their parent. |
| 209 if (renderer->isRenderView()) { | 209 if (renderer->isRenderView()) { |
| 210 if (const FrameView* parentFrame = toRenderView(renderer)->frameView()->
parentFrameView()) { | 210 if (const FrameView* parentFrame = toRenderView(renderer)->frameView()->
parentFrameView()) { |
| 211 if (const RenderView* parentRenderer = parentFrame->renderView()) { | 211 if (const RenderView* parentRenderer = parentFrame->renderView()) { |
| 212 // Does this frame contain only blocks-on bits already present i
n the parent frame? | 212 // Does this frame contain only blocks-on bits already present i
n the parent frame? |
| 213 if (!(style->scrollBlocksOn() & ~parentRenderer->style()->scroll
BlocksOn())) | 213 if (!(style->scrollBlocksOn() & ~parentRenderer->style()->scroll
BlocksOn())) |
| 214 return false; | 214 return false; |
| 215 } | 215 } |
| 216 } else { |
| 217 // The root frame will either always already be composited, or compo
siting will be disabled. |
| 218 // Either way, we don't need to require compositing for scroll block
s on. This avoids |
| 219 // enabling compositing by default, and avoids cluttering the root l
ayers compositing reasons. |
| 220 return false; |
| 216 } | 221 } |
| 217 } | 222 } |
| 218 | 223 |
| 219 return true; | 224 return true; |
| 220 } | 225 } |
| 221 | 226 |
| 222 } | 227 } |
| OLD | NEW |