Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Unified Diff: Source/WebCore/rendering/RenderLayerCompositor.cpp

Issue 11970041: Merge 139461 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1364/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/rendering/RenderLayerCompositor.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/rendering/RenderLayerCompositor.cpp
===================================================================
--- Source/WebCore/rendering/RenderLayerCompositor.cpp (revision 139983)
+++ Source/WebCore/rendering/RenderLayerCompositor.cpp (working copy)
@@ -454,7 +454,6 @@
CompositingState compState(updateRoot, m_compositingConsultsOverlap);
bool layersChanged = false;
bool saw3DTransform = false;
- m_fixedPositionLayerNotCompositedReasonMap.clear();
if (m_compositingConsultsOverlap) {
OverlapMap overlapTestRequestMap;
computeCompositingRequirements(0, updateRoot, &overlapTestRequestMap, compState, layersChanged, saw3DTransform);
@@ -550,8 +549,9 @@
bool RenderLayerCompositor::updateBacking(RenderLayer* layer, CompositingChangeRepaint shouldRepaint)
{
bool layerChanged = false;
+ RenderLayer::ViewportConstrainedNotCompositedReason viewportConstrainedNotCompositedReason = RenderLayer::NoNotCompositedReason;
- if (needsToBeComposited(layer)) {
+ if (needsToBeComposited(layer, &viewportConstrainedNotCompositedReason)) {
enableCompositingMode();
if (!layer->backing()) {
@@ -623,10 +623,17 @@
if (layerChanged)
layer->clearClipRectsIncludingDescendants(PaintingClipRects);
- // If a fixed position layer gained/lost a backing, the scrolling coordinator needs to recalculate whether it can do fast scrolling.
- if (layerChanged && layer->renderer()->style()->position() == FixedPosition) {
- if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
- scrollingCoordinator->frameViewFixedObjectsDidChange(m_renderView->frameView());
+ // If a fixed position layer gained/lost a backing or the reason not compositing it changed,
+ // the scrolling coordinator needs to recalculate whether it can do fast scrolling.
+ if (layer->renderer()->style()->position() == FixedPosition) {
+ if (layer->viewportConstrainedNotCompositedReason() != viewportConstrainedNotCompositedReason) {
+ layer->setViewportConstrainedNotCompositedReason(viewportConstrainedNotCompositedReason);
+ layerChanged = true;
+ }
+ if (layerChanged) {
+ if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+ scrollingCoordinator->frameViewFixedObjectsDidChange(m_renderView->frameView());
+ }
}
if (layer->backing())
@@ -845,8 +852,7 @@
CompositingState childState(compositingState);
childState.m_subtreeIsCompositing = false;
- FixedPositionLayerNotCompositedReason fixedPositionLayerNotCompositedReason = NoReason;
- bool willBeComposited = needsToBeComposited(layer, &fixedPositionLayerNotCompositedReason);
+ bool willBeComposited = needsToBeComposited(layer);
if (willBeComposited) {
// Tell the parent it has compositing descendants.
compositingState.m_subtreeIsCompositing = true;
@@ -855,8 +861,7 @@
if (overlapMap)
overlapMap->pushCompositingContainer();
- } else if (fixedPositionLayerNotCompositedReason != NoReason)
- m_fixedPositionLayerNotCompositedReasonMap.set(layer, fixedPositionLayerNotCompositedReason);
+ }
#if !ASSERT_DISABLED
LayerListMutationDetector mutationChecker(layer);
@@ -1564,18 +1569,18 @@
return false;
}
-bool RenderLayerCompositor::needsToBeComposited(const RenderLayer* layer, FixedPositionLayerNotCompositedReason* fixedPositionLayerNotCompositedReason) const
+bool RenderLayerCompositor::needsToBeComposited(const RenderLayer* layer, RenderLayer::ViewportConstrainedNotCompositedReason* viewportConstrainedNotCompositedReason) const
{
if (!canBeComposited(layer))
return false;
- return requiresCompositingLayer(layer, fixedPositionLayerNotCompositedReason) || layer->mustCompositeForIndirectReasons() || (inCompositingMode() && layer->isRootLayer());
+ return requiresCompositingLayer(layer, viewportConstrainedNotCompositedReason) || layer->mustCompositeForIndirectReasons() || (inCompositingMode() && layer->isRootLayer());
}
// Note: this specifies whether the RL needs a compositing layer for intrinsic reasons.
// Use needsToBeComposited() to determine if a RL actually needs a compositing layer.
// static
-bool RenderLayerCompositor::requiresCompositingLayer(const RenderLayer* layer, FixedPositionLayerNotCompositedReason* fixedPositionLayerNotCompositedReason) const
+bool RenderLayerCompositor::requiresCompositingLayer(const RenderLayer* layer, RenderLayer::ViewportConstrainedNotCompositedReason* viewportConstrainedNotCompositedReason) const
{
RenderObject* renderer = layer->renderer();
// The compositing state of a reflection should match that of its reflected layer.
@@ -1593,7 +1598,7 @@
|| clipsCompositingDescendants(layer)
|| requiresCompositingForAnimation(renderer)
|| requiresCompositingForFilters(renderer)
- || requiresCompositingForPosition(renderer, layer, fixedPositionLayerNotCompositedReason)
+ || requiresCompositingForPosition(renderer, layer, viewportConstrainedNotCompositedReason)
|| requiresCompositingForOverflowScrolling(layer)
|| requiresCompositingForBlending(renderer);
}
@@ -1681,7 +1686,7 @@
return "filters";
if (requiresCompositingForPosition(renderer, layer))
- return "position: fixed";
+ return renderer->style()->position() == FixedPosition ? "position: fixed" : "position: sticky";
if (requiresCompositingForOverflowScrolling(layer))
return "-webkit-overflow-scrolling: touch";
@@ -1971,7 +1976,7 @@
#endif
}
-bool RenderLayerCompositor::requiresCompositingForPosition(RenderObject* renderer, const RenderLayer* layer, FixedPositionLayerNotCompositedReason* fixedPositionLayerNotCompositedReason) const
+bool RenderLayerCompositor::requiresCompositingForPosition(RenderObject* renderer, const RenderLayer* layer, RenderLayer::ViewportConstrainedNotCompositedReason* viewportConstrainedNotCompositedReason) const
{
// position:fixed elements that create their own stacking context (e.g. have an explicit z-index,
// opacity, transform) can get their own composited layer. A stacking context is required otherwise
@@ -1990,11 +1995,11 @@
return false;
}
- // Don't promote fixed position elements that are descendants of transformed elements.
- // They will stay fixed wrt the transformed element rather than the enclosing frame.
+ // Don't promote fixed position elements that are descendants of a non-view container, e.g. transformed elements.
+ // They will stay fixed wrt the container rather than the enclosing frame.
if (container != m_renderView) {
- if (fixedPositionLayerNotCompositedReason)
- *fixedPositionLayerNotCompositedReason = DescendantOfTransformedElement;
+ if (viewportConstrainedNotCompositedReason)
+ *viewportConstrainedNotCompositedReason = RenderLayer::NotCompositedForNonViewContainer;
return false;
}
@@ -2005,8 +2010,8 @@
| RenderLayer::ExcludeHiddenDescendants | RenderLayer::DontConstrainForMask | RenderLayer::IncludeCompositedDescendants);
layerBounds.scale(frameView->frame()->frameScaleFactor());
if (!viewBounds.intersects(enclosingIntRect(layerBounds))) {
- if (fixedPositionLayerNotCompositedReason)
- *fixedPositionLayerNotCompositedReason = LayerBoundsOutOfView;
+ if (viewportConstrainedNotCompositedReason)
+ *viewportConstrainedNotCompositedReason = RenderLayer::NotCompositedForBoundsOutOfView;
return false;
}
}
« no previous file with comments | « Source/WebCore/rendering/RenderLayerCompositor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698