OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 setLocation(visibleRect().location()); | 157 setLocation(visibleRect().location()); |
158 | 158 |
159 // TODO: We should probably be calling scaleDidChange type functions here. | 159 // TODO: We should probably be calling scaleDidChange type functions here. |
160 // see Page::setPageScaleFactor. | 160 // see Page::setPageScaleFactor. |
161 } | 161 } |
162 | 162 |
163 // Modifies the top of the graphics layer tree to add layers needed to support | 163 // Modifies the top of the graphics layer tree to add layers needed to support |
164 // the inner/outer viewport fixed-position model for pinch zoom. When finished, | 164 // the inner/outer viewport fixed-position model for pinch zoom. When finished, |
165 // the tree will look like this (with * denoting added layers): | 165 // the tree will look like this (with * denoting added layers): |
166 // | 166 // |
167 // *innerViewportContainerLayer (fixed pos container) | 167 // *rootTransformLayer |
168 // +- *pageScaleLayer | 168 // +- *innerViewportContainerLayer (fixed pos container) |
169 // | +- *innerViewportScrollLayer | 169 // +- *pageScaleLayer |
170 // | +-- overflowControlsHostLayer (root layer) | 170 // | +- *innerViewportScrollLayer |
171 // | +-- rootTransformLayer (optional) | 171 // | +-- overflowControlsHostLayer (root layer) |
172 // | +-- outerViewportContainerLayer (fixed pos container) [frame
container layer in RenderLayerCompositor] | 172 // | +-- outerViewportContainerLayer (fixed pos container) [frame
container layer in RenderLayerCompositor] |
173 // | | +-- outerViewportScrollLayer [frame scroll layer in Rend
erLayerCompositor] | 173 // | | +-- outerViewportScrollLayer [frame scroll layer in Rend
erLayerCompositor] |
174 // | | +-- content layers ... | 174 // | | +-- content layers ... |
175 // | +-- horizontal ScrollbarLayer (non-overlay) | 175 // | +-- horizontal ScrollbarLayer (non-overlay) |
176 // | +-- verticalScrollbarLayer (non-overlay) | 176 // | +-- verticalScrollbarLayer (non-overlay) |
177 // | +-- scroll corner (non-overlay) | 177 // | +-- scroll corner (non-overlay) |
178 // +- *horizontalScrollbarLayer (overlay) | 178 // +- *horizontalScrollbarLayer (overlay) |
179 // +- *verticalScrollbarLayer (overlay) | 179 // +- *verticalScrollbarLayer (overlay) |
180 // | 180 // |
181 void PinchViewport::attachToLayerTree(GraphicsLayer* currentLayerTreeRoot, Graph
icsLayerFactory* graphicsLayerFactory) | 181 void PinchViewport::attachToLayerTree(GraphicsLayer* currentLayerTreeRoot, Graph
icsLayerFactory* graphicsLayerFactory) |
182 { | 182 { |
183 TRACE_EVENT1("webkit", "PinchViewport::attachToLayerTree", "currentLayerTree
Root", (bool)currentLayerTreeRoot); | 183 TRACE_EVENT1("webkit", "PinchViewport::attachToLayerTree", "currentLayerTree
Root", (bool)currentLayerTreeRoot); |
184 if (!currentLayerTreeRoot) { | 184 if (!currentLayerTreeRoot) { |
185 m_innerViewportScrollLayer->removeAllChildren(); | 185 m_innerViewportScrollLayer->removeAllChildren(); |
186 return; | 186 return; |
187 } | 187 } |
188 | 188 |
189 if (currentLayerTreeRoot->parent() && currentLayerTreeRoot->parent() == m_in
nerViewportScrollLayer) | 189 if (currentLayerTreeRoot->parent() && currentLayerTreeRoot->parent() == m_in
nerViewportScrollLayer) |
190 return; | 190 return; |
191 | 191 |
192 if (!m_innerViewportScrollLayer) { | 192 if (!m_innerViewportScrollLayer) { |
193 ASSERT(!m_overlayScrollbarHorizontal | 193 ASSERT(!m_overlayScrollbarHorizontal |
194 && !m_overlayScrollbarVertical | 194 && !m_overlayScrollbarVertical |
195 && !m_pageScaleLayer | 195 && !m_pageScaleLayer |
196 && !m_innerViewportContainerLayer); | 196 && !m_innerViewportContainerLayer); |
197 | 197 |
| 198 m_rootTransformLayer = GraphicsLayer::create(graphicsLayerFactory, this)
; |
198 m_innerViewportContainerLayer = GraphicsLayer::create(graphicsLayerFacto
ry, this); | 199 m_innerViewportContainerLayer = GraphicsLayer::create(graphicsLayerFacto
ry, this); |
199 m_pageScaleLayer = GraphicsLayer::create(graphicsLayerFactory, this); | 200 m_pageScaleLayer = GraphicsLayer::create(graphicsLayerFactory, this); |
200 m_innerViewportScrollLayer = GraphicsLayer::create(graphicsLayerFactory,
this); | 201 m_innerViewportScrollLayer = GraphicsLayer::create(graphicsLayerFactory,
this); |
201 m_overlayScrollbarHorizontal = GraphicsLayer::create(graphicsLayerFactor
y, this); | 202 m_overlayScrollbarHorizontal = GraphicsLayer::create(graphicsLayerFactor
y, this); |
202 m_overlayScrollbarVertical = GraphicsLayer::create(graphicsLayerFactory,
this); | 203 m_overlayScrollbarVertical = GraphicsLayer::create(graphicsLayerFactory,
this); |
203 | 204 |
204 WebCore::ScrollingCoordinator* coordinator = m_frameHost.page().scrollin
gCoordinator(); | 205 WebCore::ScrollingCoordinator* coordinator = m_frameHost.page().scrollin
gCoordinator(); |
205 ASSERT(coordinator); | 206 ASSERT(coordinator); |
206 coordinator->setLayerIsContainerForFixedPositionLayers(m_innerViewportSc
rollLayer.get(), true); | 207 coordinator->setLayerIsContainerForFixedPositionLayers(m_innerViewportSc
rollLayer.get(), true); |
207 | 208 |
208 // Set masks to bounds so the compositor doesn't clobber a manually | 209 // Set masks to bounds so the compositor doesn't clobber a manually |
209 // set inner viewport container layer size. | 210 // set inner viewport container layer size. |
210 m_innerViewportContainerLayer->setMasksToBounds(m_frameHost.settings().m
ainFrameClipsContent()); | 211 m_innerViewportContainerLayer->setMasksToBounds(m_frameHost.settings().m
ainFrameClipsContent()); |
211 m_innerViewportContainerLayer->setSize(m_size); | 212 m_innerViewportContainerLayer->setSize(m_size); |
212 | 213 |
213 m_innerViewportScrollLayer->platformLayer()->setScrollClipLayer( | 214 m_innerViewportScrollLayer->platformLayer()->setScrollClipLayer( |
214 m_innerViewportContainerLayer->platformLayer()); | 215 m_innerViewportContainerLayer->platformLayer()); |
215 m_innerViewportScrollLayer->platformLayer()->setUserScrollable(true, tru
e); | 216 m_innerViewportScrollLayer->platformLayer()->setUserScrollable(true, tru
e); |
216 | 217 |
| 218 m_rootTransformLayer->addChild(m_innerViewportContainerLayer.get()); |
217 m_innerViewportContainerLayer->addChild(m_pageScaleLayer.get()); | 219 m_innerViewportContainerLayer->addChild(m_pageScaleLayer.get()); |
218 m_pageScaleLayer->addChild(m_innerViewportScrollLayer.get()); | 220 m_pageScaleLayer->addChild(m_innerViewportScrollLayer.get()); |
219 m_innerViewportContainerLayer->addChild(m_overlayScrollbarHorizontal.get
()); | 221 m_innerViewportContainerLayer->addChild(m_overlayScrollbarHorizontal.get
()); |
220 m_innerViewportContainerLayer->addChild(m_overlayScrollbarVertical.get()
); | 222 m_innerViewportContainerLayer->addChild(m_overlayScrollbarVertical.get()
); |
221 | 223 |
222 // Ensure this class is set as the scroll layer's ScrollableArea. | 224 // Ensure this class is set as the scroll layer's ScrollableArea. |
223 coordinator->scrollableAreaScrollLayerDidChange(this); | 225 coordinator->scrollableAreaScrollLayerDidChange(this); |
224 | 226 |
225 // Setup the inner viewport overlay scrollbars. | 227 // Setup the inner viewport overlay scrollbars. |
226 setupScrollbar(WebScrollbar::Horizontal); | 228 setupScrollbar(WebScrollbar::Horizontal); |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 } else if (graphicsLayer == m_overlayScrollbarVertical.get()) { | 411 } else if (graphicsLayer == m_overlayScrollbarVertical.get()) { |
410 name = "Overlay Scrollbar Vertical Layer"; | 412 name = "Overlay Scrollbar Vertical Layer"; |
411 } else { | 413 } else { |
412 ASSERT_NOT_REACHED(); | 414 ASSERT_NOT_REACHED(); |
413 } | 415 } |
414 | 416 |
415 return name; | 417 return name; |
416 } | 418 } |
417 | 419 |
418 } // namespace WebCore | 420 } // namespace WebCore |
OLD | NEW |