Skip to content
Permalink
Browse files
8261927: WebKit build fails with Visual Studio 2017
Reviewed-by: kcr, ghb
  • Loading branch information
arun-Joseph committed Feb 21, 2021
1 parent 4733824 commit 9e42eea46d735f80235effdebb535ee66b59f7d1
Showing with 33 additions and 2 deletions.
  1. +33 −2 modules/javafx.web/src/main/native/Source/WebCore/style/StyleScopeRuleSets.cpp
@@ -230,10 +230,41 @@ static Vector<InvalidationRuleSet>* ensureInvalidationRuleSets(const KeyType& ke
if (!ruleSet)
ruleSet = RuleSet::create();
ruleSet->addRule(*feature.styleRule, feature.selectorIndex, feature.selectorListIndex);
if constexpr (std::is_same<RuleFeatureType, RuleFeatureWithInvalidationSelector>::value) {
/*if constexpr (std::is_same<RuleFeatureType, RuleFeatureWithInvalidationSelector>::value) {
if (feature.invalidationSelector)
invalidationSelectorArray[arrayIndex].append(feature.invalidationSelector);
}
}*/
}
auto invalidationRuleSets = makeUnique<Vector<InvalidationRuleSet>>();
for (unsigned i = 0; i < matchElementArray.size(); ++i) {
if (matchElementArray[i])
invalidationRuleSets->append({ static_cast<MatchElement>(i), *matchElementArray[i], WTFMove(invalidationSelectorArray[i]) });
}
return invalidationRuleSets;
}).iterator->value.get();
}

template<typename KeyType, typename Hash, typename HashTraits>
static Vector<InvalidationRuleSet>* ensureInvalidationRuleSets(const KeyType& key, HashMap<KeyType, std::unique_ptr<Vector<InvalidationRuleSet>>, Hash, HashTraits>& ruleSetMap, const HashMap<KeyType, std::unique_ptr<Vector<RuleFeatureWithInvalidationSelector>>, Hash, HashTraits>& ruleFeatures)
{
return ruleSetMap.ensure(key, [&]() -> std::unique_ptr<Vector<InvalidationRuleSet>> {
auto* features = ruleFeatures.get(key);
if (!features)
return nullptr;

std::array<RefPtr<RuleSet>, matchElementCount> matchElementArray;
std::array<Vector<const CSSSelector*>, matchElementCount> invalidationSelectorArray;
for (auto& feature : *features) {
auto arrayIndex = static_cast<unsigned>(*feature.matchElement);
auto& ruleSet = matchElementArray[arrayIndex];
if (!ruleSet)
ruleSet = RuleSet::create();
ruleSet->addRule(*feature.styleRule, feature.selectorIndex, feature.selectorListIndex);
// TODO : Visual studio 2017 doesn't support if constexpr in lamda, once updated to 2019, remove this function and uncomment above function's code
//if constexpr (std::is_same<RuleFeatureType, RuleFeatureWithInvalidationSelector>::value) {
if (feature.invalidationSelector)
invalidationSelectorArray[arrayIndex].append(feature.invalidationSelector);
//}
}
auto invalidationRuleSets = makeUnique<Vector<InvalidationRuleSet>>();
for (unsigned i = 0; i < matchElementArray.size(); ++i) {

1 comment on commit 9e42eea

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on 9e42eea Feb 21, 2021

Please sign in to comment.