OLD | NEW |
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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // Non-layered Viewport constrained objects, e.g. fixed position element
s, are |
| 372 // positioned in Blink using integer coordinates. In that case, we don't
want |
| 373 // to set the WebLayer's scroll position at fractional precision otherwi
se the |
| 374 // WebLayer's position after snapping to device pixel can be off with re
gard to |
| 375 // fixed position elements. |
| 376 if (m_lastMainThreadScrollingReasons & ScrollingCoordinator::HasNonLayer
ViewportConstrainedObjects) |
| 377 webLayer->setScrollPositionDouble(DoublePoint(scrollableArea->scroll
Position() - scrollableArea->minimumScrollPosition())); |
| 378 else |
| 379 webLayer->setScrollPositionDouble(DoublePoint(scrollableArea->scroll
PositionDouble() - scrollableArea->minimumScrollPosition())); |
| 380 |
372 webLayer->setBounds(scrollableArea->contentsSize()); | 381 webLayer->setBounds(scrollableArea->contentsSize()); |
373 bool canScrollX = scrollableArea->userInputScrollable(HorizontalScrollba
r); | 382 bool canScrollX = scrollableArea->userInputScrollable(HorizontalScrollba
r); |
374 bool canScrollY = scrollableArea->userInputScrollable(VerticalScrollbar)
; | 383 bool canScrollY = scrollableArea->userInputScrollable(VerticalScrollbar)
; |
375 webLayer->setUserScrollable(canScrollX, canScrollY); | 384 webLayer->setUserScrollable(canScrollX, canScrollY); |
376 } | 385 } |
377 if (WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea,
HorizontalScrollbar)) { | 386 if (WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea,
HorizontalScrollbar)) { |
378 GraphicsLayer* horizontalScrollbarLayer = scrollableArea->layerForHorizo
ntalScrollbar(); | 387 GraphicsLayer* horizontalScrollbarLayer = scrollableArea->layerForHorizo
ntalScrollbar(); |
379 if (horizontalScrollbarLayer) | 388 if (horizontalScrollbarLayer) |
380 setupScrollbarLayer(horizontalScrollbarLayer, scrollbarLayer, webLay
er, containerLayer); | 389 setupScrollbarLayer(horizontalScrollbarLayer, scrollbarLayer, webLay
er, containerLayer); |
381 } | 390 } |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 for (const auto& scrollbar : m_horizontalScrollbars) | 545 for (const auto& scrollbar : m_horizontalScrollbars) |
537 GraphicsLayer::unregisterContentsLayer(scrollbar.value->layer()); | 546 GraphicsLayer::unregisterContentsLayer(scrollbar.value->layer()); |
538 for (const auto& scrollbar : m_verticalScrollbars) | 547 for (const auto& scrollbar : m_verticalScrollbars) |
539 GraphicsLayer::unregisterContentsLayer(scrollbar.value->layer()); | 548 GraphicsLayer::unregisterContentsLayer(scrollbar.value->layer()); |
540 | 549 |
541 m_horizontalScrollbars.clear(); | 550 m_horizontalScrollbars.clear(); |
542 m_verticalScrollbars.clear(); | 551 m_verticalScrollbars.clear(); |
543 m_layersWithTouchRects.clear(); | 552 m_layersWithTouchRects.clear(); |
544 m_wasFrameScrollable = false; | 553 m_wasFrameScrollable = false; |
545 | 554 |
546 // This is retained for testing. | |
547 m_lastMainThreadScrollingReasons = 0; | 555 m_lastMainThreadScrollingReasons = 0; |
548 setShouldUpdateScrollLayerPositionOnMainThread(m_lastMainThreadScrollingReas
ons); | 556 setShouldUpdateScrollLayerPositionOnMainThread(m_lastMainThreadScrollingReas
ons); |
549 } | 557 } |
550 | 558 |
551 // Note that in principle this could be called more often than computeTouchEvent
TargetRects, for | 559 // Note that in principle this could be called more often than computeTouchEvent
TargetRects, for |
552 // example during a non-composited scroll (although that's not yet implemented -
crbug.com/261307). | 560 // example during a non-composited scroll (although that's not yet implemented -
crbug.com/261307). |
553 void ScrollingCoordinator::setTouchEventTargetRects(LayerHitTestRects& layerRect
s) | 561 void ScrollingCoordinator::setTouchEventTargetRects(LayerHitTestRects& layerRect
s) |
554 { | 562 { |
555 TRACE_EVENT0("input", "ScrollingCoordinator::setTouchEventTargetRects"); | 563 TRACE_EVENT0("input", "ScrollingCoordinator::setTouchEventTargetRects"); |
556 | 564 |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 bool frameIsScrollable = frameView && frameView->isScrollable(); | 998 bool frameIsScrollable = frameView && frameView->isScrollable(); |
991 if (frameIsScrollable != m_wasFrameScrollable) | 999 if (frameIsScrollable != m_wasFrameScrollable) |
992 return true; | 1000 return true; |
993 | 1001 |
994 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : nullptr) | 1002 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : nullptr) |
995 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); | 1003 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); |
996 return false; | 1004 return false; |
997 } | 1005 } |
998 | 1006 |
999 } // namespace blink | 1007 } // namespace blink |
OLD | NEW |