Thursday, September 11, 2008

Implementation of "word-break" property of CSS3 Text module

"word-break" is new property of CSS3 text module. First implementation is Microsoft's Browswer as known as Internet Explorer as their origianl specification.

Internet Explorer 7 and Safari 3.1 has word-break implementation. So I try to confirming the "word-break" implementation on both browsers.

Safari 3 / Google Chome (WebKit)

WebKit doesn't consider CJK scripts. The result of all modes is same. If using "word-break: keep-all;", KANJI characters should not break line.

Internet Explorer 7

Trident's behaivour of Japanese scripts is strenge. When using "word-break: keep-all;", although "TOUTEN" ("、". It means like comma) is broken lines, KUTEN ("。". It means like priod) isn't broken lines.

No one has correct implementation of "word-break" property.

Tuesday, August 12, 2008

Checkout Thunderbird 3 repository

Build document in wiki.mozilla.org is too old. I explain enlistment of Thunderbird 3.

checkout comm-central repository

Thuderbird 3 / Seamonkey 2 repository is moved from cvs.mozilla.org to hg.mozilla.org.

$ hg clone http://hg.mozilla.org/comm-central/

checkout other project

Thunderbird 3 depends on mozilla-central and other project such as LDAP C-SDK. So you need checkout other projects

$ cd comm-central
$ python client.py checkout

Good luck!

Monday, June 2, 2008

Mozilla Japan says Gecko 1.9 (cairo 1.6.4) uses ATSUI backend?

I found a article of mozilla event in Japan at May 31 2008.

Report: Incoming Firefox 3 is fastest! - mozilla party jp 9.0
http://journal.mycom.co.jp/articles/2008/06/01/mozillapartyjp9/index.html

Mozilla Japan says Gecko 1.9 uses ATSUI (Apple Type Services for Unicode Imaging). Ha????? Although Gecko 1.9 uses Cario 1.6.4 (stabled version) w/ some patches, Cairo 1.6 uses CoreText (CGFont) instead of ATSUI. So Gecko 1.9 doesn't use ATSUI. I cannot make sense why they explain invalid information for graphics backend... You know, ATSUI API set is from Carbon, and doesn't support on 64bit Mac OS X.

Also, as long as I checked cairo mailing list, Vladimir posted the following mail at March 17 2008.

Here's a patch that renames the current ATSUI font backend to a Quartz font backend, in preparation for eventually dropping the ATSUI dependancy internally and using CGFont directly. This patch makes --enable-quartz give you both quartz surface and quartz font support; otherwise, I would've needed to use "cairo-quartz-font.h", breaking the usual pattern. I also can't think of a reason to compile with just one of those -- even if you only use one or the other, it won't hurt to have them both available (since they have the exact same dependencies).

Vladimir is one of mozilla.com members...

Saturday, May 3, 2008

NSS Optimize (x86_64)

I open a new bug to x64 optimization for nss. This patch is improved DES (2-3% up) and SHA512 (5% up). On Windows, SHA512 improves 8-10% up.

Bug 431958 – Improve DES and SHA512 for x86_64 platform

Monday, April 28, 2008

Firefox Performance on Linux (Ubuntu 8.04)

JavaScirpt benchmark for x86 build and x64 build on Ubuntu 8.04 using dromaeo by Mozilla.

Wednesday, March 26, 2008

Sunspider score with Safari, Firefox 3 and Opera 9.5

This is the resule of sunspider by WebKit.org.

Google's chart has no function of omit scale. So I remove IE7's score.

I compare with beta version such as Firefox 3 and Opera 9.5

Tuesday, January 15, 2008

Using WebKit on Windows

Since I research WebKit, I try writing how to use WebKit in your application.

WebKit has COM interface, so you need use it via COM interface. This way is same as Trident (MSHTML Web Browser Control) of Internet Explorer.

Initialize

At first, you get IWebView interface using CoCreateInstance(). Then, when you call IWebView::initWithFrame() with window handle of parent window, so you can create WebKit window.

IWebView *pWebView;
HRESULT hr;

hr = ::CoCreateInstance(CLSID_WebView,
                        0,
                        CLSCTX_ALL,
                        IID_IWebView,
                        (void**)&pWebView);
if(hr != S_OK)
    goto error;

hr = pWebView->setHostWindow((OLE_HANDLE) hWnd);
if(hr != S_OK)
    goto error;

::GetClientRect(hWnd,&clientRect);
hr = pWebView->initWithFrame(clientRect, NULL, NULL);
if(hr != S_OK)
    goto error;

Loading URL...

