[WebKit-devel] (K)WebView initialization change proposal

Paweł Prażak kojot350 at gmail.com
Tue May 5 18:23:29 CEST 2009


Hi!

I found that in KWebView's and WebView's constructors we create
(K)WebPage object and set it, so if we create new WebView we create
and immediately destroy a KWebPage object (in KWebView's constructor)
and than we create WebPage object.

I propose to eliminate this unnecessary object and to make WebPage
creation lazy. This way, we will have less overhead in constructor and
the KWebView::page() will never return a null pointer.

The WebPage would be created on demand if needed (in page() method).

About the KWebView::page(), something weird happens there, but the
problem is not so obvious on the first sight. We call QWebView::page()
to determine if we already have one, the problem is that
QWebView::page() creates new QWebPage if needed (if d->page is null),
so we create new QWebPage just to maka qobject_cast<KWebPage *> and
find out that its not a KWebPage.

Please take a look at attached patch with proposed implementation for details.

I look forward to your comments :)

--
Best Regards,
Paweł
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-WebView-initialization-change.patch
Type: text/x-patch
Size: 4395 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/webkit-devel/attachments/20090505/bce29808/attachment.patch 


More information about the WebKit-devel mailing list