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

Side by Side Diff: Source/WebCore/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: simplified to hasScrollbars() 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/WebCore/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 1913 matching lines...) Expand 10 before | Expand all | Expand 10 after
1924 return false; 1924 return false;
1925 } 1925 }
1926 1926
1927 // Don't promote fixed position elements that are descendants of a non-view container, e.g. transformed elements. 1927 // Don't promote fixed position elements that are descendants of a non-view container, e.g. transformed elements.
1928 // They will stay fixed wrt the container rather than the enclosing frame. 1928 // They will stay fixed wrt the container rather than the enclosing frame.
1929 if (container != m_renderView) { 1929 if (container != m_renderView) {
1930 if (viewportConstrainedNotCompositedReason) 1930 if (viewportConstrainedNotCompositedReason)
1931 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForNonViewContainer; 1931 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForNonViewContainer;
1932 return false; 1932 return false;
1933 } 1933 }
1934 1934
1935 // If the fixed-position element does not have any scrollable ancestor
1936 // between it and its container, then we do not need to spend compositor
1937 // resources for it.
1938 bool noScrollableAncestor = true;
1939 if (m_renderView->frameView() && (m_renderView->frameView()->isScrollable()) )
trchen 2013/04/17 20:38:14 Do we have to check whether container is a transfo
shawnsingh 2013/04/17 20:57:36 That's exactly what the if-statement above this ne
trchen 2013/04/17 21:03:03 Hmm I didn't realize that transformed container ne
vangelis 2013/04/17 22:05:29 Actually that's not necessarily bad. If an element
1940 noScrollableAncestor = false;
1941
1942 RenderLayer* ancestor = layer->parent();
1943 while (ancestor && noScrollableAncestor) {
trchen 2013/04/17 20:38:14 nits: I prefer to use for loop: for (RenderLayer*
shawnsingh 2013/04/17 20:57:36 The for-loop version skips the case where ancestor
trchen 2013/04/17 21:03:03 Ah ha you're right. Got your point. :)
1944 if (ancestor->hasScrollbars())
vangelis 2013/04/17 19:53:15 I'm wondering whether ancestor->hasScrollbars() wi
shawnsingh 2013/04/17 20:15:57 I had empirically checked, with printf debugging o
trchen 2013/04/17 20:38:14 Shawn is right. RenderView itself, as a RenderBloc
vangelis 2013/04/17 22:05:29 Ah, ok!
1945 noScrollableAncestor = false;
1946 if (ancestor->renderer() == container)
1947 break;
1948 ancestor = ancestor->parent();
1949 }
1950
1951 if (noScrollableAncestor) {
1952 if (viewportConstrainedNotCompositedReason)
1953 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForUnscrollableAncestors;
1954 return false;
1955 }
1956
1935 // Subsequent tests depend on layout. If we can't tell now, just keep things the way they are until layout is done. 1957 // Subsequent tests depend on layout. If we can't tell now, just keep things the way they are until layout is done.
1936 if (!m_inPostLayoutUpdate) { 1958 if (!m_inPostLayoutUpdate) {
1937 m_reevaluateCompositingAfterLayout = true; 1959 m_reevaluateCompositingAfterLayout = true;
1938 return layer->isComposited(); 1960 return layer->isComposited();
1939 } 1961 }
1940 1962
1941 bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescend ant(); 1963 bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescend ant();
1942 if (!paintsContent) { 1964 if (!paintsContent) {
1943 if (viewportConstrainedNotCompositedReason) 1965 if (viewportConstrainedNotCompositedReason)
1944 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForNoVisibleContent; 1966 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForNoVisibleContent;
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
2778 info.addMember(m_layerForOverhangAreas, "layerForOverhangAreas"); 2800 info.addMember(m_layerForOverhangAreas, "layerForOverhangAreas");
2779 info.addMember(m_contentShadowLayer, "contentShadowLayer"); 2801 info.addMember(m_contentShadowLayer, "contentShadowLayer");
2780 info.addMember(m_layerForTopOverhangArea, "layerForTopOverhangArea"); 2802 info.addMember(m_layerForTopOverhangArea, "layerForTopOverhangArea");
2781 info.addMember(m_layerForBottomOverhangArea, "layerForBottomOverhangArea"); 2803 info.addMember(m_layerForBottomOverhangArea, "layerForBottomOverhangArea");
2782 info.addMember(m_layerForHeader, "layerForHeader"); 2804 info.addMember(m_layerForHeader, "layerForHeader");
2783 info.addMember(m_layerForFooter, "layerForFooter"); 2805 info.addMember(m_layerForFooter, "layerForFooter");
2784 #endif 2806 #endif
2785 } 2807 }
2786 2808
2787 } // namespace WebCore 2809 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/rendering/RenderLayer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698