summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-05-05 16:16:52 -0700
committerJohn Reck <jreck@google.com>2011-05-05 17:04:12 -0700
commitdae0bcf2fadac43fd4c32c263ad3c1075ca8511d (patch)
tree9d55657870da2297e7e0b62c385ebbd27a2d3736
parent703236f98a63a5ed7da8d9014d30dd30b1a6db6f (diff)
downloadexternal_webkit-dae0bcf2fadac43fd4c32c263ad3c1075ca8511d.zip
external_webkit-dae0bcf2fadac43fd4c32c263ad3c1075ca8511d.tar.gz
external_webkit-dae0bcf2fadac43fd4c32c263ad3c1075ca8511d.tar.bz2
Fix issue where solid was drawn instead of ring
Bug: 4283275 Change-Id: Ie05440e3618ffa36004af35fed3d350763f09d50
-rw-r--r--WebCore/platform/graphics/android/GLWebViewState.cpp36
-rw-r--r--WebCore/platform/graphics/android/GLWebViewState.h3
-rw-r--r--WebKit/android/nav/WebView.cpp2
3 files changed, 33 insertions, 8 deletions
diff --git a/WebCore/platform/graphics/android/GLWebViewState.cpp b/WebCore/platform/graphics/android/GLWebViewState.cpp
index 74f03f5..4acd563 100644
--- a/WebCore/platform/graphics/android/GLWebViewState.cpp
+++ b/WebCore/platform/graphics/android/GLWebViewState.cpp
@@ -159,11 +159,12 @@ void GLWebViewState::setBaseLayer(BaseLayerAndroid* layer, const SkRegion& inval
TilesManager::instance()->setShowVisualIndicator(showVisualIndicator);
}
-void GLWebViewState::setRings(Vector<IntRect>& rings)
+void GLWebViewState::setRings(Vector<IntRect>& rings, bool isPressed)
{
android::Mutex::Autolock lock(m_baseLayerLock);
m_displayRings = true;
m_rings = rings;
+ m_ringsIsPressed = isPressed;
}
void GLWebViewState::invalRegion(const SkRegion& region)
@@ -241,16 +242,22 @@ void GLWebViewState::drawFocusRing(IntRect& srcRect)
{
// TODO: use a 9-patch texture to draw the focus ring
// instead of plain colors
- const int border = 1;
- const int fuzzyBorder = border * 2;
- const int padding = 4;
const float alpha = 0.3;
- const float borderAlpha = 0.40;
+ float borderAlpha = 0.40;
const int r = 104;
const int g = 153;
const int b = 255;
+ int padding = 4;
+ int border = 1;
+ int fuzzyBorder = border * 2;
+ if (!m_ringsIsPressed) {
+ padding = 0;
+ border = 2;
+ fuzzyBorder = 3;
+ borderAlpha = 0.2;
+ }
if (m_focusRingTexture == -1)
m_focusRingTexture = GLUtils::createSampleColorTexture(r, g, b);
@@ -276,7 +283,24 @@ void GLWebViewState::drawFocusRing(IntRect& srcRect)
TilesManager::instance()->shader()->drawQuad(rTop, m_focusRingTexture, borderAlpha);
TilesManager::instance()->shader()->drawQuad(rRight, m_focusRingTexture, borderAlpha);
TilesManager::instance()->shader()->drawQuad(rBottom, m_focusRingTexture, borderAlpha);
- TilesManager::instance()->shader()->drawQuad(rOverlay, m_focusRingTexture, alpha);
+ if (m_ringsIsPressed) {
+ TilesManager::instance()->shader()->drawQuad(rOverlay, m_focusRingTexture, alpha);
+ } else {
+ rLeft.set(rect.x() - fuzzyBorder, rect.y(),
+ rect.x(), rect.y() + rect.height());
+ rTop.set(rect.x() - fuzzyBorder, rect.y() - fuzzyBorder,
+ rect.x() + rect.width() + fuzzyBorder, rect.y());
+ rRight.set(rect.x() + rect.width(), rect.y(),
+ rect.x() + rect.width() + fuzzyBorder,
+ rect.y() + rect.height());
+ rBottom.set(rect.x() - fuzzyBorder, rect.y() + rect.height(),
+ rect.x() + rect.width() + fuzzyBorder,
+ rect.y() + rect.height() + fuzzyBorder);
+ TilesManager::instance()->shader()->drawQuad(rLeft, m_focusRingTexture, alpha);
+ TilesManager::instance()->shader()->drawQuad(rTop, m_focusRingTexture, alpha);
+ TilesManager::instance()->shader()->drawQuad(rRight, m_focusRingTexture, alpha);
+ TilesManager::instance()->shader()->drawQuad(rBottom, m_focusRingTexture, alpha);
+ }
}
void GLWebViewState::paintExtras()
diff --git a/WebCore/platform/graphics/android/GLWebViewState.h b/WebCore/platform/graphics/android/GLWebViewState.h
index 7892337..980dd3c 100644
--- a/WebCore/platform/graphics/android/GLWebViewState.h
+++ b/WebCore/platform/graphics/android/GLWebViewState.h
@@ -181,7 +181,7 @@ public:
void scheduleUpdate(const double& currentTime, const SkIRect& viewport, float scale);
void paintExtras();
- void setRings(Vector<IntRect>& rings);
+ void setRings(Vector<IntRect>& rings, bool isPressed);
void resetRings();
void drawFocusRing(IntRect& rect);
@@ -290,6 +290,7 @@ private:
#endif
bool m_displayRings;
Vector<IntRect> m_rings;
+ bool m_ringsIsPressed;
int m_focusRingTexture;
};
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp
index f4f8ce0..610a29d 100644
--- a/WebKit/android/nav/WebView.cpp
+++ b/WebKit/android/nav/WebView.cpp
@@ -488,7 +488,7 @@ bool drawGL(WebCore::IntRect& viewRect, WebCore::IntRect* invalRect, WebCore::In
m_glWebViewState->resetRings();
if (extra) {
if (extra == &m_ring) {
- m_glWebViewState->setRings(m_ring.rings());
+ m_glWebViewState->setRings(m_ring.rings(), m_ring.m_isPressed);
} else {
LayerAndroid mainPicture(m_navPictureUI);
PictureSet* content = m_baseLayer->content();