Commit 92074bee authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Commit Bot

Turn AnimationDirection and AttributeMatchType into enum classes.

When compiling with -Wshadow some of their values conflicted with those
of FindOptionFlag in core/editing/finder/find_options.h

Bug: 294205
Change-Id: I33f3e451f163841ebfce823bdefa3902e7ea0c7b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2460821Reviewed-by: default avatarKevin Ellis <kevers@chromium.org>
Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#815219}
parent 7092ef34
......@@ -59,7 +59,7 @@ struct CORE_EXPORT Timing {
};
// Represents the animation direction from the Web Animations spec, see
// https://drafts.csswg.org/web-animations-1/#animation-direction.
enum AnimationDirection {
enum class AnimationDirection {
kForwards,
kBackwards,
};
......
......@@ -878,7 +878,8 @@ const CSSSelector* CSSSelector::SerializeCompound(
}
if (simple_selector->match_ != kAttributeSet) {
SerializeString(simple_selector->SerializingValue(), builder);
if (simple_selector->AttributeMatch() == kCaseInsensitive)
if (simple_selector->AttributeMatch() ==
AttributeMatchType::kCaseInsensitive)
builder.Append(" i");
builder.Append(']');
}
......
......@@ -258,7 +258,7 @@ class CORE_EXPORT CSSSelector {
kPseudoVideoPersistentAncestor,
};
enum AttributeMatchType {
enum class AttributeMatchType {
kCaseSensitive,
kCaseInsensitive,
};
......
......@@ -504,7 +504,8 @@ std::unique_ptr<CSSParserSelector> CSSSelectorParser::ConsumeAttribute(
std::make_unique<CSSParserSelector>();
if (block.AtEnd()) {
selector->SetAttribute(qualified_name, CSSSelector::kCaseSensitive);
selector->SetAttribute(qualified_name,
CSSSelector::AttributeMatchType::kCaseSensitive);
selector->SetMatch(CSSSelector::kAttributeSet);
context_->Count(WebFeature::kHasIDClassTagAttribute);
return selector;
......@@ -785,12 +786,12 @@ CSSSelector::MatchType CSSSelectorParser::ConsumeAttributeMatch(
CSSSelector::AttributeMatchType CSSSelectorParser::ConsumeAttributeFlags(
CSSParserTokenRange& range) {
if (range.Peek().GetType() != kIdentToken)
return CSSSelector::kCaseSensitive;
return CSSSelector::AttributeMatchType::kCaseSensitive;
const CSSParserToken& flag = range.ConsumeIncludingWhitespace();
if (EqualIgnoringASCIICase(flag.Value(), "i"))
return CSSSelector::kCaseInsensitive;
return CSSSelector::AttributeMatchType::kCaseInsensitive;
failed_parsing_ = true;
return CSSSelector::kCaseSensitive;
return CSSSelector::AttributeMatchType::kCaseSensitive;
}
bool CSSSelectorParser::ConsumeANPlusB(CSSParserTokenRange& range,
......
......@@ -773,7 +773,8 @@ static bool AnyAttributeMatches(Element& element,
const AtomicString& selector_value = selector.Value();
TextCaseSensitivity case_sensitivity =
(selector.AttributeMatch() == CSSSelector::kCaseInsensitive)
(selector.AttributeMatch() ==
CSSSelector::AttributeMatchType::kCaseInsensitive)
? kTextCaseASCIIInsensitive
: kTextCaseSensitive;
......
......@@ -505,7 +505,8 @@ SelectorQuery::SelectorQuery(CSSSelectorList selector_list)
// are case sensitive, so we need the same behavior for [id=value].
if (current->Match() == CSSSelector::kAttributeExact &&
current->Attribute() == html_names::kIdAttr &&
current->AttributeMatch() == CSSSelector::kCaseSensitive) {
current->AttributeMatch() ==
CSSSelector::AttributeMatchType::kCaseSensitive) {
selector_id_ = current->Value();
break;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment