Fact-checked by Grok 2 weeks ago

KHTML

KHTML is a discontinued rendering developed by the project as the core HTML rendering component for the and various KDE applications. Originating in the late 1990s, KHTML underwent a significant rewrite in March 1999 by Lars Knoll, adopting the W3C (DOM) as its internal representation to improve standards compliance. In mid-1999, support was added through Harri Porten's KJS , followed by CSS implementation between January and March 2000 by Knoll, Antti Koivisto, and Dirk Mueller, establishing KHTML as a lightweight yet capable web comparable to contemporaries like and . The engine supported key web standards, including XML/HTML4 parsing, DOM Levels 1 and 2, ECMA-262 1.5 compliance, CSS 2.1 (with partial CSS3 elements), and Java applet rendering. KHTML's architecture emphasized modularity and integration with , enabling its use beyond browsing in email clients and other tools for embedding web content. Its most notable legacy stems from Apple's 2001 fork, which evolved into the engine, powering , the iPhone browser, and influencing further derivatives like Blink in , thus extending KHTML's impact to the majority of modern web browsers. of KHTML ceased with the transition to KDE Frameworks 6 in 2024, though it remains available in legacy KDE 5 branches for .

History

Origins

KHTML's development began in 1998 as an initiative by contributors to the project, notably Torben Weis and Martin Jones, who developed the precursor KDE HTML Widget (khtmlw) providing basic 3.2 support. This laid the groundwork for a dedicated layout engine aimed at the web browser and file manager. The effort sought to deliver a seamless, integrated browsing experience within the desktop environment, replacing earlier rudimentary HTML rendering components and enabling to serve as a unified tool for web navigation and file handling. The primary motivations behind KHTML were to engineer a lightweight rendering engine that prioritized web standards compliance, offering an open-source counterpoint to dominant proprietary solutions such as Microsoft's . By building upon the framework, the developers ensured cross-platform portability and efficient integration with KDE's component-based architecture, known as KParts, which allowed modular embedding of the engine into various applications without excessive overhead. This approach emphasized simplicity and adherence to specifications like HTML 4.0, focusing initially on core rendering capabilities while deferring advanced scripting features. Lars Knoll led a significant rewrite in to advance these goals. KHTML's first public integration occurred with the release of in 2.0 on October 23, , where it handled HTML 4.0 rendering but lacked built-in JavaScript support, relying instead on external modules for enhanced functionality. Early versions provided HTML 4.0 rendering, with for CSS Level 2 and DOM Level 1 added in subsequent iterations starting in 1999-. Early adopters appreciated its standards-oriented design, though full compliance evolved over subsequent iterations. A significant early challenge for the KHTML team was operating with limited resources in comparison to larger endeavors like the project, which boasted greater funding and developer contributions. This constraint influenced the adoption of a from the outset, leveraging KDE's KParts system to facilitate incremental improvements and easier maintenance without overhauling the entire codebase. Despite these hurdles, the engine's focus on efficiency and interoperability positioned it as a viable option for resource-conscious systems.

Rewrite and Improvements

In the early 2000s, KHTML underwent a significant refactoring led by Lars Knoll and other developers to improve its performance, modularity, and compliance with web standards. The effort began with a complete committed to the KDE CVS repository in August 1999 by Knoll, which adopted the W3C (DOM) as the engine's internal representation. This change separated HTML parsing from layout calculations, resulting in better speed and reduced memory usage compared to the initial widget-based design. From January to March 2000, collaborated with Antti Koivisto and Mueller to add comprehensive support for Cascading Style Sheets (CSS) and stabilize KHTML's architecture, making it suitable for rendering complex web applications on par with engines like and . Contributions from the broader community expanded during this phase, culminating in the integration of DOM Level 2 support by 2002, which enhanced dynamic content manipulation through refcounted memory management and fuller adherence to W3C specifications. Further enhancements focused on standards compliance, with KHTML achieving full passage of the Acid1 test—validating CSS1 implementation—by the release of 3 in 2002. Support for CSS 2.1 was progressively strengthened from 2003 through 2005, enabling more reliable styling and layout for modern web pages within the 3 framework. These refactorings collectively transformed KHTML into a mature, efficient engine, prioritizing conceptual adherence to web standards over exhaustive feature lists.

Expansion with Modules

In the early 2000s, KHTML's functionality was extended through the development of dedicated modules that addressed key gaps in web scripting and multimedia rendering, allowing Konqueror to handle dynamic content more effectively while maintaining a lightweight core. One pivotal addition was the KJS engine, created in 1999 by Harri Porten to fulfill Konqueror's need for ECMAScript-compliant execution. This module integrated seamlessly with KHTML's , enabling the interpretation of embedded scripts and supporting interactive web elements without bloating the primary rendering pipeline. Building on this foundation, the KSVG module was initiated in 2003 to introduce experimental support for (SVG) 1.1, focusing on vector-based rendering for diagrams, charts, and animations within . As a KPart component, KSVG provided partial implementation of the W3C standard, including features like rotated text and ECMAScript-driven interactivity, though full completion was never achieved due to shifting priorities in development. This extension enhanced KHTML's ability to display high-quality, resolution-independent graphics, marking an early open-source effort toward vector web standards compliance. Complementing these were image-handling enhancements via the KImageIO library and associated plugins, developed between 2002 and 2004 to broaden support for common formats such as and in and other applications. KImageIO served as an interface for loading and saving images through a plugin architecture, allowing dynamic registration of formats like those in kdelibs without requiring recompilation of the core . KHTML's facilitated optional loading of these components—such as KJS for scripting, KSVG for vectors, and KImageIO for —ensuring the engine remained efficient for basic browsing while scaling for advanced needs. By 2005, with integrations like those in 3.4 and 3.5, these modules contributed to Konqueror's strong compliance with web standards, including near-full CSS 2.1 support and successful passage of the Acid2 test, covering a substantial portion of contemporary web features.

Discontinuation

Active development of KHTML began to slow after 2010 as the project shifted focus toward QtWebEngine, a Chromium-based rendering engine, to provide better support for modern web standards in applications like . This transition was driven by the need for improved compatibility with evolving web technologies, as KHTML struggled to keep pace with rapid advancements in engines. The last significant updates to KHTML occurred in 2016, primarily consisting of security patches and minor maintenance to ensure compatibility with KDE Frameworks 5 (KF5). During this period, efforts centered on addressing vulnerabilities rather than adding new features, leading to stagnation in support for HTML5 and CSS3 specifications as development resources diminished. In 2023, KDE officially announced the discontinuation of KHTML, with the engine removed from KDE Frameworks 6 (KF6) upon its release in 2024; the GitHub and GitLab repositories were archived, preserving the KF5 branch as the final maintained version. This decision was influenced by the overwhelming dominance of the WebKit and Blink rendering engine ecosystems, which rendered ongoing maintenance of KHTML unsustainable for the KDE community. Concurrently, Konqueror pivoted toward integration with QtWebEngine by around 2016, while the KDE project promoted Falkon—a new browser based on QtWebEngine—as the primary web browsing solution starting in 2017.

Technical Features

Core Rendering Engine

KHTML's core rendering engine processes web content through a series of stages, beginning with parsing the and CSS to construct the necessary data structures for layout and display. The parsing stage employs an HTML tokenizer that converts the raw source into a (DOM) tree using a state machine-based approach. This tokenizer is instantiated via the DocumentImpl::open() method and can be either an HTMLTokenizer for standard or an XMLTokenizer for XML documents. The CSS parser then processes stylesheet rules, organizing them into computed styles that are applied to DOM nodes according to the CSS cascade rules, determining the visual properties for each element. In the layout phase, KHTML computes the box model for elements, distinguishing between and inline boxes to determine their geometric properties such as width, height, margins, and padding. This computation follows the standard , where , padding, borders, and margins are calculated relative to the containing . Reflow is triggered whenever , styles, or dimensions change, recalculating positions and sizes incrementally to update the layout tree efficiently; it supports positioning schemes including fixed, relative, , and static. The render tree, a parallel structure to the DOM, represents visual elements and includes anonymous render objects inserted to wrap inline or handle structural needs as per CSS specifications, such as enclosing the string "more text" in an anonymous . The painting stage rasterizes the layout results onto the screen using Qt's graphics primitives, primarily through the QPainter class for drawing elements like text, images, and borders. Elements with z-index or opacity are handled in separate layers to enable without full repaints, leveraging Qt's clipping and capabilities for efficient rendering. The KHTMLView class manages this process, invoking paint methods with QPainter instances clipped to specific regions (e.g., int clipx, int clipy, int clipw, int cliph).