You cannot use takeStringURL like MacOS X sample. This method will return E_NOTIMPL.

If you want to use WebKit on Windows, you get IWebURLRequest object via CoCreateInstance(), then, you call IWebFrame::loadRequest(). If you want to open HTML stirng, you can use other method of IWebView.

HRESULT hr;
BSTR str;
IWebFrame* pWebFrame;
IWebURLRequest * pWebURLRequest;
IWebView* pWebView;

hr = ::CoCreateInstance(CLSID_WebURLRequest,
                        0,
                        CLSCTX_ALL,
                        IID_IWebURLRequest,
                        (void**)&pWebURLRequest);
if(hr != S_OK)
    goto error;

str = ::SysAllocString(L"http://www.apple.com/");
hr = pWebURLRequest->initWithURL(str,
                                 WebURLRequestUseProtocolCachePolicy,
                                 60);
if(hr != S_OK)
    goto error;

hr = pWebView->mainFrame(&pWebFrame);
if(hr != S_OK)
    goto error;

hr = pWebFrame->loadRequest(pWebURLRequest);
if(hr != S_OK)
    goto error;

pWebURLRequest->Release();
pWebFrame->Release();

Thursday, January 10, 2008

How to Handle Back Key on .NET Compact Framework 2.0

When you start to develop Windows Mobile 6.0 Standard using C# (.NET Compact Framework 2.0), you will hit a trouble of Back key handling.

When I am looking for the resolution of this, I found the following document in MSDN./

How to: Override the Smartphone Back Key

BUT, although I add code for "Keys.Escape" and "Keys.Back", I cannot handle back key. This docuemnt is for .NET Compact framework 3.5???. So I am looking for it again, I found the following posts.

Capture Back Key - MSDN Forum

Mauricio,

This is a bug in CF. Setting the form's KeyPreview property to true should allow you to handle the Back key in the form's KeyPress event handler. However, I've discovered that the KeyPress event is only fired if the focused control is a container control (form, tab page, panel, etc.).

I'm investigating a couple of possible workarounds. I'll let you know if I find one.

Dan

This post says that it is no way to use C#. So although I try using sub class, .NET Comapct Framework has no method of WndProc. So, to call Win32 API directly, I can handle back key. I believe that a true way is to use SHCMBM_OVERRIDEKEY.

using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace WindowProc
{
    public partial class Form1 : Form
    {
        #region P/Invoke
        public const int GWL_WNDPROC = -4;
        public const uint WM_HOTKEY = 0x0312;

        [DllImport("coredll.dll")]
        public extern static IntPtr SetWindowLong(IntPtr hwnd,
                                                  int nIndex,
                                                  IntPtr dwNewLong);

        [DllImport("coredll.dll")]
        public extern static int CallWindowProc(IntPtr lpPrevWndFunc,
                                                IntPtr hwnd,
                                                uint msg,
                                                uint wParam,
                                                int lParam);

        [DllImport("coredll.dll")]
        public extern static int PostMessage(IntPtr hwnd,
                                             uint msg,
                                             uint wParam,
                                             uint lParam);
        #endregion

        public delegate int WndProcDelegate(IntPtr hwnd, uint msg, uint wParam, int lParam);

        IntPtr mOldWndProc;
        WndProcDelegate mProc;

        public Form1()
        {
            InitializeComponent();

            mProc = new WndProcDelegate(WndProc);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            SetHook();
        }

        private void SetHook()
        {
            IntPtr hwnd = this.Handle;
            if (hwnd == IntPtr.Zero)
            {
                throw new InvalidOperationException("hWnd is null");
            }

            mOldWndProc = SetWindowLong(hwnd,
                                        GWL_WNDPROC,
                                        Marshal.GetFunctionPointerForDelegate(mProc));
        }

        // Restores the original window procedure for the control.
        private void Unhook()
        {
            IntPtr hwnd = this.Handle;
            if (hwnd == IntPtr.Zero)
            {
                throw new InvalidOperationException("hWnd is null");
            }

            SetWindowLong(hwnd, GWL_WNDPROC, mOldWndProc);
        }

        protected virtual int WndProc(IntPtr hwnd, uint msg, uint wParam, int lParam)
        {
            if (msg == WM_HOTKEY && (lParam & 0xffff0000) == 0x1b0000)
            {
                if ((lParam & 0x1000) == 0)
                {
                    //
                    // This is key down message of [Back] key
                    //
                }
                else
                {
                    //
                    // This is key up message of [Back] key
                    //
                }
                return 1;
            }

            return CallWindowProc(mOldWndProc, hwnd, msg, wParam, lParam);
        }
    }
}