Changes between Initial Version and Version 1 of QtWebKitHacking

Mar 12, 2008 3:01:11 AM (16 years ago)



  • QtWebKitHacking

    v1 v1  
     1In the spirit of many HACKING files that came before this one this file contains a high level overview of the QtWebKit classes and how they interact.  This is meant mostly for those who want to hack on QtWebKit rather then developers who want to use QtWebKit.  It isn't complete by any means, but should give you a nice overview and some hints on where to start looking when you want to enhance/fix something.
     5QWebView - A QWidget that wraps QWebPage, many functions just call page()->foo() or page()->mainFrame()-foo().  This class exists mostly to pass QWidget events to QWebPage.  You could write a similar class using QGraphicsItem and QWebPage.
     7QWebPage - A web page with a pointer to QWebView if set.  Contains many if not all of the webkit objects.  Really this is just a class that owns a bunch of other objects.  Most of webkit stuff (url, html, etc) is down in the frame and not here.
     8 - has a QWebPluginFactory and QWebSettings
     9 - has a QNetworkAccessManager which is typically shared among all QWebpage's
     10 - has a QWebHistory for this page
     11 - has a (main) QWebFrame
     12 Webkit wise it has:
     13 - WebCore::ChromeClientQt *chromeClient;
     14 - WebCore::ContextMenuClientQt *contextMenuClient;
     15 - WebCore::EditorClientQt *editorClient;
     16 - WebCore::Page *page;
     18QWebPluginFactory - QObject that is subclasses so developers can add plugins to QWebPage
     19    WebCoreSupport/FrameLoaderClientQt.cpp is the one that call's create()
     21QWebSettings - there is one global and one per page.  Contains settings such as the current font size.
     23QNetworkAccessManager - Qt class that gets/sends QNetworkRequest's.  All i/o http etc is in here
     24   Also contains the QCookiejar. get() is called by QNetworkReplyHandler.cpp QNetworkReplyHandler listens for finished.
     26QWebHistory - history for the current page.  Wrapper around WebCore::BackForwardList::addItem  addItem is called when there is new data from QNetworkReplyHandler::forwardData()
     28QWebHistoryInterface - base class that a global history manager should subclass
     29 - historyContains() is called from WebCore::checkPseudoState()
     30 - addHistoryItem is called from FrameLoaderClientQt::updateGlobalHistoryForStandardLoad()
     32QWebFrame - container of what we typically think of a webpage, a url with a data, scrollbar, etc
     33 - has N child frames
     34 - This is where you find the paint, print, etc functions
     35 - contains the url, name, referrer
     36 - has a QWebFrame *q;
     37 - has a WebCore::FrameLoaderClientQt *frameLoaderClient;
     38 - has a WebCore::Frame *frame;
     39 - has a QWebPage *page;
     41QWebHitTestResult - used to find out what is under a point, see QWebFrame::hitTestContent(point)
     42 - wrapper around HitTestResult
     47WebKit/qt/WebCoreSupport/  Virtual classes that are implemented as a way for webkit to do stuff outside of webkit such as closing the tab/page/browser or getting a url
     49ChromeClientQt subclass of WebCore::ChromeClient and has a pointer to QWebPage.
     50This is how many of the calls from webkit including signals like toolBarVisibilityChangeRequested(visible); get sent up to QWebPage
     52ContextMenuClientQt.cpp - does nothing (who handles context menu's?)
     54DragClientQt.cpp - implemented using QDrag
     56EditCommandQt.cpp - Command for undo/redo in editors
     58EditorClientQt.cpp - grammar, spelling not implemented... some key handling stuff... not sure
     60InspectorClientQt.cpp - Makes a QWebView top level window for the inspector
     62FrameLoaderClientQt.cpp - implements all of the loading functionality.  mishmash of stuff from creating a frame, getting the user agent, pulling up a file dialog, create plugin, accepting/denying urls.
     68Inside WebCore/ is the majority of the webkit logic. Various parts have implementation that hook in Qt code or use Qt code from the above classes.  Most of the Qt code I have read here is small.
     71 - focus, mouse, wheel, events
     72 - drag-n-drop
     75 - wrapper to support the QWebPluginFactory plugins ?
     78 - QClipboard wrapper ?
     81 DocumentLoaderQt - not implemented
     84 - CookieJarQt.cpp - uses the current QNetworkAccessManager's cookiejar to get/set cookies
     85 - StringQt.cpp - wrapper for QString constructors
     86 - KURLQt.cpp - wrapper for QUrl and provides KURL(const QUrl& url) and operator QUrl()
     87 - SoundQt.cpp - implements systemBeep()  :)
     88 - Many more classes....