summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/android/nav/WebView.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit/android/nav/WebView.cpp')
-rw-r--r--Source/WebKit/android/nav/WebView.cpp143
1 files changed, 6 insertions, 137 deletions
diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp
index 2bd76f5..162d6bd 100644
--- a/Source/WebKit/android/nav/WebView.cpp
+++ b/Source/WebKit/android/nav/WebView.cpp
@@ -144,9 +144,8 @@ struct JavaGlue {
} m_javaGlue;
WebView(JNIEnv* env, jobject javaWebView, int viewImpl, WTF::String drawableDir,
- bool isHighEndGfx) :
- m_ring((WebViewCore*) viewImpl)
- , m_isHighEndGfx(isHighEndGfx)
+ bool isHighEndGfx)
+ : m_isHighEndGfx(isHighEndGfx)
{
memset(m_extras, 0, DRAW_EXTRAS_SIZE * sizeof(DrawExtra*));
jclass clazz = env->FindClass("android/webkit/WebView");
@@ -193,7 +192,6 @@ WebView(JNIEnv* env, jobject javaWebView, int viewImpl, WTF::String drawableDir,
m_heightCanMeasure = false;
m_lastDx = 0;
m_lastDxTime = 0;
- m_ringAnimationEnd = 0;
m_baseLayer = 0;
m_glDrawFunctor = 0;
m_isDrawingPaused = false;
@@ -230,33 +228,6 @@ DrawExtra* getDrawExtra(DrawExtras extras)
return m_extras[extras - 1];
}
-DrawExtra* getDrawExtraLegacy(DrawExtras extras)
-{
- CachedRoot* root = getFrameCache(AllowNewer);
- if (!root) {
- DBG_NAV_LOG("!root");
- if (extras == DrawExtrasCursorRing)
- resetCursorRing();
- }
- DrawExtra* extra = getDrawExtra(extras);
- if (!extra) {
- switch (extras) {
- case DrawExtrasCursorRing:
- if (drawCursorPreamble(root) && m_ring.setup()) {
- if (m_ring.m_isPressed || m_ringAnimationEnd == UINT_MAX)
- extra = &m_ring;
- drawCursorPostamble();
- }
- break;
- // Just to prevent compiler warnings
- case DrawExtrasSelection:
- case DrawExtrasNone:
- break;
- }
- }
- return extra;
-}
-
void stopGL()
{
#if USE(ACCELERATED_COMPOSITING)
@@ -335,60 +306,6 @@ void scrollRectOnScreen(const IntRect& rect)
viewInvalidate();
}
-void resetCursorRing()
-{
- m_ringAnimationEnd = 0;
- m_viewImpl->m_hasCursorBounds = false;
-}
-
-bool drawCursorPreamble(CachedRoot* root)
-{
- if (!root) return false;
- const CachedFrame* frame;
- const CachedNode* node = root->currentCursor(&frame);
- if (!node) {
- DBG_NAV_LOGV("%s", "!node");
- resetCursorRing();
- return false;
- }
- m_ring.setIsButton(node);
- if (node->isHidden()) {
- DBG_NAV_LOG("node->isHidden()");
- m_viewImpl->m_hasCursorBounds = false;
- return false;
- }
-#if USE(ACCELERATED_COMPOSITING)
- if (node->isInLayer() && root->rootLayer()) {
- LayerAndroid* layer = root->rootLayer();
- layer->updateFixedLayersPositions(m_visibleRect);
- layer->updatePositions();
- }
-#endif
- setVisibleRect(root);
- m_ring.m_root = root;
- m_ring.m_frame = frame;
- m_ring.m_node = node;
- SkMSec time = SkTime::GetMSecs();
- m_ring.m_isPressed = time < m_ringAnimationEnd
- && m_ringAnimationEnd != UINT_MAX;
- return true;
-}
-
-void drawCursorPostamble()
-{
- if (m_ringAnimationEnd == UINT_MAX)
- return;
- SkMSec time = SkTime::GetMSecs();
- if (time < m_ringAnimationEnd) {
- // views assume that inval bounds coordinates are non-negative
- WebCore::IntRect invalBounds(0, 0, INT_MAX, INT_MAX);
- invalBounds.intersect(m_ring.m_absBounds);
- postInvalidateDelayed(m_ringAnimationEnd - time, invalBounds);
- } else {
- hideCursor(const_cast<CachedRoot*>(m_ring.m_root));
- }
-}
-
bool drawGL(WebCore::IntRect& viewRect, WebCore::IntRect* invalRect,
WebCore::IntRect& webViewRect, int titleBarHeight,
WebCore::IntRect& clip, float scale, int extras)
@@ -400,7 +317,6 @@ bool drawGL(WebCore::IntRect& viewRect, WebCore::IntRect* invalRect,
if (!m_glWebViewState) {
TilesManager::instance()->setHighEndGfx(m_isHighEndGfx);
m_glWebViewState = new GLWebViewState();
- m_glWebViewState->glExtras()->setCursorRingExtra(&m_ring);
if (m_baseLayer->content()) {
SkRegion region;
SkIRect rect;
@@ -411,7 +327,7 @@ bool drawGL(WebCore::IntRect& viewRect, WebCore::IntRect* invalRect,
}
}
- DrawExtra* extra = getDrawExtraLegacy((DrawExtras) extras);
+ DrawExtra* extra = getDrawExtra((DrawExtras) extras);
unsigned int pic = m_glWebViewState->currentPictureCounter();
m_glWebViewState->glExtras()->setDrawExtra(extra);
@@ -459,7 +375,7 @@ PictureSet* draw(SkCanvas* canvas, SkColor bgColor, DrawExtras extras, bool spli
if (content->draw(canvas))
ret = split ? new PictureSet(*content) : 0;
- DrawExtra* extra = getDrawExtraLegacy(extras);
+ DrawExtra* extra = getDrawExtra(extras);
if (extra)
extra->draw(canvas, 0);
@@ -778,7 +694,6 @@ bool moveCursor(int keyCode, int count, bool ignoreScroll)
}
bool result = false;
if (cachedNode) {
- showCursorUntimed();
m_viewImpl->updateCursorBounds(root, cachedFrame, cachedNode);
root->setCursor(const_cast<CachedFrame*>(cachedFrame),
const_cast<CachedNode*>(cachedNode));
@@ -860,7 +775,6 @@ void selectBestAt(const WebCore::IntRect& rect)
WebCore::IntRect bounds = node->bounds(frame);
root->rootHistory()->setMouseBounds(bounds);
m_viewImpl->updateCursorBounds(root, frame, node);
- showCursorTimed();
root->setCursor(const_cast<CachedFrame*>(frame),
const_cast<CachedNode*>(node));
}
@@ -921,11 +835,6 @@ bool motionUp(int x, int y, int slop)
(WebCore::Frame*) frame->framePointer(),
(WebCore::Node*) result->nodePointer(), rx, ry);
}
- if (result->isTextInput() || result->isSelect()
- || result->isContentEditable()) {
- showCursorUntimed();
- } else
- showCursorTimed();
return pageScrolled;
}
@@ -1012,21 +921,6 @@ void setFindIsUp(bool up)
m_viewImpl->m_findIsUp = up;
}
-void showCursorTimed()
-{
- DBG_NAV_LOG("");
- m_ringAnimationEnd = SkTime::GetMSecs() + PRESSED_STATE_DURATION;
- viewInvalidate();
-}
-
-void showCursorUntimed()
-{
- DBG_NAV_LOG("");
- m_ring.m_isPressed = false;
- m_ringAnimationEnd = UINT_MAX;
- viewInvalidate();
-}
-
void setHeightCanMeasure(bool measure)
{
m_heightCanMeasure = measure;
@@ -1311,7 +1205,8 @@ int getHandleLayerId(SelectText::HandleId handleId, SkIRect& cursorRect) {
m_baseLayer->updateLayerPositions(m_visibleRect);
LayerAndroid* root = compositeRoot();
LayerAndroid* layer = root ? root->findById(layerId) : 0;
- rect = layer->drawTransform()->mapRect(rect);
+ if (layer && layer->drawTransform())
+ rect = layer->drawTransform()->mapRect(rect);
}
cursorRect.set(rect.x(), rect.y(), rect.maxX(), rect.maxY());
return layerId;
@@ -1323,12 +1218,10 @@ private: // local state for WebView
CachedRoot* m_frameCacheUI; // navigation data ready for use
WebViewCore* m_viewImpl;
int m_generation; // associate unique ID with sent kit focus to match with ui
- SkMSec m_ringAnimationEnd;
// Corresponds to the same-named boolean on the java side.
bool m_heightCanMeasure;
int m_lastDx;
SkMSec m_lastDxTime;
- CursorRing m_ring;
DrawExtra* m_extras[DRAW_EXTRAS_SIZE];
BaseLayerAndroid* m_baseLayer;
Functor* m_glDrawFunctor;
@@ -1551,19 +1444,7 @@ static const CachedInput* getInputCandidate(JNIEnv *env, jobject obj)
static jboolean nativePageShouldHandleShiftAndArrows(JNIEnv *env, jobject obj)
{
-#if ENABLE(ANDROID_NAVCACHE)
- const CachedNode* focus = getFocusNode(env, obj);
- if (!focus) return false;
- // Plugins handle shift and arrows whether or not they have focus.
- if (focus->isPlugin()) return true;
- const CachedNode* cursor = getCursorNode(env, obj);
- // ContentEditable nodes should only receive shift and arrows if they have
- // both the cursor and the focus.
- return cursor && cursor->nodePointer() == focus->nodePointer()
- && cursor->isContentEditable();
-#else
return true;
-#endif
}
static jobject nativeCursorNodeBounds(JNIEnv *env, jobject obj)
@@ -1954,12 +1835,6 @@ static void nativeSelectBestAt(JNIEnv *env, jobject obj, jobject jrect)
static void nativeSelectAt(JNIEnv *env, jobject obj, jint x, jint y)
{
- WebView* view = GET_NATIVE_VIEW(env, obj);
- ALOG_ASSERT(view, "view not set in %s", __FUNCTION__);
- WebCore::IntRect rect = IntRect(x, y , 1, 1);
- view->selectBestAt(rect);
- if (view->hasCursorNode())
- view->showCursorUntimed();
}
static jobject nativeLayerBounds(JNIEnv* env, jobject obj, jint jlayer)
@@ -2050,7 +1925,6 @@ static void nativeSetFindIsUp(JNIEnv *env, jobject obj, jboolean isUp)
static void nativeShowCursorTimed(JNIEnv *env, jobject obj)
{
- GET_NATIVE_VIEW(env, obj)->showCursorTimed();
}
static void nativeSetHeightCanMeasure(JNIEnv *env, jobject obj, bool measure)
@@ -2133,7 +2007,6 @@ static bool nativeMoveCursorToNextTextInput(JNIEnv *env, jobject obj)
const WebCore::IntRect& bounds = next->bounds(frame);
root->rootHistory()->setMouseBounds(bounds);
view->getWebViewCore()->updateCursorBounds(root, frame, next);
- view->showCursorUntimed();
root->setCursor(const_cast<CachedFrame*>(frame),
const_cast<CachedNode*>(next));
view->sendMoveFocus(static_cast<WebCore::Frame*>(frame->framePointer()),
@@ -2392,11 +2265,7 @@ static void nativeSetPauseDrawing(JNIEnv *env, jobject obj, jint nativeView,
static bool nativeDisableNavcache(JNIEnv *env, jobject obj)
{
-#if ENABLE(ANDROID_NAVCACHE)
- return false;
-#else
return true;
-#endif
}
static void nativeSetTextSelection(JNIEnv *env, jobject obj, jint nativeView,