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

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

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: Fix README.md 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 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 // WebViewImpl explicitly rather than via GraphicsLayer::didScroll since it 1110 // WebViewImpl explicitly rather than via GraphicsLayer::didScroll since it
1111 // needs to be set in tandem with the page scale delta. 1111 // needs to be set in tandem with the page scale delta.
1112 if (isVisualViewport) 1112 if (isVisualViewport)
1113 m_layer->layer()->setScrollClient(0); 1113 m_layer->layer()->setScrollClient(0);
1114 else 1114 else
1115 m_layer->layer()->setScrollClient(this); 1115 m_layer->layer()->setScrollClient(this);
1116 } 1116 }
1117 1117
1118 void GraphicsLayer::didScroll() { 1118 void GraphicsLayer::didScroll() {
1119 if (m_scrollableArea) { 1119 if (m_scrollableArea) {
1120 DoublePoint newPosition = 1120 ScrollOffset newOffset =
1121 -m_scrollableArea->scrollOrigin() + 1121 toFloatSize(m_layer->layer()->scrollPositionDouble() -
1122 toDoubleSize(m_layer->layer()->scrollPositionDouble()); 1122 m_scrollableArea->scrollOrigin());
1123 1123
1124 // FrameView::setScrollPosition() doesn't work for compositor commits 1124 // FrameView::setScrollOffset() doesn't work for compositor commits
1125 // (interacts poorly with programmatic scroll animations) so we need to use 1125 // (interacts poorly with programmatic scroll animations) so we need to use
1126 // the ScrollableArea version. The FrameView method should go away soon 1126 // the ScrollableArea version. The FrameView method should go away soon
1127 // anyway. 1127 // anyway.
1128 m_scrollableArea->ScrollableArea::setScrollPosition(newPosition, 1128 m_scrollableArea->ScrollableArea::setScrollOffset(newOffset,
1129 CompositorScroll); 1129 CompositorScroll);
1130 } 1130 }
1131 } 1131 }
1132 1132
1133 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> 1133 std::unique_ptr<base::trace_event::ConvertableToTraceFormat>
1134 GraphicsLayer::TakeDebugInfo(cc::Layer* layer) { 1134 GraphicsLayer::TakeDebugInfo(cc::Layer* layer) {
1135 std::unique_ptr<base::trace_event::TracedValue> tracedValue( 1135 std::unique_ptr<base::trace_event::TracedValue> tracedValue(
1136 m_debugInfo.asTracedValue()); 1136 m_debugInfo.asTracedValue());
1137 tracedValue->SetString( 1137 tracedValue->SetString(
1138 "layer_name", WTF::StringUTF8Adaptor(debugName(layer)).asStringPiece()); 1138 "layer_name", WTF::StringUTF8Adaptor(debugName(layer)).asStringPiece());
1139 return std::move(tracedValue); 1139 return std::move(tracedValue);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) { 1275 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) {
1276 if (!layer) { 1276 if (!layer) {
1277 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); 1277 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n");
1278 return; 1278 return;
1279 } 1279 }
1280 1280
1281 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); 1281 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo);
1282 fprintf(stderr, "%s\n", output.utf8().data()); 1282 fprintf(stderr, "%s\n", output.utf8().data());
1283 } 1283 }
1284 #endif 1284 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698