summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.mk1
-rw-r--r--Source/WebCore/platform/graphics/android/BaseTile.cpp10
-rw-r--r--Source/WebCore/platform/graphics/android/BaseTile.h6
-rw-r--r--Source/WebCore/platform/graphics/android/PaintTileOperation.cpp2
-rw-r--r--Source/WebCore/platform/graphics/android/PaintTileOperation.h4
-rw-r--r--Source/WebCore/platform/graphics/android/TiledPage.cpp4
-rw-r--r--Source/WebCore/platform/graphics/android/TiledTexture.cpp2
-rw-r--r--Source/WebKit/android/WebCoreSupport/EditorClientAndroid.cpp18
-rw-r--r--Source/WebKit/android/jni/WebViewCore.cpp27
-rw-r--r--Source/WebKit/android/jni/WebViewCore.h6
10 files changed, 58 insertions, 22 deletions
diff --git a/Android.mk b/Android.mk
index e46cd93..d01ef64 100644
--- a/Android.mk
+++ b/Android.mk
@@ -285,6 +285,7 @@ LOCAL_SHARED_LIBRARIES := \
libicuuc \
libicui18n \
libmedia \
+ libmedia_native \
libnativehelper \
libskia \
libsqlite \
diff --git a/Source/WebCore/platform/graphics/android/BaseTile.cpp b/Source/WebCore/platform/graphics/android/BaseTile.cpp
index b5c0f0a..d15feeb 100644
--- a/Source/WebCore/platform/graphics/android/BaseTile.cpp
+++ b/Source/WebCore/platform/graphics/android/BaseTile.cpp
@@ -48,7 +48,6 @@ namespace WebCore {
BaseTile::BaseTile(bool isLayerTile)
: m_glWebViewState(0)
- , m_painter(0)
, m_x(-1)
, m_y(-1)
, m_page(0)
@@ -85,11 +84,10 @@ BaseTile::~BaseTile()
// All the following functions must be called from the main GL thread.
-void BaseTile::setContents(TilePainter* painter, int x, int y, float scale)
+void BaseTile::setContents(int x, int y, float scale)
{
// TODO: investigate whether below check/discard is necessary
- if (!painter
- || (m_x != x)
+ if ((m_x != x)
|| (m_y != y)
|| (m_scale != scale)) {
// neither texture is relevant
@@ -97,7 +95,6 @@ void BaseTile::setContents(TilePainter* painter, int x, int y, float scale)
}
android::AutoMutex lock(m_atomicSync);
- m_painter = painter;
m_x = x;
m_y = y;
m_scale = scale;
@@ -288,7 +285,7 @@ bool BaseTile::isTileVisible(const IntRect& viewTileBounds)
}
// This is called from the texture generation thread
-void BaseTile::paintBitmap()
+void BaseTile::paintBitmap(TilePainter* painter)
{
// We acquire the values below atomically. This ensures that we are reading
// values correctly across cores. Further, once we have these values they
@@ -300,7 +297,6 @@ void BaseTile::paintBitmap()
float scale = m_scale;
const int x = m_x;
const int y = m_y;
- TilePainter* painter = m_painter;
if (!dirty || !texture) {
m_atomicSync.unlock();
diff --git a/Source/WebCore/platform/graphics/android/BaseTile.h b/Source/WebCore/platform/graphics/android/BaseTile.h
index f02386b..ab16dc9 100644
--- a/Source/WebCore/platform/graphics/android/BaseTile.h
+++ b/Source/WebCore/platform/graphics/android/BaseTile.h
@@ -94,7 +94,7 @@ public:
bool isLayerTile() { return m_isLayerTile; }
- void setContents(TilePainter* painter, int x, int y, float scale);
+ void setContents(int x, int y, float scale);
void setPage(TiledPage* page) { m_page = page; }
void reserveTexture();
@@ -105,7 +105,7 @@ public:
const TransformationMatrix* transform);
// the only thread-safe function called by the background thread
- void paintBitmap();
+ void paintBitmap(TilePainter* painter);
bool intersectWithRect(int x, int y, int tileWidth, int tileHeight,
float scale, const SkRect& dirtyRect,
@@ -138,14 +138,12 @@ public:
virtual bool removeTexture(BaseTileTexture* texture);
virtual TiledPage* page() { return m_page; }
virtual GLWebViewState* state() { return m_glWebViewState; }
- TilePainter* painter() { return m_painter; }
private:
void validatePaint();
GLWebViewState* m_glWebViewState;
- TilePainter* m_painter;
int m_x;
int m_y;
diff --git a/Source/WebCore/platform/graphics/android/PaintTileOperation.cpp b/Source/WebCore/platform/graphics/android/PaintTileOperation.cpp
index a79298c..1fcb765 100644
--- a/Source/WebCore/platform/graphics/android/PaintTileOperation.cpp
+++ b/Source/WebCore/platform/graphics/android/PaintTileOperation.cpp
@@ -67,7 +67,7 @@ bool PaintTileOperation::operator==(const QueuedOperation* operation)
void PaintTileOperation::run()
{
if (m_tile) {
- m_tile->paintBitmap();
+ m_tile->paintBitmap(m_painter);
m_tile->setRepaintPending(false);
m_tile = 0;
}
diff --git a/Source/WebCore/platform/graphics/android/PaintTileOperation.h b/Source/WebCore/platform/graphics/android/PaintTileOperation.h
index 4e98287..05825e2 100644
--- a/Source/WebCore/platform/graphics/android/PaintTileOperation.h
+++ b/Source/WebCore/platform/graphics/android/PaintTileOperation.h
@@ -38,13 +38,13 @@ class ImageTexture;
class PaintTileOperation : public QueuedOperation {
public:
- PaintTileOperation(BaseTile* tile, TilePainter* painter = 0);
+ PaintTileOperation(BaseTile* tile, TilePainter* painter);
virtual ~PaintTileOperation();
virtual bool operator==(const QueuedOperation* operation);
virtual void run();
// returns a rendering priority for m_tile, lower values are processed faster
virtual int priority();
- TilePainter* painter() { return m_tile->painter(); }
+ TilePainter* painter() { return m_painter; }
float scale() { return m_tile->scale(); }
private:
diff --git a/Source/WebCore/platform/graphics/android/TiledPage.cpp b/Source/WebCore/platform/graphics/android/TiledPage.cpp
index df740e7..afa2014 100644
--- a/Source/WebCore/platform/graphics/android/TiledPage.cpp
+++ b/Source/WebCore/platform/graphics/android/TiledPage.cpp
@@ -171,7 +171,7 @@ void TiledPage::prepareRow(bool goingLeft, int tilesInRow, int firstTileX, int y
currentTile->setGLWebViewState(m_glWebViewState);
currentTile->setPage(this);
- currentTile->setContents(this, x, y, m_scale);
+ currentTile->setContents(x, y, m_scale);
// TODO: move below (which is largely the same for layers / tiled
// page) into prepare() function
@@ -183,7 +183,7 @@ void TiledPage::prepareRow(bool goingLeft, int tilesInRow, int firstTileX, int y
if (currentTile->backTexture()
&& currentTile->isDirty()
&& !currentTile->isRepaintPending()) {
- PaintTileOperation *operation = new PaintTileOperation(currentTile);
+ PaintTileOperation *operation = new PaintTileOperation(currentTile, this);
TilesManager::instance()->scheduleOperation(operation);
}
}
diff --git a/Source/WebCore/platform/graphics/android/TiledTexture.cpp b/Source/WebCore/platform/graphics/android/TiledTexture.cpp
index 9ce6f6d..039e28c 100644
--- a/Source/WebCore/platform/graphics/android/TiledTexture.cpp
+++ b/Source/WebCore/platform/graphics/android/TiledTexture.cpp
@@ -168,7 +168,7 @@ void TiledTexture::prepareTile(int x, int y, TilePainter* painter)
}
ALOGV("preparing tile %p at %d, %d, painter is %p", tile, x, y, painter);
- tile->setContents(painter, x, y, m_scale);
+ tile->setContents(x, y, m_scale);
// TODO: move below (which is largely the same for layers / tiled page) into
// prepareGL() function
diff --git a/Source/WebKit/android/WebCoreSupport/EditorClientAndroid.cpp b/Source/WebKit/android/WebCoreSupport/EditorClientAndroid.cpp
index 785f0a8..042c227 100644
--- a/Source/WebKit/android/WebCoreSupport/EditorClientAndroid.cpp
+++ b/Source/WebKit/android/WebCoreSupport/EditorClientAndroid.cpp
@@ -228,8 +228,22 @@ void EditorClientAndroid::checkGrammarOfString(unsigned short const*, int, WTF::
void EditorClientAndroid::checkSpellingOfString(unsigned short const*, int, int*, int*) {}
String EditorClientAndroid::getAutoCorrectSuggestionForMisspelledWord(const String&) { return String(); }
void EditorClientAndroid::textFieldDidEndEditing(Element*) {}
-void EditorClientAndroid::textDidChangeInTextArea(Element*) {}
-void EditorClientAndroid::textDidChangeInTextField(Element*) {}
+void EditorClientAndroid::textDidChangeInTextArea(Element* element)
+{
+ Frame* frame = m_page->focusController()->focusedOrMainFrame();
+ if (!frame || !frame->view())
+ return;
+ WebViewCore* webViewCore = WebViewCore::getWebViewCore(frame->view());
+ webViewCore->updateTextSizeAndScroll(element);
+}
+void EditorClientAndroid::textDidChangeInTextField(Element* element)
+{
+ Frame* frame = m_page->focusController()->focusedOrMainFrame();
+ if (!frame || !frame->view())
+ return;
+ WebViewCore* webViewCore = WebViewCore::getWebViewCore(frame->view());
+ webViewCore->updateTextSizeAndScroll(element);
+}
void EditorClientAndroid::textFieldDidBeginEditing(Element*) {}
void EditorClientAndroid::ignoreWordInSpellDocument(String const&) {}
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp
index d263a22..9aaec25 100644
--- a/Source/WebKit/android/jni/WebViewCore.cpp
+++ b/Source/WebKit/android/jni/WebViewCore.cpp
@@ -337,6 +337,7 @@ struct WebViewCore::JavaGlue {
jmethodID m_sendViewInvalidate;
jmethodID m_updateTextfield;
jmethodID m_updateTextSelection;
+ jmethodID m_updateTextSizeAndScroll;
jmethodID m_clearTextEntry;
jmethodID m_restoreScale;
jmethodID m_needTouchEvents;
@@ -471,6 +472,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m
m_javaGlue->m_sendViewInvalidate = GetJMethod(env, clazz, "sendViewInvalidate", "(IIII)V");
m_javaGlue->m_updateTextfield = GetJMethod(env, clazz, "updateTextfield", "(IZLjava/lang/String;I)V");
m_javaGlue->m_updateTextSelection = GetJMethod(env, clazz, "updateTextSelection", "(IIIII)V");
+ m_javaGlue->m_updateTextSizeAndScroll = GetJMethod(env, clazz, "updateTextSizeAndScroll", "(IIIII)V");
m_javaGlue->m_clearTextEntry = GetJMethod(env, clazz, "clearTextEntry", "()V");
m_javaGlue->m_restoreScale = GetJMethod(env, clazz, "restoreScale", "(FF)V");
m_javaGlue->m_needTouchEvents = GetJMethod(env, clazz, "needTouchEvents", "(Z)V");
@@ -3802,6 +3804,24 @@ void WebViewCore::updateTextSelection()
checkException(env);
}
+void WebViewCore::updateTextSizeAndScroll(WebCore::Node* node)
+{
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject javaObject = m_javaGlue->object(env);
+ if (!javaObject.get())
+ return;
+ RenderTextControl* rtc = toRenderTextControl(node);
+ if (!rtc)
+ return;
+ int width = rtc->scrollWidth();
+ int height = rtc->contentHeight();
+ int scrollX = rtc->scrollLeft();
+ int scrollY = rtc->scrollTop();
+ env->CallVoidMethod(javaObject.get(), m_javaGlue->m_updateTextSizeAndScroll,
+ reinterpret_cast<int>(node), width, height, scrollX, scrollY);
+ checkException(env);
+}
+
void WebViewCore::updateTextfield(WebCore::Node* ptr, bool changeToPassword,
const WTF::String& text)
{
@@ -4212,13 +4232,14 @@ int WebViewCore::findTextOnPage(const WTF::String &text)
frame->document()->markers()->removeMarkers(DocumentMarker::TextMatch);
m_matchCount += frame->editor()->countMatchesForText(text, findOptions,
0, true);
- updateMatchCount();
frame->editor()->setMarkedTextMatchesAreHighlighted(true);
frame = frame->tree()->traverseNextWithWrap(false);
} while (frame);
-
m_activeMatchIndex = m_matchCount - 1; // prime first findNext
- findNextOnPage(true);
+ if (!m_matchCount) // send at least one update, even if no hits
+ updateMatchCount();
+ else
+ findNextOnPage(true);
return m_matchCount;
}
diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h
index baf9995..6850111 100644
--- a/Source/WebKit/android/jni/WebViewCore.h
+++ b/Source/WebKit/android/jni/WebViewCore.h
@@ -229,6 +229,12 @@ namespace android {
*/
void updateTextSelection();
+ /**
+ * Updates the java side with the node's content size and scroll
+ * position.
+ */
+ void updateTextSizeAndScroll(WebCore::Node* node);
+
void clearTextEntry();
// JavaScript support
void jsAlert(const WTF::String& url, const WTF::String& text);