Chromium Code Reviews| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 // If there is a fullscreen element, set the scroll bounds to empty so t he main frame won't scroll. | 161 // If there is a non-root fullscreen element, prevent the main frame |
| 162 // from scrolling. | |
| 162 Document* mainFrameDocument = m_page->deprecatedLocalMainFrame()->docume nt(); | 163 Document* mainFrameDocument = m_page->deprecatedLocalMainFrame()->docume nt(); |
| 163 Element* fullscreenElement = Fullscreen::fullscreenElementFrom(*mainFram eDocument); | 164 Element* fullscreenElement = Fullscreen::fullscreenElementFrom(*mainFram eDocument); |
| 164 if (fullscreenElement && fullscreenElement != mainFrameDocument->documen tElement()) | 165 if (fullscreenElement && fullscreenElement != mainFrameDocument->documen tElement()) { |
| 165 scrollingWebLayer->setBounds(IntSize()); | 166 if (m_page->settings().pinchVirtualViewportEnabled()) { |
| 166 else | 167 scrollingWebLayer->setUserScrollable(false, false); |
| 167 scrollingWebLayer->setBounds(frameView->contentsSize()); | 168 toWebLayer(m_page->frameHost().pinchViewport().innerViewportScro llLayer())->setUserScrollable(false, false); |
|
Rick Byers
2014/10/09 14:28:52
ScrollView::setScrollbarModes can override this.
aelias_OOO_until_Jul13
2014/10/10 00:58:50
Good point. I overrode the userInputScrollable ge
| |
| 169 } else { | |
| 170 scrollingWebLayer->setBounds(IntSize()); | |
| 171 } | |
| 172 } else { | |
| 173 if (m_page->settings().pinchVirtualViewportEnabled()) { | |
| 174 scrollingWebLayer->setUserScrollable(frameView->userInputScrolla ble(HorizontalScrollbar), frameView->userInputScrollable(VerticalScrollbar)); | |
| 175 toWebLayer(m_page->frameHost().pinchViewport().innerViewportScro llLayer())->setUserScrollable(true, true); | |
| 176 } else { | |
| 177 scrollingWebLayer->setBounds(frameView->contentsSize()); | |
| 178 } | |
| 179 } | |
| 168 } | 180 } |
| 169 | 181 |
| 170 const FrameTree& tree = m_page->mainFrame()->tree(); | 182 const FrameTree& tree = m_page->mainFrame()->tree(); |
| 171 for (const Frame* child = tree.firstChild(); child; child = child->tree().ne xtSibling()) { | 183 for (const Frame* child = tree.firstChild(); child; child = child->tree().ne xtSibling()) { |
| 172 if (!child->isLocalFrame()) | 184 if (!child->isLocalFrame()) |
| 173 continue; | 185 continue; |
| 174 if (WebLayer* scrollLayer = toWebLayer(toLocalFrame(child)->view()->laye rForScrolling())) | 186 if (WebLayer* scrollLayer = toWebLayer(toLocalFrame(child)->view()->laye rForScrolling())) |
| 175 scrollLayer->setBounds(toLocalFrame(child)->view()->contentsSize()); | 187 scrollLayer->setBounds(toLocalFrame(child)->view()->contentsSize()); |
| 176 } | 188 } |
| 177 } | 189 } |
| (...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 975 bool frameIsScrollable = frameView && frameView->isScrollable(); | 987 bool frameIsScrollable = frameView && frameView->isScrollable(); |
| 976 if (frameIsScrollable != m_wasFrameScrollable) | 988 if (frameIsScrollable != m_wasFrameScrollable) |
| 977 return true; | 989 return true; |
| 978 | 990 |
| 979 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : 0) | 991 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : 0) |
| 980 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( ); | 992 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( ); |
| 981 return false; | 993 return false; |
| 982 } | 994 } |
| 983 | 995 |
| 984 } // namespace blink | 996 } // namespace blink |
| OLD | NEW |