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

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: Rebased and addressed reviewers older comments 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
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 (container == m_renderView && m_renderView->frameView() && (m_renderView- >frameView()->isScrollable()))
vangelis 2013/04/16 06:54:23 Because of the code right above, we're guaranteed
shawnsingh 2013/04/16 20:20:06 Oops - forgot to remove this based on your previou
1940 noScrollableAncestor = false;
vangelis 2013/04/16 06:54:23 Should you set the value of viewportConstrainedNot
shawnsingh 2013/04/16 20:20:06 Thanks for catching this - will do it.
1941
1942 RenderLayer* ancestor = layer->parent();
1943 while (ancestor && noScrollableAncestor) {
1944 if (ancestor->hasHorizontalScrollbar() || ancestor->hasVerticalScrollbar ())
vangelis 2013/04/16 06:54:23 Since you know you need to iterate until you get b
trchen 2013/04/16 19:36:21 I have the same concern. For historical reason we
shawnsingh 2013/04/16 20:20:06 I don't think we can eliminate those lines of code
1945 noScrollableAncestor = false;
1946 if (ancestor->renderer() == container)
1947 break;
1948 ancestor = ancestor->parent();
1949 }
1950
1951 if (noScrollableAncestor)
1952 return false;
1953
1935 // Subsequent tests depend on layout. If we can't tell now, just keep things the way they are until layout is done. 1954 // 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) { 1955 if (!m_inPostLayoutUpdate) {
1937 m_reevaluateCompositingAfterLayout = true; 1956 m_reevaluateCompositingAfterLayout = true;
1938 return layer->isComposited(); 1957 return layer->isComposited();
1939 } 1958 }
1940 1959
1941 bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescend ant(); 1960 bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescend ant();
1942 if (!paintsContent) { 1961 if (!paintsContent) {
1943 if (viewportConstrainedNotCompositedReason) 1962 if (viewportConstrainedNotCompositedReason)
1944 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForNoVisibleContent; 1963 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForNoVisibleContent;
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
2778 info.addMember(m_layerForOverhangAreas, "layerForOverhangAreas"); 2797 info.addMember(m_layerForOverhangAreas, "layerForOverhangAreas");
2779 info.addMember(m_contentShadowLayer, "contentShadowLayer"); 2798 info.addMember(m_contentShadowLayer, "contentShadowLayer");
2780 info.addMember(m_layerForTopOverhangArea, "layerForTopOverhangArea"); 2799 info.addMember(m_layerForTopOverhangArea, "layerForTopOverhangArea");
2781 info.addMember(m_layerForBottomOverhangArea, "layerForBottomOverhangArea"); 2800 info.addMember(m_layerForBottomOverhangArea, "layerForBottomOverhangArea");
2782 info.addMember(m_layerForHeader, "layerForHeader"); 2801 info.addMember(m_layerForHeader, "layerForHeader");
2783 info.addMember(m_layerForFooter, "layerForFooter"); 2802 info.addMember(m_layerForFooter, "layerForFooter");
2784 #endif 2803 #endif
2785 } 2804 }
2786 2805
2787 } // namespace WebCore 2806 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/virtual/softwarecompositing/layer-creation/fixed-position-change-out-of-view-in-view-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698