2008年8月25日星期一

认识了解WebKit

WebKit作为一个浏览器引擎,其第一Release版本在2003年1月发布,虽然出现的相对比较晚,但以其一些优越的特性,获得了诸如Google、Apple、Adobe、Yahoo等公司的青睐,似乎大有赶超Gecko的势头,带着究竟什么是WebKit?其主要特点有哪些?如何应用它?它与其他浏览器内核有哪些不同等疑问,开始认识了解WebKit。。。

一、什么是WebKit?
WebKit is an open source web browser engine. WebKit is also the name of the Mac OS X system framework version of the engine that's used by Safari, Dashboard, Mail, and many other OS X applications.

WebKit is an open source application framework that provides a foundation upon which to build a web browser. WebKit was originally derived from the Konqueror browser’s KHTML software library by Apple, Inc. for use as the engine of Mac OS X’s Safari web browser, and has now been further developed by Apple, Nokia, Google and others. The framework is now used by Omniweb, Shiira, iCab, Adobe AIR, Iris Browser, mobile phones (including the iPhone), Nokia’s Series 60 browser, and Google’s Android platform.

WebKit's HTML and JavaScript code began as a branch of the KHTML and KJS libraries from KDE.

二、WebKit主要特点及其目标
Web Content Engine
The project's primary focus is content deployed on the World Wide Web, using standards-based technologies such as HTML, CSS, JavaScript and the DOM. However, we also want to make it possible to embed WebKit in other applications, and to use it as a general-purpose display and interaction engine.
Open Source
WebKit should remain freely usable for both open source and proprietary applications.

Performance
Maintaining and improving speed and memory use is an important goal. We never consider performance "good enough", but strive to constantly improve. As web content becomes richer and more complex, and as web browsers run on more limited devices, performance gains continue to have value even if normal browsing seems fast enough.

Portability
The WebKit project seeks to address a variety of needs. We want to make it reasonable to port WebKit to a variety of desktop, mobile, embedded and other platforms. We will provide the infrastructure to do this with tight platform integration, reusing native platform services where appropriate and providing friendly embedding APIs.
Compatibility
For users browsing the web, compatibility with their existing sites is essential. We strive to maintain and improve compatibility with existing web content, sometimes even at the expense of standards. We use regression testing to maintain our compatibility gains.

Standards Compliance
WebKit aims for compliance with relevant web standards, and support for new standards
Security
Protecting users from security violations is critical. We fix security issues promptly to protect users and maintain their trust.
WebKit is an engine, not a browser
We do not plan to develop or host a full-featured web browser based on WebKit.
WebKit is not the solution to every problem
We focus on web content, not complete solutions to every imaginable technology need.

三、WebKit主要组成
WebKit作为一个浏览器内核引擎,正如上面所描述,其主要内容专注在浏览器的核心部分Javascript的实现(JavaScriptCore)、布局渲染的实现(WebCore)以及对外接口的支持。

Gecko内核提供了一整套的与浏览器相关的解决方案如包括对NSPR、XPCOM、Network、Extension、XUL等的支持与实现等,但WebKit往往专注于核心部分,其他部分由外壳程序或其他公共库来实现,如其对Http请求的实现可由外部的公共库如libcurl、cf、soup等来提供实现,其本身不提供Http协议实现方面的代码,而Gecko中的Http请求完全由Gecko中的Network部分来实现。

为了跨越更多平台及图形库,WebKit提供了cairo、gtk、mac、win、qt、wxwidget等对外接口的支持,这方面并不比Gecko逊色多少。

对外部嵌入程序而言,WebKit提供了具有浏览器功能的、同时与外壳程序相对应的平台或图形库相关的动态库。如在Safari中WebKit内核仅以一个webkit.dll的形式出现。相对Gecko内核而言,虽然其功能比较少,但其使用起来简单方便,实现代码相对简洁,性能也不错。

四、参考资源
The WebKit Open Source Project
WiKi WebKit
Comparison of layout engines

没有评论: