WebKit kernel exploration [1] -- WebKit Introduction

Source: Internet
Author: User

[Reprinted please noteArticleSource, unchanged]

Source: http://www.cnblogs.com/jyli/archive/2010/01/31/1660355.html 
Author: Li Jiayi

It has been a while to study the WebKit kernel. During this period, I spent a lot of time studying WebKit.CodeAnd read a lot of information online. After that, I began to try to crop the WebKit kernel to get what I needed.

As the saying goes, "If you are a student and have no friends, you will be alone and ignorant." In the spirit of communication, I would like to share with you. By the way, I will review my journey over this period of time. Currently, although I can't say it is excellent in the WebKit kernel, I have finally traveled through the WebKit kernel and gained a lot of direct experience in WebKit kernel code.

Based on the WebKit kernel code, I will introduce in detail the composition of the WebKit kernel and the functions and implementations of each module. The article will be updated and supplemented with a new understanding.


What is WebKit

Wekbit is an open-source web browser engine, that is, the browser kernel. The default browser of Apple Safari, Google Chrome, Nokia s60, Apple mobile phone, and Android mobile phone use WebKit as the browser kernel. The degree of WebKit adoption can be seen from this. Naturally, it has become one of the three mainstream browser kernels. The other two are gecko and Trident respectively. The well-known Firefox uses the gecko kernel, while Microsoft's ie series uses the Trident kernel. Although the IE kernel browser still occupies the majority of the market share, other kernel browsers also come to the fore. Among them, WebKit, as an excellent browser kernel, has attracted wide attention in the industry due to its many outstanding features. In particular, the recent addition of Google has warmed up WebKit. From the Goole Chrome browser, the built-in browser of Goole anroid mobile phone operating system uses WebKit as the kernel, and the recently released Chrome OS is even more promising. From the implementation point of view, it is said that it is more clean and clear than the gecko code. I have not studied the gecko code yet, so there is no way to compare it.


What does wekbit do?

What does WebKit do as the browser kernel? To understand this, let's first look at what the next web browser has done. From the perspective of input and output, we can see what a web browser has done for us. Let's take a look at a simple example. The input from a Web browser is an HTML document, and the output is a Web page that we can see with our eyes, the input and output of a common user are as simple as they are, as shown in.

So what is the input and output of WebKit? If we can understand this, we can clearly understand what WebKit is. However, it is still difficult to clarify this point, because the output of WebKit is more complicated, because its output is not directly oriented to users. Now, simply put, the input of WebKit is a web document, the output is an invisible model. The upper layer of the browser uses these models to draw the actual page we see. We will discuss these models more specifically when appropriate.


Wekbit Composition

WebKit actually contains three parts, at least from the code structure. Of course, more modules can be divided if subdivided. As shown in


Among them, WebCore is the core part of WebKit. It implements document modeling, including CSS, Dom, and render implementation. javasript core is obviously an implementation supported by javasript. The orange-labeled WebKit contains the implementation of WebKit encapsulation on many different platforms, that is, the implementation of some concepts that correspond directly to the browser, such as webview, webpage, webframe. These three parts constitute WebKit. In the source code, they correspond to these three directories respectively, that is, the three parts of WebKit are WebCore, javasripcore, and WebKit.


ApplicationProgramHow to Use WebKit

It can be seen that the WebKit application is located on the WebKit module, and the application does not directly deal with WebCore and JavaScript core, and does not need to deal with them, instead, it interacts with the WebKit Module I mentioned earlier to shield the WebCore and javasripcore sections. The WebKit module abstracts the part required by most applications. The majority of applications mentioned here actually refer to browsers. for implementing a browser, the WebKit module provides enough interfaces. However, some applications may have to be transformed, but in other words, WebKit was originally designed as the browser kernel and implemented.

Here we can see that if we want to use WebKit to implement a function perfect browser or other browser applications, you only need to understand the WebKit module, more specifically, you only need to know the interfaces it provides. In fact, for most platforms, if the WebKit kernel is used as the browser kernel component, the corresponding documentation section is about the interface provided by the WebKit module. Many Platforms provide browser components, which are used in the same way as other visual components and are very convenient to use in applications. For example, if a platform provides a visual component called webview, we can use the following lines of code to display a Web page. Only three lines of code are used.

Webview * view = new webview ();

View-> load (URL ("http://www.google.cn "));

View-> show ();

There are many platforms that use WebKit as browser components, including Symbian s60, Android, QT, and GTK. Recently I saw the message, as if Black Berry was preparing to use WebKit on his mobile phone.


To be continued ....

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.