WebKit


WebKit is a browser engine developed by Apple and primarily used in its Safari web browser, as well as all the iOS web browsers. WebKit is also used by the BlackBerry Browser, the Tizen mobile operating systems, and a browser included with the Amazon Kindle e-book reader. WebKit's C++ application programming interface provides a set of classes to display Web content in windows, and implements browser features such as following links when clicked by the user, managing a back-forward list, and managing a history of pages recently visited.
WebKit's HTML and JavaScript engine started as a fork of the KHTML and KJS libraries from KDE, and has since been further developed by KDE contributors, Apple, Google, Nokia, Bitstream, BlackBerry, Igalia, and others. WebKit supports macOS, Windows, Linux, and various other Unix-like operating systems. On April 3, 2013, Google announced that it had forked WebCore, a component of WebKit, to be used in future versions of Google Chrome and the Opera web browser, under the name Blink.
WebKit is available under a BSD-form license with the exception of the WebCore and JavaScriptCore components, which are available under the GNU Lesser General Public License. As of March 7, 2013, WebKit is a trademark of Apple, registered with the U.S. Patent and Trademark Office.

Origins

The code that would become WebKit began in 1998 as the KDE HTML layout engine and KDE JavaScript engine. The WebKit project was started within Apple by Don Melton on June 25, 2001, as a fork of KHTML and KJS. Melton explained in an e-mail to KDE developers that KHTML and KJS allowed easier development than other available technologies by virtue of being small, cleanly designed and standards-compliant. KHTML and KJS were ported to OS X with the help of an adapter library and renamed WebCore and JavaScriptCore. JavaScriptCore was announced in an e-mail to a KDE mailing list in June 2002, alongside the first release of Apple's changes. WebCore was announced at the Macworld Expo in January 2003 by Apple CEO Steve Jobs with the release of the Safari web browser. JavaScriptCore was first included with Mac OS X v10.2 as a private framework which Apple used in their Sherlock application, while WebCore debuted with the first beta of Safari. Mac OS X v10.3 was the first major release of Apple's operating system to bundle WebKit, although it had already been bundled with a minor release of 10.2.
According to Apple, some changes involved OS X-specific features that are absent in KDE's KHTML, which called for different development tactics.

Split development

The exchange of code between WebCore and KHTML became increasingly difficult as the code base diverged because both projects had different approaches in coding and code sharing. At one point KHTML developers said they were unlikely to accept Apple's changes and claimed the relationship between the two groups was a "bitter failure". Apple submitted their changes in large patches containing very many changes with inadequate documentation, often to do with future additions. Thus, these patches were difficult for the KDE developers to integrate back into KHTML. Also, Apple had demanded that developers sign non-disclosure agreements before looking at Apple's source code and even then they were unable to access Apple's bug database.
During the publicized "divorce" period, KDE developer Kurt Pfeifle posted an article claiming KHTML developers had managed to backport many Safari improvements from WebCore to KHTML, and they always appreciated the improvements coming from Apple and still do so. The article also noted Apple had begun to contact KHTML developers about discussing how to improve the mutual relationship and ways of future cooperation. In fact, the KDE project was able to incorporate some of these changes to improve KHTML's rendering speed and add features, including compliance with the Acid2 rendering test.
Following the story of the fork's appearance in the news, Apple released changes of the source code of WebKit fork in a public revision-control repository. Since the transfer of the source code into a public Concurrent Versions System repository, Apple and KHTML developers have had increasing collaboration. Many KHTML developers have become reviewers and submitters for WebKit revision control repository.
The WebKit team had also reversed many Apple-specific changes in the original WebKit code base and implemented platform-specific abstraction layers to make committing the core rendering code to other platforms significantly easier.
In July 2007, Ars Technica reported that the KDE team would move from KHTML to WebKit. Instead, after several years of integration, KDE Development Platform version 4.5.0 was released in August 2010 with support for both WebKit and KHTML, and development of KHTML continues.

Open-sourcing

