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