Checkout The Source Code

For OS X or Linux

Open a shell.

On OS X, you can use the Terminal App, which resides in /Applications/Utilities.

You can download a snapshot of the WebKit source tree from It is updated every six hours. Note the archived checkout uses an HTTP connection. We recommend running the following command to use HTTPS instead:

svn switch --relocate

Type these commands to check out the WebKit source tree:

tar jxvf WebKit-SVN-source.tar.bz2
cd webkit

Alternatively, type this command to check out the WebKit source tree:

svn checkout WebKit

Run the ./Tools/Scripts/update-webkit script to update your source tree.

Build Webkit

Run the build-webkit script to build WebKit.

Use the –debug option for a debug build, which includes debugging symbols and assertions:

build-webkit --debug

By default, build-webkit places build products in WebKitBuild. You can specify a different build location on Mac in your Xcode preferences. On other platforms, the WEBKIT_OUTPUTDIR environment variable can be used to set a different build products location. If you have set up a custom build location, then build-webkit will place the build products there.

Once your build has finished, you can run Safari using your custom WebKit build.

Don’t forget that if you have any questions or problems building WebKit, feel free to get in touch!



<html lang="en">
    <meta charset="UTF-8">
    <title>DumpRenderTree in Action</title>

<div class="wrapper">
    <div class="main">

<style type="text/css">
    * {
        margin: 0;
        padding: 0;



cd webkit
svn upgrade
./Tools/Scripts/run-webkit-tests --verbose ~/Desktop/test.html


  • test-actual.txt:描述了WebKit实际构建的RenderTree结果
  • test-expected.txt:描述了正常情况下RenderTree的结果


layer at (0,0) size 800x600
  RenderView at (0,0) size 800x600
layer at (0,0) size 800x18
  RenderBlock {HTML} at (0,0) size 800x18
    RenderBody {BODY} at (0,0) size 800x18
      RenderBlock {DIV} at (0,0) size 800x18
        RenderBlock {DIV} at (0,0) size 800x18
          RenderBlock {P} at (0,0) size 800x18
            RenderText {#text} at (0,0) size 92x18
              text run at (0,0) width 92: "Hello,"