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

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: 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') | 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) 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 integer and fractional part of the scroll offset to CC
398 // separately to be clear that CC needs to take special care of the fractional
399 // part, e.g. compensating for fixed-position layer's position. Once Blink can
400 // fully position elements at fractional boundary, we can get rid of these separate
401 // calls.
402 DoublePoint scrollPosition(scrollableArea->scrollPositionDouble() - scrollableArea->minimumScrollPosition());
403 IntPoint flooredScrollPosition(flooredIntPoint(scrollPosition));
404 DoublePoint fractionalPart(scrollPosition.x() - flooredScrollPositio n.x(), scrollPosition.y() - flooredScrollPosition.y());
405 webLayer->setScrollPositionDouble(DoublePoint(flooredScrollPosition) );
aelias_OOO_until_Jul13 2015/01/28 22:31:34 Let's send the full nonfloored position here. The
Yufeng Shen (Slow to review) 2015/01/28 22:49:33 Done.
Rick Byers 2015/01/29 20:55:07 Just saw this - sorry. Maybe I just need an conci
406 webLayer->setScrollPositionFractionalPart(fractionalPart);
407 }
397 408
398 webLayer->setBounds(scrollableArea->contentsSize()); 409 webLayer->setBounds(scrollableArea->contentsSize());
399 bool canScrollX = scrollableArea->userInputScrollable(HorizontalScrollba r); 410 bool canScrollX = scrollableArea->userInputScrollable(HorizontalScrollba r);
400 bool canScrollY = scrollableArea->userInputScrollable(VerticalScrollbar) ; 411 bool canScrollY = scrollableArea->userInputScrollable(VerticalScrollbar) ;
401 webLayer->setUserScrollable(canScrollX, canScrollY); 412 webLayer->setUserScrollable(canScrollX, canScrollY);
402 } 413 }
403 if (WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea, HorizontalScrollbar)) { 414 if (WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea, HorizontalScrollbar)) {
404 GraphicsLayer* horizontalScrollbarLayer = scrollableArea->layerForHorizo ntalScrollbar(); 415 GraphicsLayer* horizontalScrollbarLayer = scrollableArea->layerForHorizo ntalScrollbar();
405 if (horizontalScrollbarLayer) 416 if (horizontalScrollbarLayer)
406 setupScrollbarLayer(horizontalScrollbarLayer, scrollbarLayer, webLay er, containerLayer); 417 setupScrollbarLayer(horizontalScrollbarLayer, scrollbarLayer, webLay er, containerLayer);
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 bool frameIsScrollable = frameView && frameView->isScrollable(); 1045 bool frameIsScrollable = frameView && frameView->isScrollable();
1035 if (frameIsScrollable != m_wasFrameScrollable) 1046 if (frameIsScrollable != m_wasFrameScrollable)
1036 return true; 1047 return true;
1037 1048
1038 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : nullptr) 1049 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : nullptr)
1039 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( ); 1050 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( );
1040 return false; 1051 return false;
1041 } 1052 }
1042 1053
1043 } // namespace blink 1054 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | public/platform/WebLayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698