Standards Compliance

KHTML achieved full compliance with the 4.01 specification early in its development, positioning it as one of the first browser engines to prioritize web standards from inception. By , with the of 3.5, KHTML demonstrated strong adherence to CSS 2.1, becoming the second engine after to fully pass the Acid2 test, which verifies rendering of complex and CSS features. However, support for emerging elements remained experimental and incomplete even by 2010; for instance, basic parsing for elements like <video> and <canvas> was added in later 4 releases, but full functionality was lacking without additional plugins. In terms of CSS3, KHTML showed early leadership in specific areas, with version 3.5.6 in 2007 passing all tests in the Automated CSS3 Selectors Testsuite, outperforming contemporaries in selector support. Advanced CSS3 modules like flexbox were not natively implemented, remaining unsupported in core KHTML until discontinuation, though late patches in KDE 4 series introduced partial compatibility via experimental flags. Other standards included robust basic parsing for XML and , enabling strict document handling. DOM support was comprehensive for Levels 1 and 2, covering core node manipulation and events, but Level 3 features such as advanced and load/save methods were only partially realized. Native WebGL integration was absent, with any 3D graphics relying on external KDE modules or plugins like those based on Qt . Testing outcomes highlighted KHTML's strengths and gaps. By 2009, using KHTML scored 83/100 on the test, reflecting solid progress in , DOM, and conformance but falling short of full compliance due to incomplete and support. Persistent limitations were evident in rendering bugs, such as incorrect placement of table footers (<tfoot>) and failure to apply frame/rules attributes, as documented in KDE's bug tracker. saw implementation in KDE 4.1 but suffered from issues like improper responsive behavior on dynamic content resizes, also tracked in KDE reports. These challenges underscored KHTML's focus on core standards while highlighting areas where ongoing maintenance was needed for evolving web specifications.

Derivatives and Legacy

WebKit Development

Apple engineers initiated a of KHTML in 2001 to develop a rendering engine for the browser on macOS. This , initially kept , incorporated modifications to KHTML's core while building upon its modular architecture, with the goal of optimizing performance for Apple's ecosystem. The project remained closed-source for several years, during which Apple contributed enhancements internally before deciding to open it to the community. On June 7, 2005, Apple released the engine as under the name , using a dual LGPL and BSD license, retaining the LGPL for KHTML-derived components while applying BSD to new Apple code. evolved KHTML's KJS module into a more robust JavaScriptCore engine, which added just-in-time () compilation capabilities with the in June 2008 to improve script execution speed. Another key enhancement was the introduction of accelerated compositing in 2009, leveraging GPU hardware for smoother animations and transformations, marking a significant departure from KHTML's software-based rendering approach. WebKit achieved several milestones that highlighted its advancements over the original KHTML. In March 2008, it became the first engine to achieve a full 100/100 score on the test in a public build, demonstrating superior standards compliance in rendering , DOM, and interactions. By mid-2009, with 4, WebKit added native support for video playback using the codec, enabling seamless embedding of media without plugins and setting a precedent for multimedia integration. This engine also formed the foundation for iOS WebKit, powering the iPhone's mobile browsing experience from 2007 onward and influencing the development of touch-optimized web standards. Licensing remained a blend of the original KHTML's LGPL for inherited code and BSD for Apple's additions, ensuring compatibility with diverse platforms while allowing proprietary integrations. By , following external forks, Apple restructured the project to clearly delineate components: WebCore as the successor to KHTML's rendering engine and as the standalone interpreter, both under LGPL, with the overarching API layer under BSD. These changes solidified WebKit's role as a performant, standards-focused engine distinct from its KHTML roots.

Other Forks and Influences

