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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 } | 148 } |
149 | 149 |
150 FrameView* frameView = m_page->deprecatedLocalMainFrame()->view(); | 150 FrameView* frameView = m_page->deprecatedLocalMainFrame()->view(); |
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 |
| 159 // update its size separately. |
158 if (WebLayer* scrollingWebLayer = frameView ? toWebLayer(frameView->layerFor
Scrolling()) : 0) { | 160 if (WebLayer* scrollingWebLayer = frameView ? toWebLayer(frameView->layerFor
Scrolling()) : 0) { |
159 // If there is a non-root fullscreen element, prevent the main frame | 161 // If there is a fullscreen element, set the scroll bounds to empty so t
he main frame won't scroll. |
160 // from scrolling. | |
161 Document* mainFrameDocument = m_page->deprecatedLocalMainFrame()->docume
nt(); | 162 Document* mainFrameDocument = m_page->deprecatedLocalMainFrame()->docume
nt(); |
162 Element* fullscreenElement = Fullscreen::fullscreenElementFrom(*mainFram
eDocument); | 163 Element* fullscreenElement = Fullscreen::fullscreenElementFrom(*mainFram
eDocument); |
163 if (fullscreenElement && fullscreenElement != mainFrameDocument->documen
tElement()) { | 164 if (fullscreenElement && fullscreenElement != mainFrameDocument->documen
tElement()) |
164 if (m_page->settings().pinchVirtualViewportEnabled()) { | 165 scrollingWebLayer->setBounds(IntSize()); |
165 toWebLayer(m_page->frameHost().pinchViewport().scrollLayer())->s
etUserScrollable(false, false); | 166 else |
166 } else { | 167 scrollingWebLayer->setBounds(frameView->contentsSize()); |
167 scrollingWebLayer->setBounds(IntSize()); | |
168 } | |
169 } else { | |
170 if (m_page->settings().pinchVirtualViewportEnabled()) { | |
171 toWebLayer(m_page->frameHost().pinchViewport().scrollLayer())->s
etUserScrollable(true, true); | |
172 } else { | |
173 scrollingWebLayer->setBounds(frameView->contentsSize()); | |
174 } | |
175 } | |
176 scrollingWebLayer->setUserScrollable(frameView->userInputScrollable(Hori
zontalScrollbar), frameView->userInputScrollable(VerticalScrollbar)); | |
177 } | 168 } |
178 | 169 |
179 const FrameTree& tree = m_page->mainFrame()->tree(); | 170 const FrameTree& tree = m_page->mainFrame()->tree(); |
180 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()) { |
181 if (!child->isLocalFrame()) | 172 if (!child->isLocalFrame()) |
182 continue; | 173 continue; |
183 if (WebLayer* scrollLayer = toWebLayer(toLocalFrame(child)->view()->laye
rForScrolling())) | 174 if (WebLayer* scrollLayer = toWebLayer(toLocalFrame(child)->view()->laye
rForScrolling())) |
184 scrollLayer->setBounds(toLocalFrame(child)->view()->contentsSize()); | 175 scrollLayer->setBounds(toLocalFrame(child)->view()->contentsSize()); |
185 } | 176 } |
186 } | 177 } |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 bool frameIsScrollable = frameView && frameView->isScrollable(); | 975 bool frameIsScrollable = frameView && frameView->isScrollable(); |
985 if (frameIsScrollable != m_wasFrameScrollable) | 976 if (frameIsScrollable != m_wasFrameScrollable) |
986 return true; | 977 return true; |
987 | 978 |
988 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : 0) | 979 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : 0) |
989 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); | 980 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); |
990 return false; | 981 return false; |
991 } | 982 } |
992 | 983 |
993 } // namespace blink | 984 } // namespace blink |
OLD | NEW |