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

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

Issue 2730573003: Moved FrameHost::m_visualViewport to Page (Closed)
Patch Set: Fixed some compile errors on mac and android Created 3 years, 9 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
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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) 228 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled())
229 layoutViewportScrollLayer->setBounds(frameView->contentsSize()); 229 layoutViewportScrollLayer->setBounds(frameView->contentsSize());
230 230
231 // If there is a non-root fullscreen element, prevent the viewport from 231 // If there is a non-root fullscreen element, prevent the viewport from
232 // scrolling. 232 // scrolling.
233 Document* mainFrameDocument = 233 Document* mainFrameDocument =
234 m_page->deprecatedLocalMainFrame()->document(); 234 m_page->deprecatedLocalMainFrame()->document();
235 Element* fullscreenElement = 235 Element* fullscreenElement =
236 Fullscreen::fullscreenElementFrom(*mainFrameDocument); 236 Fullscreen::fullscreenElementFrom(*mainFrameDocument);
237 WebLayer* visualViewportScrollLayer = 237 WebLayer* visualViewportScrollLayer =
238 toWebLayer(m_page->frameHost().visualViewport().scrollLayer()); 238 toWebLayer(m_page->visualViewport().scrollLayer());
239 239
240 if (visualViewportScrollLayer) { 240 if (visualViewportScrollLayer) {
241 if (fullscreenElement && 241 if (fullscreenElement &&
242 fullscreenElement != mainFrameDocument->documentElement()) 242 fullscreenElement != mainFrameDocument->documentElement())
243 visualViewportScrollLayer->setUserScrollable(false, false); 243 visualViewportScrollLayer->setUserScrollable(false, false);
244 else 244 else
245 visualViewportScrollLayer->setUserScrollable(true, true); 245 visualViewportScrollLayer->setUserScrollable(true, true);
246 } 246 }
247 247
248 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { 248 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 } 478 }
479 479
480 bool ScrollingCoordinator::scrollableAreaScrollLayerDidChange( 480 bool ScrollingCoordinator::scrollableAreaScrollLayerDidChange(
481 ScrollableArea* scrollableArea) { 481 ScrollableArea* scrollableArea) {
482 if (!m_page || !m_page->mainFrame()) 482 if (!m_page || !m_page->mainFrame())
483 return false; 483 return false;
484 484
485 GraphicsLayer* scrollLayer = scrollableArea->layerForScrolling(); 485 GraphicsLayer* scrollLayer = scrollableArea->layerForScrolling();
486 486
487 if (scrollLayer) { 487 if (scrollLayer) {
488 bool isForVisualViewport = 488 bool isForVisualViewport = scrollableArea == &m_page->visualViewport();
489 scrollableArea == &m_page->frameHost().visualViewport();
490 scrollLayer->setScrollableArea(scrollableArea, isForVisualViewport); 489 scrollLayer->setScrollableArea(scrollableArea, isForVisualViewport);
491 } 490 }
492 491
493 WebLayer* webLayer = toWebLayer(scrollableArea->layerForScrolling()); 492 WebLayer* webLayer = toWebLayer(scrollableArea->layerForScrolling());
494 WebLayer* containerLayer = toWebLayer(scrollableArea->layerForContainer()); 493 WebLayer* containerLayer = toWebLayer(scrollableArea->layerForContainer());
495 if (webLayer) { 494 if (webLayer) {
496 webLayer->setScrollClipLayer(containerLayer); 495 webLayer->setScrollClipLayer(containerLayer);
497 FloatPoint scrollPosition(scrollableArea->scrollOrigin() + 496 FloatPoint scrollPosition(scrollableArea->scrollOrigin() +
498 scrollableArea->getScrollOffset()); 497 scrollableArea->getScrollOffset());
499 webLayer->setScrollPosition(scrollPosition); 498 webLayer->setScrollPosition(scrollPosition);
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 void ScrollingCoordinator::willDestroyLayer(PaintLayer* layer) { 832 void ScrollingCoordinator::willDestroyLayer(PaintLayer* layer) {
834 m_layersWithTouchRects.erase(layer); 833 m_layersWithTouchRects.erase(layer);
835 } 834 }
836 835
837 void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread( 836 void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(
838 MainThreadScrollingReasons mainThreadScrollingReasons) { 837 MainThreadScrollingReasons mainThreadScrollingReasons) {
839 if (!m_page->mainFrame()->isLocalFrame() || 838 if (!m_page->mainFrame()->isLocalFrame() ||
840 !m_page->deprecatedLocalMainFrame()->view()) 839 !m_page->deprecatedLocalMainFrame()->view())
841 return; 840 return;
842 841
843 GraphicsLayer* visualViewportLayer = 842 GraphicsLayer* visualViewportLayer = m_page->visualViewport().scrollLayer();
844 m_page->frameHost().visualViewport().scrollLayer();
845 WebLayer* visualViewportScrollLayer = toWebLayer(visualViewportLayer); 843 WebLayer* visualViewportScrollLayer = toWebLayer(visualViewportLayer);
846 GraphicsLayer* layer = m_page->deprecatedLocalMainFrame() 844 GraphicsLayer* layer = m_page->deprecatedLocalMainFrame()
847 ->view() 845 ->view()
848 ->layoutViewportScrollableArea() 846 ->layoutViewportScrollableArea()
849 ->layerForScrolling(); 847 ->layerForScrolling();
850 if (WebLayer* scrollLayer = toWebLayer(layer)) { 848 if (WebLayer* scrollLayer = toWebLayer(layer)) {
851 m_lastMainThreadScrollingReasons = mainThreadScrollingReasons; 849 m_lastMainThreadScrollingReasons = mainThreadScrollingReasons;
852 if (mainThreadScrollingReasons) { 850 if (mainThreadScrollingReasons) {
853 ScrollableArea* scrollableArea = layer->getScrollableArea(); 851 ScrollableArea* scrollableArea = layer->getScrollableArea();
854 if (scrollableArea) { 852 if (scrollableArea) {
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 frameView ? toWebLayer(frameView->layoutViewportScrollableArea() 1193 frameView ? toWebLayer(frameView->layoutViewportScrollableArea()
1196 ->layerForScrolling()) 1194 ->layerForScrolling())
1197 : nullptr) { 1195 : nullptr) {
1198 return WebSize(frameView->layoutViewportScrollableArea()->contentsSize()) != 1196 return WebSize(frameView->layoutViewportScrollableArea()->contentsSize()) !=
1199 scrollLayer->bounds(); 1197 scrollLayer->bounds();
1200 } 1198 }
1201 return false; 1199 return false;
1202 } 1200 }
1203 1201
1204 } // namespace blink 1202 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698