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

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 again Created 7 years, 8 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 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after
1927 } 1927 }
1928 1928
1929 // Don't promote fixed position elements that are descendants of a non-view container, e.g. transformed elements. 1929 // Don't promote fixed position elements that are descendants of a non-view container, e.g. transformed elements.
1930 // They will stay fixed wrt the container rather than the enclosing frame. 1930 // They will stay fixed wrt the container rather than the enclosing frame.
1931 if (container != m_renderView) { 1931 if (container != m_renderView) {
1932 if (viewportConstrainedNotCompositedReason) 1932 if (viewportConstrainedNotCompositedReason)
1933 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForNonViewContainer; 1933 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForNonViewContainer;
1934 return false; 1934 return false;
1935 } 1935 }
1936 1936
1937 // If the fixed-position element does not have any scrollable ancestor betwe en it and
1938 // its container, then we do not need to spend compositor resources for it. Start by
1939 // assuming we can opt-out (i.e. no scrollable ancestor), and refine the ans wer below.
1940 bool noScrollableAncestor = true;
1941
1942 // The FrameView has the scrollbars associated with the top level viewport, so we have to
1943 // check the FrameView in addition to the hierarchy of ancestors.
1944 if (m_renderView->frameView() && (m_renderView->frameView()->isScrollable()) )
1945 noScrollableAncestor = false;
1946
1947 RenderLayer* ancestor = layer->parent();
1948 while (ancestor && noScrollableAncestor) {
jamesr 2013/04/20 01:24:10 this seems too slow. This function is called from
shawnsingh 2013/04/21 00:22:21 This only occurs for fixed-position elements. The
1949 if (ancestor->hasScrollbars())
1950 noScrollableAncestor = false;
1951 if (ancestor->renderer() == container)
jamesr 2013/04/20 01:24:10 since we've checked explicitly for transformed con
shawnsingh 2013/04/21 00:22:21 No, it can't. You're right that container is the
1952 break;
1953 ancestor = ancestor->parent();
1954 }
1955
1956 if (noScrollableAncestor) {
1957 if (viewportConstrainedNotCompositedReason)
1958 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForUnscrollableAncestors;
1959 return false;
1960 }
1961
1937 // Subsequent tests depend on layout. If we can't tell now, just keep things the way they are until layout is done. 1962 // Subsequent tests depend on layout. If we can't tell now, just keep things the way they are until layout is done.
1938 if (!m_inPostLayoutUpdate) { 1963 if (!m_inPostLayoutUpdate) {
1939 m_reevaluateCompositingAfterLayout = true; 1964 m_reevaluateCompositingAfterLayout = true;
1940 return layer->isComposited(); 1965 return layer->isComposited();
1941 } 1966 }
1942 1967
1943 bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescend ant(); 1968 bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescend ant();
1944 if (!paintsContent) { 1969 if (!paintsContent) {
1945 if (viewportConstrainedNotCompositedReason) 1970 if (viewportConstrainedNotCompositedReason)
1946 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForNoVisibleContent; 1971 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForNoVisibleContent;
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
2780 info.addMember(m_layerForOverhangAreas, "layerForOverhangAreas"); 2805 info.addMember(m_layerForOverhangAreas, "layerForOverhangAreas");
2781 info.addMember(m_contentShadowLayer, "contentShadowLayer"); 2806 info.addMember(m_contentShadowLayer, "contentShadowLayer");
2782 info.addMember(m_layerForTopOverhangArea, "layerForTopOverhangArea"); 2807 info.addMember(m_layerForTopOverhangArea, "layerForTopOverhangArea");
2783 info.addMember(m_layerForBottomOverhangArea, "layerForBottomOverhangArea"); 2808 info.addMember(m_layerForBottomOverhangArea, "layerForBottomOverhangArea");
2784 info.addMember(m_layerForHeader, "layerForHeader"); 2809 info.addMember(m_layerForHeader, "layerForHeader");
2785 info.addMember(m_layerForFooter, "layerForFooter"); 2810 info.addMember(m_layerForFooter, "layerForFooter");
2786 #endif 2811 #endif
2787 } 2812 }
2788 2813
2789 } // namespace WebCore 2814 } // 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