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

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

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: Created 4 years, 2 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 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 // WebViewImpl explicitly rather than via GraphicsLayer::didScroll since it 1171 // WebViewImpl explicitly rather than via GraphicsLayer::didScroll since it
1172 // needs to be set in tandem with the page scale delta. 1172 // needs to be set in tandem with the page scale delta.
1173 if (isVisualViewport) 1173 if (isVisualViewport)
1174 m_layer->layer()->setScrollClient(0); 1174 m_layer->layer()->setScrollClient(0);
1175 else 1175 else
1176 m_layer->layer()->setScrollClient(this); 1176 m_layer->layer()->setScrollClient(this);
1177 } 1177 }
1178 1178
1179 void GraphicsLayer::didScroll() { 1179 void GraphicsLayer::didScroll() {
1180 if (m_scrollableArea) { 1180 if (m_scrollableArea) {
1181 DoublePoint newPosition = 1181 ScrollOffset newOffset = toScrollOffset(-m_scrollableArea->scrollOrigin()) +
1182 -m_scrollableArea->scrollOrigin() + 1182 m_layer->layer()->scrollOffset();
1183 toDoubleSize(m_layer->layer()->scrollPositionDouble());
1184 1183
1185 // FrameView::setScrollPosition doesn't work for compositor commits (interac ts poorly with programmatic scroll animations) 1184 // FrameView::setScrollPosition doesn't work for compositor commits (interac ts poorly with programmatic scroll animations)
1186 // so we need to use the ScrollableArea version. The FrameView method should go away soon anyway. 1185 // so we need to use the ScrollableArea version. The FrameView method should go away soon anyway.
bokan 2016/10/02 19:47:51 Remove comment
szager1 2016/10/05 07:43:36 Done.
1187 m_scrollableArea->ScrollableArea::setScrollPosition(newPosition, 1186 m_scrollableArea->setScrollOffset(newOffset, CompositorScroll);
1188 CompositorScroll);
1189 } 1187 }
1190 } 1188 }
1191 1189
1192 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> 1190 std::unique_ptr<base::trace_event::ConvertableToTraceFormat>
1193 GraphicsLayer::TakeDebugInfo(cc::Layer* layer) { 1191 GraphicsLayer::TakeDebugInfo(cc::Layer* layer) {
1194 std::unique_ptr<base::trace_event::TracedValue> tracedValue( 1192 std::unique_ptr<base::trace_event::TracedValue> tracedValue(
1195 m_debugInfo.asTracedValue()); 1193 m_debugInfo.asTracedValue());
1196 tracedValue->SetString( 1194 tracedValue->SetString(
1197 "layer_name", WTF::StringUTF8Adaptor(debugName(layer)).asStringPiece()); 1195 "layer_name", WTF::StringUTF8Adaptor(debugName(layer)).asStringPiece());
1198 return std::move(tracedValue); 1196 return std::move(tracedValue);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) { 1330 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) {
1333 if (!layer) { 1331 if (!layer) {
1334 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); 1332 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n");
1335 return; 1333 return;
1336 } 1334 }
1337 1335
1338 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); 1336 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo);
1339 fprintf(stderr, "%s\n", output.utf8().data()); 1337 fprintf(stderr, "%s\n", output.utf8().data());
1340 } 1338 }
1341 #endif 1339 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698