diff options
| -rw-r--r-- | Android.v8.mk | 3 | ||||
| -rw-r--r-- | V8Binding/Android.libv8.mk | 4 | ||||
| -rw-r--r-- | V8Binding/Android.v8shell.mk | 2 | ||||
| -rw-r--r-- | V8Binding/v8/src/heap.cc | 53 | ||||
| -rw-r--r-- | V8Binding/v8/src/heap.h | 8 | ||||
| -rw-r--r-- | WebCore/page/EventHandler.cpp | 11 | ||||
| -rw-r--r-- | WebCore/platform/graphics/android/GraphicsContextAndroid.cpp | 6 | ||||
| -rw-r--r-- | WebCore/platform/graphics/android/ImageAndroid.cpp | 4 | ||||
| -rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 66 | ||||
| -rw-r--r-- | WebKit/android/jni/WebViewCore.h | 3 | ||||
| -rw-r--r-- | WebKit/android/nav/CacheBuilder.cpp | 2 | ||||
| -rw-r--r-- | WebKit/android/nav/CachedRoot.cpp | 19 | ||||
| -rw-r--r-- | WebKit/android/nav/CachedRoot.h | 2 | ||||
| -rw-r--r-- | WebKit/android/nav/WebView.cpp | 4 | ||||
| -rw-r--r-- | perf/Android.mk | 2 |
15 files changed, 128 insertions, 61 deletions
diff --git a/Android.v8.mk b/Android.v8.mk index f6845d2..d0da67d 100644 --- a/Android.v8.mk +++ b/Android.v8.mk @@ -207,10 +207,9 @@ LOCAL_SHARED_LIBRARIES := \ ifneq ($(TARGET_SIMULATOR),true) LOCAL_SHARED_LIBRARIES += libdl endif -LOCAL_SHARED_LIBRARIES += libv8 # Build the list of static libraries -LOCAL_STATIC_LIBRARIES := libxml2 +LOCAL_STATIC_LIBRARIES += libxml2 libv8 # Redefine LOCAL_SRC_FILES to be all the WebKit source files LOCAL_SRC_FILES := $(WEBKIT_SRC_FILES) diff --git a/V8Binding/Android.libv8.mk b/V8Binding/Android.libv8.mk index 74a9688..bca0167 100644 --- a/V8Binding/Android.libv8.mk +++ b/V8Binding/Android.libv8.mk @@ -6,7 +6,7 @@ include $(CLEAR_VARS) # Set up the target identity LOCAL_MODULE := libv8 -LOCAL_MODULE_CLASS := SHARED_LIBRARIES +LOCAL_MODULE_CLASS := STATIC_LIBRARIES intermediates := $(call local-intermediates-dir) LOCAL_CPP_EXTENSION := .cc @@ -172,4 +172,4 @@ endif LOCAL_C_INCLUDES += $(LOCAL_PATH)/v8/src -include $(BUILD_SHARED_LIBRARY) +include $(BUILD_STATIC_LIBRARY) diff --git a/V8Binding/Android.v8shell.mk b/V8Binding/Android.v8shell.mk index c57d4de..46cf4ee 100644 --- a/V8Binding/Android.v8shell.mk +++ b/V8Binding/Android.v8shell.mk @@ -6,7 +6,7 @@ LOCAL_MODULE := v8shell LOCAL_CPP_EXTENSION := .cc -LOCAL_SHARED_LIBRARIES := libv8 +LOCAL_STATIC_LIBRARIES := libv8 LOCAL_C_INCLUDES += $(LOCAL_PATH)/v8/include diff --git a/V8Binding/v8/src/heap.cc b/V8Binding/v8/src/heap.cc index 772cf32..df8ae6b 100644 --- a/V8Binding/v8/src/heap.cc +++ b/V8Binding/v8/src/heap.cc @@ -1220,28 +1220,49 @@ bool Heap::CreateApiObjects() { return true; } + +void Heap::CreateCEntryStub() { + CEntryStub stub; + c_entry_code_ = *stub.GetCode(); +} + + +void Heap::CreateCEntryDebugBreakStub() { + CEntryDebugBreakStub stub; + c_entry_debug_break_code_ = *stub.GetCode(); +} + + +void Heap::CreateJSEntryStub() { + JSEntryStub stub; + js_entry_code_ = *stub.GetCode(); +} + + +void Heap::CreateJSConstructEntryStub() { + JSConstructEntryStub stub; + js_construct_entry_code_ = *stub.GetCode(); +} + + void Heap::CreateFixedStubs() { // Here we create roots for fixed stubs. They are needed at GC // for cooking and uncooking (check out frames.cc). // The eliminates the need for doing dictionary lookup in the // stub cache for these stubs. HandleScope scope; - { - CEntryStub stub; - c_entry_code_ = *stub.GetCode(); - } - { - CEntryDebugBreakStub stub; - c_entry_debug_break_code_ = *stub.GetCode(); - } - { - JSEntryStub stub; - js_entry_code_ = *stub.GetCode(); - } - { - JSConstructEntryStub stub; - js_construct_entry_code_ = *stub.GetCode(); - } + // gcc-4.4 has problem to generate the correct vtables if the following + // functions are inlined. e.g., + // { CEntryStub stub; + // c_entry_code_ = *stub.GetCode(); + // } + // { CEntryDebugBreakStub stub; + // c_entry_debug_break_code_ = *stub.GetCode(); + // } + Heap::CreateCEntryStub(); + Heap::CreateCEntryDebugBreakStub(); + Heap::CreateJSEntryStub(); + Heap::CreateJSConstructEntryStub(); } diff --git a/V8Binding/v8/src/heap.h b/V8Binding/v8/src/heap.h index d8080b6..856de20 100644 --- a/V8Binding/v8/src/heap.h +++ b/V8Binding/v8/src/heap.h @@ -936,6 +936,14 @@ class Heap : public AllStatic { static bool CreateInitialMaps(); static bool CreateInitialObjects(); + + // These four Create*EntryStub functions are here because of a gcc-4.4 bug + // that assign wrong vptr entries. + static void CreateCEntryStub(); + static void CreateCEntryDebugBreakStub(); + static void CreateJSEntryStub(); + static void CreateJSConstructEntryStub(); + static void CreateFixedStubs(); static Object* CreateOddball(Map* map, const char* to_string, diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp index 1031a3d..c59ad00 100644 --- a/WebCore/page/EventHandler.cpp +++ b/WebCore/page/EventHandler.cpp @@ -79,6 +79,10 @@ #include "PlatformTouchEvent.h" #endif +#if defined(ANDROID_PLUGINS) +#include "WebViewCore.h" +#endif + namespace WebCore { using namespace HTMLNames; @@ -1849,6 +1853,13 @@ static Node* eventTargetNodeForDocument(Document* doc) if (!doc) return 0; Node* node = doc->focusedNode(); + +#if defined(ANDROID_PLUGINS) + if (!node && doc->frame() && doc->frame()->view()) + node = android::WebViewCore::getWebViewCore(doc->frame()->view()) + ->cursorNodeIsPlugin(); +#endif + if (!node && doc->isHTMLDocument()) node = doc->body(); if (!node) diff --git a/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp b/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp index 0358a54..b112230 100644 --- a/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp +++ b/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp @@ -137,7 +137,7 @@ public: if (mShadow.mBlur > 0) { paint->setAntiAlias(true); paint->setDither(true); - paint->setXfermode(mMode); + paint->setXfermodeMode(mMode); paint->setColor(mShadow.mColor); paint->setMaskFilter(SkBlurMaskFilter::Create(mShadow.mBlur, SkBlurMaskFilter::kNormal_BlurStyle))->unref(); @@ -225,7 +225,7 @@ public: void setup_paint_common(SkPaint* paint) const { paint->setAntiAlias(mState->mUseAA); paint->setDither(true); - paint->setXfermode(mState->mMode); + paint->setXfermodeMode(mState->mMode); if (mState->mShadow.mBlur > 0) { SkDrawLooper* looper = new SkBlurDrawLooper(mState->mShadow.mBlur, mState->mShadow.mDx, @@ -909,7 +909,7 @@ void GraphicsContext::clearRect(const FloatRect& rect) SkPaint paint; m_data->setup_paint_fill(&paint); - paint.setXfermode(SkXfermode::kClear_Mode); + paint.setXfermodeMode(SkXfermode::kClear_Mode); GC2Canvas(this)->drawRect(rect, paint); } diff --git a/WebCore/platform/graphics/android/ImageAndroid.cpp b/WebCore/platform/graphics/android/ImageAndroid.cpp index f0b36fb..3561796 100644 --- a/WebCore/platform/graphics/android/ImageAndroid.cpp +++ b/WebCore/platform/graphics/android/ImageAndroid.cpp @@ -213,7 +213,7 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, ctxt->setupFillPaint(&paint); // need global alpha among other things paint.setFilterBitmap(true); - paint.setXfermode(WebCoreCompositeToSkiaMode(compositeOp)); + paint.setXfermodeMode(WebCoreCompositeToSkiaMode(compositeOp)); canvas->drawBitmapRect(bitmap, &srcR, dstR, &paint); #ifdef TRACE_SUBSAMPLED_BITMAPS @@ -285,7 +285,7 @@ void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& srcRect, SkShader::kRepeat_TileMode); paint.setShader(shader)->unref(); // now paint is the only owner of shader - paint.setXfermode(WebCoreCompositeToSkiaMode(compositeOp)); + paint.setXfermodeMode(WebCoreCompositeToSkiaMode(compositeOp)); paint.setFilterBitmap(true); SkMatrix matrix(patternTransform); diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index 07f9fd4..9cf48dd 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -1157,6 +1157,29 @@ void WebViewCore::sendPluginEvent(const ANPEvent& evt) } } +static bool nodeIsPlugin(Node* node) { + RenderObject* renderer = node->renderer(); + if (renderer && renderer->isWidget()) { + Widget* widget = static_cast<RenderWidget*>(renderer)->widget(); + return widget && widget->isPluginView(); + } + return false; +} + +Node* WebViewCore::cursorNodeIsPlugin() { + gCursorBoundsMutex.lock(); + bool hasCursorBounds = m_hasCursorBounds; + Frame* frame = (Frame*) m_cursorFrame; + Node* node = (Node*) m_cursorNode; + gCursorBoundsMutex.unlock(); + if (hasCursorBounds && CacheBuilder::validNode(m_mainFrame, frame, node) + && nodeIsPlugin(node)) { + return node; + } + return 0; +} + + /////////////////////////////////////////////////////////////////////////////// void WebViewCore::moveMouseIfLatest(int moveGeneration, WebCore::Frame* frame, int x, int y) @@ -1173,15 +1196,6 @@ void WebViewCore::moveMouseIfLatest(int moveGeneration, moveMouse(frame, x, y); } -static bool nodeIsPlugin(Node* node) { - RenderObject* renderer = node->renderer(); - if (renderer && renderer->isWidget()) { - Widget* widget = static_cast<RenderWidget*>(renderer)->widget(); - return widget && widget->isPluginView(); - } - return 0; -} - // Update mouse position and may change focused node. void WebViewCore::moveMouse(WebCore::Frame* frame, int x, int y) { @@ -1404,8 +1418,10 @@ void WebViewCore::passToJs( int keyValue, bool down, bool cap, bool fn, bool sym) { WebCore::Node* focus = currentFocus(); - if (!focus) + if (!focus) { + DBG_NAV_LOG("!focus"); return; + } WebCore::Frame* frame = focus->document()->frame(); // Construct the ModifierKey value WebCore::PlatformKeyboardEvent::ModifierKey mods = @@ -1423,14 +1439,18 @@ void WebViewCore::passToJs( m_textGeneration = generation; DBG_NAV_LOGD("focus=%p keyCode=%d keyValue=%d", focus, keyCode, keyValue); WebCore::RenderObject* renderer = focus->renderer(); - if (!renderer || (!renderer->isTextField() && !renderer->isTextArea())) + if (!renderer || (!renderer->isTextField() && !renderer->isTextArea())) { + DBG_NAV_LOGD("renderer==%p || not text", renderer); return; + } setFocusControllerActive(true); WebCore::RenderTextControl* renderText = static_cast<WebCore::RenderTextControl*>(renderer); WebCore::String test = renderText->text(); - if (test == current) + if (test == current) { + DBG_NAV_LOG("test == current"); return; + } // If the text changed during the key event, update the UI text field. updateTextfield(focus, false, test); } @@ -1616,20 +1636,6 @@ bool WebViewCore::key(int keyCode, UChar32 unichar, int repeatCount, bool isShif { WebCore::EventHandler* eventHandler = m_mainFrame->eventHandler(); WebCore::Node* focusNode = currentFocus(); - if (!focusNode) { - gCursorBoundsMutex.lock(); - bool hasCursorBounds = m_hasCursorBounds; - Frame* frame = (Frame*) m_cursorFrame; - Node* node = (Node*) m_cursorNode; - gCursorBoundsMutex.unlock(); - if (hasCursorBounds - && CacheBuilder::validNode(m_mainFrame, frame, node) - && nodeIsPlugin(node)) { - // check if this plugin really wants the key (TODO) - DBG_NAV_LOGD("widget=%p is plugin", widget); - focusNode = node; - } - } if (focusNode) { eventHandler = focusNode->document()->frame()->eventHandler(); } @@ -1656,6 +1662,9 @@ bool WebViewCore::click() { WebCore::HitTestResult hitTestResult = m_mainFrame->eventHandler()-> hitTestResultAtPoint(pt, false); WebCore::Node* focusNode = hitTestResult.innerNode(); + DBG_NAV_LOGD("m_mousePos=(%d,%d) m_scrollOffset=(%d,%d) pt=(%d,%d)" + " focusNode=%p", m_mousePos.x(), m_mousePos.y(), + m_scrollOffsetX, m_scrollOffsetY, pt.x(), pt.y(), focusNode); if (focusNode) { keyHandled = handleMouseClick(focusNode->document()->frame(), focusNode); } @@ -1724,6 +1733,7 @@ bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* node webFrame->setUserInitiatedClick(true); nodePtr->dispatchSimulatedClick(0, true, true); webFrame->setUserInitiatedClick(false); + DBG_NAV_LOG("area"); return true; } WebCore::RenderObject* renderer = nodePtr->renderer(); @@ -1755,13 +1765,13 @@ bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* node listBoxRequest(reply, names.begin(), size, enabledArray.begin(), enabledArray.count(), multiple, selectedArray.begin(), multiple ? selectedArray.count() : selectElement->optionToListIndex(select->selectedIndex())); + DBG_NAV_LOG("menu list"); return true; } } if (!valid || !framePtr) framePtr = m_mainFrame; webFrame->setUserInitiatedClick(true); - DBG_NAV_LOGD("m_mousePos={%d,%d}", m_mousePos.x(), m_mousePos.y()); WebCore::PlatformMouseEvent mouseDown(m_mousePos, m_mousePos, WebCore::LeftButton, WebCore::MouseEventPressed, 1, false, false, false, false, WTF::currentTime()); @@ -1776,6 +1786,8 @@ bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* node // If the user clicked on a textfield, make the focusController active // so we show the blinking cursor. WebCore::Node* focusNode = currentFocus(); + DBG_NAV_LOGD("m_mousePos={%d,%d} focusNode=%p handled=%s", m_mousePos.x(), + m_mousePos.y(), focusNode, handled ? "true" : "false"); if (focusNode) { WebCore::RenderObject* renderer = focusNode->renderer(); if (renderer && (renderer->isTextField() || renderer->isTextArea())) diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h index e08bbb8..26e3a23 100644 --- a/WebKit/android/jni/WebViewCore.h +++ b/WebKit/android/jni/WebViewCore.h @@ -294,6 +294,9 @@ namespace android { // send this event to all of the plugins who have the given flag set void sendPluginEvent(const ANPEvent& evt, ANPEventFlag flag); + // return the cursorNode if it is a plugin + Node* cursorNodeIsPlugin(); + // Notify the Java side whether it needs to pass down the touch events void needTouchEvents(bool); diff --git a/WebKit/android/nav/CacheBuilder.cpp b/WebKit/android/nav/CacheBuilder.cpp index 475d2b7..ac24668 100644 --- a/WebKit/android/nav/CacheBuilder.cpp +++ b/WebKit/android/nav/CacheBuilder.cpp @@ -446,7 +446,7 @@ void CacheBuilder::Debug::groups() { //print(renderer ? renderer->information().ascii() : "NO_RENDER_INFO"); if (node->isElementNode()) { Element* element = static_cast<Element*>(node); - NamedAttrMap* attrs = element->attributes(); + NamedNodeMap* attrs = element->attributes(); unsigned length = attrs->length(); if (length > 0) { newLine(); diff --git a/WebKit/android/nav/CachedRoot.cpp b/WebKit/android/nav/CachedRoot.cpp index 7de2bfa..7da4bd3 100644 --- a/WebKit/android/nav/CachedRoot.cpp +++ b/WebKit/android/nav/CachedRoot.cpp @@ -694,14 +694,27 @@ int CachedRoot::getAndResetSelectionStart() return start; } -void CachedRoot::getSimulatedMousePosition(WebCore::IntPoint* point) +void CachedRoot::getSimulatedMousePosition(WebCore::IntPoint* point) const { #ifndef NDEBUG ASSERT(CachedFrame::mDebug.mInUse); #endif const WebCore::IntRect& mouseBounds = mHistory->mMouseBounds; - point->setX(mouseBounds.x() + (mouseBounds.width() >> 1)); - point->setY(mouseBounds.y() + (mouseBounds.height() >> 1)); + int x = mouseBounds.x(); + int y = mouseBounds.y(); + int width = mouseBounds.width(); + int height = mouseBounds.height(); + point->setX(x + (width >> 1)); // default to box center + point->setY(y + (height >> 1)); + const CachedNode* cursor = currentCursor(); + if (cursor && cursor->bounds().contains(mHistory->mMouseBounds)) { + if (cursor->isTextField()) // if text field, return end of line + point->setX(x + width - 1); + else if (cursor->isTextArea()) { // if text area, return start + point->setX(x + 1); + point->setY(y + 1); + } + } #if DEBUG_NAV_UI && !defined BROWSER_DEBUG const WebCore::IntRect& navBounds = mHistory->mNavBounds; LOGD("%s mHistory->mNavBounds={%d,%d,%d,%d} " diff --git a/WebKit/android/nav/CachedRoot.h b/WebKit/android/nav/CachedRoot.h index 1167a22..38ab2d8 100644 --- a/WebKit/android/nav/CachedRoot.h +++ b/WebKit/android/nav/CachedRoot.h @@ -56,7 +56,7 @@ public: SkPicture* getPicture() { return mPicture; } int getAndResetSelectionEnd(); int getAndResetSelectionStart(); - void getSimulatedMousePosition(WebCore::IntPoint* ); + void getSimulatedMousePosition(WebCore::IntPoint* ) const; void init(WebCore::Frame* , CachedHistory* ); bool innerDown(const CachedNode* , BestData* ) const; bool innerLeft(const CachedNode* , BestData* ) const; diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp index 1e36b03..a6e0d37 100644 --- a/WebKit/android/nav/WebView.cpp +++ b/WebKit/android/nav/WebView.cpp @@ -404,7 +404,7 @@ void drawMatches(SkCanvas* canvas) void drawCursorRing(SkCanvas* canvas) { - CachedRoot* root = getFrameCache(AllowNewer); + const CachedRoot* root = getFrameCache(AllowNewer); if (!root) { DBG_NAV_LOG("!root"); m_followedLink = false; @@ -1356,7 +1356,7 @@ static jint nativeCursorNodePointer(JNIEnv *env, jobject obj) static jobject nativeCursorPosition(JNIEnv *env, jobject obj) { WebView* view = GET_NATIVE_VIEW(env, obj); - CachedRoot* root = view->getFrameCache(WebView::DontAllowNewer); + const CachedRoot* root = view->getFrameCache(WebView::DontAllowNewer); WebCore::IntPoint pos = WebCore::IntPoint(0, 0); if (root) root->getSimulatedMousePosition(&pos); diff --git a/perf/Android.mk b/perf/Android.mk index ce84e37..80ed7df 100644 --- a/perf/Android.mk +++ b/perf/Android.mk @@ -47,6 +47,6 @@ LOCAL_MODULE := webcore_test # before we try to compile our sources. LOCAL_ADDITIONAL_DEPENDENCIES := $(filter %.h, $(WEBKIT_GENERATED_SOURCES)) -LOCAL_MODULE_TAGS := tests +LOCAL_MODULE_TAGS := optional include $(BUILD_EXECUTABLE) |
