summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranklinDM <mrmineshafter17@gmail.com>2023-02-18 19:29:42 +0800
committerFranklinDM <mrmineshafter17@gmail.com>2023-02-20 23:35:55 +0800
commit828c8cc46f3866d45482e933a29ab3e157a63610 (patch)
tree06ed58c07d4a63721ea831ba49c22a26a04d100f
parentbc399f78712db00edd71213bc048080ccdea72bc (diff)
downloaduxp-828c8cc46f3866d45482e933a29ab3e157a63610.tar.gz
Issue #2078 - Part 3: Rename nsCSSRuleProcessor::SelectorListMatches to RestrictedSelectorListMatches
This is in preparation for merging the logic of RestrictedSelectorListMatches and AnySelectorInArgListMatches.
-rw-r--r--dom/base/Element.cpp11
-rw-r--r--dom/base/nsINode.cpp12
-rw-r--r--layout/inspector/inDOMUtils.cpp7
-rw-r--r--layout/style/nsCSSRuleProcessor.cpp10
-rw-r--r--layout/style/nsCSSRuleProcessor.h6
5 files changed, 24 insertions, 22 deletions
diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp
index 73784d0470..d44d55bc20 100644
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -3428,9 +3428,9 @@ Element::Closest(const nsAString& aSelector, ErrorResult& aResult)
matchingContext.AddScopeElement(this);
for (nsINode* node = this; node; node = node->GetParentNode()) {
if (node->IsElement() &&
- nsCSSRuleProcessor::SelectorListMatches(node->AsElement(),
- matchingContext,
- selectorList)) {
+ nsCSSRuleProcessor::RestrictedSelectorListMatches(node->AsElement(),
+ matchingContext,
+ selectorList)) {
return node->AsElement();
}
}
@@ -3454,8 +3454,9 @@ Element::Matches(const nsAString& aSelector, ErrorResult& aError)
TreeMatchContext::eNeverMatchVisited);
matchingContext.SetHasSpecifiedScope();
matchingContext.AddScopeElement(this);
- return nsCSSRuleProcessor::SelectorListMatches(this, matchingContext,
- selectorList);
+ return nsCSSRuleProcessor::RestrictedSelectorListMatches(this,
+ matchingContext,
+ selectorList);
}
static const nsAttrValue::EnumTable kCORSAttributeTable[] = {
diff --git a/dom/base/nsINode.cpp b/dom/base/nsINode.cpp
index db8986c4e8..749a3ee4a2 100644
--- a/dom/base/nsINode.cpp
+++ b/dom/base/nsINode.cpp
@@ -2879,9 +2879,9 @@ FindMatchingElementsWithId(const nsAString& aId, nsINode* aRoot,
// We have an element with the right id and it's a strict descendant
// of aRoot. Make sure it really matches the selector.
if (!aMatchInfo ||
- nsCSSRuleProcessor::SelectorListMatches(element,
- aMatchInfo->mMatchContext,
- aMatchInfo->mSelectorList)) {
+ nsCSSRuleProcessor::RestrictedSelectorListMatches(element,
+ aMatchInfo->mMatchContext,
+ aMatchInfo->mSelectorList)) {
aList.AppendElement(element);
if (onlyFirstMatch) {
return;
@@ -2932,9 +2932,9 @@ FindMatchingElements(nsINode* aRoot, nsCSSSelectorList* aSelectorList, T &aList,
cur;
cur = cur->GetNextNode(aRoot)) {
if (cur->IsElement() &&
- nsCSSRuleProcessor::SelectorListMatches(cur->AsElement(),
- matchingContext,
- aSelectorList)) {
+ nsCSSRuleProcessor::RestrictedSelectorListMatches(cur->AsElement(),
+ matchingContext,
+ aSelectorList)) {
if (onlyFirstMatch) {
aList.AppendElement(cur->AsElement());
return;
diff --git a/layout/inspector/inDOMUtils.cpp b/layout/inspector/inDOMUtils.cpp
index 800201ce21..f2b52aed21 100644
--- a/layout/inspector/inDOMUtils.cpp
+++ b/layout/inspector/inDOMUtils.cpp
@@ -465,7 +465,7 @@ inDOMUtils::SelectorMatchesElement(nsIDOMElement* aElement,
}
// We have a matching pseudo element, now remove it so we can compare
- // directly against |element| when proceeding into SelectorListMatches.
+ // directly against |element| when proceeding into RestrictedSelectorListMatches.
// It's OK to do this - we just cloned sel and nothing else is using it.
sel->RemoveRightmostSelector();
}
@@ -476,8 +476,9 @@ inDOMUtils::SelectorMatchesElement(nsIDOMElement* aElement,
nsRuleWalker::eRelevantLinkUnvisited,
element->OwnerDoc(),
TreeMatchContext::eNeverMatchVisited);
- *aMatches = nsCSSRuleProcessor::SelectorListMatches(element, matchingContext,
- sel);
+ *aMatches = nsCSSRuleProcessor::RestrictedSelectorListMatches(element,
+ matchingContext,
+ sel);
return NS_OK;
}
diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp
index cccf881b26..302c25b092 100644
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -1316,8 +1316,8 @@ struct NodeMatchContext {
// node being matched that is itself or an ancestor.)
//
// Always false when TreeMatchContext::mForStyling is false. (We
- // could figure it out for SelectorListMatches, but we're starting
- // from the middle of the selector list when doing
+ // could figure it out for RestrictedSelectorListMatches, but we're
+ // starting from the middle of the selector list when doing
// Has{Attribute,State}DependentStyle, so we can't tell. So when
// mForStyling is false, we have to assume we don't know.)
const bool mIsRelevantLink;
@@ -4067,9 +4067,9 @@ nsCSSRuleProcessor::RefreshRuleCascade(nsPresContext* aPresContext)
}
/* static */ bool
-nsCSSRuleProcessor::SelectorListMatches(Element* aElement,
- TreeMatchContext& aTreeMatchContext,
- nsCSSSelectorList* aSelectorList)
+nsCSSRuleProcessor::RestrictedSelectorListMatches(Element* aElement,
+ TreeMatchContext& aTreeMatchContext,
+ nsCSSSelectorList* aSelectorList)
{
MOZ_ASSERT(!aTreeMatchContext.mForScopedStyle,
"mCurrentStyleScope will need to be saved and restored after the "
diff --git a/layout/style/nsCSSRuleProcessor.h b/layout/style/nsCSSRuleProcessor.h
index ae3e76da28..0fcdc6f744 100644
--- a/layout/style/nsCSSRuleProcessor.h
+++ b/layout/style/nsCSSRuleProcessor.h
@@ -92,9 +92,9 @@ public:
* include any pseudo-element selectors. aSelectorList is allowed
* to be null; in this case false will be returned.
*/
- static bool SelectorListMatches(mozilla::dom::Element* aElement,
- TreeMatchContext& aTreeMatchContext,
- nsCSSSelectorList* aSelectorList);
+ static bool RestrictedSelectorListMatches(mozilla::dom::Element* aElement,
+ TreeMatchContext& aTreeMatchContext,
+ nsCSSSelectorList* aSelectorList);
/*
* Helper to get the content state for a content node. This may be