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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp

Issue 2680953002: Remove GraphicsLayer::didScroll and directly call ScrollableArea::didScroll (Closed)
Patch Set: Incorporate reviewer comments: more tests, less bad tests Created 3 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 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 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 } 1145 }
1146 1146
1147 void GraphicsLayer::setScrollableArea(ScrollableArea* scrollableArea, 1147 void GraphicsLayer::setScrollableArea(ScrollableArea* scrollableArea,
1148 bool isVisualViewport) { 1148 bool isVisualViewport) {
1149 if (m_scrollableArea == scrollableArea) 1149 if (m_scrollableArea == scrollableArea)
1150 return; 1150 return;
1151 1151
1152 m_scrollableArea = scrollableArea; 1152 m_scrollableArea = scrollableArea;
1153 1153
1154 // VisualViewport scrolling may involve pinch zoom and gets routed through 1154 // VisualViewport scrolling may involve pinch zoom and gets routed through
1155 // WebViewImpl explicitly rather than via GraphicsLayer::didScroll since it 1155 // WebViewImpl explicitly rather than via ScrollableArea::didScroll since it
1156 // needs to be set in tandem with the page scale delta. 1156 // needs to be set in tandem with the page scale delta.
1157 if (isVisualViewport) 1157 if (isVisualViewport)
1158 m_layer->layer()->setScrollClient(0); 1158 m_layer->layer()->setScrollClient(nullptr);
1159 else 1159 else
1160 m_layer->layer()->setScrollClient(this); 1160 m_layer->layer()->setScrollClient(scrollableArea);
1161 }
1162
1163 void GraphicsLayer::didScroll() {
1164 if (m_scrollableArea) {
1165 ScrollOffset newOffset =
1166 toFloatSize(m_layer->layer()->scrollPositionDouble() -
1167 m_scrollableArea->scrollOrigin());
1168 m_scrollableArea->setScrollOffset(newOffset, CompositorScroll);
1169 }
1170 } 1161 }
1171 1162
1172 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> 1163 std::unique_ptr<base::trace_event::ConvertableToTraceFormat>
1173 GraphicsLayer::TakeDebugInfo(cc::Layer* layer) { 1164 GraphicsLayer::TakeDebugInfo(cc::Layer* layer) {
1174 std::unique_ptr<base::trace_event::TracedValue> tracedValue( 1165 std::unique_ptr<base::trace_event::TracedValue> tracedValue(
1175 m_debugInfo.asTracedValue()); 1166 m_debugInfo.asTracedValue());
1176 tracedValue->SetString( 1167 tracedValue->SetString(
1177 "layer_name", WTF::StringUTF8Adaptor(debugName(layer)).asStringPiece()); 1168 "layer_name", WTF::StringUTF8Adaptor(debugName(layer)).asStringPiece());
1178 return std::move(tracedValue); 1169 return std::move(tracedValue);
1179 } 1170 }
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) { 1321 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) {
1331 if (!layer) { 1322 if (!layer) {
1332 LOG(INFO) << "Cannot showGraphicsLayerTree for (nil)."; 1323 LOG(INFO) << "Cannot showGraphicsLayerTree for (nil).";
1333 return; 1324 return;
1334 } 1325 }
1335 1326
1336 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); 1327 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo);
1337 LOG(INFO) << output.utf8().data(); 1328 LOG(INFO) << output.utf8().data();
1338 } 1329 }
1339 #endif 1330 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698