Bug 1361274. There's no need to update link :visited state when doing querySelectorAll, since querySelectorAll ignores that state anyway. r=smaug

In our current setup, in which links with an href attribute always match either
:link or :visited, no matter whether that attribute's value is a valid URI,
changes to the attribute always put the element into either the "match nothing"
state or the "match :link" state, via calls to Link::ResetLinkState.

The only thing FlushPendingLinkUpdates is needed for is (lazily, in case it
turns out to not be needed because the element got removed from the DOM anyway)
registering a history observer to switch the link state to :visited as needed.

This means that selector matching consumers that would never expose :visited
state to start with don't need to worry about calling FlushPendingLinkUpdates.
This commit is contained in:
Boris Zbarsky
2017-05-03 16:54:25 -04:00
parent ea4fd14c34
commit 50c4dcff23
7 changed files with 26 additions and 10 deletions

View File

@@ -295,7 +295,6 @@ HTMLContentElement::Match(nsIContent* aContent)
TreeMatchContext matchingContext(false, nsRuleWalker::eRelevantLinkUnvisited,
doc, TreeMatchContext::eNeverMatchVisited);
doc->FlushPendingLinkUpdates();
matchingContext.SetHasSpecifiedScope();
matchingContext.AddScopeElement(host->AsElement());