diff options
author | Patrick Scott <phanna@android.com> | 2010-12-09 18:12:20 -0500 |
---|---|---|
committer | Patrick Scott <phanna@android.com> | 2010-12-13 08:23:29 -0500 |
commit | fe812d40b53dc52d5c929e39b5e293af8b6cb4e4 (patch) | |
tree | 81002048cd73d5fa21b7cac3b047c2f1b1755b64 /WebCore/platform/graphics/android/LayerAndroid.cpp | |
parent | 83ddee4501f0c2f48d1073e0185a2fb0a732c929 (diff) | |
download | external_webkit-fe812d40b53dc52d5c929e39b5e293af8b6cb4e4.zip external_webkit-fe812d40b53dc52d5c929e39b5e293af8b6cb4e4.tar.gz external_webkit-fe812d40b53dc52d5c929e39b5e293af8b6cb4e4.tar.bz2 |
Fix hit testing inside layers.
* Prevent asking for a sync in GraphicsLayerAndroid if some property has not
changed.
* Remove scrolling logic from LayerAndroid and create a subclass for scrollable
layers.
* Report the scrolling limits to the layer in order to scroll iframes (not
turned on) and to avoid computing them each time the layer is scrolled.
* Change the foreground rect calculations to better match the non-overflow case.
* During hit testing, intersect the hitTestClip with the foreground and
background to prevent false positives in the layer.
* Prepare for iframe scrolling by adding code to trigger compositing for
iframes. This currently works great except for navigation so it disabled for
now.
Bug: 3258631
Change-Id: I0da2d8dbe25376c6aa4f485c9350048c82c6f563
Diffstat (limited to 'WebCore/platform/graphics/android/LayerAndroid.cpp')
-rw-r--r-- | WebCore/platform/graphics/android/LayerAndroid.cpp | 45 |
1 files changed, 1 insertions, 44 deletions
diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp index ca9a0e3..f02136a 100644 --- a/WebCore/platform/graphics/android/LayerAndroid.cpp +++ b/WebCore/platform/graphics/android/LayerAndroid.cpp @@ -51,7 +51,6 @@ LayerAndroid::LayerAndroid(bool isRootLayer) : SkLayer(), m_haveClip(false), m_doRotation(false), m_isFixed(false), - m_contentScrollable(false), m_recordingPicture(0), m_contentsImage(0), m_extra(0), @@ -68,7 +67,6 @@ LayerAndroid::LayerAndroid(bool isRootLayer) : SkLayer(), LayerAndroid::LayerAndroid(const LayerAndroid& layer) : SkLayer(layer), m_isRootLayer(layer.m_isRootLayer), m_haveClip(layer.m_haveClip), - m_contentScrollable(layer.m_contentScrollable), m_extra(0), // deliberately not copied m_uniqueId(layer.m_uniqueId) { @@ -96,7 +94,7 @@ LayerAndroid::LayerAndroid(const LayerAndroid& layer) : SkLayer(layer), SkSafeRef(m_recordingPicture); for (int i = 0; i < layer.countChildren(); i++) - addChild(new LayerAndroid(*layer.getChild(i)))->unref(); + addChild(layer.getChild(i)->copy())->unref(); KeyframesMap::const_iterator end = layer.m_animations.end(); for (KeyframesMap::const_iterator it = layer.m_animations.begin(); it != end; ++it) @@ -110,7 +108,6 @@ LayerAndroid::LayerAndroid(SkPicture* picture) : SkLayer(), m_haveClip(false), m_doRotation(false), m_isFixed(false), - m_contentScrollable(false), m_recordingPicture(picture), m_contentsImage(0), m_extra(0), @@ -476,46 +473,6 @@ SkPicture* LayerAndroid::recordContext() return 0; } -bool LayerAndroid::scrollTo(int x, int y) { - SkIRect scrollBounds; - getScrollRect(&scrollBounds); - if (scrollBounds.fRight == 0 && scrollBounds.fBottom == 0) - return false; - - SkScalar newX = SkScalarPin(x, 0, scrollBounds.fRight); - SkScalar newY = SkScalarPin(y, 0, scrollBounds.fBottom); - // Check for no change. - if (newX == scrollBounds.fLeft && newY == scrollBounds.fTop) - return false; - - SkScalar diffX = newX - scrollBounds.fLeft; - SkScalar diffY = newY - scrollBounds.fTop; - const SkPoint& pos = getPosition(); - setPosition(pos.fX - diffX, pos.fY - diffY); - return true; -} - -void LayerAndroid::getScrollRect(SkIRect* out) const { - if (!contentIsScrollable()) - return; - - // Scrollable layers have a mask layer and then the actual main layer. - if (getParent() == 0 || getParent()->getParent() == 0) - return; - LayerAndroid* realLayer = static_cast<LayerAndroid*>(getParent()->getParent()); - - SkRect scrollBounds; - realLayer->bounds(&scrollBounds); - - const SkPoint& maskLayerPosition = getParent()->getPosition(); - const SkPoint& pos = getPosition(); - // Our original position is the offset of the mask layer's position. - out->fLeft = maskLayerPosition.fX - pos.fX; - out->fTop = maskLayerPosition.fY - pos.fY; - out->fRight = getSize().width() - scrollBounds.width(); - out->fBottom = getSize().height() - scrollBounds.height(); -} - bool LayerAndroid::prepareContext(bool force) { if (masksToBounds()) |