Index: Source/core/frame/VisualViewport.cpp |
diff --git a/Source/core/frame/VisualViewport.cpp b/Source/core/frame/VisualViewport.cpp |
index 95c5d1416348fae715a163656e7097708bdb2ab6..103148f016c14ec913128ebbf1c7570b898d8ca4 100644 |
--- a/Source/core/frame/VisualViewport.cpp |
+++ b/Source/core/frame/VisualViewport.cpp |
@@ -48,19 +48,13 @@ |
#include "platform/geometry/FloatSize.h" |
#include "platform/graphics/GraphicsLayer.h" |
#include "platform/graphics/GraphicsLayerFactory.h" |
-#include "platform/scroll/Scrollbar.h" |
-#include "platform/scroll/ScrollbarTheme.h" |
#include "public/platform/Platform.h" |
#include "public/platform/WebCompositorSupport.h" |
#include "public/platform/WebLayer.h" |
#include "public/platform/WebLayerTreeView.h" |
-#include "public/platform/WebScrollbar.h" |
-#include "public/platform/WebScrollbarLayer.h" |
using blink::WebLayer; |
using blink::WebLayerTreeView; |
-using blink::WebScrollbar; |
-using blink::WebScrollbarLayer; |
using blink::FrameHost; |
using blink::GraphicsLayer; |
using blink::GraphicsLayerFactory; |
@@ -104,10 +98,6 @@ void VisualViewport::setSize(const IntSize& size) |
if (m_innerViewportContainerLayer) { |
m_innerViewportContainerLayer->setSize(m_size); |
- |
- // Need to re-compute sizes for the overlay scrollbars. |
- setupScrollbar(WebScrollbar::Horizontal); |
- setupScrollbar(WebScrollbar::Vertical); |
} |
if (autosizerNeedsUpdating) { |
@@ -273,11 +263,9 @@ bool VisualViewport::magnifyScaleAroundAnchor(float magnifyDelta, const FloatPoi |
// | +-- outerViewportContainerLayer (fixed pos container) [frame container layer in DeprecatedPaintLayerCompositor] |
// | | +-- outerViewportScrollLayer [frame scroll layer in DeprecatedPaintLayerCompositor] |
// | | +-- content layers ... |
-// | +-- horizontal ScrollbarLayer (non-overlay) |
-// | +-- verticalScrollbarLayer (non-overlay) |
-// | +-- scroll corner (non-overlay) |
-// +- *horizontalScrollbarLayer (overlay) |
-// +- *verticalScrollbarLayer (overlay) |
+// +- horizontalScrollbarLayer |
+// +- verticalScrollbarLayer |
+// +- scroll corner (non-overlay only) |
// |
void VisualViewport::attachToLayerTree(GraphicsLayer* currentLayerTreeRoot, GraphicsLayerFactory* graphicsLayerFactory) |
{ |
@@ -292,9 +280,7 @@ void VisualViewport::attachToLayerTree(GraphicsLayer* currentLayerTreeRoot, Grap |
return; |
if (!m_innerViewportScrollLayer) { |
- ASSERT(!m_overlayScrollbarHorizontal |
- && !m_overlayScrollbarVertical |
- && !m_overscrollElasticityLayer |
+ ASSERT(!m_overscrollElasticityLayer |
&& !m_pageScaleLayer |
&& !m_innerViewportContainerLayer); |
@@ -304,8 +290,6 @@ void VisualViewport::attachToLayerTree(GraphicsLayer* currentLayerTreeRoot, Grap |
m_overscrollElasticityLayer = GraphicsLayer::create(graphicsLayerFactory, this); |
m_pageScaleLayer = GraphicsLayer::create(graphicsLayerFactory, this); |
m_innerViewportScrollLayer = GraphicsLayer::create(graphicsLayerFactory, this); |
- m_overlayScrollbarHorizontal = GraphicsLayer::create(graphicsLayerFactory, this); |
- m_overlayScrollbarVertical = GraphicsLayer::create(graphicsLayerFactory, this); |
ScrollingCoordinator* coordinator = frameHost().page().scrollingCoordinator(); |
ASSERT(coordinator); |
@@ -324,68 +308,15 @@ void VisualViewport::attachToLayerTree(GraphicsLayer* currentLayerTreeRoot, Grap |
m_innerViewportContainerLayer->addChild(m_overscrollElasticityLayer.get()); |
m_overscrollElasticityLayer->addChild(m_pageScaleLayer.get()); |
m_pageScaleLayer->addChild(m_innerViewportScrollLayer.get()); |
- m_innerViewportContainerLayer->addChild(m_overlayScrollbarHorizontal.get()); |
- m_innerViewportContainerLayer->addChild(m_overlayScrollbarVertical.get()); |
// Ensure this class is set as the scroll layer's ScrollableArea. |
coordinator->scrollableAreaScrollLayerDidChange(this); |
- |
- // Setup the inner viewport overlay scrollbars. |
- setupScrollbar(WebScrollbar::Horizontal); |
- setupScrollbar(WebScrollbar::Vertical); |
} |
m_innerViewportScrollLayer->removeAllChildren(); |
m_innerViewportScrollLayer->addChild(currentLayerTreeRoot); |
} |
-void VisualViewport::setupScrollbar(WebScrollbar::Orientation orientation) |
-{ |
- bool isHorizontal = orientation == WebScrollbar::Horizontal; |
- GraphicsLayer* scrollbarGraphicsLayer = isHorizontal ? |
- m_overlayScrollbarHorizontal.get() : m_overlayScrollbarVertical.get(); |
- OwnPtr<WebScrollbarLayer>& webScrollbarLayer = isHorizontal ? |
- m_webOverlayScrollbarHorizontal : m_webOverlayScrollbarVertical; |
- |
- int thumbThickness = frameHost().settings().pinchOverlayScrollbarThickness(); |
- int scrollbarThickness = thumbThickness; |
- int scrollbarMargin = scrollbarThickness; |
- |
- // FIXME: Rather than manually creating scrollbar layers, we should create |
- // real scrollbars so we can reuse all the machinery from ScrollbarTheme. |
-#if OS(ANDROID) |
- thumbThickness = ScrollbarTheme::theme()->thumbThickness(0); |
- scrollbarThickness = ScrollbarTheme::theme()->scrollbarThickness(RegularScrollbar); |
- scrollbarMargin = ScrollbarTheme::theme()->scrollbarMargin(); |
-#endif |
- |
- if (!webScrollbarLayer) { |
- ScrollingCoordinator* coordinator = frameHost().page().scrollingCoordinator(); |
- ASSERT(coordinator); |
- ScrollbarOrientation webcoreOrientation = isHorizontal ? HorizontalScrollbar : VerticalScrollbar; |
- webScrollbarLayer = coordinator->createSolidColorScrollbarLayer(webcoreOrientation, thumbThickness, scrollbarMargin, false); |
- |
- webScrollbarLayer->setClipLayer(m_innerViewportContainerLayer->platformLayer()); |
- |
- // The compositor will control the scrollbar's visibility. Set to invisible by defualt |
- // so scrollbars don't show up in layout tests. |
- webScrollbarLayer->layer()->setOpacity(0); |
- |
- scrollbarGraphicsLayer->setContentsToPlatformLayer(webScrollbarLayer->layer()); |
- scrollbarGraphicsLayer->setDrawsContent(false); |
- } |
- |
- int xPosition = isHorizontal ? 0 : m_innerViewportContainerLayer->size().width() - scrollbarThickness; |
- int yPosition = isHorizontal ? m_innerViewportContainerLayer->size().height() - scrollbarThickness : 0; |
- int width = isHorizontal ? m_innerViewportContainerLayer->size().width() - scrollbarThickness : scrollbarThickness; |
- int height = isHorizontal ? scrollbarThickness : m_innerViewportContainerLayer->size().height() - scrollbarThickness; |
- |
- // Use the GraphicsLayer to position the scrollbars. |
- scrollbarGraphicsLayer->setPosition(IntPoint(xPosition, yPosition)); |
- scrollbarGraphicsLayer->setSize(IntSize(width, height)); |
- scrollbarGraphicsLayer->setContentsRect(IntRect(0, 0, width, height)); |
-} |
- |
void VisualViewport::registerLayersWithTreeView(WebLayerTreeView* layerTreeView) const |
{ |
TRACE_EVENT0("blink", "VisualViewport::registerLayersWithTreeView"); |
@@ -400,15 +331,14 @@ void VisualViewport::registerLayersWithTreeView(WebLayerTreeView* layerTreeView) |
// Get the outer viewport scroll layer. |
WebLayer* scrollLayer = compositor->scrollLayer() ? compositor->scrollLayer()->platformLayer() : 0; |
- m_webOverlayScrollbarHorizontal->setScrollLayer(scrollLayer); |
- m_webOverlayScrollbarVertical->setScrollLayer(scrollLayer); |
- |
ASSERT(compositor); |
layerTreeView->registerViewportLayers( |
m_overscrollElasticityLayer->platformLayer(), |
m_pageScaleLayer->platformLayer(), |
m_innerViewportScrollLayer->platformLayer(), |
scrollLayer); |
+ |
+ layerTreeView->setHidePinchScrollbarsNearMinScale(false); |
} |
void VisualViewport::clearLayersForTreeView(WebLayerTreeView* layerTreeView) const |
@@ -528,8 +458,6 @@ IntSize VisualViewport::contentsSize() const |
void VisualViewport::invalidateScrollbarRect(Scrollbar*, const IntRect&) |
{ |
- // Do nothing. Visual scrollbars live on the compositor thread and will |
- // be updated when the viewport is synced to the CC. |
} |
void VisualViewport::setScrollOffset(const IntPoint& offset, ScrollType scrollType) |
@@ -554,12 +482,12 @@ GraphicsLayer* VisualViewport::layerForScrolling() const |
GraphicsLayer* VisualViewport::layerForHorizontalScrollbar() const |
{ |
- return m_overlayScrollbarHorizontal.get(); |
+ return 0; |
} |
GraphicsLayer* VisualViewport::layerForVerticalScrollbar() const |
{ |
- return m_overlayScrollbarVertical.get(); |
+ return 0; |
} |
void VisualViewport::paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& inClip) |
@@ -651,10 +579,6 @@ String VisualViewport::debugName(const GraphicsLayer* graphicsLayer) |
name = "Page Scale Layer"; |
} else if (graphicsLayer == m_innerViewportScrollLayer.get()) { |
name = "Inner Viewport Scroll Layer"; |
- } else if (graphicsLayer == m_overlayScrollbarHorizontal.get()) { |
- name = "Overlay Scrollbar Horizontal Layer"; |
- } else if (graphicsLayer == m_overlayScrollbarVertical.get()) { |
- name = "Overlay Scrollbar Vertical Layer"; |
} else if (graphicsLayer == m_rootTransformLayer) { |
name = "Root Transform Layer"; |
} else { |