Showing posts with label webkit. Show all posts
Showing posts with label webkit. Show all posts

Friday, February 25, 2011

在webview裡用iframe

之前在android上 試著用WebView來load一個我自己的html
而這個html裡面就一個簡單的iframe會去load google.com的page

但發現這個page一直不能被load進iframe
研究了webkit許久後

才發現
http://android.git.kernel.org/?p=platform/external/webkit.git;a=blob;f=WebCore/loader/MainResourceLoader.cpp;h=3e75880483e2a772d05be1a9ab04542c6d53cc34;hb=2943c136f14cf8d0631249dd8764a0b6ab45fb98#l316
是這裡cancel掉

而原因是http-header裡有著
x-frame-options:SAMEORIGIN

而load的page(google.com) 跟原本這個html(我自己的test html)的origin並不一樣(host)
所以造成了iframe裡的google一直load不進來

Thursday, February 17, 2011

Android Webkit enable SVG

想要在android上的webkit enable SVG
看了 http://code.google.com/p/android/issues/detail?id=1376 後

拿裡面這個patch來build
除了要ENABLE_SVG=1 ENABLE_SVG_ANIMATION=1 (也可用在buildspec裡)外
發現一直有compile error,  animateTag undefined之類的

然後把make_names.pl裡面的SVG_FLAGS印出來
發現真的少了ENABLE_SVG_ANIMATION

就在花了很多時間在看是make沒處理好還是perl
怎麼找都找不出問題
最後把他clean後再build一次

就ok了...............................XD

Friday, February 11, 2011

Android webkit裡的GIF Animation

大家一直在吵說android的webkit到底有沒有support animate GIF
有的人說有 有的人說沒有

雖然在config.h 裡  是有define ANDROID_ANIMATED_GIF
但其實關鍵是在ANDROID_LARGE_MEMORY_DEVICE

而這個option只有在比較後面的device 才有enable, 像nexus one
http://android.git.kernel.org/?p=platform/external/webkit.git;a=blob;f=Android.mk;h=21f6cf4e8b7d65479cbeb741f63a17b2d94f8238;hb=HEAD#l242


而android emulator上  並不會enable這個option
參考
http://allstarschh.blogspot.com/2010/11/default-javascript-engine-on-froyo.html

所以就目前Android  2.3上只有在device上才能看到animated GIF emulator上不行

如果一定想要在emulator上跑的話
就要自己enable ANDROID_LARGE_MEMORY_DEVICE 這個option了

Friday, January 7, 2011

EventLogTags

在android webkit裡的看到了一個EventLogTags的class
但卻遍尋不著他的source

原來他是從EvnetLogTags.logtags產生的
http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/webkit/EventLogTags.logtags;h=082a43734976d1570c4db1315ba12d03f48bc4fc;hb=HEAD

Wednesday, November 24, 2010

webkit 的resource loading

不太了解Webkit在resource loading時的pipeline是怎麼作的

http://webkit.org/blog/1188/how-webkit-loads-a-web-page/


Thursday, November 18, 2010

signature check in Android PluginManager

常常看到有人在問android PluginManager裡面的signature 是幹嘛用的
http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/webkit/PluginManager.java;h=cdcb662e057c4d41b7e7af235991d53037d1e19d;hb=HEAD#l75


查了一下commit的log
原來是當初要給flash on android


commit 73477e7336cd1bdd67984a0f6374c79108a8f098
Author: Grace Kloba
Date:   Wed Sep 30 17:45:46 2009 -0700

    Add the signature checking for WebView plugins. The
    first one is for SampleBrowserPlugin. The second
    one is for Flash.

diff --git a/core/java/android/webkit/PluginManager.java b/core/java/android/webkit/PluginManager.java
index 766bd75..edba446 100644
--- a/core/java/android/webkit/PluginManager.java
+++ b/core/java/android/webkit/PluginManager.java
@@ -65,6 +65,15 @@ public class PluginManager {

     private ArrayList mPackageInfoCache;

+    // Only plugin matches one of the signatures in the list can be loaded
+    // inside the WebView process
+    private static final String SIGNATURE_1 = "308204a830820390a003020102020900936eacbe07f201df300d06092a864886f70d0101050500308194310b3009060355040613025553311330110603550408130a43616c69666f726e69613116301
+    private static final String SIGNATURE_2 = "308204c5308203ada003020102020900d7cb412f75f4887e300d06092a864886f70d010105050030819d310b3009060355040613025553311330110603550408130a43616c69666f726e69613111300
+
+    private static final Signature[] SIGNATURES = new Signature[] {
+        new Signature(SIGNATURE_1), new Signature(SIGNATURE_2)
+    };
+
     private PluginManager(Context context) {
         mContext = context;
         mPackageInfoCache = new ArrayList();
@@ -148,9 +157,12 @@ public class PluginManager {
                 }
                 boolean signatureMatch = false;
                 for (Signature signature : signatures) {
-                    // TODO: check signature against Google provided one
-                    signatureMatch = true;
-                    break;
+                    for (int i = 0; i < SIGNATURES.length; i++) {
+                        if (SIGNATURES[i].equals(signature)) {
+                            signatureMatch = true;
+                            break;
+                        }
+                    }
                 }
                 if (!signatureMatch) {
                     continue;

Monday, November 15, 2010

Thursday, October 28, 2010

html5 audio tag on Android(froyo)

目前audio tag在android是動不了的
除了那controller只是一個白框之外

但在白框點了下去後
發現在external/webkit/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp裡

MediaPlayerPrivate::play

只有處理video的case
m_glue->m_javaProxy  是null的

而這javaProxy只有在 createJavaPlayerIfNeeded
, setVisible(true)時才會被create
也就是 only for video case 才會處理

================================================
PS: 2010/12/07 update
Android 2.3 (Gingerbrand) already supports HTML5 audio tag

Wednesday, October 27, 2010

html5 video tag on Android

找到了幾個可以在android上跑video tag的url

http://broken-links.com/tests/video/

http://www.awakecoding.com/android/

不過發現這幾個video的codec 在emulator上都沒support
所以只是有聲沒影

Wednesday, June 9, 2010

enable webkit debug

目前是指gtk上

--enable-debug後build

然後要export WEBKIT_DEBUG='LEVEL'

其中LEVEL要看WebCore/platform/Logging.cpp

Thursday, April 1, 2010

enable native WebKit log

最近一直試著要在native WebKit加log
但就是看不到

最後看到
external/webkit/WebCore/platform/android/ScreenAndroid.cpp
的一段話

35 #undef LOG // FIXME: Still have to do this to get the log to show up
36 #include "utils/Log.h"

照著他的方式來作

媽呀 真的log出現了

原來在WebCore/config.h 會去include
而這裡面也有定義LOG

所以我加的LOG[VDIWE]全都跑到wtf/Assertions.h裡面了
(事實上是空的 因為LOG_DISABLE被設為1了)