On June 7, 2005, Safari developer Dave Hyatt announced on his weblog that Apple was open-sourcing WebKit and opening up access to WebKit's revision control tree and the issue tracker. This was announced at Apple's Worldwide Developers Conference 2005 by Apple Senior Vice President of Software Engineering Bertrand Serlet.
In mid-December 2005, support for Scalable Vector Graphics was merged into the standard build and in early January 2006 the source code was migrated from Concurrent Versions System to Subversion.
WebKit's JavaScriptCore and WebCore components are available under the GNU Lesser General Public License, while the rest of WebKit is available under a BSD-style license.

Further development

Beginning in early 2007, the development team began to implement Cascading Style Sheets extensions, including animation, transitions and both 2D and 3D transforms; such extensions were released as working drafts to the World Wide Web Consortium in 2009 for standardization.
In November 2007, the project announced that it had added support for media features of the HTML5 draft specification, allowing embedded video to be natively rendered and script-controlled in WebKit.
On June 2, 2008, the WebKit project announced they rewrote JavaScriptCore as "SquirrelFish", a bytecode interpreter. The project evolved into SquirrelFish Extreme, announced on September 18, 2008, which compiles JavaScript into native machine code, eliminating the need for a bytecode interpreter and thus speeding up JavaScript execution. Initially, the only supported processor architecture for SFX was the x86, but at the end of January 2009, SFX was enabled for OS X on x86-64 as it passes all tests on that platform.

WebKit2

On April 8, 2010, a project named WebKit2 was announced to redesign WebKit. Its goal was to abstract the components that provide web rendering cleanly from their surrounding interface or application shell, creating a situation where, "web content lives in a separate process from the application UI". This abstraction was intended to make reuse a more straightforward process for WebKit2 than for WebKit. WebKit2 had "an incompatible API change from the original WebKit", which motivated its name change.
The WebKit2 targets were set to Linux, MacOS, Windows, GTK, and MeeGo-Harmattan. Safari for OS X switched to the new API with version 5.1. Safari for iOS switched to WebKit2 since iOS 8.
The original WebKit API has been renamed WebKitLegacy API. WebKit2 API has been renamed just plain WebKit API.

Use

WebKit is used as the rendering engine within Safari and was formerly used by Google's Chrome web browser on Windows, macOS, iOS, and Android before version 4.4 KitKat. Other applications on macOS make use of WebKit, such as Apple's e-mail client Mail and the 2008 version of Microsoft's Entourage personal information manager, both of which make use of WebKit to render e-mail messages with HTML content.

Installed base

New web browsers have been built around WebKit such as the S60 browser on Symbian mobile phones, BlackBerry Browser, Midori, Chrome browser, the Android Web browser before version 4.4 KitKat, and the browser used in PlayStation 3 system software from version 4.10. KDE's Rekonq web browser and Plasma Workspaces also use it as the native web rendering engine. WebKit has been adopted as the rendering engine in OmniWeb, iCab and Web and Sleipnir, replacing their original rendering engines. GNOME's Web supported both Gecko and WebKit for some time, but the team decided that Gecko's release cycle and future development plans would make it too cumbersome to continue supporting it. webOS uses WebKit as the basis of its application runtime. The latest interface update for Valve's Steam employs WebKit to render its interface and built-in browser. WebKit is used to render HTML and run JavaScript in the Adobe Integrated Runtime application platform. In Adobe Creative Suite CS5, WebKit is used to render some parts of the user interface. As of the first half of 2010, an analyst estimated the cumulative number of mobile handsets shipped with a WebKit-based browser at 350 million. By mid April 2015, WebKit browser market share was 50.3%.

Ports

