зеркало из https://github.com/mozilla/gecko-dev.git
Bug 762345 - Skip all the QIing stuff in the TreeMatchContext constructor if possible; r=bzbarsky
This commit is contained in:
Родитель
4868367e85
Коммит
b354f9cf8c
|
@ -6132,7 +6132,7 @@ inline static nsresult FindMatchingElements(nsINode* aRoot,
|
|||
|
||||
nsIDocument* doc = aRoot->OwnerDoc();
|
||||
TreeMatchContext matchingContext(false, nsRuleWalker::eRelevantLinkUnvisited,
|
||||
doc);
|
||||
doc, TreeMatchContext::eNeverMatchVisited);
|
||||
doc->FlushPendingLinkUpdates();
|
||||
|
||||
// Fast-path selectors involving IDs. We can only do this if aRoot
|
||||
|
@ -6246,7 +6246,8 @@ nsGenericElement::MozMatchesSelector(const nsAString& aSelector, nsresult* aResu
|
|||
OwnerDoc()->FlushPendingLinkUpdates();
|
||||
TreeMatchContext matchingContext(false,
|
||||
nsRuleWalker::eRelevantLinkUnvisited,
|
||||
OwnerDoc());
|
||||
OwnerDoc(),
|
||||
TreeMatchContext::eNeverMatchVisited);
|
||||
matches = nsCSSRuleProcessor::SelectorListMatches(this, matchingContext,
|
||||
selectorList);
|
||||
}
|
||||
|
|
|
@ -192,10 +192,16 @@ struct NS_STACK_CLASS TreeMatchContext {
|
|||
// Whether this document is using PB mode
|
||||
bool mUsingPrivateBrowsing;
|
||||
|
||||
enum MatchVisited {
|
||||
eNeverMatchVisited,
|
||||
eMatchVisitedDefault
|
||||
};
|
||||
|
||||
// Constructor to use when creating a tree match context for styling
|
||||
TreeMatchContext(bool aForStyling,
|
||||
nsRuleWalker::VisitedHandlingType aVisitedHandling,
|
||||
nsIDocument* aDocument)
|
||||
nsIDocument* aDocument,
|
||||
MatchVisited aMatchVisited = eMatchVisitedDefault)
|
||||
: mForStyling(aForStyling)
|
||||
, mHaveRelevantLink(false)
|
||||
, mVisitedHandling(aVisitedHandling)
|
||||
|
@ -205,12 +211,14 @@ struct NS_STACK_CLASS TreeMatchContext {
|
|||
, mCompatMode(aDocument->GetCompatibilityMode())
|
||||
, mUsingPrivateBrowsing(false)
|
||||
{
|
||||
nsCOMPtr<nsISupports> container = mDocument->GetContainer();
|
||||
if (container) {
|
||||
nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(container);
|
||||
NS_ASSERTION(loadContext, "Couldn't get loadContext from container; assuming no private browsing.");
|
||||
if (loadContext) {
|
||||
mUsingPrivateBrowsing = loadContext->UsePrivateBrowsing();
|
||||
if (aMatchVisited != eNeverMatchVisited) {
|
||||
nsCOMPtr<nsISupports> container = mDocument->GetContainer();
|
||||
if (container) {
|
||||
nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(container);
|
||||
NS_ASSERTION(loadContext, "Couldn't get loadContext from container; assuming no private browsing.");
|
||||
if (loadContext) {
|
||||
mUsingPrivateBrowsing = loadContext->UsePrivateBrowsing();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче