| 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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 int thumbThickness = theme.thumbThickness(); | 446 int thumbThickness = theme.thumbThickness(); |
| 447 int scrollbarThickness = theme.scrollbarThickness(RegularScrollbar); | 447 int scrollbarThickness = theme.scrollbarThickness(RegularScrollbar); |
| 448 int scrollbarMargin = theme.scrollbarMargin(); | 448 int scrollbarMargin = theme.scrollbarMargin(); |
| 449 | 449 |
| 450 if (!webScrollbarLayer) { | 450 if (!webScrollbarLayer) { |
| 451 ScrollingCoordinator* coordinator = | 451 ScrollingCoordinator* coordinator = |
| 452 frameHost().page().scrollingCoordinator(); | 452 frameHost().page().scrollingCoordinator(); |
| 453 ASSERT(coordinator); | 453 ASSERT(coordinator); |
| 454 ScrollbarOrientation webcoreOrientation = | 454 ScrollbarOrientation webcoreOrientation = |
| 455 isHorizontal ? HorizontalScrollbar : VerticalScrollbar; | 455 isHorizontal ? HorizontalScrollbar : VerticalScrollbar; |
| 456 WebLayer* scrollLayer = layerForScrolling()->platformLayer(); | |
| 457 webScrollbarLayer = coordinator->createSolidColorScrollbarLayer( | 456 webScrollbarLayer = coordinator->createSolidColorScrollbarLayer( |
| 458 webcoreOrientation, thumbThickness, scrollbarMargin, false, | 457 webcoreOrientation, thumbThickness, scrollbarMargin, false); |
| 459 scrollLayer); | |
| 460 | 458 |
| 461 // The compositor will control the scrollbar's visibility. Set to invisible | 459 // The compositor will control the scrollbar's visibility. Set to invisible |
| 462 // by default so scrollbars don't show up in layout tests. | 460 // by default so scrollbars don't show up in layout tests. |
| 463 webScrollbarLayer->layer()->setOpacity(0); | 461 webScrollbarLayer->layer()->setOpacity(0); |
| 464 scrollbarGraphicsLayer->setContentsToPlatformLayer( | 462 scrollbarGraphicsLayer->setContentsToPlatformLayer( |
| 465 webScrollbarLayer->layer()); | 463 webScrollbarLayer->layer()); |
| 466 scrollbarGraphicsLayer->setDrawsContent(false); | 464 scrollbarGraphicsLayer->setDrawsContent(false); |
| 467 } | 465 } |
| 468 | 466 |
| 469 int xPosition = isHorizontal ? 0 | 467 int xPosition = isHorizontal ? 0 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 480 int height = isHorizontal ? scrollbarThickness | 478 int height = isHorizontal ? scrollbarThickness |
| 481 : m_innerViewportContainerLayer->size().height() - | 479 : m_innerViewportContainerLayer->size().height() - |
| 482 scrollbarThickness; | 480 scrollbarThickness; |
| 483 | 481 |
| 484 // Use the GraphicsLayer to position the scrollbars. | 482 // Use the GraphicsLayer to position the scrollbars. |
| 485 scrollbarGraphicsLayer->setPosition(IntPoint(xPosition, yPosition)); | 483 scrollbarGraphicsLayer->setPosition(IntPoint(xPosition, yPosition)); |
| 486 scrollbarGraphicsLayer->setSize(FloatSize(width, height)); | 484 scrollbarGraphicsLayer->setSize(FloatSize(width, height)); |
| 487 scrollbarGraphicsLayer->setContentsRect(IntRect(0, 0, width, height)); | 485 scrollbarGraphicsLayer->setContentsRect(IntRect(0, 0, width, height)); |
| 488 } | 486 } |
| 489 | 487 |
| 488 void VisualViewport::setScrollLayerOnScrollbars(WebLayer* scrollLayer) const { |
| 489 // TODO(bokan): This is currently done while registering viewport layers |
| 490 // with the compositor but could it actually be done earlier, like in |
| 491 // setupScrollbars? Then we wouldn't need this method. |
| 492 m_webOverlayScrollbarHorizontal->setScrollLayer(scrollLayer); |
| 493 m_webOverlayScrollbarVertical->setScrollLayer(scrollLayer); |
| 494 } |
| 495 |
| 490 bool VisualViewport::visualViewportSuppliesScrollbars() const { | 496 bool VisualViewport::visualViewportSuppliesScrollbars() const { |
| 491 return frameHost().page().settings().getViewportEnabled(); | 497 return frameHost().page().settings().getViewportEnabled(); |
| 492 } | 498 } |
| 493 | 499 |
| 494 bool VisualViewport::scrollAnimatorEnabled() const { | 500 bool VisualViewport::scrollAnimatorEnabled() const { |
| 495 return frameHost().page().settings().getScrollAnimatorEnabled(); | 501 return frameHost().page().settings().getScrollAnimatorEnabled(); |
| 496 } | 502 } |
| 497 | 503 |
| 498 HostWindow* VisualViewport::getHostWindow() const { | 504 HostWindow* VisualViewport::getHostWindow() const { |
| 499 return &frameHost().page().chromeClient(); | 505 return &frameHost().page().chromeClient(); |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 } else if (graphicsLayer == m_rootTransformLayer.get()) { | 855 } else if (graphicsLayer == m_rootTransformLayer.get()) { |
| 850 name = "Root Transform Layer"; | 856 name = "Root Transform Layer"; |
| 851 } else { | 857 } else { |
| 852 ASSERT_NOT_REACHED(); | 858 ASSERT_NOT_REACHED(); |
| 853 } | 859 } |
| 854 | 860 |
| 855 return name; | 861 return name; |
| 856 } | 862 } |
| 857 | 863 |
| 858 } // namespace blink | 864 } // namespace blink |
| OLD | NEW |