diff options
author | Patrick Scott <phanna@android.com> | 2010-08-13 16:17:40 -0400 |
---|---|---|
committer | Patrick Scott <phanna@android.com> | 2010-08-16 12:39:44 -0400 |
commit | 726264480d16a18c02f405aff63a32ba06fb0476 (patch) | |
tree | 97f7b473af2ce50a7165849008c1a4f385da3c5f /WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp | |
parent | a01792f8060881461b672472ba3dfdd77044e0a5 (diff) | |
download | external_webkit-726264480d16a18c02f405aff63a32ba06fb0476.zip external_webkit-726264480d16a18c02f405aff63a32ba06fb0476.tar.gz external_webkit-726264480d16a18c02f405aff63a32ba06fb0476.tar.bz2 |
Update navigation in scrollable layers.
Set the foreground clip after drawing. Use the absolute bounds to
compute the local foreground clip in order to compensate for any
outline.
Consolidate the check for overflow scrolling into RenderLayer.
Request a compositing update after computing the scroll dimensions.
Only change the foregroundRect of the layer during paint so that the
outline rect (and background/layerBounds) are correct.
Draw the outline as part of the background phase. During painting of
a layer, scroll to (0,0), paint, then scroll back.
When clicking on an element in a layer, scroll to the position of the
element but do not scroll back. This makes text input fields visible
to the tree and will properly update when typing. Record the original
scroll position of layers in order to offset the bounds of nodes when
checking the nav cache. Make sure to reset all cached layers during
setRootLayer. Otherwise we were reaching into layers from the wrong
thread.
Change-Id: Id9827ec461989b0869a8252d4d2563ecd12c5fac
Diffstat (limited to 'WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp')
-rw-r--r-- | WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp index a5ca972..adbd18b 100644 --- a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp +++ b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp @@ -106,6 +106,12 @@ SkLength convertLength(Length l) { return length; } +static RenderLayer* renderLayerFromClient(GraphicsLayerClient* client) { + if (client) + return static_cast<RenderLayerBacking*>(client)->owningLayer(); + return 0; +} + GraphicsLayerAndroid::GraphicsLayerAndroid(GraphicsLayerClient* client) : GraphicsLayer(client), m_needsSyncChildren(false), @@ -122,9 +128,8 @@ GraphicsLayerAndroid::GraphicsLayerAndroid(GraphicsLayerClient* client) : m_currentPosition(0, 0) { m_contentLayer = new LayerAndroid(true); - if (m_client) { - RenderLayerBacking* backing = static_cast<RenderLayerBacking*>(m_client); - RenderLayer* renderLayer = backing->owningLayer(); + RenderLayer* renderLayer = renderLayerFromClient(m_client); + if (renderLayer) { m_contentLayer->setIsRootLayer(renderLayer->isRootLayer() && !(renderLayer->renderer()->frame()->ownerElement())); } @@ -224,8 +229,7 @@ void GraphicsLayerAndroid::updateFixedPosition() if (!m_client) return; - RenderLayerBacking* backing = static_cast<RenderLayerBacking*>(m_client); - RenderLayer* renderLayer = backing->owningLayer(); + RenderLayer* renderLayer = renderLayerFromClient(m_client); RenderView* view = static_cast<RenderView*>(renderLayer->renderer()); // If we are a fixed position layer, just set it @@ -293,9 +297,6 @@ void GraphicsLayerAndroid::setSize(const FloatSize& size) MLOG("(%x) setSize (%.2f,%.2f)", this, size.width(), size.height()); GraphicsLayer::setSize(size); m_contentLayer->setSize(size.width(), size.height()); - m_contentLayer->setForegroundClip( - SkRect::MakeWH(SkFloatToScalar(size.width()), - SkFloatToScalar(size.height()))); updateFixedPosition(); askForSync(); } @@ -473,6 +474,22 @@ bool GraphicsLayerAndroid::repaint() m_needsRepaint = false; m_invalidatedRects.clear(); + RenderLayer* layer = renderLayerFromClient(m_client); + // Use the absolute bounds of the renderer instead of the layer's + // bounds because the layer will add in the outline. What we want + // is the content bounds inside the outline. + FloatRect clip = layer->renderer()->absoluteBoundingBoxRect(); + // Move the clip local to the layer position. + clip.move(-m_position.x(), -m_position.y()); + if (layer->hasOverflowScroll()) { + // If this is a scrollable layer, inset the clip by the border. + RenderBox* box = layer->renderBox(); + clip.move(box->borderLeft(), box->borderTop()); + clip.setWidth(clip.width() - box->borderLeft() - box->borderRight()); + clip.setHeight(clip.height() - box->borderTop() - box->borderBottom()); + } + m_contentLayer->setForegroundClip(clip); + return true; } return false; @@ -927,11 +944,6 @@ void GraphicsLayerAndroid::notifyClientAnimationStarted() } } -void GraphicsLayerAndroid::setContentsClip(const IntRect& clip) -{ - m_contentLayer->setForegroundClip(clip); -} - } // namespace WebCore #endif // USE(ACCELERATED_COMPOSITING) |