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

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

Issue 558813003: Disable scrolling for fullscreen elements by changing scroll layer size. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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 | Source/web/tests/WebFrameTest.cpp » ('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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 bool frameIsScrollable = frameView && frameView->isScrollable(); 151 bool frameIsScrollable = frameView && frameView->isScrollable();
152 if (m_shouldScrollOnMainThreadDirty || m_wasFrameScrollable != frameIsScroll able) { 152 if (m_shouldScrollOnMainThreadDirty || m_wasFrameScrollable != frameIsScroll able) {
153 setShouldUpdateScrollLayerPositionOnMainThread(mainThreadScrollingReason s()); 153 setShouldUpdateScrollLayerPositionOnMainThread(mainThreadScrollingReason s());
154 m_shouldScrollOnMainThreadDirty = false; 154 m_shouldScrollOnMainThreadDirty = false;
155 } 155 }
156 m_wasFrameScrollable = frameIsScrollable; 156 m_wasFrameScrollable = frameIsScrollable;
157 157
158 // The mainFrame view doesn't get included in the FrameTree below, so we 158 // The mainFrame view doesn't get included in the FrameTree below, so we
159 // update its size separately. 159 // update its size separately.
160 if (WebLayer* scrollingWebLayer = frameView ? toWebLayer(frameView->layerFor Scrolling()) : 0) { 160 if (WebLayer* scrollingWebLayer = frameView ? toWebLayer(frameView->layerFor Scrolling()) : 0) {
161 scrollingWebLayer->setBounds(frameView->contentsSize()); 161 // If there is a fullscreen element, set the scroll bounds to empty so t he main frame won't scroll.
162 // If there is a fullscreen element, set the scroll clip layer to 0 so m ain frame won't scroll.
163 Document* mainFrameDocument = m_page->deprecatedLocalMainFrame()->docume nt(); 162 Document* mainFrameDocument = m_page->deprecatedLocalMainFrame()->docume nt();
164 Element* fullscreenElement = Fullscreen::fullscreenElementFrom(*mainFram eDocument); 163 Element* fullscreenElement = Fullscreen::fullscreenElementFrom(*mainFram eDocument);
165 if (fullscreenElement && fullscreenElement != mainFrameDocument->documen tElement()) 164 if (fullscreenElement && fullscreenElement != mainFrameDocument->documen tElement())
166 scrollingWebLayer->setScrollClipLayer(0); 165 scrollingWebLayer->setBounds(IntSize());
167 else 166 else
168 scrollingWebLayer->setScrollClipLayer(toWebLayer(frameView->layerFor Container())); 167 scrollingWebLayer->setBounds(frameView->contentsSize());
169 } 168 }
170 169
171 const FrameTree& tree = m_page->mainFrame()->tree(); 170 const FrameTree& tree = m_page->mainFrame()->tree();
172 for (const Frame* child = tree.firstChild(); child; child = child->tree().ne xtSibling()) { 171 for (const Frame* child = tree.firstChild(); child; child = child->tree().ne xtSibling()) {
173 if (!child->isLocalFrame()) 172 if (!child->isLocalFrame())
174 continue; 173 continue;
175 if (WebLayer* scrollLayer = toWebLayer(toLocalFrame(child)->view()->laye rForScrolling())) 174 if (WebLayer* scrollLayer = toWebLayer(toLocalFrame(child)->view()->laye rForScrolling()))
176 scrollLayer->setBounds(toLocalFrame(child)->view()->contentsSize()); 175 scrollLayer->setBounds(toLocalFrame(child)->view()->contentsSize());
177 } 176 }
178 } 177 }
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 bool frameIsScrollable = frameView && frameView->isScrollable(); 964 bool frameIsScrollable = frameView && frameView->isScrollable();
966 if (frameIsScrollable != m_wasFrameScrollable) 965 if (frameIsScrollable != m_wasFrameScrollable)
967 return true; 966 return true;
968 967
969 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : 0) 968 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : 0)
970 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( ); 969 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( );
971 return false; 970 return false;
972 } 971 }
973 972
974 } // namespace blink 973 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698