Bug 20952 - QtWebKit needs the old history pull model for API Compability
Summary: QtWebKit needs the old history pull model for API Compability
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 25485
  Show dependency treegraph
 
Reported: 2008-09-19 19:15 PDT by Holger Freyther
Modified: 2009-04-30 11:07 PDT (History)
2 users (show)

See Also:


Attachments
Add the GlobalHistory back for QtWebKit (6.68 KB, patch)
2008-09-19 19:17 PDT, Holger Freyther
darin: review-
Details | Formatted Diff | Diff
Add the GlobalHistory back for QtWebKit. (15.38 KB, patch)
2008-12-14 08:21 PST, Holger Freyther
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Holger Freyther 2008-09-19 19:15:48 PDT
In r30840 the global history was replaced with PageGroup and pushing the visited links into WebCore. While this new model brings a great speed improvement to visited link coloring it breaks the pull model of the Qt API. For API Compability QtWebKit needs to have a compat mode.
Comment 1 Holger Freyther 2008-09-19 19:17:34 PDT
Created attachment 23590 [details]
Add the GlobalHistory back for QtWebKit

Optionally have a global history fallback which is enabled for the qtwebkit platform.
Comment 2 Eric Seidel (no email) 2008-09-20 13:38:04 PDT
Comment on attachment 23590 [details]
Add the GlobalHistory back for QtWebKit

Really?  WebCore shouldn't have any API.
Comment 3 Holger Freyther 2008-09-20 14:10:34 PDT
(In reply to comment #2)
> (From update of attachment 23590 [details] [edit])
> Really?  WebCore shouldn't have any API.

I think there is a misunderstanding. The QtWebKit API for history is very basic and only has a "bool contains(const QUrl&)" method. This used to match perfectly with the internal model of WebCore. The internal model was changed to the better (PageGroup and pushing the visited links for a group into WebCore and hashing them) and the semantic of the QtWebKit API does not work anymore. For QtWebKit compability reasons it is required to have a fallback (which is #ifdef'ed and not used for the other platforms).

So the QtWebKit API broke due changes in WebCore and we need a way to have the API to work as in Qt4.4.

Comment 4 Darin Adler 2008-09-21 11:34:54 PDT
I'm really sad this got exposed in the QtWebKit API. I've been talking about this change for a long time, and requiring actual URL objects to be made for every link to check visited status really kills performance!

Anyway, I'll review soon.
Comment 5 Darin Adler 2008-10-03 13:06:03 PDT
Comment on attachment 23590 [details]
Add the GlobalHistory back for QtWebKit

I'm disappointed that this makes the visited link code more complicated -- those two new Document functions have interfaces that are hard to understand with a mysterious boolean result and a fixed size buffer in the header, while visitedLinkHash is so much easier to understand!

Can we remove this in the future? Would you be willing to change the Qt API?

This is an area we are likely to want to refine further -- I had been planning to change the algorithm to be faster and not require putting the URL into a buffer. The legacy dependency here is going to make it hard to make that improvement.

+// We have to fallback to the old historyContains behaviour for the Qt4.4 API

Should be "fall back", the verb, rather than "fallback", the noun.

 unsigned Document::visitedLinkHash(const AtomicString& attributeURL) const
 {
-    const UChar* characters = attributeURL.characters();
     unsigned length = attributeURL.length();
     if (!length)
         return 0;

It doesn't make sense to put this into a local variable when it's only used once. I also don't think we need a special case for 0 in this function any more. The other functions already have special cases.

+    return AlreadyHashed::avoidDeletedValue(result ?
+                                            attributeURL.string().impl()->hash() :
+                                            StringImpl::computeHash(buffer.data(), buffer.size()));

This is not our usual formatting. Maybe you need to use another local variable to avoid having this deeply indented ? : expression.

     if (hasColonSlashSlash && !needsTrailingSlash(characters, length))
-        return AlreadyHashed::avoidDeletedValue(attributeURL.string().impl()->hash());
-
-    Vector<UChar, 512> buffer;
+        return true;

I think this needs to be return false, not true.

+        result.append(characters, length);
+        result.append('/');
+        return false;

I think this needs to be return true, not false.

-    return AlreadyHashed::avoidDeletedValue(StringImpl::computeHash(buffer.data(), buffer.size()));
+    return false;

I think this needs to be return true, not false.

How did you test?
Comment 6 Holger Freyther 2008-12-14 08:13:35 PST
(In reply to comment #5)

> How did you test?

I don't remember, but the things you spotted imply badly or not at all at least no tests on OSX/Win were done.
Comment 7 Holger Freyther 2008-12-14 08:21:56 PST
Created attachment 26011 [details]
Add the GlobalHistory back for QtWebKit.

Another patch working on the LinkHash and CSSStyleSelector:
  - Add a method to LinkHash to resolve the URL. In contrast to the previous attempt the API is not too ugly

  - I'm aware how ugly this is, specially of having a #ifdef in the CSSStyleSelector and having a WebKit type there. For Qt4.5 it is needed though. Maybe it is time to add a "bridge" for QtWebKit as well and some hints to reduce the ugliness are much appreciated.

  - The limited tests of Gtk+ still pass and a test case for QtWebKit is added
Comment 8 Simon Hausmann 2009-02-10 08:56:03 PST
Comment on attachment 26011 [details]
Add the GlobalHistory back for QtWebKit.

Darin, could you take another look at Holger's latest patch?

FWIW I agree about the fact that it's very sad that this became public API in Qt and I'm all in favour of deprecating it and having a minimalistic API instead that completely hides the actual history tracking.

Thanks :)
Comment 9 Darin Adler 2009-04-19 14:47:20 PDT
Comment on attachment 26011 [details]
Add the GlobalHistory back for QtWebKit.

r=me
Comment 10 Eric Seidel (no email) 2009-04-29 14:57:47 PDT
Did this ever land?  If it's not really needed by Qt, lets just chuck this patch! :)
Comment 11 Simon Hausmann 2009-04-30 03:27:07 PDT
Landed in r43052
Comment 12 Dimitri Glazkov (Google) 2009-04-30 10:49:14 PDT
This broke Chromium build :-\.

I think I'll just plug it for now by defining a no-opish visitedURL, but I agree with everybody here -- let's API this puppy.

Comment 13 Dimitri Glazkov (Google) 2009-04-30 11:07:01 PDT
I opted for creating a new bug 25485 to track Chromium-specific mods. Re-closing.