In 2013, Google forked WebKit to create Blink, a rendering engine specifically tailored for the Chromium project underlying Google Chrome, introducing divergences such as enhanced multi-process architecture for improved security and stability, and integration with the V8 JavaScript engine. Blink has since become the dominant browser engine, powering approximately 80% of global web browsing (as of October 2025) through browsers like Chrome, Microsoft Edge, and Opera. Beyond the primary WebKit fork, KHTML saw limited additional derivatives, including TDEHTML, a maintained branch adapted for the Trinity Desktop Environment as an alternative to KDE's ecosystem. Experimental ports also emerged, such as an adaptation of KHTML for the Haiku operating system in the early 2010s, enabling basic web rendering within Haiku's native environment via the HaikuPorts repository, where it remains active for compatibility purposes. KHTML's modular architecture, built around KParts for component reusability, influenced subsequent open-source web engine designs emphasizing extensibility and integration with desktop frameworks. Elements of its , particularly in and JavaScript handling via KJS, were indirectly reused in QtWebKit, a 2007–2016 Qt framework port that bridged WebKit's rendering capabilities to Qt applications, facilitating embedded web views in . As of 2025, forks like TDEHTML and the port continue to receive maintenance for legacy compatibility, while QtWebEngine has succeeded QtWebKit for modern Qt applications. Overall, KHTML fostered early open-source diversity in engines during the pre-Chromium era, providing a lightweight alternative to proprietary systems and contributing to the evolution of standards compliance in community-driven projects; its archived repositories continue to support research into historical rendering techniques and challenges.

