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

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

Issue 747903005: Pass integer scroll position to CC if frameView has non-layered viewport constrained objects (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: call updateDescendantDependentFlags() before calling hasVisibleContent() otherwise it crashes Created 6 years 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) 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 setupScrollbarLayer(scrollbarGraphicsLayer, scrollbarLayer, scrollLayer, containerLayer); 348 setupScrollbarLayer(scrollbarGraphicsLayer, scrollbarLayer, scrollLayer, containerLayer);
349 349
350 // Root layer non-overlay scrollbars should be marked opaque to disable 350 // Root layer non-overlay scrollbars should be marked opaque to disable
351 // blending. 351 // blending.
352 bool isOpaqueScrollbar = !scrollbar->isOverlayScrollbar(); 352 bool isOpaqueScrollbar = !scrollbar->isOverlayScrollbar();
353 scrollbarGraphicsLayer->setContentsOpaque(isMainFrame && isOpaqueScrollb ar); 353 scrollbarGraphicsLayer->setContentsOpaque(isMainFrame && isOpaqueScrollb ar);
354 } else 354 } else
355 removeWebScrollbarLayer(scrollableArea, orientation); 355 removeWebScrollbarLayer(scrollableArea, orientation);
356 } 356 }
357 357
358 bool ScrollingCoordinator::scrollableAreaScrollLayerDidChange(ScrollableArea* sc rollableArea) 358 bool ScrollingCoordinator::scrollableAreaScrollLayerDidChange(ScrollableArea* sc rollableArea, bool hasVisibleViewportConstrainedObjects)
359 { 359 {
360 GraphicsLayer* scrollLayer = scrollableArea->layerForScrolling(); 360 GraphicsLayer* scrollLayer = scrollableArea->layerForScrolling();
361 361
362 if (scrollLayer) { 362 if (scrollLayer) {
363 ASSERT(m_page); 363 ASSERT(m_page);
364 scrollLayer->setScrollableArea(scrollableArea, isForViewport(scrollableA rea)); 364 scrollLayer->setScrollableArea(scrollableArea, isForViewport(scrollableA rea));
365 } 365 }
366 366
367 WebLayer* webLayer = toWebLayer(scrollableArea->layerForScrolling()); 367 WebLayer* webLayer = toWebLayer(scrollableArea->layerForScrolling());
368 WebLayer* containerLayer = toWebLayer(scrollableArea->layerForContainer()); 368 WebLayer* containerLayer = toWebLayer(scrollableArea->layerForContainer());
369 if (webLayer) { 369 if (webLayer) {
370 webLayer->setScrollClipLayer(containerLayer); 370 webLayer->setScrollClipLayer(containerLayer);
371 webLayer->setScrollPositionDouble(DoublePoint(scrollableArea->scrollPosi tionDouble() - scrollableArea->minimumScrollPosition())); 371 // Viewport constrained objects, e.g. fixed position elements, are
372 // positioned in Blink using integer coordinates. In that case, we
373 // don't want to set the WebLayer's scroll position at fractional
374 // precision otherwise the WebLayer's position after snapping to
375 // device pixel can be off with regard to fixed position elements.
376 // FIXME: fixed position elements which have their own compositing
377 // layer can actually be positioned at device pixel boundary in
378 // chromium compositor, so this should really be conditioned on
379 // non-composited fixed position elements. crbug.com/414283.
380 if (hasVisibleViewportConstrainedObjects) {
Rick Byers 2014/12/05 19:01:41 Rather than taking this bit in from our caller (wh
381 webLayer->setScrollPositionDouble(DoublePoint(scrollableArea->scroll Position() - scrollableArea->minimumScrollPosition()));
382 } else {
383 webLayer->setScrollPositionDouble(DoublePoint(scrollableArea->scroll PositionDouble() - scrollableArea->minimumScrollPosition()));
384 }
372 webLayer->setBounds(scrollableArea->contentsSize()); 385 webLayer->setBounds(scrollableArea->contentsSize());
373 bool canScrollX = scrollableArea->userInputScrollable(HorizontalScrollba r); 386 bool canScrollX = scrollableArea->userInputScrollable(HorizontalScrollba r);
374 bool canScrollY = scrollableArea->userInputScrollable(VerticalScrollbar) ; 387 bool canScrollY = scrollableArea->userInputScrollable(VerticalScrollbar) ;
375 webLayer->setUserScrollable(canScrollX, canScrollY); 388 webLayer->setUserScrollable(canScrollX, canScrollY);
376 } 389 }
377 if (WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea, HorizontalScrollbar)) { 390 if (WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea, HorizontalScrollbar)) {
378 GraphicsLayer* horizontalScrollbarLayer = scrollableArea->layerForHorizo ntalScrollbar(); 391 GraphicsLayer* horizontalScrollbarLayer = scrollableArea->layerForHorizo ntalScrollbar();
379 if (horizontalScrollbarLayer) 392 if (horizontalScrollbarLayer)
380 setupScrollbarLayer(horizontalScrollbarLayer, scrollbarLayer, webLay er, containerLayer); 393 setupScrollbarLayer(horizontalScrollbarLayer, scrollbarLayer, webLay er, containerLayer);
381 } 394 }
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 bool frameIsScrollable = frameView && frameView->isScrollable(); 1005 bool frameIsScrollable = frameView && frameView->isScrollable();
993 if (frameIsScrollable != m_wasFrameScrollable) 1006 if (frameIsScrollable != m_wasFrameScrollable)
994 return true; 1007 return true;
995 1008
996 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : nullptr) 1009 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : nullptr)
997 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( ); 1010 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( );
998 return false; 1011 return false;
999 } 1012 }
1000 1013
1001 } // namespace blink 1014 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/page/scrolling/ScrollingCoordinator.h ('k') | Source/core/rendering/compositing/RenderLayerCompositor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698