The week after Hyatt announced WebKit's open-sourcing, Nokia announced that it had ported WebKit to the Symbian operating system and was developing a browser based on WebKit for mobile phones running S60. Named Web Browser for S60, it was used on Nokia, Samsung, LG, and other Symbian S60 mobile phones. Apple has also ported WebKit to iOS to run on the iPhone, iPod Touch, and iPad, where it is used to render content in the device's web browser and e-mail software. The Android mobile phone platform used WebKit as the basis of its web browser and the Palm Pre, announced January 2009, has an interface based on WebKit. The Amazon Kindle 3 includes an experimental WebKit based browser.
In June 2007, Apple announced that WebKit had been ported to Microsoft Windows as part of Safari.
is a major web browser on Linux that uses WebKitGTK
WebKit has also been ported to several toolkits that support multiple platforms, such as the GTK toolkit for Linux, under the name WebKitGTK which is used by GNOME Web, Adobe Integrated Runtime, Enlightenment Foundation Libraries, and the Clutter toolkit. Qt Software included a WebKit port in the Qt 4.4 release as a module called QtWebKit. The Iris Browser on Qt also used WebKit. The Enlightenment Foundation Libraries port – EWebKit – was developed focusing the embedded and mobile systems, for use as stand alone browser, widgets-gadgets, rich text viewer and composer. The Clutter port is developed by Collabora and sponsored by Robert Bosch GmbH.
There was also a project synchronized with WebKit called Origyn Web Browser, which provided a meta-port to an abstract platform with the aim of making porting to embedded or lightweight systems quicker and easier. This port is used for embedded devices such as set-top boxes, PMP and it has been ported into AmigaOS, AROS and MorphOS. MorphOS version 1.7 is the first version of Origyn Web Browser supporting HTML5 media tags.

Web Platform for Embedded

Web Platform for Embedded is a WebKit port designed for embedded applications; it further improves the architecture by splitting the basic rendering functional blocks into a general-purpose routines library, platform backends, and engine itself.
The GTK port, albeit self-contained, can be built to use these base libraries instead of it's internal platform support implementation.

Forking by Google

On April 3, 2013, Google announced that it would produce a fork of WebKit's WebCore component, to be named Blink. Chrome's developers decided on the fork to allow greater freedom in implementing WebCore's features in the browser without causing conflicts upstream, and to allow simplifying its codebase by removing code for WebCore components unused by Chrome. In relation to Opera Software's announcement earlier in the year that it would switch to WebKit by means of the Chromium codebase, it was confirmed that the Opera web browser would also switch to Blink. Following the announcement, WebKit developers began discussions on removing Chrome-specific code from the engine to streamline its codebase. WebKit no longer has any Chrome specific code.

Components

WebCore

WebCore is a layout, rendering, and Document Object Model library for HTML and Scalable Vector Graphics, developed by the WebKit project. Its full source code is licensed under the GNU Lesser General Public License. The WebKit framework wraps WebCore and JavaScriptCore, providing an Objective-C application programming interface to the C++-based WebCore rendering engine and JavaScriptCore script engine, allowing it to be easily referenced by applications based on the Cocoa API; later versions also include a cross-platform C++ platform abstraction, and various ports provide more APIs.
WebKit passes the Acid2 and Acid3 tests, with pixel-perfect rendering and no timing or smoothness issues on reference hardware.

JavaScriptCore

JavaScriptCore is a framework that provides a JavaScript engine for WebKit implementations, and provides this type of scripting in other contexts within macOS. JavaScriptCore is originally derived from KDE's JavaScript engine library and the PCRE regular expression library. Since forking from KJS and PCRE, JavaScriptCore has been improved with many new features and greatly improved performance.
On June 2, 2008, the WebKit project announced they rewrote JavaScriptCore as "SquirrelFish", a bytecode interpreter. The project evolved into SquirrelFish Extreme, announced on September 18, 2008, which compiles JavaScript into native machine code, eliminating the need for a bytecode interpreter and thus speeding JavaScript execution.
An optimizing just-in-time compiler named FTL was announced on May 13, 2014. It uses LLVM to generate optimized machine code. "FTL" stands for "Fourth-Tier-LLVM", and unofficially for faster-than-light, alluding to its speed. As of February 15 2016, the backend of FTL JIT is replaced by "Bare Bones Backend".