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

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 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 1906 matching lines...) Expand 10 before | Expand all | Expand 10 after
1917 } 1917 }
1918 1918
1919 // Don't promote fixed position elements that are descendants of a non-view container, e.g. transformed elements. 1919 // Don't promote fixed position elements that are descendants of a non-view container, e.g. transformed elements.
1920 // They will stay fixed wrt the container rather than the enclosing frame. 1920 // They will stay fixed wrt the container rather than the enclosing frame.
1921 if (container != m_renderView) { 1921 if (container != m_renderView) {
1922 if (viewportConstrainedNotCompositedReason) 1922 if (viewportConstrainedNotCompositedReason)
1923 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForNonViewContainer; 1923 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForNonViewContainer;
1924 return false; 1924 return false;
1925 } 1925 }
1926 1926
1927 // If the fixed-position element does not have any scrollable ancestor betwe en it and
1928 // its container, then we do not need to spend compositor resources for it. Start by
1929 // assuming we can opt-out (i.e. no scrollable ancestor), and refine the ans wer below.
1930 bool noScrollableAncestor = true;
enne (OOO) 2013/04/30 01:51:35 style nit: bools are always easier to understand w
1931
1932 // The FrameView has the scrollbars associated with the top level viewport, so we have to
enne (OOO) 2013/04/30 01:51:35 I'm not sure what you mean by "top level" here. T
1933 // check the FrameView in addition to the hierarchy of ancestors.
1934 if (m_renderView->frameView() && (m_renderView->frameView()->isScrollable()) )
1935 noScrollableAncestor = false;
enne (OOO) 2013/04/30 01:51:35 I don't quite understand how you can set this to f
shawnsingh 2013/04/30 20:53:51 Setting it to false means that we should still com
1936
1937 RenderLayer* ancestor = layer->parent();
Tom Hudson 2013/04/29 14:50:24 Naive question: this function assumes layer is non
shawnsingh 2013/04/29 15:57:13 It's a "reasonable assumption" that it will not be
1938 while (ancestor && noScrollableAncestor) {
1939 if (ancestor->hasScrollbars())
Ian Vollick 2013/04/30 00:22:22 I believe the check is frameView->containsScrollab
1940 noScrollableAncestor = false;
1941 if (ancestor->renderer() == container)
enne (OOO) 2013/04/30 01:51:35 I think it would be clearer to call container m_re
1942 break;
1943 ancestor = ancestor->parent();
1944 }
1945
1946 if (noScrollableAncestor) {
1947 if (viewportConstrainedNotCompositedReason)
1948 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForUnscrollableAncestors;
1949 return false;
1950 }
1951
1927 // Subsequent tests depend on layout. If we can't tell now, just keep things the way they are until layout is done. 1952 // Subsequent tests depend on layout. If we can't tell now, just keep things the way they are until layout is done.
1928 if (!m_inPostLayoutUpdate) { 1953 if (!m_inPostLayoutUpdate) {
1929 m_reevaluateCompositingAfterLayout = true; 1954 m_reevaluateCompositingAfterLayout = true;
1930 return layer->isComposited(); 1955 return layer->isComposited();
1931 } 1956 }
1932 1957
1933 bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescend ant(); 1958 bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescend ant();
1934 if (!paintsContent) { 1959 if (!paintsContent) {
1935 if (viewportConstrainedNotCompositedReason) 1960 if (viewportConstrainedNotCompositedReason)
1936 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForNoVisibleContent; 1961 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForNoVisibleContent;
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
2716 info.addMember(m_layerForScrollCorner, "layerForScrollCorner"); 2741 info.addMember(m_layerForScrollCorner, "layerForScrollCorner");
2717 #if ENABLE(RUBBER_BANDING) 2742 #if ENABLE(RUBBER_BANDING)
2718 info.addMember(m_layerForOverhangAreas, "layerForOverhangAreas"); 2743 info.addMember(m_layerForOverhangAreas, "layerForOverhangAreas");
2719 info.addMember(m_contentShadowLayer, "contentShadowLayer"); 2744 info.addMember(m_contentShadowLayer, "contentShadowLayer");
2720 info.addMember(m_layerForTopOverhangArea, "layerForTopOverhangArea"); 2745 info.addMember(m_layerForTopOverhangArea, "layerForTopOverhangArea");
2721 info.addMember(m_layerForBottomOverhangArea, "layerForBottomOverhangArea"); 2746 info.addMember(m_layerForBottomOverhangArea, "layerForBottomOverhangArea");
2722 #endif 2747 #endif
2723 } 2748 }
2724 2749
2725 } // namespace WebCore 2750 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698