| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "platform/geometry/DoubleRect.h" | 48 #include "platform/geometry/DoubleRect.h" |
| 49 #include "platform/geometry/FloatSize.h" | 49 #include "platform/geometry/FloatSize.h" |
| 50 #include "platform/graphics/GraphicsLayer.h" | 50 #include "platform/graphics/GraphicsLayer.h" |
| 51 #include "platform/scroll/Scrollbar.h" | 51 #include "platform/scroll/Scrollbar.h" |
| 52 #include "platform/scroll/ScrollbarThemeOverlay.h" | 52 #include "platform/scroll/ScrollbarThemeOverlay.h" |
| 53 #include "public/platform/WebCompositorSupport.h" | 53 #include "public/platform/WebCompositorSupport.h" |
| 54 #include "public/platform/WebLayer.h" | 54 #include "public/platform/WebLayer.h" |
| 55 #include "public/platform/WebLayerTreeView.h" | 55 #include "public/platform/WebLayerTreeView.h" |
| 56 #include "public/platform/WebScrollbar.h" | 56 #include "public/platform/WebScrollbar.h" |
| 57 #include "public/platform/WebScrollbarLayer.h" | 57 #include "public/platform/WebScrollbarLayer.h" |
| 58 #include <memory> | |
| 59 | 58 |
| 60 using blink::WebLayer; | 59 using blink::WebLayer; |
| 61 using blink::WebLayerTreeView; | 60 using blink::WebLayerTreeView; |
| 62 using blink::WebScrollbar; | 61 using blink::WebScrollbar; |
| 63 using blink::WebScrollbarLayer; | 62 using blink::WebScrollbarLayer; |
| 64 using blink::FrameHost; | 63 using blink::FrameHost; |
| 65 using blink::GraphicsLayer; | 64 using blink::GraphicsLayer; |
| 66 | 65 |
| 67 namespace blink { | 66 namespace blink { |
| 68 | 67 |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 // | 368 // |
| 370 void VisualViewport::attachToLayerTree(GraphicsLayer* currentLayerTreeRoot) | 369 void VisualViewport::attachToLayerTree(GraphicsLayer* currentLayerTreeRoot) |
| 371 { | 370 { |
| 372 TRACE_EVENT1("blink", "VisualViewport::attachToLayerTree", "currentLayerTree
Root", (bool)currentLayerTreeRoot); | 371 TRACE_EVENT1("blink", "VisualViewport::attachToLayerTree", "currentLayerTree
Root", (bool)currentLayerTreeRoot); |
| 373 if (!currentLayerTreeRoot) { | 372 if (!currentLayerTreeRoot) { |
| 374 if (m_innerViewportScrollLayer) | 373 if (m_innerViewportScrollLayer) |
| 375 m_innerViewportScrollLayer->removeAllChildren(); | 374 m_innerViewportScrollLayer->removeAllChildren(); |
| 376 return; | 375 return; |
| 377 } | 376 } |
| 378 | 377 |
| 379 if (currentLayerTreeRoot->parent() && currentLayerTreeRoot->parent() == m_in
nerViewportScrollLayer.get()) | 378 if (currentLayerTreeRoot->parent() && currentLayerTreeRoot->parent() == m_in
nerViewportScrollLayer) |
| 380 return; | 379 return; |
| 381 | 380 |
| 382 if (!m_innerViewportScrollLayer) { | 381 if (!m_innerViewportScrollLayer) { |
| 383 ASSERT(!m_overlayScrollbarHorizontal | 382 ASSERT(!m_overlayScrollbarHorizontal |
| 384 && !m_overlayScrollbarVertical | 383 && !m_overlayScrollbarVertical |
| 385 && !m_overscrollElasticityLayer | 384 && !m_overscrollElasticityLayer |
| 386 && !m_pageScaleLayer | 385 && !m_pageScaleLayer |
| 387 && !m_innerViewportContainerLayer); | 386 && !m_innerViewportContainerLayer); |
| 388 | 387 |
| 389 // FIXME: The root transform layer should only be created on demand. | 388 // FIXME: The root transform layer should only be created on demand. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 | 440 |
| 442 setupScrollbar(WebScrollbar::Horizontal); | 441 setupScrollbar(WebScrollbar::Horizontal); |
| 443 setupScrollbar(WebScrollbar::Vertical); | 442 setupScrollbar(WebScrollbar::Vertical); |
| 444 } | 443 } |
| 445 | 444 |
| 446 void VisualViewport::setupScrollbar(WebScrollbar::Orientation orientation) | 445 void VisualViewport::setupScrollbar(WebScrollbar::Orientation orientation) |
| 447 { | 446 { |
| 448 bool isHorizontal = orientation == WebScrollbar::Horizontal; | 447 bool isHorizontal = orientation == WebScrollbar::Horizontal; |
| 449 GraphicsLayer* scrollbarGraphicsLayer = isHorizontal ? | 448 GraphicsLayer* scrollbarGraphicsLayer = isHorizontal ? |
| 450 m_overlayScrollbarHorizontal.get() : m_overlayScrollbarVertical.get(); | 449 m_overlayScrollbarHorizontal.get() : m_overlayScrollbarVertical.get(); |
| 451 std::unique_ptr<WebScrollbarLayer>& webScrollbarLayer = isHorizontal ? | 450 OwnPtr<WebScrollbarLayer>& webScrollbarLayer = isHorizontal ? |
| 452 m_webOverlayScrollbarHorizontal : m_webOverlayScrollbarVertical; | 451 m_webOverlayScrollbarHorizontal : m_webOverlayScrollbarVertical; |
| 453 | 452 |
| 454 ScrollbarThemeOverlay& theme = ScrollbarThemeOverlay::mobileTheme(); | 453 ScrollbarThemeOverlay& theme = ScrollbarThemeOverlay::mobileTheme(); |
| 455 int thumbThickness = theme.thumbThickness(); | 454 int thumbThickness = theme.thumbThickness(); |
| 456 int scrollbarThickness = theme.scrollbarThickness(RegularScrollbar); | 455 int scrollbarThickness = theme.scrollbarThickness(RegularScrollbar); |
| 457 int scrollbarMargin = theme.scrollbarMargin(); | 456 int scrollbarMargin = theme.scrollbarMargin(); |
| 458 | 457 |
| 459 if (!webScrollbarLayer) { | 458 if (!webScrollbarLayer) { |
| 460 ScrollingCoordinator* coordinator = frameHost().page().scrollingCoordina
tor(); | 459 ScrollingCoordinator* coordinator = frameHost().page().scrollingCoordina
tor(); |
| 461 ASSERT(coordinator); | 460 ASSERT(coordinator); |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 } else if (graphicsLayer == m_overscrollElasticityLayer.get()) { | 825 } else if (graphicsLayer == m_overscrollElasticityLayer.get()) { |
| 827 name = "Overscroll Elasticity Layer"; | 826 name = "Overscroll Elasticity Layer"; |
| 828 } else if (graphicsLayer == m_pageScaleLayer.get()) { | 827 } else if (graphicsLayer == m_pageScaleLayer.get()) { |
| 829 name = "Page Scale Layer"; | 828 name = "Page Scale Layer"; |
| 830 } else if (graphicsLayer == m_innerViewportScrollLayer.get()) { | 829 } else if (graphicsLayer == m_innerViewportScrollLayer.get()) { |
| 831 name = "Inner Viewport Scroll Layer"; | 830 name = "Inner Viewport Scroll Layer"; |
| 832 } else if (graphicsLayer == m_overlayScrollbarHorizontal.get()) { | 831 } else if (graphicsLayer == m_overlayScrollbarHorizontal.get()) { |
| 833 name = "Overlay Scrollbar Horizontal Layer"; | 832 name = "Overlay Scrollbar Horizontal Layer"; |
| 834 } else if (graphicsLayer == m_overlayScrollbarVertical.get()) { | 833 } else if (graphicsLayer == m_overlayScrollbarVertical.get()) { |
| 835 name = "Overlay Scrollbar Vertical Layer"; | 834 name = "Overlay Scrollbar Vertical Layer"; |
| 836 } else if (graphicsLayer == m_rootTransformLayer.get()) { | 835 } else if (graphicsLayer == m_rootTransformLayer) { |
| 837 name = "Root Transform Layer"; | 836 name = "Root Transform Layer"; |
| 838 } else { | 837 } else { |
| 839 ASSERT_NOT_REACHED(); | 838 ASSERT_NOT_REACHED(); |
| 840 } | 839 } |
| 841 | 840 |
| 842 return name; | 841 return name; |
| 843 } | 842 } |
| 844 | 843 |
| 845 } // namespace blink | 844 } // namespace blink |
| OLD | NEW |