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

Side by Side Diff: Source/core/page/scrolling/ScrollingCoordinator.cpp

Issue 889453002: Add a WebLayer:setScrollCompensationAdjustment between Blink and CC (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: address comments Created 5 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
« no previous file with comments | « no previous file | public/platform/WebLayer.h » ('j') | public/platform/WebLayer.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 383
384 WebLayer* webLayer = toWebLayer(scrollableArea->layerForScrolling()); 384 WebLayer* webLayer = toWebLayer(scrollableArea->layerForScrolling());
385 WebLayer* containerLayer = toWebLayer(scrollableArea->layerForContainer()); 385 WebLayer* containerLayer = toWebLayer(scrollableArea->layerForContainer());
386 if (webLayer) { 386 if (webLayer) {
387 webLayer->setScrollClipLayer(containerLayer); 387 webLayer->setScrollClipLayer(containerLayer);
388 // Non-layered Viewport constrained objects, e.g. fixed position element s, are 388 // Non-layered Viewport constrained objects, e.g. fixed position element s, are
389 // positioned in Blink using integer coordinates. In that case, we don't want 389 // positioned in Blink using integer coordinates. In that case, we don't want
390 // to set the WebLayer's scroll position at fractional precision otherwi se the 390 // to set the WebLayer's scroll position at fractional precision otherwi se the
391 // WebLayer's position after snapping to device pixel can be off with re gard to 391 // WebLayer's position after snapping to device pixel can be off with re gard to
392 // fixed position elements. 392 // fixed position elements.
393 if (m_lastMainThreadScrollingReasons & ScrollingCoordinator::HasNonLayer ViewportConstrainedObjects) 393 if (m_lastMainThreadScrollingReasons & ScrollingCoordinator::HasNonLayer ViewportConstrainedObjects) {
394 webLayer->setScrollPositionDouble(DoublePoint(scrollableArea->scroll Position() - scrollableArea->minimumScrollPosition())); 394 webLayer->setScrollPositionDouble(DoublePoint(scrollableArea->scroll Position() - scrollableArea->minimumScrollPosition()));
395 else 395 } else {
396 webLayer->setScrollPositionDouble(DoublePoint(scrollableArea->scroll PositionDouble() - scrollableArea->minimumScrollPosition())); 396 // Blink can only use the integer part of the scroll offset to posit ion elements.
397 // So it sends the fractional part of the scroll offset to CC separa tely to be
398 // clear that CC needs to take special care of the fractional part, e.g.
399 // compensating for fixed-position layer's position. Once Blink can fully position
400 // elements at fractional boundary, we can get rid of this call.
401 DoublePoint scrollPosition(scrollableArea->scrollPositionDouble() - scrollableArea->minimumScrollPosition());
402 IntPoint flooredScrollPosition(flooredIntPoint(scrollPosition));
403 DoublePoint fractionalPart(scrollPosition.x() - flooredScrollPositio n.x(), scrollPosition.y() - flooredScrollPosition.y());
404 webLayer->setScrollPositionDouble(scrollPosition);
Rick Byers 2015/01/29 20:53:13 You don't want flooredScrollPosition here? If the
405 webLayer->setScrollPositionFractionalPart(fractionalPart);
406 }
397 407
398 webLayer->setBounds(scrollableArea->contentsSize()); 408 webLayer->setBounds(scrollableArea->contentsSize());
399 bool canScrollX = scrollableArea->userInputScrollable(HorizontalScrollba r); 409 bool canScrollX = scrollableArea->userInputScrollable(HorizontalScrollba r);
400 bool canScrollY = scrollableArea->userInputScrollable(VerticalScrollbar) ; 410 bool canScrollY = scrollableArea->userInputScrollable(VerticalScrollbar) ;
401 webLayer->setUserScrollable(canScrollX, canScrollY); 411 webLayer->setUserScrollable(canScrollX, canScrollY);
402 } 412 }
403 if (WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea, HorizontalScrollbar)) { 413 if (WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea, HorizontalScrollbar)) {
404 GraphicsLayer* horizontalScrollbarLayer = scrollableArea->layerForHorizo ntalScrollbar(); 414 GraphicsLayer* horizontalScrollbarLayer = scrollableArea->layerForHorizo ntalScrollbar();
405 if (horizontalScrollbarLayer) 415 if (horizontalScrollbarLayer)
406 setupScrollbarLayer(horizontalScrollbarLayer, scrollbarLayer, webLay er, containerLayer); 416 setupScrollbarLayer(horizontalScrollbarLayer, scrollbarLayer, webLay er, containerLayer);
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 bool frameIsScrollable = frameView && frameView->isScrollable(); 1044 bool frameIsScrollable = frameView && frameView->isScrollable();
1035 if (frameIsScrollable != m_wasFrameScrollable) 1045 if (frameIsScrollable != m_wasFrameScrollable)
1036 return true; 1046 return true;
1037 1047
1038 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : nullptr) 1048 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : nullptr)
1039 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( ); 1049 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( );
1040 return false; 1050 return false;
1041 } 1051 }
1042 1052
1043 } // namespace blink 1053 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | public/platform/WebLayer.h » ('j') | public/platform/WebLayer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698