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

Side by Side Diff: Source/core/rendering/RenderLayerCompositor.cpp

Issue 13828004: Avoid compositing fixed-position elements if they cannot scroll (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased and addressed feedback Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after
1960 } 1960 }
1961 1961
1962 // Don't promote fixed position elements that are descendants of a non-view container, e.g. transformed elements. 1962 // Don't promote fixed position elements that are descendants of a non-view container, e.g. transformed elements.
1963 // They will stay fixed wrt the container rather than the enclosing frame. 1963 // They will stay fixed wrt the container rather than the enclosing frame.
1964 if (container != m_renderView) { 1964 if (container != m_renderView) {
1965 if (viewportConstrainedNotCompositedReason) 1965 if (viewportConstrainedNotCompositedReason)
1966 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForNonViewContainer; 1966 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForNonViewContainer;
1967 return false; 1967 return false;
1968 } 1968 }
1969 1969
1970 // If the fixed-position element does not have any scrollable ancestor betwe en it and
1971 // its container, then we do not need to spend compositor resources for it. Start by
1972 // assuming we can opt-out (i.e. no scrollable ancestor), and refine the ans wer below.
1973 bool hasScrollableAncestor = false;
1974
1975 // The FrameView has the scrollbars associated with the top level viewport, so we have to
1976 // check the FrameView in addition to the hierarchy of ancestors.
1977 FrameView* frameView = m_renderView->frameView();
1978 if (frameView && frameView->isScrollable())
1979 hasScrollableAncestor = true;
enne (OOO) 2013/05/02 01:04:07 Thanks, this is way clearer.
1980
1981 RenderLayer* ancestor = layer->parent();
1982 while (ancestor && !hasScrollableAncestor) {
1983 if (frameView->containsScrollableArea(ancestor))
1984 hasScrollableAncestor = true;
1985 if (ancestor->renderer() == m_renderView)
1986 break;
1987 ancestor = ancestor->parent();
1988 }
1989
1990 if (!hasScrollableAncestor) {
1991 if (viewportConstrainedNotCompositedReason)
1992 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForUnscrollableAncestors;
1993 return false;
1994 }
1995
1970 // Subsequent tests depend on layout. If we can't tell now, just keep things the way they are until layout is done. 1996 // Subsequent tests depend on layout. If we can't tell now, just keep things the way they are until layout is done.
1971 if (!m_inPostLayoutUpdate) { 1997 if (!m_inPostLayoutUpdate) {
1972 m_reevaluateCompositingAfterLayout = true; 1998 m_reevaluateCompositingAfterLayout = true;
1973 return layer->isComposited(); 1999 return layer->isComposited();
1974 } 2000 }
1975 2001
1976 bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescend ant(); 2002 bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescend ant();
1977 if (!paintsContent) { 2003 if (!paintsContent) {
1978 if (viewportConstrainedNotCompositedReason) 2004 if (viewportConstrainedNotCompositedReason)
1979 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForNoVisibleContent; 2005 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForNoVisibleContent;
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
2759 info.addMember(m_layerForScrollCorner, "layerForScrollCorner"); 2785 info.addMember(m_layerForScrollCorner, "layerForScrollCorner");
2760 #if ENABLE(RUBBER_BANDING) 2786 #if ENABLE(RUBBER_BANDING)
2761 info.addMember(m_layerForOverhangAreas, "layerForOverhangAreas"); 2787 info.addMember(m_layerForOverhangAreas, "layerForOverhangAreas");
2762 info.addMember(m_contentShadowLayer, "contentShadowLayer"); 2788 info.addMember(m_contentShadowLayer, "contentShadowLayer");
2763 info.addMember(m_layerForTopOverhangArea, "layerForTopOverhangArea"); 2789 info.addMember(m_layerForTopOverhangArea, "layerForTopOverhangArea");
2764 info.addMember(m_layerForBottomOverhangArea, "layerForBottomOverhangArea"); 2790 info.addMember(m_layerForBottomOverhangArea, "layerForBottomOverhangArea");
2765 #endif 2791 #endif
2766 } 2792 }
2767 2793
2768 } // namespace WebCore 2794 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698