| 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 } else | 345 } else |
| 346 removeWebScrollbarLayer(scrollableArea, orientation); | 346 removeWebScrollbarLayer(scrollableArea, orientation); |
| 347 } | 347 } |
| 348 | 348 |
| 349 bool ScrollingCoordinator::scrollableAreaScrollLayerDidChange(ScrollableArea* sc
rollableArea) | 349 bool ScrollingCoordinator::scrollableAreaScrollLayerDidChange(ScrollableArea* sc
rollableArea) |
| 350 { | 350 { |
| 351 GraphicsLayer* scrollLayer = scrollableArea->layerForScrolling(); | 351 GraphicsLayer* scrollLayer = scrollableArea->layerForScrolling(); |
| 352 | 352 |
| 353 if (scrollLayer) { | 353 if (scrollLayer) { |
| 354 ASSERT(m_page); | 354 ASSERT(m_page); |
| 355 // With pinch virtual viewport we no longer need to special case the mai
n frame. | 355 scrollLayer->setScrollableArea(scrollableArea, isForViewport(scrollableA
rea)); |
| 356 bool pinchVirtualViewportEnabled = m_page->settings().pinchVirtualViewpo
rtEnabled(); | |
| 357 bool layerScrollShouldFireGraphicsLayerDidScroll = isForMainFrame(scroll
ableArea) && !pinchVirtualViewportEnabled; | |
| 358 scrollLayer->setScrollableArea(scrollableArea, layerScrollShouldFireGrap
hicsLayerDidScroll); | |
| 359 } | 356 } |
| 360 | 357 |
| 361 WebLayer* webLayer = toWebLayer(scrollableArea->layerForScrolling()); | 358 WebLayer* webLayer = toWebLayer(scrollableArea->layerForScrolling()); |
| 362 WebLayer* containerLayer = toWebLayer(scrollableArea->layerForContainer()); | 359 WebLayer* containerLayer = toWebLayer(scrollableArea->layerForContainer()); |
| 363 if (webLayer) { | 360 if (webLayer) { |
| 364 webLayer->setScrollClipLayer(containerLayer); | 361 webLayer->setScrollClipLayer(containerLayer); |
| 365 webLayer->setScrollPosition(IntPoint(scrollableArea->scrollPosition() -
scrollableArea->minimumScrollPosition())); | 362 webLayer->setScrollPosition(IntPoint(scrollableArea->scrollPosition() -
scrollableArea->minimumScrollPosition())); |
| 366 webLayer->setBounds(scrollableArea->contentsSize()); | 363 webLayer->setBounds(scrollableArea->contentsSize()); |
| 367 bool canScrollX = scrollableArea->userInputScrollable(HorizontalScrollba
r); | 364 bool canScrollX = scrollableArea->userInputScrollable(HorizontalScrollba
r); |
| 368 bool canScrollY = scrollableArea->userInputScrollable(VerticalScrollbar)
; | 365 bool canScrollY = scrollableArea->userInputScrollable(VerticalScrollbar)
; |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 ASSERT(m_page); | 841 ASSERT(m_page); |
| 845 | 842 |
| 846 if (!coordinatesScrollingForFrameView(frameView)) | 843 if (!coordinatesScrollingForFrameView(frameView)) |
| 847 return; | 844 return; |
| 848 | 845 |
| 849 m_shouldScrollOnMainThreadDirty = true; | 846 m_shouldScrollOnMainThreadDirty = true; |
| 850 } | 847 } |
| 851 | 848 |
| 852 bool ScrollingCoordinator::isForMainFrame(ScrollableArea* scrollableArea) const | 849 bool ScrollingCoordinator::isForMainFrame(ScrollableArea* scrollableArea) const |
| 853 { | 850 { |
| 854 return m_page->mainFrame()->isLocalFrame() ? scrollableArea == m_page->depre
catedLocalMainFrame()->view() : false; | 851 if (!m_page->mainFrame()->isLocalFrame()) |
| 852 return false; |
| 853 |
| 854 return scrollableArea == m_page->deprecatedLocalMainFrame()->view(); |
| 855 } |
| 856 |
| 857 bool ScrollingCoordinator::isForViewport(ScrollableArea* scrollableArea) const |
| 858 { |
| 859 return isForMainFrame(scrollableArea) |
| 860 || scrollableArea == &m_page->frameHost().pinchViewport(); |
| 855 } | 861 } |
| 856 | 862 |
| 857 void ScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView) | 863 void ScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView) |
| 858 { | 864 { |
| 859 ASSERT(isMainThread()); | 865 ASSERT(isMainThread()); |
| 860 ASSERT(m_page); | 866 ASSERT(m_page); |
| 861 | 867 |
| 862 if (!coordinatesScrollingForFrameView(frameView)) | 868 if (!coordinatesScrollingForFrameView(frameView)) |
| 863 return; | 869 return; |
| 864 | 870 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 964 bool frameIsScrollable = frameView && frameView->isScrollable(); | 970 bool frameIsScrollable = frameView && frameView->isScrollable(); |
| 965 if (frameIsScrollable != m_wasFrameScrollable) | 971 if (frameIsScrollable != m_wasFrameScrollable) |
| 966 return true; | 972 return true; |
| 967 | 973 |
| 968 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : 0) | 974 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : 0) |
| 969 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); | 975 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); |
| 970 return false; | 976 return false; |
| 971 } | 977 } |
| 972 | 978 |
| 973 } // namespace blink | 979 } // namespace blink |
| OLD | NEW |