vision thriving 2001

KHTML WebKit

Apple forked KHTML for Safari. Now powers Safari, all iOS browsers. Led to Blink (Chrome) fork in 2013.

What it is

KHTML was a web browser layout engine and JavaScript interpreter developed by the KDE project for the Konqueror browser. WebKit is Apple's fork, consisting of WebCore (layout engine, forked from KHTML) and JavaScriptCore (JS engine, forked from KJS). It renders HTML, CSS, and JavaScript to display web pages.

The story

In the early 2000s, Apple had a browser problem. Safari was shipping with the aging Internet Explorer for Mac as the default, and Apple needed a modern rendering engine. Their engineers evaluated two candidates: Mozilla's Gecko and KDE's KHTML. Gecko was more feature-complete but massive and complex. KHTML was small (under 140,000 lines), cleanly designed, and standards-compliant. Apple chose KHTML.

On June 25, 2001, Lisa Melton at Apple started the internal WebKit project, forking KHTML and its JavaScript engine KJS. Apple developed it behind closed doors for nearly two years before Steve Jobs unveiled Safari at Macworld in January 2003. When Apple finally announced they were using KHTML, the KDE community had mixed feelings—flattered that Apple chose their engine, but concerned about how the relationship would work.

Those concerns proved justified. Apple's development style clashed violently with KDE's open process. Apple would send back changes as enormous, poorly documented 'code drops'—massive patches containing dozens of interdependent changes that were nearly impossible to integrate back into KHTML. KDE developers described the code as 'hugely inconsistent' with 'basically no way of merging in one change without bringing a whole bunch of others in.' When KDE developers tried to contribute patches to WebKit, they sat unreviewed for months, with some rejected over whitespace formatting. One KDE developer called the relationship a 'bitter failure.'

Apple eventually open-sourced WebKit in June 2005, releasing the full source under a BSD license. This helped somewhat, but the codebases had diverged so significantly that meaningful re-convergence never happened. KDE eventually adopted WebKit for their Konqueror browser in 2007, essentially acknowledging that the fork had overtaken the original.

WebKit went on to power Safari, early Android browsers, and briefly Google Chrome—until Google forked WebKit into Blink in 2013, creating yet another generation of the KHTML family tree.

Timeline

KHTML and KJS engines created within the KDE project

Apple starts internal WebKit project by forking KHTML/KJS

Steve Jobs unveils Safari at Macworld, reveals KHTML fork

KDE developers struggle with Apple's large, undocumented code drops

Apple open-sources WebKit under BSD license

KDE begins adopting WebKit for Konqueror browser

Google forks WebKit into Blink for Chrome

Key people

Lisa Melton
Apple engineer who started the internal WebKit project
Steve Jobs
Unveiled Safari with WebKit at Macworld 2003
Don Melton
Apple Safari/WebKit team lead
Lars Knoll
KHTML original developer at KDE

Impact

WebKit is one of the most consequential forks in software history. It powers Safari on every Apple device, meaning hundreds of millions of people use KHTML's descendant daily without knowing it. The WebKit/Blink family tree (KHTML -> WebKit -> Blink) now powers the overwhelming majority of web browsers worldwide.

The fork also became a case study in corporate open source dynamics. Apple took a small community project, built something world-changing on top of it, but handled the upstream relationship poorly enough to generate lasting resentment. The lesson was absorbed by later corporate open source participants.

Lesson: Taking open source code is easy; maintaining a healthy relationship with the upstream community while doing it is the hard part.