RESOLVED FIXED Bug 105752
Move visited link-checking (and caching) code out of SelectorChecker.
https://bugs.webkit.org/show_bug.cgi?id=105752
Summary Move visited link-checking (and caching) code out of SelectorChecker.
Dimitri Glazkov (Google)
Reported 2012-12-25 20:33:32 PST
Move visited link-checking (and caching) code out of SelectorChecker.
Attachments
Patch (21.47 KB, patch)
2012-12-25 20:44 PST, Dimitri Glazkov (Google)
no flags
Moved cache to document. (20.44 KB, patch)
2012-12-25 21:07 PST, Dimitri Glazkov (Google)
no flags
Introduced VistedLinkState. (30.37 KB, patch)
2012-12-26 18:21 PST, Dimitri Glazkov (Google)
no flags
Patch for landing (29.87 KB, patch)
2012-12-27 10:11 PST, Dimitri Glazkov (Google)
no flags
Dimitri Glazkov (Google)
Comment 1 2012-12-25 20:44:55 PST
Dimitri Glazkov (Google)
Comment 2 2012-12-25 21:07:36 PST
Created attachment 180726 [details] Moved cache to document.
Dimitri Glazkov (Google)
Comment 3 2012-12-25 21:08:58 PST
Sorry, I chickened out and decided to move visited-link cache to Document, which is where it was (life/scope-wise) before. This change now has no behavior changes.
Antti Koivisto
Comment 4 2012-12-26 00:35:14 PST
Comment on attachment 180726 [details] Moved cache to document. View in context: https://bugs.webkit.org/attachment.cgi?id=180726&action=review This doesn't seem like a progression to me. The code get spread out and the already bloaty Document grows further. Why not factor this into a type? LinkStyleInvalidator or similar. > Source/WebCore/html/HTMLAnchorElement.h:107 > + static EInsideLink determineLinkState(Element*); > + static LinkHash linkHashForElement(Element*); Hanging generic Element functions to HTMLAnchorElement is confusing.
Dimitri Glazkov (Google)
Comment 5 2012-12-26 10:19:19 PST
(In reply to comment #4) > (From update of attachment 180726 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=180726&action=review > > This doesn't seem like a progression to me. The code get spread out and the already bloaty Document grows further. > > Why not factor this into a type? LinkStyleInvalidator or similar. Okay. How about dom/VisitedLinkState? I'll also move the determineLinkState, et al. there, so now it will truly represent the visited link state for the Document.
Dimitri Glazkov (Google)
Comment 6 2012-12-26 18:21:51 PST
Created attachment 180773 [details] Introduced VistedLinkState.
Allan Sandfeld Jensen
Comment 7 2012-12-27 03:35:54 PST
Comment on attachment 180773 [details] Introduced VistedLinkState. View in context: https://bugs.webkit.org/attachment.cgi?id=180773&action=review > Source/WebCore/html/HTMLAnchorElement.h:101 > - > + Please try to not include this change in the patch, since it would record the file as changed when it is otherwise not.
Antti Koivisto
Comment 8 2012-12-27 09:23:39 PST
Comment on attachment 180773 [details] Introduced VistedLinkState. View in context: https://bugs.webkit.org/attachment.cgi?id=180773&action=review Looks good. > Source/WebCore/dom/VisitedLinkState.h:49 > + void invalidateStylesForAllLinks(); > + void invalidateStylesForLink(LinkHash); Maybe singular Style?
Dimitri Glazkov (Google)
Comment 9 2012-12-27 10:03:40 PST
(In reply to comment #7) > (From update of attachment 180773 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=180773&action=review > > > Source/WebCore/html/HTMLAnchorElement.h:101 > > - > > + > > Please try to not include this change in the patch, since it would record the file as changed when it is otherwise not. Will remove when landing.
Dimitri Glazkov (Google)
Comment 10 2012-12-27 10:03:52 PST
(In reply to comment #8) > (From update of attachment 180773 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=180773&action=review > > Looks good. > > > Source/WebCore/dom/VisitedLinkState.h:49 > > + void invalidateStylesForAllLinks(); > > + void invalidateStylesForLink(LinkHash); > > Maybe singular Style? Sure thing!
Dimitri Glazkov (Google)
Comment 11 2012-12-27 10:11:38 PST
Created attachment 180807 [details] Patch for landing
WebKit Review Bot
Comment 12 2012-12-27 10:42:29 PST
Comment on attachment 180807 [details] Patch for landing Clearing flags on attachment: 180807 Committed r138509: <http://trac.webkit.org/changeset/138509>
WebKit Review Bot
Comment 13 2012-12-27 10:42:34 PST
All reviewed patches have been landed. Closing bug.
Eric Seidel (no email)
Comment 14 2012-12-27 10:55:08 PST
Thank you again Dimitri. :)
WebKit Review Bot
Comment 15 2012-12-27 12:56:12 PST
Re-opened since this is blocked by bug 105806
Dimitri Glazkov (Google)
Comment 16 2012-12-27 14:38:35 PST
My bad. Got a bit too happy with moving ptrs. Relanding with a fix shortly...
Dimitri Glazkov (Google)
Comment 17 2012-12-27 14:58:07 PST
Darin Adler
Comment 18 2012-12-27 18:05:45 PST
Comment on attachment 180807 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=180807&action=review > Source/WebCore/dom/VisitedLinkState.cpp:48 > +inline static const AtomicString* linkAttribute(Element* element) A little strange to use "inline static" rather than the usual "static inline" that we use elsewhere. > Source/WebCore/dom/VisitedLinkState.cpp:66 > +VisitedLinkState::VisitedLinkState(Document* document) > + :m_document(document) > +{ } Two formatting errors: 1) Missing space after colon. 2) Braces should not be on a single line. > Source/WebCore/dom/VisitedLinkState.cpp:83 > + if (const AtomicString* attr = linkAttribute(element)) > + return WebCore::visitedLinkHash(document->baseURL(), *attr); Would be better to use the word "attribute" instead of the abbreviation "attr". > Source/WebCore/dom/VisitedLinkState.cpp:108 > + // An empty href refers to the document itself which is always visited. It is useful to check this explicitly so > + // that visited links can be tested in platform independent manner, without explicit support in the test harness. > + if (attribute->isEmpty()) > + return InsideVisitedLink; What about an href that consists only of whitespace? Does the visitedLinkHash function trim whitespace when resolving the URL?
Dimitri Glazkov (Google)
Comment 19 2012-12-27 19:20:41 PST
(In reply to comment #18) > (From update of attachment 180807 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=180807&action=review > > > Source/WebCore/dom/VisitedLinkState.cpp:48 > > +inline static const AtomicString* linkAttribute(Element* element) > > A little strange to use "inline static" rather than the usual "static inline" that we use elsewhere. > > > Source/WebCore/dom/VisitedLinkState.cpp:66 > > +VisitedLinkState::VisitedLinkState(Document* document) > > + :m_document(document) > > +{ } > > Two formatting errors: > > 1) Missing space after colon. > 2) Braces should not be on a single line. > > > Source/WebCore/dom/VisitedLinkState.cpp:83 > > + if (const AtomicString* attr = linkAttribute(element)) > > + return WebCore::visitedLinkHash(document->baseURL(), *attr); > > Would be better to use the word "attribute" instead of the abbreviation "attr". > Thank you for spotting these! Fixed in http://trac.webkit.org/changeset/138519. > > Source/WebCore/dom/VisitedLinkState.cpp:108 > > + // An empty href refers to the document itself which is always visited. It is useful to check this explicitly so > > + // that visited links can be tested in platform independent manner, without explicit support in the test harness. > > + if (attribute->isEmpty()) > > + return InsideVisitedLink; > > What about an href that consists only of whitespace? Does the visitedLinkHash function trim whitespace when resolving the URL? I don't know. I was just moving the pipes around.
Note You need to log in before you can comment on or make changes to this bug.