summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android
diff options
context:
space:
mode:
authorVictoria Lease <violets@google.com>2012-01-17 13:21:47 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-01-17 13:21:47 -0800
commite96b048156eff6c16137059734b1d411e8b3aa37 (patch)
tree6f013c084c06f43d58e5fb51394c2f4c73524e3e /Source/WebCore/platform/graphics/android
parent567625eea8f93777ef78246d5293b742a68292bb (diff)
parent5ce1aad01a972e0d333ad599a2117a2cdf981221 (diff)
downloadexternal_webkit-e96b048156eff6c16137059734b1d411e8b3aa37.zip
external_webkit-e96b048156eff6c16137059734b1d411e8b3aa37.tar.gz
external_webkit-e96b048156eff6c16137059734b1d411e8b3aa37.tar.bz2
Merge "Only draw cursor rings once."
Diffstat (limited to 'Source/WebCore/platform/graphics/android')
-rw-r--r--Source/WebCore/platform/graphics/android/GLExtras.cpp4
-rw-r--r--Source/WebCore/platform/graphics/android/android_graphics.cpp23
-rw-r--r--Source/WebCore/platform/graphics/android/android_graphics.h4
3 files changed, 29 insertions, 2 deletions
diff --git a/Source/WebCore/platform/graphics/android/GLExtras.cpp b/Source/WebCore/platform/graphics/android/GLExtras.cpp
index bf489c9..9ad369a 100644
--- a/Source/WebCore/platform/graphics/android/GLExtras.cpp
+++ b/Source/WebCore/platform/graphics/android/GLExtras.cpp
@@ -165,6 +165,10 @@ void GLExtras::drawRegion(const SkRegion& region, bool fill,
void GLExtras::drawCursorRings(const LayerAndroid* layer)
{
+ int layerId = layer ? layer->uniqueId() : -1;
+ if (layerId != m_ring->layerId())
+ return;
+
SkRegion region;
for (size_t i = 0; i < m_ring->rings().size(); i++) {
IntRect rect = m_ring->rings().at(i);
diff --git a/Source/WebCore/platform/graphics/android/android_graphics.cpp b/Source/WebCore/platform/graphics/android/android_graphics.cpp
index e88c65d..57f1b41 100644
--- a/Source/WebCore/platform/graphics/android/android_graphics.cpp
+++ b/Source/WebCore/platform/graphics/android/android_graphics.cpp
@@ -37,6 +37,12 @@
namespace android {
+CursorRing::CursorRing(WebViewCore* core)
+ : m_viewImpl(core)
+ , m_layerId(-1)
+{
+}
+
// The CSS values for the inner and outer widths may be specified as fractions
#define WIDTH_SCALE 0.0625f // 1/16, to offset the scale in CSSStyleSelector
@@ -116,12 +122,27 @@ void CursorRing::setIsButton(const CachedNode* node)
bool CursorRing::setup()
{
- m_node->cursorRings(m_frame, &m_rings);
+ m_layerId = -1;
+ if (m_frame && m_root) {
+ const CachedLayer* cachedLayer = m_frame->layer(m_node);
+ if (cachedLayer) {
+ const WebCore::LayerAndroid* rootLayer = m_root->rootLayer();
+ const LayerAndroid* aLayer = cachedLayer->layer(rootLayer);
+ if (aLayer)
+ m_layerId = aLayer->uniqueId();
+ }
+ }
+ if (m_layerId == -1)
+ m_node->cursorRings(m_frame, &m_rings);
+ else
+ m_node->localCursorRings(m_frame, &m_rings);
+
if (!m_rings.size()) {
DBG_NAV_LOG("!rings.size()");
m_viewImpl->m_hasCursorBounds = false;
return false;
}
+
setIsButton(m_node);
m_bounds = m_node->bounds(m_frame);
m_viewImpl->updateCursorBounds(m_root, m_frame, m_node);
diff --git a/Source/WebCore/platform/graphics/android/android_graphics.h b/Source/WebCore/platform/graphics/android/android_graphics.h
index 60ac115..bd08a6e 100644
--- a/Source/WebCore/platform/graphics/android/android_graphics.h
+++ b/Source/WebCore/platform/graphics/android/android_graphics.h
@@ -52,12 +52,13 @@ class WebViewCore;
class CursorRing : public DrawExtra {
public:
- CursorRing(WebViewCore* core) : m_viewImpl(core) {}
+ CursorRing(WebViewCore* core);
virtual ~CursorRing() {}
virtual void draw(SkCanvas* , LayerAndroid* , IntRect* );
void setIsButton(const CachedNode* );
bool setup();
WTF::Vector<IntRect>& rings() { return m_rings; }
+ int layerId() const { return m_layerId; }
private:
friend class WebView;
friend class WebCore::GLExtras;
@@ -71,6 +72,7 @@ private:
const CachedNode* m_node;
bool m_isButton;
bool m_isPressed;
+ int m_layerId;
};
}