| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 // | 266 // |
| 267 // *rootTransformLayer | 267 // *rootTransformLayer |
| 268 // +- *innerViewportContainerLayer (fixed pos container) | 268 // +- *innerViewportContainerLayer (fixed pos container) |
| 269 // | +- *overscrollElasticityLayer | 269 // | +- *overscrollElasticityLayer |
| 270 // | +- *pageScaleLayer | 270 // | +- *pageScaleLayer |
| 271 // | +- *innerViewportScrollLayer | 271 // | +- *innerViewportScrollLayer |
| 272 // | +-- overflowControlsHostLayer (root layer) | 272 // | +-- overflowControlsHostLayer (root layer) |
| 273 // | +-- outerViewportContainerLayer (fixed pos container) [f
rame container layer in DeprecatedPaintLayerCompositor] | 273 // | +-- outerViewportContainerLayer (fixed pos container) [f
rame container layer in DeprecatedPaintLayerCompositor] |
| 274 // | | +-- outerViewportScrollLayer [frame scroll layer in
DeprecatedPaintLayerCompositor] | 274 // | | +-- outerViewportScrollLayer [frame scroll layer in
DeprecatedPaintLayerCompositor] |
| 275 // | | +-- content layers ... | 275 // | | +-- content layers ... |
| 276 // | +-- horizontal ScrollbarLayer (non-overlay) | 276 // +- horizontalScrollbarLayer |
| 277 // | +-- verticalScrollbarLayer (non-overlay) | 277 // +- verticalScrollbarLayer |
| 278 // | +-- scroll corner (non-overlay) | 278 // +- scroll corner (non-overlay only) |
| 279 // +- *horizontalScrollbarLayer (overlay) | |
| 280 // +- *verticalScrollbarLayer (overlay) | |
| 281 // | 279 // |
| 282 void VisualViewport::attachToLayerTree(GraphicsLayer* currentLayerTreeRoot, Grap
hicsLayerFactory* graphicsLayerFactory) | 280 void VisualViewport::attachToLayerTree(GraphicsLayer* currentLayerTreeRoot, Grap
hicsLayerFactory* graphicsLayerFactory) |
| 283 { | 281 { |
| 284 TRACE_EVENT1("blink", "VisualViewport::attachToLayerTree", "currentLayerTree
Root", (bool)currentLayerTreeRoot); | 282 TRACE_EVENT1("blink", "VisualViewport::attachToLayerTree", "currentLayerTree
Root", (bool)currentLayerTreeRoot); |
| 285 if (!currentLayerTreeRoot) { | 283 if (!currentLayerTreeRoot) { |
| 286 if (m_innerViewportScrollLayer) | 284 if (m_innerViewportScrollLayer) |
| 287 m_innerViewportScrollLayer->removeAllChildren(); | 285 m_innerViewportScrollLayer->removeAllChildren(); |
| 288 return; | 286 return; |
| 289 } | 287 } |
| 290 | 288 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 317 m_innerViewportContainerLayer->setSize(m_size); | 315 m_innerViewportContainerLayer->setSize(m_size); |
| 318 | 316 |
| 319 m_innerViewportScrollLayer->platformLayer()->setScrollClipLayer( | 317 m_innerViewportScrollLayer->platformLayer()->setScrollClipLayer( |
| 320 m_innerViewportContainerLayer->platformLayer()); | 318 m_innerViewportContainerLayer->platformLayer()); |
| 321 m_innerViewportScrollLayer->platformLayer()->setUserScrollable(true, tru
e); | 319 m_innerViewportScrollLayer->platformLayer()->setUserScrollable(true, tru
e); |
| 322 | 320 |
| 323 m_rootTransformLayer->addChild(m_innerViewportContainerLayer.get()); | 321 m_rootTransformLayer->addChild(m_innerViewportContainerLayer.get()); |
| 324 m_innerViewportContainerLayer->addChild(m_overscrollElasticityLayer.get(
)); | 322 m_innerViewportContainerLayer->addChild(m_overscrollElasticityLayer.get(
)); |
| 325 m_overscrollElasticityLayer->addChild(m_pageScaleLayer.get()); | 323 m_overscrollElasticityLayer->addChild(m_pageScaleLayer.get()); |
| 326 m_pageScaleLayer->addChild(m_innerViewportScrollLayer.get()); | 324 m_pageScaleLayer->addChild(m_innerViewportScrollLayer.get()); |
| 327 m_innerViewportContainerLayer->addChild(m_overlayScrollbarHorizontal.get
()); | 325 |
| 328 m_innerViewportContainerLayer->addChild(m_overlayScrollbarVertical.get()
); | 326 if (visualViewportSuppliesScrollbars()) { |
| 327 m_innerViewportContainerLayer->addChild(m_overlayScrollbarHorizontal
.get()); |
| 328 m_innerViewportContainerLayer->addChild(m_overlayScrollbarVertical.g
et()); |
| 329 } |
| 329 | 330 |
| 330 // Ensure this class is set as the scroll layer's ScrollableArea. | 331 // Ensure this class is set as the scroll layer's ScrollableArea. |
| 331 coordinator->scrollableAreaScrollLayerDidChange(this); | 332 coordinator->scrollableAreaScrollLayerDidChange(this); |
| 332 | 333 |
| 333 // Setup the inner viewport overlay scrollbars. | 334 // Setup the inner viewport overlay scrollbars. |
| 334 setupScrollbar(WebScrollbar::Horizontal); | 335 setupScrollbar(WebScrollbar::Horizontal); |
| 335 setupScrollbar(WebScrollbar::Vertical); | 336 setupScrollbar(WebScrollbar::Vertical); |
| 336 } | 337 } |
| 337 | 338 |
| 338 m_innerViewportScrollLayer->removeAllChildren(); | 339 m_innerViewportScrollLayer->removeAllChildren(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 363 ScrollingCoordinator* coordinator = frameHost().page().scrollingCoordina
tor(); | 364 ScrollingCoordinator* coordinator = frameHost().page().scrollingCoordina
tor(); |
| 364 ASSERT(coordinator); | 365 ASSERT(coordinator); |
| 365 ScrollbarOrientation webcoreOrientation = isHorizontal ? HorizontalScrol
lbar : VerticalScrollbar; | 366 ScrollbarOrientation webcoreOrientation = isHorizontal ? HorizontalScrol
lbar : VerticalScrollbar; |
| 366 webScrollbarLayer = coordinator->createSolidColorScrollbarLayer(webcoreO
rientation, thumbThickness, scrollbarMargin, false); | 367 webScrollbarLayer = coordinator->createSolidColorScrollbarLayer(webcoreO
rientation, thumbThickness, scrollbarMargin, false); |
| 367 | 368 |
| 368 webScrollbarLayer->setClipLayer(m_innerViewportContainerLayer->platformL
ayer()); | 369 webScrollbarLayer->setClipLayer(m_innerViewportContainerLayer->platformL
ayer()); |
| 369 | 370 |
| 370 // The compositor will control the scrollbar's visibility. Set to invisi
ble by defualt | 371 // The compositor will control the scrollbar's visibility. Set to invisi
ble by defualt |
| 371 // so scrollbars don't show up in layout tests. | 372 // so scrollbars don't show up in layout tests. |
| 372 webScrollbarLayer->layer()->setOpacity(0); | 373 webScrollbarLayer->layer()->setOpacity(0); |
| 373 | |
| 374 scrollbarGraphicsLayer->setContentsToPlatformLayer(webScrollbarLayer->la
yer()); | 374 scrollbarGraphicsLayer->setContentsToPlatformLayer(webScrollbarLayer->la
yer()); |
| 375 scrollbarGraphicsLayer->setDrawsContent(false); | 375 scrollbarGraphicsLayer->setDrawsContent(false); |
| 376 } | 376 } |
| 377 | 377 |
| 378 int xPosition = isHorizontal ? 0 : m_innerViewportContainerLayer->size().wid
th() - scrollbarThickness; | 378 int xPosition = isHorizontal ? 0 : m_innerViewportContainerLayer->size().wid
th() - scrollbarThickness; |
| 379 int yPosition = isHorizontal ? m_innerViewportContainerLayer->size().height(
) - scrollbarThickness : 0; | 379 int yPosition = isHorizontal ? m_innerViewportContainerLayer->size().height(
) - scrollbarThickness : 0; |
| 380 int width = isHorizontal ? m_innerViewportContainerLayer->size().width() - s
crollbarThickness : scrollbarThickness; | 380 int width = isHorizontal ? m_innerViewportContainerLayer->size().width() - s
crollbarThickness : scrollbarThickness; |
| 381 int height = isHorizontal ? scrollbarThickness : m_innerViewportContainerLay
er->size().height() - scrollbarThickness; | 381 int height = isHorizontal ? scrollbarThickness : m_innerViewportContainerLay
er->size().height() - scrollbarThickness; |
| 382 | 382 |
| 383 // Use the GraphicsLayer to position the scrollbars. | 383 // Use the GraphicsLayer to position the scrollbars. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 402 | 402 |
| 403 m_webOverlayScrollbarHorizontal->setScrollLayer(scrollLayer); | 403 m_webOverlayScrollbarHorizontal->setScrollLayer(scrollLayer); |
| 404 m_webOverlayScrollbarVertical->setScrollLayer(scrollLayer); | 404 m_webOverlayScrollbarVertical->setScrollLayer(scrollLayer); |
| 405 | 405 |
| 406 ASSERT(compositor); | 406 ASSERT(compositor); |
| 407 layerTreeView->registerViewportLayers( | 407 layerTreeView->registerViewportLayers( |
| 408 m_overscrollElasticityLayer->platformLayer(), | 408 m_overscrollElasticityLayer->platformLayer(), |
| 409 m_pageScaleLayer->platformLayer(), | 409 m_pageScaleLayer->platformLayer(), |
| 410 m_innerViewportScrollLayer->platformLayer(), | 410 m_innerViewportScrollLayer->platformLayer(), |
| 411 scrollLayer); | 411 scrollLayer); |
| 412 |
| 413 // TODO(aelias): Remove this call after this setting is deleted. |
| 414 layerTreeView->setHidePinchScrollbarsNearMinScale(false); |
| 415 } |
| 416 |
| 417 bool VisualViewport::visualViewportSuppliesScrollbars() const |
| 418 { |
| 419 return frameHost().settings().viewportMetaEnabled(); |
| 412 } | 420 } |
| 413 | 421 |
| 414 void VisualViewport::clearLayersForTreeView(WebLayerTreeView* layerTreeView) con
st | 422 void VisualViewport::clearLayersForTreeView(WebLayerTreeView* layerTreeView) con
st |
| 415 { | 423 { |
| 416 ASSERT(layerTreeView); | 424 ASSERT(layerTreeView); |
| 417 | 425 |
| 418 layerTreeView->clearViewportLayers(); | 426 layerTreeView->clearViewportLayers(); |
| 419 } | 427 } |
| 420 | 428 |
| 421 DoubleRect VisualViewport::visibleContentRectDouble(IncludeScrollbarsInRect) con
st | 429 DoubleRect VisualViewport::visibleContentRectDouble(IncludeScrollbarsInRect) con
st |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 } else if (graphicsLayer == m_rootTransformLayer) { | 666 } else if (graphicsLayer == m_rootTransformLayer) { |
| 659 name = "Root Transform Layer"; | 667 name = "Root Transform Layer"; |
| 660 } else { | 668 } else { |
| 661 ASSERT_NOT_REACHED(); | 669 ASSERT_NOT_REACHED(); |
| 662 } | 670 } |
| 663 | 671 |
| 664 return name; | 672 return name; |
| 665 } | 673 } |
| 666 | 674 |
| 667 } // namespace blink | 675 } // namespace blink |
| OLD | NEW |