Index: cc/layer_impl.cc |
diff --git a/cc/layer_impl.cc b/cc/layer_impl.cc |
index 8545e42f7336acf9fffbedd72ca9d3549dd1cfe0..ea1ddae2fa924f5f425a79c5bd80d92bf9ad896c 100644 |
--- a/cc/layer_impl.cc |
+++ b/cc/layer_impl.cc |
@@ -56,6 +56,8 @@ LayerImpl::LayerImpl(LayerTreeImpl* treeImpl, int id) |
#endif |
, m_horizontalScrollbarLayer(0) |
, m_verticalScrollbarLayer(0) |
+ , m_horizontalPinchZoomScrollbarLayer(0) |
+ , m_verticalPinchZoomScrollbarLayer(0) |
{ |
DCHECK(m_layerId > 0); |
DCHECK(m_layerTreeImpl); |
@@ -836,6 +838,16 @@ void LayerImpl::updateScrollbarPositions() |
m_verticalScrollbarLayer->setTotalSize(m_bounds.height()); |
m_verticalScrollbarLayer->setMaximum(m_maxScrollOffset.y()); |
} |
+ if (m_horizontalPinchZoomScrollbarLayer) { |
+ m_horizontalPinchZoomScrollbarLayer->setCurrentPos(currentOffset.x()); |
+ m_horizontalPinchZoomScrollbarLayer->setTotalSize(m_bounds.width()); |
+ m_horizontalPinchZoomScrollbarLayer->setMaximum(m_maxScrollOffset.x()); |
+ } |
+ if (m_verticalPinchZoomScrollbarLayer) { |
+ m_verticalPinchZoomScrollbarLayer->setCurrentPos(currentOffset.y()); |
+ m_verticalPinchZoomScrollbarLayer->setTotalSize(m_bounds.height()); |
+ m_verticalPinchZoomScrollbarLayer->setMaximum(m_maxScrollOffset.y()); |
+ } |
if (currentOffset == m_lastScrollOffset) |
return; |
@@ -889,11 +901,48 @@ void LayerImpl::setScrollDelta(const gfx::Vector2dF& scrollDelta) |
void LayerImpl::setImplTransform(const gfx::Transform& transform) |
{ |
- if (m_implTransform == transform) |
+ // TODO(wjmaclean) - do not commit the changes in this function |
+ // yet! I've included them in this patch to show the eventual |
+ // mechanism I propose for mainframe scrollbar scaling, |
+ // but the transforms cannot be finalized until the |
+ // desktop compatibility viewport lands. |
+ |
+ // We should never have just one pinch-zoom scrollbar. |
+ DCHECK((m_horizontalPinchZoomScrollbarLayer && m_verticalPinchZoomScrollbarLayer) || |
+ (!m_horizontalPinchZoomScrollbarLayer && !m_verticalPinchZoomScrollbarLayer)); |
+ |
+ bool hasPinchZoomScrollbars = m_horizontalPinchZoomScrollbarLayer && m_verticalPinchZoomScrollbarLayer; |
+ |
+ if (!hasPinchZoomScrollbars && (m_implTransform == transform)) |
return; |
- m_implTransform = transform; |
- noteLayerPropertyChangedForSubtree(); |
+ bool redirectedToClipLayer = false; |
+ if (hasPinchZoomScrollbars) { |
+ gfx::Transform scrollbarTransformHorizontal(transform); |
+ // TODO(wjmaclean) This is the wrong translation, need to |
+ // know the offset of the desktop compatibility viewport. |
aelias_OOO_until_Jul13
2013/02/06 19:02:45
I gather you're trying to make the scrollbars visi
|
+ scrollbarTransformHorizontal.Translate(0, -layerTreeImpl()->device_scale_factor() * scrollOffset().y()); |
+ if (m_horizontalScrollbarLayer) |
+ m_horizontalScrollbarLayer->setImplTransform(scrollbarTransformHorizontal); |
+ |
+ gfx::Transform scrollbarTransformVertical(transform); |
+ // TODO(wjmaclean) Same comment as above. |
+ scrollbarTransformVertical.Translate(-layerTreeImpl()->device_scale_factor() * scrollOffset().x(), 0); |
+ if (m_verticalScrollbarLayer) |
+ m_verticalScrollbarLayer->setImplTransform(scrollbarTransformVertical); |
+ // If we're using pinch-zoom scrollbars, we don't want them |
+ // clipped to the untransformed bounds, so we re-direct |
+ // the implTransform to the clip layer instead. |
+ if (parent()) { |
+ parent()->setImplTransform(transform); |
+ redirectedToClipLayer = true; |
+ } |
+ } |
+ |
+ if (!redirectedToClipLayer && m_implTransform != transform) { |
+ m_implTransform = transform; |
+ noteLayerPropertyChangedForSubtree(); |
+ } |
} |
void LayerImpl::setDoubleSided(bool doubleSided) |
@@ -969,4 +1018,14 @@ void LayerImpl::setVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer) |
m_verticalScrollbarLayer->setScrollLayerId(id()); |
} |
+void LayerImpl::setHorizontalPinchZoomScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer) |
+{ |
+ m_horizontalPinchZoomScrollbarLayer = scrollbarLayer; |
+} |
+ |
+void LayerImpl::setVerticalPinchZoomScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer) |
+{ |
+ m_verticalPinchZoomScrollbarLayer = scrollbarLayer; |
+} |
+ |
} // namespace cc |