References

  1. [1]
    Konqueror - KDE UserBase Wiki
    Mar 16, 2013 · Konqueror is the built-in web browser. It has fast, standards-compliant HTML and JavaScript rendering engines, KHTML and KJS respectively.<|control11|><|separator|>
  2. [2]
    Development/Architecture/KDE3/KHTML - KDE TechBase
    Feb 9, 2018 · KHTML is an XML/HTML4 compliant HTML library, with support for DOM, Java, JavaScript and Cascading Style Sheets (CSS). You can get an overview ...<|control11|><|separator|>
  3. [3]
    History/KHTML - HTML WG Wiki - W3C
    Feb 9, 2010 · KHTML was rewritten in 1999 to use W3C DOM, added Javascript, then CSS support, and became the basis for Webkit and browsers like Safari.
  4. [4]
    KDE 4.0 Released
    Jan 11, 2008 · KHTML is the webpage rendering engine used by Konqueror, KDE's web browser. KHTML is light-weight and supports modern standards such as CSS 3.
  5. [5]
    aKademy 2006 - State of KHTML - KDE
    State of KHTML ... The KHTML engine has long been a key part of the KDE desktop environment, providing us with a tightly integrated web browser, rich email ...
  6. [6]
    George and Lars on KHTML and WebKit
    Dec 13, 2006 · They cover the early history of KHTML, as well as some of the newer things going on with WebKit and KHTML. One point they mention a number ...
  7. [7]
    KDE/khtml - GitHub
    KHTML HTML rendering engine. Removed for KF6, the 'kf5' branch contains the last maintained state. Releases 249 tags
  8. [8]
    [PDF] 20yearsofKDE.pdf - 20 Years of KDE
    KDE at that point had become more than just a desktop, evolving into something greater: KDE was no longer the software created by people, but the people who ...
  9. [9]
    Interview With KDE's Konqueror Team - OSnews
    Sep 3, 2001 · ... KHTML only provides the rendering engine, there is little that can be stripped from the rendering engine without sacrifying standards compliance ...
  10. [10]
  11. [11]
    Acid 2 in major browsers - HowToCreate
    Konqueror 3 was the first KHTML browser to pass the original (CSS1) Acid test, which was published 3 years before the first Konqueror browser was released. Acid ...
  12. [12]
    History - HTML WG Wiki - W3C
    Jan 1, 2014 · Lars Knoll rewrites KHTML to use the standard W3C DOM as its internal document representation, enabling integration with Harri Porten's KJS to ...
  13. [13]
    [PDF] Architecture and evolution of the modern web browser
    Jun 20, 2006 · Konqueror makes extensive use of various KDE libraries: KHTML performs parsing, layout, and rendering of web pages; KJS interprets embedded ...
  14. [14]
    KDE Conquers the Vectors with KSVG
    Sep 16, 2003 · KSVG has recently been moved to the kdegraphics module, meaning that KSVG will now be part of the KDE 3.2 release ... SVG support is not ...Missing: KHTML | Show results with:KHTML
  15. [15]
    [PDF] KDE 2.0 Development - David Sweet
    ... Konqueror, with all its plug-ins for various mime types. If you think ... KImageIO::registerFormats(); as shown on line 15. Conveniently enough, this ...
  16. [16]
    Development/Architecture/KDE3/System Configuration Cache
    Mar 11, 2007 · ... image format that is supported by KDE. The correct way to access this information is through the KImageIO class. ... konqueror, netscape ...
  17. [17]
    Announcing KDE 3.4 - KDE Community
    Mar 16, 2005 · KHTML has improved standard support and now close to full support for CSS 2.1 and the CSS 3 Selectors module; Better synchronization between ...
  18. [18]
    KDE 3.5 Released
    Nov 29, 2005 · Konqueror is the second major web browser to pass the Acid2 CSS test, ahead of Firefox and Internet Explorer; Konqueror can also free webpages ...
  19. [19]
    365299 – make transition from qtwebkit to qtwebengine
    Sep 23, 2024 · Since Jan feels required to ultimately support both khtml forks, the result will probably look like a plugin driven system with the (available ...Missing: shift | Show results with:shift
  20. [20]
    The state of Falkon: KDE's browser is much better than you know
    Dec 9, 2024 · Falkon is in a far better, more usable, and capable state than most people know. Hopefully, this article will get a few more people to try it out.
  21. [21]
    Frameworks / KHtml · GitLab - KDE Invent
    KHTML. HTML rendering engine. Removed for KF6, the 'kf5' branch contains the last maintained state.
  22. [22]
    Release of KDE Frameworks 5.28.0
    Nov 15, 2016 · Tuesday, 15 November 2016. KDE today announces the release of KDE Frameworks 5.28.0. This release is part of a series of planned monthly ...
  23. [23]
    The KDE desktop gets an overhaul with Plasma 6 - LWN.net
    Feb 28, 2024 · Schwan pointed to removal of deprecated frameworks, like KHtml, the KJS javascript engine, and KHotkeys. The project has also worked to get rid ...
  24. [24]
    [PDF] What's cooking for KDE Frameworks 6
    Retire some frameworks. ○. KDELibs4Support. ○. KHTML. ○. KDEWebKit. ○. KJS(Embed). ○. Kross. ○. KMediaPlayer. ○. KXmlRpcClient. ○. KInit. Page ...
  25. [25]
    About Falkon
    Falkon is a KDE web browser using QtWebEngine rendering engine, previously known as QupZilla. It aims to be a lightweight web browser available through all ...Missing: 2016 | Show results with:2016
  26. [26]
    373781 – Konqueror 5.0.97 crashes with qtwebengine
    Feb 1, 2017 · KDE Bugtracking System – Bug 373781 Konqueror 5.0.97 crashes with qtwebengine Last modified: 2017-02-01 00:33:44 UTC. Home; | New; | Browse ...Missing: switch | Show results with:switch
  27. [27]
    docs/DESIGN.html · v5.75.0 · Frameworks / KHtml - KDE Invent
    Jan 8, 2019 · a url argument. ... We support DOM Level2 except for the events model at the moment. ... We support almost all of HTML4 and xhtml. ... We support ...
  28. [28]
    CSS Box Model
    Jun 20, 2008 · Browsers based on the Gecko engine (Mozilla and Netscape 6 and above) or KHTML (Safari and Konqueror) seem to correctly implement the box model ...
  29. [29]
    Source: khtmlview.h - KDE API Reference
    ... QPainter; class QRect; namespace DOM { class ... khtml { class RenderObject; class RenderRoot ... QPainter * p, int clipx, int clipy, int clipw, int ...
  30. [30]
    KHTML future - Zack Rusin
    Oct 23, 2007 · "KHTML is likely to be superseded by WebKit in KDE 4.1 / Qt 4.4." So ... The effort should go into a) standards compliance and b) getting web ...
  31. [31]
    KDE 3.5: A Visual Guide to New Features
    Konqueror has now become the second browser to pass the arduous 'Acid2' css compliance test. Apple's Safari browser was the first, which makes use of ...
  32. [32]
    KDE 3.5.6 Changelog
    With these changes, KHTML becomes the first rendering engine to thoroughly pass the 578 tests of the excellent Automated CSS3 Selectors Testsuite (http://www.Missing: removed | Show results with:removed<|control11|><|separator|>
  33. [33]
    Schedules/KDE4/4.1 Feature Plan - KDE Community Wiki
    Sep 13, 2009 · KHTML, prospective loading of other network resources while waiting for arrival of blocking scripts. DONE, KHTML, Support CSS3 Media Queries.<|control11|><|separator|>
  34. [34]
    29577 – table rendering: tfoot to the bottom of the ... - KDE bug tracker
    Sep 16, 2002 · Summary: table rendering: tfoot to the bottom of the table! Status: CLOSED FIXED. Alias: None. Product ...Missing: media queries
  35. [35]
    47412 – table rendering: frame and rules attributes do not work
    Oct 27, 2002 · KDE Bugtracking System – Bug 47412 table rendering: frame and rules attributes do not work Last modified: 2002-10-27 20:54:32 UTC. Home; | New ...Missing: media queries
  36. [36]
    Google Chrome Breaks Up With Apple's WebKit - WIRED
    Apr 3, 2013 · The WebKit project is run by Apple, but it's actually a fork of KHTML, a rendering engine featured in the Linux browser Konqueror. In 2001, ...
  37. [37]
    The Browser Engine That Could - The History of the Web
    Jul 7, 2020 · From a browser engine that started as the lesser known option used in an obscure browser to one that would take hold over the entire browser ...
  38. [38]
    JavaScriptCore, the WebKit JS implementation - wingolog
    Oct 28, 2011 · As far as I can tell, for JSC, 2009 and 2010 were spent in "consolidation". By that I mean that JSC had a JIT and a bytecode interpreter, and ...
  39. [39]
    WebKit achieves Acid3 100/100 in public build
    Mar 26, 2008 · WebKit has become the first publicly available rendering engine to achieve 100/100 on Acid3. The final test, test 79, was a brutal torture test of SVG text ...Missing: date | Show results with:date
  40. [40]
    HTML5 Video | Open Source Lab
    Allows for playback of video on a webpage without special plugins, etc. March 2009 - Safari4 adds native support. June 2009 - iPhone 3. Oct 2009 - Google Chrome ...Missing: WebKit | Show results with:WebKit
  41. [41]
    WebKit - Glossary - MDN Web Docs
    Oct 28, 2025 · WebKit began life as a fork of KDE's KHTML and KJS libraries, but many individuals and companies have since contributed (including KDE, Apple, ...
  42. [42]
    Licensing WebKit
    WebKit is open source software with portions licensed under the LGPL and BSD licenses available here. GNU LIBRARY GENERAL PUBLIC LICENSE.
  43. [43]
    Google going its own way, forking WebKit rendering engine
    Apr 3, 2013 · The WebKit project was started by Apple in 2001, itself a fork of a rendering engine called KHTML. The project includes a core rendering engine ...
  44. [44]
    Blink: A rendering engine for the Chromium project
    Apr 3, 2013 · WebKit is a lightweight yet powerful rendering engine that emerged out of KHTML in 2001. Its flexibility, performance and thoughtful design ...
  45. [45]
    History of Web Browser Engines from 1990 until today - Eylenburg
    The loss of browser diversity since the rise of Chromium has been greatly lamented. Below you can find a graph that shows the historical and present browser ...
  46. [46]
    HTML rendering engine - Haiku Depot Server
    KHTML is a web rendering engine, based on the KParts technology and using KJS for JavaScript support. Active: Yes; Name: khtml; Repository: HaikuPorts ...
  47. [47]
    The unforking of KDE's KHTML and Webkit - Ars Technica
    Jul 23, 2007 · At the time, the rendering was decent for 90% of all HTML you could throw at it, but had limited support for JavaScript and other features that ...
  48. [48]
    QtWebKit - WebKit Trac
    Apr 13, 2013 · WebKit is an open source web browser engine. WebKit's HTML and JavaScript code began as a branch of the KHTML and KJS libraries from KDE. As ...