[bt-devel] QtWebKit DOM access

Gary Holmlund gary.holmlund at gmail.com
Tue Jan 13 07:23:04 MST 2009


Eeli Kaikkonen wrote:
> Quoting Gary Holmlund <gary.holmlund at gmail.com>:
>
>> 2. Scrolls to the correct position based on html anchor. QtWebKit does
>> not have a gotoAnchor() function like KHTML does. I had to call from
>> c++ to javascript to do this.
>>
>
> I guess there must be a way to do this without javascript. After all,
> going to an anchor is basic functionality of any web browser. Maybe we 
> could look into the source code of the Qt example browser (I don't 
> remember what it's called).
When you use a url the anchor is part of the url and works. We use 
setHtml to pass text directly into the webviewer. This does not have an 
anchor parameter. The underlying webkit has a gotoAnchor() just like the 
KHTML view did, but Qt has not provided a wrapper function allowing us 
to use it. Calling Javascript to do it was simple. It is a one line 
function.

>> 4. The Drag/Drop of verses to the bookmark window is working. I had to
>> catch the mousemove and mousedown events in Javascript, gather the DOM
>> info and call c++. The QDrag is created much like it originally was.
>>
>
> How about dropping? Does it accept dropped bookmarks/references?
I just have not reimplememted it. I don't expect any problem with it.

>> I arranged the code in both the chtmlreaddisplay.h/cpp files like this:
>>
>> #ifndef USE_QWEBKIT_CHTML
>>       all of the original code ...
>> #else
>>       new code ...
>> #endif
>>
>> This allows me to compile either the old or new version by the change
>> of one #define. With a "diff" I can show that the original code has not
>> been changed. I have also added a new Javascript file and a c++ class
>> that is called from the Javascript.
>>
>> If you agree, I would like to check in these changes in the next few
>> days and then continue to work on completing this functionality.
>
> I would rather have a new class named BtHtmlReadDisplay. There are not
> so many callers, they could have the #if clauses if necessary.
>
> Another possibility is to create a branch. Then #ifs are not needed at
> all. Something like git would be great now, but maybe we just use svn. 
> It's also possible to create a branch for 1.7 because there won't be 
> much changes left for that and we could backport bug fixes from the 
> webkit HEAD. I also think that it's better to release 1.7 first and 
> only after that move completely to WebKit based development.
>
> --Eeli Kaikkonen
I am open to any of these methods. I may just continue development 
locally for now.

Gary




More information about the bt-devel mailing list