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

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

Issue 18187004: Don't update graphics layer positions during coordinated scrolling (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Set define in core.gyp Created 7 years, 5 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/RenderLayerCompositor.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 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 } 1147 }
1148 1148
1149 void RenderLayerCompositor::frameViewDidScroll() 1149 void RenderLayerCompositor::frameViewDidScroll()
1150 { 1150 {
1151 FrameView* frameView = m_renderView->frameView(); 1151 FrameView* frameView = m_renderView->frameView();
1152 IntPoint scrollPosition = frameView->scrollPosition(); 1152 IntPoint scrollPosition = frameView->scrollPosition();
1153 1153
1154 if (!m_scrollLayer) 1154 if (!m_scrollLayer)
1155 return; 1155 return;
1156 1156
1157 // If there's a scrolling coordinator that manages scrolling for this frame view, 1157 bool scrollingCoordinatorHandlesOffset = false;
1158 // it will also manage updating the scroll layer position.
1159 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) { 1158 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) {
1160 if (Settings* settings = m_renderView->document()->settings()) { 1159 if (Settings* settings = m_renderView->document()->settings()) {
1161 if (isMainFrame() || settings->compositedScrollingForFramesEnabled() ) 1160 if (isMainFrame() || settings->compositedScrollingForFramesEnabled() )
1162 scrollingCoordinator->scrollableAreaScrollLayerDidChange(frameVi ew); 1161 scrollingCoordinatorHandlesOffset = scrollingCoordinator->scroll ableAreaScrollLayerDidChange(frameView);
1163 } 1162 }
1164 } 1163 }
1165 1164
1166 m_scrollLayer->setPosition(FloatPoint(-scrollPosition.x(), -scrollPosition.y ())); 1165 #ifndef BLINK_SCROLLING_POSITION_NO_OFFSET
1166 // FIXME: Remove when possible. Only required to stage multi-repo change.
1167 scrollingCoordinatorHandlesOffset = false;
1168 #endif
1169
1170 // Scroll position = scroll minimum + scroll offset. Adjust the layer's
1171 // position to handle whatever the scroll coordinator isn't handling.
1172 // The minimum scroll position is non-zero for RTL pages with overflow.
1173 if (scrollingCoordinatorHandlesOffset)
1174 m_scrollLayer->setPosition(-frameView->minimumScrollPosition());
1175 else
1176 m_scrollLayer->setPosition(-scrollPosition);
1167 } 1177 }
1168 1178
1169 void RenderLayerCompositor::frameViewDidLayout() 1179 void RenderLayerCompositor::frameViewDidLayout()
1170 { 1180 {
1171 } 1181 }
1172 1182
1173 void RenderLayerCompositor::rootFixedBackgroundsChanged() 1183 void RenderLayerCompositor::rootFixedBackgroundsChanged()
1174 { 1184 {
1175 if (!supportsFixedRootBackgroundCompositing()) 1185 if (!supportsFixedRootBackgroundCompositing())
1176 return; 1186 return;
1177 1187
1178 // To avoid having to make the fixed root background layer fixed positioned to 1188 // To avoid having to make the fixed root background layer fixed positioned to
1179 // stay put, we position it in the layer tree as follows: 1189 // stay put, we position it in the layer tree as follows:
1180 // 1190 //
1181 // + Overflow controls host 1191 // + Overflow controls host
1182 // + Frame clip 1192 // + Frame clip
1183 // + (Fixed root background) <-- Here. 1193 // + (Fixed root background) <-- Here.
1184 // + Frame scroll 1194 // + Frame scroll
1185 // + Root content layer 1195 // + Root content layer
1186 // + Scrollbars 1196 // + Scrollbars
1187 // 1197 //
1188 // That is, it needs to be the first child of the frame clip, the sibling of 1198 // That is, it needs to be the first child of the frame clip, the sibling of
1189 // the frame scroll layer. The compositor does not own the background layer, it 1199 // the frame scroll layer. The compositor does not own the background layer, it
1190 // just positions it (like the foreground layer). 1200 // just positions it (like the foreground layer).
1191 if (GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer()) 1201 if (GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer())
1192 m_clipLayer->addChildBelow(backgroundLayer, m_scrollLayer.get()); 1202 m_clipLayer->addChildBelow(backgroundLayer, m_scrollLayer.get());
1193 } 1203 }
1194 1204
1195 void RenderLayerCompositor::scrollingLayerDidChange(RenderLayer* layer) 1205 bool RenderLayerCompositor::scrollingLayerDidChange(RenderLayer* layer)
1196 { 1206 {
1197 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) 1207 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( ))
1198 scrollingCoordinator->scrollableAreaScrollLayerDidChange(layer); 1208 return scrollingCoordinator->scrollableAreaScrollLayerDidChange(layer);
1209 return false;
1199 } 1210 }
1200 1211
1201 String RenderLayerCompositor::layerTreeAsText(LayerTreeFlags flags) 1212 String RenderLayerCompositor::layerTreeAsText(LayerTreeFlags flags)
1202 { 1213 {
1203 updateCompositingLayers(CompositingUpdateAfterLayout); 1214 updateCompositingLayers(CompositingUpdateAfterLayout);
1204 1215
1205 if (!m_rootContentLayer) 1216 if (!m_rootContentLayer)
1206 return String(); 1217 return String();
1207 1218
1208 // We skip dumping the scroll and clip layers to keep layerTreeAsText output 1219 // We skip dumping the scroll and clip layers to keep layerTreeAsText output
(...skipping 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after
2731 info.addMember(m_layerForScrollCorner, "layerForScrollCorner"); 2742 info.addMember(m_layerForScrollCorner, "layerForScrollCorner");
2732 #if ENABLE(RUBBER_BANDING) 2743 #if ENABLE(RUBBER_BANDING)
2733 info.addMember(m_layerForOverhangAreas, "layerForOverhangAreas"); 2744 info.addMember(m_layerForOverhangAreas, "layerForOverhangAreas");
2734 info.addMember(m_contentShadowLayer, "contentShadowLayer"); 2745 info.addMember(m_contentShadowLayer, "contentShadowLayer");
2735 info.addMember(m_layerForTopOverhangArea, "layerForTopOverhangArea"); 2746 info.addMember(m_layerForTopOverhangArea, "layerForTopOverhangArea");
2736 info.addMember(m_layerForBottomOverhangArea, "layerForBottomOverhangArea"); 2747 info.addMember(m_layerForBottomOverhangArea, "layerForBottomOverhangArea");
2737 #endif 2748 #endif
2738 } 2749 }
2739 2750
2740 } // namespace WebCore 2751 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderLayerCompositor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698