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 29 matching lines...) Expand all Loading... |
40 #include "core/layout/compositing/PaintLayerCompositor.h" | 40 #include "core/layout/compositing/PaintLayerCompositor.h" |
41 #include "core/loader/FrameLoaderClient.h" | 41 #include "core/loader/FrameLoaderClient.h" |
42 #include "core/page/ChromeClient.h" | 42 #include "core/page/ChromeClient.h" |
43 #include "core/page/Page.h" | 43 #include "core/page/Page.h" |
44 #include "core/page/scrolling/ScrollingCoordinator.h" | 44 #include "core/page/scrolling/ScrollingCoordinator.h" |
45 #include "platform/Histogram.h" | 45 #include "platform/Histogram.h" |
46 #include "platform/TraceEvent.h" | 46 #include "platform/TraceEvent.h" |
47 #include "platform/geometry/DoubleRect.h" | 47 #include "platform/geometry/DoubleRect.h" |
48 #include "platform/geometry/FloatSize.h" | 48 #include "platform/geometry/FloatSize.h" |
49 #include "platform/graphics/GraphicsLayer.h" | 49 #include "platform/graphics/GraphicsLayer.h" |
50 #include "platform/graphics/GraphicsLayerFactory.h" | |
51 #include "platform/scroll/Scrollbar.h" | 50 #include "platform/scroll/Scrollbar.h" |
52 #include "platform/scroll/ScrollbarThemeOverlay.h" | 51 #include "platform/scroll/ScrollbarThemeOverlay.h" |
53 #include "public/platform/WebCompositorSupport.h" | 52 #include "public/platform/WebCompositorSupport.h" |
54 #include "public/platform/WebLayer.h" | 53 #include "public/platform/WebLayer.h" |
55 #include "public/platform/WebLayerTreeView.h" | 54 #include "public/platform/WebLayerTreeView.h" |
56 #include "public/platform/WebScrollbar.h" | 55 #include "public/platform/WebScrollbar.h" |
57 #include "public/platform/WebScrollbarLayer.h" | 56 #include "public/platform/WebScrollbarLayer.h" |
58 | 57 |
59 using blink::WebLayer; | 58 using blink::WebLayer; |
60 using blink::WebLayerTreeView; | 59 using blink::WebLayerTreeView; |
61 using blink::WebScrollbar; | 60 using blink::WebScrollbar; |
62 using blink::WebScrollbarLayer; | 61 using blink::WebScrollbarLayer; |
63 using blink::FrameHost; | 62 using blink::FrameHost; |
64 using blink::GraphicsLayer; | 63 using blink::GraphicsLayer; |
65 using blink::GraphicsLayerFactory; | |
66 | 64 |
67 namespace blink { | 65 namespace blink { |
68 | 66 |
69 VisualViewport::VisualViewport(FrameHost& owner) | 67 VisualViewport::VisualViewport(FrameHost& owner) |
70 : m_frameHost(&owner) | 68 : m_frameHost(&owner) |
71 , m_scale(1) | 69 , m_scale(1) |
72 , m_topControlsAdjustment(0) | 70 , m_topControlsAdjustment(0) |
73 , m_maxPageScale(-1) | 71 , m_maxPageScale(-1) |
74 , m_trackPinchZoomStatsForPage(false) | 72 , m_trackPinchZoomStatsForPage(false) |
75 { | 73 { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 // | +-- overflowControlsHostLayer (root layer) [ owned by PaintLa
yerCompositor ] | 267 // | +-- overflowControlsHostLayer (root layer) [ owned by PaintLa
yerCompositor ] |
270 // | +-- outerViewportContainerLayer (fixed pos container) [fr
ame container layer in PaintLayerCompositor] | 268 // | +-- outerViewportContainerLayer (fixed pos container) [fr
ame container layer in PaintLayerCompositor] |
271 // | | +-- outerViewportScrollLayer [frame scroll layer in P
aintLayerCompositor] | 269 // | | +-- outerViewportScrollLayer [frame scroll layer in P
aintLayerCompositor] |
272 // | | +-- content layers ... | 270 // | | +-- content layers ... |
273 // +- *PageOverlay for InspectorOverlay | 271 // +- *PageOverlay for InspectorOverlay |
274 // +- *PageOverlay for ColorOverlay | 272 // +- *PageOverlay for ColorOverlay |
275 // +- horizontalScrollbarLayer [ owned by PaintLayerCompositor ] | 273 // +- horizontalScrollbarLayer [ owned by PaintLayerCompositor ] |
276 // +- verticalScrollbarLayer [ owned by PaintLayerCompositor ] | 274 // +- verticalScrollbarLayer [ owned by PaintLayerCompositor ] |
277 // +- scroll corner (non-overlay only) [ owned by PaintLayerCompositor ] | 275 // +- scroll corner (non-overlay only) [ owned by PaintLayerCompositor ] |
278 // | 276 // |
279 void VisualViewport::attachToLayerTree(GraphicsLayer* currentLayerTreeRoot, Grap
hicsLayerFactory* graphicsLayerFactory) | 277 void VisualViewport::attachToLayerTree(GraphicsLayer* currentLayerTreeRoot) |
280 { | 278 { |
281 TRACE_EVENT1("blink", "VisualViewport::attachToLayerTree", "currentLayerTree
Root", (bool)currentLayerTreeRoot); | 279 TRACE_EVENT1("blink", "VisualViewport::attachToLayerTree", "currentLayerTree
Root", (bool)currentLayerTreeRoot); |
282 if (!currentLayerTreeRoot) { | 280 if (!currentLayerTreeRoot) { |
283 if (m_innerViewportScrollLayer) | 281 if (m_innerViewportScrollLayer) |
284 m_innerViewportScrollLayer->removeAllChildren(); | 282 m_innerViewportScrollLayer->removeAllChildren(); |
285 return; | 283 return; |
286 } | 284 } |
287 | 285 |
288 if (currentLayerTreeRoot->parent() && currentLayerTreeRoot->parent() == m_in
nerViewportScrollLayer) | 286 if (currentLayerTreeRoot->parent() && currentLayerTreeRoot->parent() == m_in
nerViewportScrollLayer) |
289 return; | 287 return; |
290 | 288 |
291 if (!m_innerViewportScrollLayer) { | 289 if (!m_innerViewportScrollLayer) { |
292 ASSERT(!m_overlayScrollbarHorizontal | 290 ASSERT(!m_overlayScrollbarHorizontal |
293 && !m_overlayScrollbarVertical | 291 && !m_overlayScrollbarVertical |
294 && !m_overscrollElasticityLayer | 292 && !m_overscrollElasticityLayer |
295 && !m_pageScaleLayer | 293 && !m_pageScaleLayer |
296 && !m_innerViewportContainerLayer); | 294 && !m_innerViewportContainerLayer); |
297 | 295 |
298 // FIXME: The root transform layer should only be created on demand. | 296 // FIXME: The root transform layer should only be created on demand. |
299 m_rootTransformLayer = GraphicsLayer::create(graphicsLayerFactory, this)
; | 297 m_rootTransformLayer = GraphicsLayer::create(this); |
300 m_innerViewportContainerLayer = GraphicsLayer::create(graphicsLayerFacto
ry, this); | 298 m_innerViewportContainerLayer = GraphicsLayer::create(this); |
301 m_overscrollElasticityLayer = GraphicsLayer::create(graphicsLayerFactory
, this); | 299 m_overscrollElasticityLayer = GraphicsLayer::create(this); |
302 m_pageScaleLayer = GraphicsLayer::create(graphicsLayerFactory, this); | 300 m_pageScaleLayer = GraphicsLayer::create(this); |
303 m_innerViewportScrollLayer = GraphicsLayer::create(graphicsLayerFactory,
this); | 301 m_innerViewportScrollLayer = GraphicsLayer::create(this); |
304 m_overlayScrollbarHorizontal = GraphicsLayer::create(graphicsLayerFactor
y, this); | 302 m_overlayScrollbarHorizontal = GraphicsLayer::create(this); |
305 m_overlayScrollbarVertical = GraphicsLayer::create(graphicsLayerFactory,
this); | 303 m_overlayScrollbarVertical = GraphicsLayer::create(this); |
306 | 304 |
307 ScrollingCoordinator* coordinator = frameHost().page().scrollingCoordina
tor(); | 305 ScrollingCoordinator* coordinator = frameHost().page().scrollingCoordina
tor(); |
308 ASSERT(coordinator); | 306 ASSERT(coordinator); |
309 coordinator->setLayerIsContainerForFixedPositionLayers(m_innerViewportSc
rollLayer.get(), true); | 307 coordinator->setLayerIsContainerForFixedPositionLayers(m_innerViewportSc
rollLayer.get(), true); |
310 | 308 |
311 // Set masks to bounds so the compositor doesn't clobber a manually | 309 // Set masks to bounds so the compositor doesn't clobber a manually |
312 // set inner viewport container layer size. | 310 // set inner viewport container layer size. |
313 m_innerViewportContainerLayer->setMasksToBounds(frameHost().settings().m
ainFrameClipsContent()); | 311 m_innerViewportContainerLayer->setMasksToBounds(frameHost().settings().m
ainFrameClipsContent()); |
314 m_innerViewportContainerLayer->setSize(FloatSize(m_size)); | 312 m_innerViewportContainerLayer->setSize(FloatSize(m_size)); |
315 | 313 |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 } else if (graphicsLayer == m_rootTransformLayer) { | 737 } else if (graphicsLayer == m_rootTransformLayer) { |
740 name = "Root Transform Layer"; | 738 name = "Root Transform Layer"; |
741 } else { | 739 } else { |
742 ASSERT_NOT_REACHED(); | 740 ASSERT_NOT_REACHED(); |
743 } | 741 } |
744 | 742 |
745 return name; | 743 return name; |
746 } | 744 } |
747 | 745 |
748 } // namespace blink | 746 } // namespace blink |
OLD | NEW |