summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WebCore/plugins/android/PluginViewAndroid.cpp4
-rw-r--r--WebKit/Android.mk1
-rw-r--r--WebKit/android/nav/WebView.cpp5
-rw-r--r--WebKit/android/plugins/ANPBitmapInterface.cpp72
-rw-r--r--WebKit/android/plugins/android_npapi.h35
5 files changed, 112 insertions, 5 deletions
diff --git a/WebCore/plugins/android/PluginViewAndroid.cpp b/WebCore/plugins/android/PluginViewAndroid.cpp
index 0cb33f8..f10ac45 100644
--- a/WebCore/plugins/android/PluginViewAndroid.cpp
+++ b/WebCore/plugins/android/PluginViewAndroid.cpp
@@ -78,6 +78,7 @@
///////////////////////////////////////////////////////////////////////////////
extern void ANPAudioTrackInterfaceV0_Init(ANPInterface* value);
+extern void ANPBitmapInterfaceV0_Init(ANPInterface* value);
extern void ANPCanvasInterfaceV0_Init(ANPInterface* value);
extern void ANPLogInterfaceV0_Init(ANPInterface* value);
extern void ANPMatrixInterfaceV0_Init(ANPInterface* value);
@@ -98,8 +99,9 @@ struct VarProcPair {
static const VarProcPair gVarProcs[] = {
{ VARPROCLINE(AudioTrackInterfaceV0) },
- { VARPROCLINE(LogInterfaceV0) },
+ { VARPROCLINE(BitmapInterfaceV0) },
{ VARPROCLINE(CanvasInterfaceV0) },
+ { VARPROCLINE(LogInterfaceV0) },
{ VARPROCLINE(MatrixInterfaceV0) },
{ VARPROCLINE(PaintInterfaceV0) },
{ VARPROCLINE(PathInterfaceV0) },
diff --git a/WebKit/Android.mk b/WebKit/Android.mk
index 1538d98..87bc2cd 100644
--- a/WebKit/Android.mk
+++ b/WebKit/Android.mk
@@ -53,6 +53,7 @@ LOCAL_SRC_FILES := \
android/nav/SelectText.cpp \
android/nav/WebView.cpp \
\
+ android/plugins/ANPBitmapInterface.cpp \
android/plugins/ANPCanvasInterface.cpp \
android/plugins/ANPLogInterface.cpp \
android/plugins/ANPMatrixInterface.cpp \
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp
index a17847c..6260d7e 100644
--- a/WebKit/android/nav/WebView.cpp
+++ b/WebKit/android/nav/WebView.cpp
@@ -814,16 +814,15 @@ bool motionUp(int x, int y, int slop)
setNavBounds(WebCore::IntRect(rx, ry, 1, 1));
root->setCursor(const_cast<CachedFrame*>(frame),
const_cast<CachedNode*>(result));
- bool newNodeWantsKeyEvents = result->wantsKeyEvents();
CachedNodeType type = result->type();
- if (type == NORMAL_CACHEDNODETYPE || newNodeWantsKeyEvents) {
+ if (type == NORMAL_CACHEDNODETYPE) {
sendMotionUp(
frame ? (WebCore::Frame*) frame->framePointer() : 0,
result ? (WebCore::Node*) result->nodePointer() : 0, rx, ry,
slop);
}
viewInvalidate();
- if (newNodeWantsKeyEvents) {
+ if (result->isTextField() || result->isTextArea()) {
rebuildWebTextView();
displaySoftKeyboard();
} else {
diff --git a/WebKit/android/plugins/ANPBitmapInterface.cpp b/WebKit/android/plugins/ANPBitmapInterface.cpp
new file mode 100644
index 0000000..25d1e97
--- /dev/null
+++ b/WebKit/android/plugins/ANPBitmapInterface.cpp
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2009, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// must include config.h first for webkit to fiddle with new/delete
+#include "config.h"
+#include "SkANP.h"
+#include "SkColorPriv.h"
+
+static bool anp_getPixelPacking(ANPBitmapFormat fmt, ANPPixelPacking* packing) {
+ switch (fmt) {
+ case kRGBA_8888_ANPBitmapFormat:
+ if (packing) {
+ packing->AShift = SK_A32_SHIFT;
+ packing->ABits = SK_A32_BITS;
+ packing->RShift = SK_R32_SHIFT;
+ packing->RBits = SK_R32_BITS;
+ packing->GShift = SK_G32_SHIFT;
+ packing->GBits = SK_G32_BITS;
+ packing->BShift = SK_B32_SHIFT;
+ packing->BBits = SK_B32_BITS;
+ }
+ return true;
+ case kRGB_565_ANPBitmapFormat:
+ if (packing) {
+ packing->AShift = 0;
+ packing->ABits = 0;
+ packing->RShift = SK_R16_SHIFT;
+ packing->RBits = SK_R16_BITS;
+ packing->GShift = SK_G16_SHIFT;
+ packing->GBits = SK_G16_BITS;
+ packing->BShift = SK_B16_SHIFT;
+ packing->BBits = SK_B16_BITS;
+ }
+ return true;
+ default:
+ break;
+ }
+ return false;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+#define ASSIGN(obj, name) (obj)->name = anp_##name
+
+void ANPBitmapInterfaceV0_Init(ANPInterface* value) {
+ ANPBitmapInterfaceV0* i = reinterpret_cast<ANPBitmapInterfaceV0*>(value);
+
+ ASSIGN(i, getPixelPacking);
+}
+
diff --git a/WebKit/android/plugins/android_npapi.h b/WebKit/android/plugins/android_npapi.h
index 9e55252..c0eca1a 100644
--- a/WebKit/android/plugins/android_npapi.h
+++ b/WebKit/android/plugins/android_npapi.h
@@ -49,6 +49,17 @@ enum ANPBitmapFormats {
};
typedef int32_t ANPBitmapFormat;
+struct ANPPixelPacking {
+ uint8_t AShift;
+ uint8_t ABits;
+ uint8_t RShift;
+ uint8_t RBits;
+ uint8_t GShift;
+ uint8_t GBits;
+ uint8_t BShift;
+ uint8_t BBits;
+};
+
struct ANPBitmap {
void* baseAddr;
ANPBitmapFormat format;
@@ -104,6 +115,7 @@ typedef uint32_t ANPMatrixFlag;
#define kPathInterfaceV0_ANPGetValue ((NPNVariable)1005)
#define kTypefaceInterfaceV0_ANPGetValue ((NPNVariable)1006)
#define kWindowInterfaceV0_ANPGetValue ((NPNVariable)1007)
+#define kBitmapInterfaceV0_ANPGetValue ((NPNVariable)1008)
/* queries for which drawing model is desired (for the draw event)
@@ -160,6 +172,13 @@ struct ANPLogInterfaceV0 : ANPInterface {
void (*log)(NPP instance, ANPLogType, const char format[], ...);
};
+struct ANPBitmapInterfaceV0 : ANPInterface {
+ /** Returns true if the specified bitmap format is supported, and if packing
+ is non-null, sets it to the packing info for that format.
+ */
+ bool (*getPixelPacking)(ANPBitmapFormat, ANPPixelPacking* packing);
+};
+
struct ANPMatrixInterfaceV0 : ANPInterface {
/* Return a new identity matrix
*/
@@ -260,9 +279,23 @@ struct ANPPathInterfaceV0 : ANPInterface {
void (*transform)(ANPPath* src, const ANPMatrix*, ANPPath* dst);
};
+/** ANPColor is always defined to have the same packing on all platforms, and
+ it is always unpremultiplied.
+
+ This is in contrast to 32bit format(s) in bitmaps, which are premultiplied,
+ and their packing may vary depending on the platform, hence the need for
+ ANPBitmapInterface::getPixelPacking()
+ */
typedef uint32_t ANPColor;
+#define ANPColor_ASHIFT 24
+#define ANPColor_RSHIFT 16
+#define ANPColor_GSHIFT 8
+#define ANPColor_BSHIFT 0
#define ANP_MAKE_COLOR(a, r, g, b) \
- (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
+ (((a) << ANPColor_ASHIFT) | \
+ ((r) << ANPColor_RSHIFT) | \
+ ((g) << ANPColor_GSHIFT) | \
+ ((b) << ANPColor_BSHIFT))
enum ANPPaintFlag {
kAntiAlias_ANPPaintFlag = 1 << 0,