<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[214255] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/214255">214255</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2017-03-22 10:19:28 -0700 (Wed, 22 Mar 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>Use AtomicString in RuleSet and RuleFeature
https://bugs.webkit.org/show_bug.cgi?id=119310
<rdar://problem/28214658>
Reviewed by Andreas Kling.
..instead of the plain AtomicStringImpl*. This introduces some ref churn but not too much.
* css/DocumentRuleSets.cpp:
(WebCore::DocumentRuleSets::ancestorClassRules):
(WebCore::DocumentRuleSets::ancestorAttributeRulesForHTML):
* css/DocumentRuleSets.h:
* css/ElementRuleCollector.cpp:
(WebCore::ElementRuleCollector::collectMatchingRules):
(WebCore::ElementRuleCollector::collectMatchingShadowPseudoElementRules):
* css/RuleFeature.cpp:
(WebCore::RuleFeatureSet::recursivelyCollectFeaturesFromSelector):
(WebCore::makeAttributeSelectorKey):
(WebCore::RuleFeatureSet::collectFeatures):
* css/RuleFeature.h:
* css/RuleSet.cpp:
(WebCore::RuleSet::addToRuleSet):
(WebCore::rulesCountForName):
(WebCore::RuleSet::addRule):
* css/RuleSet.h:
(WebCore::RuleSet::idRules):
(WebCore::RuleSet::classRules):
(WebCore::RuleSet::shadowPseudoElementRules):
(WebCore::RuleSet::tagRules):
* css/StyleResolver.h:
(WebCore::StyleResolver::hasSelectorForAttribute):
(WebCore::StyleResolver::hasSelectorForClass):
(WebCore::StyleResolver::hasSelectorForId):
* style/AttributeChangeInvalidation.cpp:
(WebCore::Style::mayBeAffectedByAttributeChange):
(WebCore::Style::AttributeChangeInvalidation::invalidateStyle):
* style/IdChangeInvalidation.cpp:
(WebCore::Style::mayBeAffectedByHostRules):
(WebCore::Style::mayBeAffectedBySlottedRules):
(WebCore::Style::IdChangeInvalidation::invalidateStyle):
* style/StyleSharingResolver.cpp:
(WebCore::Style::SharingResolver::resolve):
(WebCore::Style::SharingResolver::canShareStyleWithElement):
(WebCore::Style::SharingResolver::classNamesAffectedByRules):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssDocumentRuleSetscpp">trunk/Source/WebCore/css/DocumentRuleSets.cpp</a></li>
<li><a href="#trunkSourceWebCorecssDocumentRuleSetsh">trunk/Source/WebCore/css/DocumentRuleSets.h</a></li>
<li><a href="#trunkSourceWebCorecssElementRuleCollectorcpp">trunk/Source/WebCore/css/ElementRuleCollector.cpp</a></li>
<li><a href="#trunkSourceWebCorecssRuleFeaturecpp">trunk/Source/WebCore/css/RuleFeature.cpp</a></li>
<li><a href="#trunkSourceWebCorecssRuleFeatureh">trunk/Source/WebCore/css/RuleFeature.h</a></li>
<li><a href="#trunkSourceWebCorecssRuleSetcpp">trunk/Source/WebCore/css/RuleSet.cpp</a></li>
<li><a href="#trunkSourceWebCorecssRuleSeth">trunk/Source/WebCore/css/RuleSet.h</a></li>
<li><a href="#trunkSourceWebCorecssStyleResolverh">trunk/Source/WebCore/css/StyleResolver.h</a></li>
<li><a href="#trunkSourceWebCorestyleAttributeChangeInvalidationcpp">trunk/Source/WebCore/style/AttributeChangeInvalidation.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleIdChangeInvalidationcpp">trunk/Source/WebCore/style/IdChangeInvalidation.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleStyleSharingResolvercpp">trunk/Source/WebCore/style/StyleSharingResolver.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (214254 => 214255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-03-22 17:18:27 UTC (rev 214254)
+++ trunk/Source/WebCore/ChangeLog        2017-03-22 17:19:28 UTC (rev 214255)
</span><span class="lines">@@ -1,3 +1,50 @@
</span><ins>+2017-03-21 Antti Koivisto <antti@apple.com>
+
+ Use AtomicString in RuleSet and RuleFeature
+ https://bugs.webkit.org/show_bug.cgi?id=119310
+ <rdar://problem/28214658>
+
+ Reviewed by Andreas Kling.
+
+ ..instead of the plain AtomicStringImpl*. This introduces some ref churn but not too much.
+
+ * css/DocumentRuleSets.cpp:
+ (WebCore::DocumentRuleSets::ancestorClassRules):
+ (WebCore::DocumentRuleSets::ancestorAttributeRulesForHTML):
+ * css/DocumentRuleSets.h:
+ * css/ElementRuleCollector.cpp:
+ (WebCore::ElementRuleCollector::collectMatchingRules):
+ (WebCore::ElementRuleCollector::collectMatchingShadowPseudoElementRules):
+ * css/RuleFeature.cpp:
+ (WebCore::RuleFeatureSet::recursivelyCollectFeaturesFromSelector):
+ (WebCore::makeAttributeSelectorKey):
+ (WebCore::RuleFeatureSet::collectFeatures):
+ * css/RuleFeature.h:
+ * css/RuleSet.cpp:
+ (WebCore::RuleSet::addToRuleSet):
+ (WebCore::rulesCountForName):
+ (WebCore::RuleSet::addRule):
+ * css/RuleSet.h:
+ (WebCore::RuleSet::idRules):
+ (WebCore::RuleSet::classRules):
+ (WebCore::RuleSet::shadowPseudoElementRules):
+ (WebCore::RuleSet::tagRules):
+ * css/StyleResolver.h:
+ (WebCore::StyleResolver::hasSelectorForAttribute):
+ (WebCore::StyleResolver::hasSelectorForClass):
+ (WebCore::StyleResolver::hasSelectorForId):
+ * style/AttributeChangeInvalidation.cpp:
+ (WebCore::Style::mayBeAffectedByAttributeChange):
+ (WebCore::Style::AttributeChangeInvalidation::invalidateStyle):
+ * style/IdChangeInvalidation.cpp:
+ (WebCore::Style::mayBeAffectedByHostRules):
+ (WebCore::Style::mayBeAffectedBySlottedRules):
+ (WebCore::Style::IdChangeInvalidation::invalidateStyle):
+ * style/StyleSharingResolver.cpp:
+ (WebCore::Style::SharingResolver::resolve):
+ (WebCore::Style::SharingResolver::canShareStyleWithElement):
+ (WebCore::Style::SharingResolver::classNamesAffectedByRules):
+
</ins><span class="cx"> 2017-03-22 Youenn Fablet <youenn@apple.com>
</span><span class="cx">
</span><span class="cx"> Safari sends empty "Access-Control-Request-Headers" in preflight request
</span></span></pre></div>
<a id="trunkSourceWebCorecssDocumentRuleSetscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/DocumentRuleSets.cpp (214254 => 214255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/DocumentRuleSets.cpp        2017-03-22 17:18:27 UTC (rev 214254)
+++ trunk/Source/WebCore/css/DocumentRuleSets.cpp        2017-03-22 17:19:28 UTC (rev 214255)
</span><span class="lines">@@ -124,7 +124,7 @@
</span><span class="cx"> m_features.shrinkToFit();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RuleSet* DocumentRuleSets::ancestorClassRules(AtomicStringImpl* className) const
</del><ins>+RuleSet* DocumentRuleSets::ancestorClassRules(const AtomicString& className) const
</ins><span class="cx"> {
</span><span class="cx"> auto addResult = m_ancestorClassRuleSets.add(className, nullptr);
</span><span class="cx"> if (addResult.isNewEntry) {
</span><span class="lines">@@ -134,7 +134,7 @@
</span><span class="cx"> return addResult.iterator->value.get();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-const DocumentRuleSets::AttributeRules* DocumentRuleSets::ancestorAttributeRulesForHTML(AtomicStringImpl* attributeName) const
</del><ins>+const DocumentRuleSets::AttributeRules* DocumentRuleSets::ancestorAttributeRulesForHTML(const AtomicString& attributeName) const
</ins><span class="cx"> {
</span><span class="cx"> auto addResult = m_ancestorAttributeRuleSetsForHTML.add(attributeName, nullptr);
</span><span class="cx"> auto& value = addResult.iterator->value;
</span></span></pre></div>
<a id="trunkSourceWebCorecssDocumentRuleSetsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/DocumentRuleSets.h (214254 => 214255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/DocumentRuleSets.h        2017-03-22 17:18:27 UTC (rev 214254)
+++ trunk/Source/WebCore/css/DocumentRuleSets.h        2017-03-22 17:19:28 UTC (rev 214255)
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx"> const RuleFeatureSet& features() const;
</span><span class="cx"> RuleSet* sibling() const { return m_siblingRuleSet.get(); }
</span><span class="cx"> RuleSet* uncommonAttribute() const { return m_uncommonAttributeRuleSet.get(); }
</span><del>- RuleSet* ancestorClassRules(AtomicStringImpl* className) const;
</del><ins>+ RuleSet* ancestorClassRules(const AtomicString& className) const;
</ins><span class="cx">
</span><span class="cx"> struct AttributeRules {
</span><span class="cx"> WTF_MAKE_FAST_ALLOCATED;
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx"> Vector<const CSSSelector*> attributeSelectors;
</span><span class="cx"> std::unique_ptr<RuleSet> ruleSet;
</span><span class="cx"> };
</span><del>- const AttributeRules* ancestorAttributeRulesForHTML(AtomicStringImpl*) const;
</del><ins>+ const AttributeRules* ancestorAttributeRulesForHTML(const AtomicString&) const;
</ins><span class="cx">
</span><span class="cx"> void initUserStyle(ExtensionStyleSheets&, const MediaQueryEvaluator&, StyleResolver&);
</span><span class="cx"> void resetAuthorStyle();
</span><span class="lines">@@ -77,8 +77,8 @@
</span><span class="cx"> mutable unsigned m_defaultStyleVersionOnFeatureCollection { 0 };
</span><span class="cx"> mutable std::unique_ptr<RuleSet> m_siblingRuleSet;
</span><span class="cx"> mutable std::unique_ptr<RuleSet> m_uncommonAttributeRuleSet;
</span><del>- mutable HashMap<AtomicStringImpl*, std::unique_ptr<RuleSet>> m_ancestorClassRuleSets;
- mutable HashMap<AtomicStringImpl*, std::unique_ptr<AttributeRules>> m_ancestorAttributeRuleSetsForHTML;
</del><ins>+ mutable HashMap<AtomicString, std::unique_ptr<RuleSet>> m_ancestorClassRuleSets;
+ mutable HashMap<AtomicString, std::unique_ptr<AttributeRules>> m_ancestorAttributeRuleSetsForHTML;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> inline const RuleFeatureSet& DocumentRuleSets::features() const
</span></span></pre></div>
<a id="trunkSourceWebCorecssElementRuleCollectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/ElementRuleCollector.cpp (214254 => 214255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/ElementRuleCollector.cpp        2017-03-22 17:18:27 UTC (rev 214254)
+++ trunk/Source/WebCore/css/ElementRuleCollector.cpp        2017-03-22 17:19:28 UTC (rev 214255)
</span><span class="lines">@@ -149,10 +149,10 @@
</span><span class="cx"> // then sort the buffer.
</span><span class="cx"> auto& id = m_element.idForStyleResolution();
</span><span class="cx"> if (!id.isNull())
</span><del>- collectMatchingRulesForList(matchRequest.ruleSet->idRules(*id.impl()), matchRequest, ruleRange);
</del><ins>+ collectMatchingRulesForList(matchRequest.ruleSet->idRules(id), matchRequest, ruleRange);
</ins><span class="cx"> if (m_element.hasClass()) {
</span><span class="cx"> for (size_t i = 0; i < m_element.classNames().size(); ++i)
</span><del>- collectMatchingRulesForList(matchRequest.ruleSet->classRules(m_element.classNames()[i].impl()), matchRequest, ruleRange);
</del><ins>+ collectMatchingRulesForList(matchRequest.ruleSet->classRules(m_element.classNames()[i]), matchRequest, ruleRange);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (m_element.isLink())
</span><span class="lines">@@ -159,7 +159,7 @@
</span><span class="cx"> collectMatchingRulesForList(matchRequest.ruleSet->linkPseudoClassRules(), matchRequest, ruleRange);
</span><span class="cx"> if (SelectorChecker::matchesFocusPseudoClass(m_element))
</span><span class="cx"> collectMatchingRulesForList(matchRequest.ruleSet->focusPseudoClassRules(), matchRequest, ruleRange);
</span><del>- collectMatchingRulesForList(matchRequest.ruleSet->tagRules(m_element.localName().impl(), m_element.isHTMLElement() && m_element.document().isHTMLDocument()), matchRequest, ruleRange);
</del><ins>+ collectMatchingRulesForList(matchRequest.ruleSet->tagRules(m_element.localName(), m_element.isHTMLElement() && m_element.document().isHTMLDocument()), matchRequest, ruleRange);
</ins><span class="cx"> collectMatchingRulesForList(matchRequest.ruleSet->universalRules(), matchRequest, ruleRange);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -288,7 +288,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> auto& pseudoId = m_element.shadowPseudoId();
</span><span class="cx"> if (!pseudoId.isEmpty())
</span><del>- collectMatchingRulesForList(rules.shadowPseudoElementRules(pseudoId.impl()), matchRequest, ruleRange);
</del><ins>+ collectMatchingRulesForList(rules.shadowPseudoElementRules(pseudoId), matchRequest, ruleRange);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> std::unique_ptr<RuleSet::RuleDataVector> ElementRuleCollector::collectSlottedPseudoElementRulesForSlot(bool includeEmptyRules)
</span></span></pre></div>
<a id="trunkSourceWebCorecssRuleFeaturecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/RuleFeature.cpp (214254 => 214255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/RuleFeature.cpp        2017-03-22 17:18:27 UTC (rev 214254)
+++ trunk/Source/WebCore/css/RuleFeature.cpp        2017-03-22 17:19:28 UTC (rev 214255)
</span><span class="lines">@@ -40,16 +40,16 @@
</span><span class="cx"> const CSSSelector* selector = &firstSelector;
</span><span class="cx"> do {
</span><span class="cx"> if (selector->match() == CSSSelector::Id) {
</span><del>- idsInRules.add(selector->value().impl());
</del><ins>+ idsInRules.add(selector->value());
</ins><span class="cx"> if (matchesAncestor)
</span><del>- idsMatchingAncestorsInRules.add(selector->value().impl());
</del><ins>+ idsMatchingAncestorsInRules.add(selector->value());
</ins><span class="cx"> } else if (selector->match() == CSSSelector::Class) {
</span><del>- classesInRules.add(selector->value().impl());
</del><ins>+ classesInRules.add(selector->value());
</ins><span class="cx"> if (matchesAncestor)
</span><del>- selectorFeatures.classesMatchingAncestors.append(selector->value().impl());
</del><ins>+ selectorFeatures.classesMatchingAncestors.append(selector->value());
</ins><span class="cx"> } else if (selector->isAttributeSelector()) {
</span><del>- auto* canonicalLocalName = selector->attributeCanonicalLocalName().impl();
- auto* localName = selector->attribute().localName().impl();
</del><ins>+ auto& canonicalLocalName = selector->attributeCanonicalLocalName();
+ auto& localName = selector->attribute().localName();
</ins><span class="cx"> attributeCanonicalLocalNamesInRules.add(canonicalLocalName);
</span><span class="cx"> attributeLocalNamesInRules.add(localName);
</span><span class="cx"> if (matchesAncestor)
</span><span class="lines">@@ -99,7 +99,7 @@
</span><span class="cx"> siblingRules.append(RuleFeature(ruleData.rule(), ruleData.selectorIndex(), ruleData.hasDocumentSecurityOrigin()));
</span><span class="cx"> if (ruleData.containsUncommonAttributeSelector())
</span><span class="cx"> uncommonAttributeRules.append(RuleFeature(ruleData.rule(), ruleData.selectorIndex(), ruleData.hasDocumentSecurityOrigin()));
</span><del>- for (auto* className : selectorFeatures.classesMatchingAncestors) {
</del><ins>+ for (auto& className : selectorFeatures.classesMatchingAncestors) {
</ins><span class="cx"> auto addResult = ancestorClassRules.ensure(className, [] {
</span><span class="cx"> return std::make_unique<Vector<RuleFeature>>();
</span><span class="cx"> });
</span><span class="lines">@@ -107,7 +107,7 @@
</span><span class="cx"> }
</span><span class="cx"> for (auto* selector : selectorFeatures.attributeSelectorsMatchingAncestors) {
</span><span class="cx"> // Hashing by attributeCanonicalLocalName makes this HTML specific.
</span><del>- auto addResult = ancestorAttributeRulesForHTML.ensure(selector->attributeCanonicalLocalName().impl(), [] {
</del><ins>+ auto addResult = ancestorAttributeRulesForHTML.ensure(selector->attributeCanonicalLocalName(), [] {
</ins><span class="cx"> return std::make_unique<AttributeRules>();
</span><span class="cx"> });
</span><span class="cx"> auto& rules = *addResult.iterator->value;
</span></span></pre></div>
<a id="trunkSourceWebCorecssRuleFeatureh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/RuleFeature.h (214254 => 214255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/RuleFeature.h        2017-03-22 17:18:27 UTC (rev 214254)
+++ trunk/Source/WebCore/css/RuleFeature.h        2017-03-22 17:19:28 UTC (rev 214255)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #include <wtf/HashMap.h>
</span><span class="cx"> #include <wtf/HashSet.h>
</span><span class="cx"> #include <wtf/text/AtomicString.h>
</span><ins>+#include <wtf/text/AtomicStringHash.h>
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -50,14 +51,14 @@
</span><span class="cx"> void shrinkToFit();
</span><span class="cx"> void collectFeatures(const RuleData&);
</span><span class="cx">
</span><del>- HashSet<AtomicStringImpl*> idsInRules;
- HashSet<AtomicStringImpl*> idsMatchingAncestorsInRules;
- HashSet<AtomicStringImpl*> classesInRules;
- HashSet<AtomicStringImpl*> attributeCanonicalLocalNamesInRules;
- HashSet<AtomicStringImpl*> attributeLocalNamesInRules;
</del><ins>+ HashSet<AtomicString> idsInRules;
+ HashSet<AtomicString> idsMatchingAncestorsInRules;
+ HashSet<AtomicString> classesInRules;
+ HashSet<AtomicString> attributeCanonicalLocalNamesInRules;
+ HashSet<AtomicString> attributeLocalNamesInRules;
</ins><span class="cx"> Vector<RuleFeature> siblingRules;
</span><span class="cx"> Vector<RuleFeature> uncommonAttributeRules;
</span><del>- HashMap<AtomicStringImpl*, std::unique_ptr<Vector<RuleFeature>>> ancestorClassRules;
</del><ins>+ HashMap<AtomicString, std::unique_ptr<Vector<RuleFeature>>> ancestorClassRules;
</ins><span class="cx">
</span><span class="cx"> struct AttributeRules {
</span><span class="cx"> WTF_MAKE_FAST_ALLOCATED;
</span><span class="lines">@@ -66,7 +67,7 @@
</span><span class="cx"> HashMap<SelectorKey, const CSSSelector*> selectors;
</span><span class="cx"> Vector<RuleFeature> features;
</span><span class="cx"> };
</span><del>- HashMap<AtomicStringImpl*, std::unique_ptr<AttributeRules>> ancestorAttributeRulesForHTML;
</del><ins>+ HashMap<AtomicString, std::unique_ptr<AttributeRules>> ancestorAttributeRulesForHTML;
</ins><span class="cx"> bool usesFirstLineRules { false };
</span><span class="cx"> bool usesFirstLetterRules { false };
</span><span class="cx">
</span><span class="lines">@@ -73,7 +74,7 @@
</span><span class="cx"> private:
</span><span class="cx"> struct SelectorFeatures {
</span><span class="cx"> bool hasSiblingSelector { false };
</span><del>- Vector<AtomicStringImpl*, 32> classesMatchingAncestors;
</del><ins>+ Vector<AtomicString, 32> classesMatchingAncestors;
</ins><span class="cx"> Vector<const CSSSelector*> attributeSelectorsMatchingAncestors;
</span><span class="cx"> };
</span><span class="cx"> void recursivelyCollectFeaturesFromSelector(SelectorFeatures&, const CSSSelector&, bool matchesAncestor = false);
</span></span></pre></div>
<a id="trunkSourceWebCorecssRuleSetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/RuleSet.cpp (214254 => 214255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/RuleSet.cpp        2017-03-22 17:18:27 UTC (rev 214254)
+++ trunk/Source/WebCore/css/RuleSet.cpp        2017-03-22 17:19:28 UTC (rev 214255)
</span><span class="lines">@@ -177,9 +177,9 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void RuleSet::addToRuleSet(AtomicStringImpl* key, AtomRuleMap& map, const RuleData& ruleData)
</del><ins>+void RuleSet::addToRuleSet(const AtomicString& key, AtomRuleMap& map, const RuleData& ruleData)
</ins><span class="cx"> {
</span><del>- if (!key)
</del><ins>+ if (key.isNull())
</ins><span class="cx"> return;
</span><span class="cx"> auto& rules = map.add(key, nullptr).iterator->value;
</span><span class="cx"> if (!rules)
</span><span class="lines">@@ -187,7 +187,7 @@
</span><span class="cx"> rules->append(ruleData);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static unsigned rulesCountForName(const RuleSet::AtomRuleMap& map, AtomicStringImpl* name)
</del><ins>+static unsigned rulesCountForName(const RuleSet::AtomRuleMap& map, const AtomicString& name)
</ins><span class="cx"> {
</span><span class="cx"> if (const auto* rules = map.get(name))
</span><span class="cx"> return rules->size();
</span><span class="lines">@@ -218,7 +218,7 @@
</span><span class="cx"> idSelector = selector;
</span><span class="cx"> break;
</span><span class="cx"> case CSSSelector::Class: {
</span><del>- auto* className = selector->value().impl();
</del><ins>+ auto& className = selector->value();
</ins><span class="cx"> if (!classSelector) {
</span><span class="cx"> classSelector = selector;
</span><span class="cx"> classBucketSize = rulesCountForName(m_classRules, className);
</span><span class="lines">@@ -305,7 +305,7 @@
</span><span class="cx"> if (customPseudoElementSelector) {
</span><span class="cx"> // FIXME: Custom pseudo elements are handled by the shadow tree's selector filter. It doesn't know about the main DOM.
</span><span class="cx"> ruleData.disableSelectorFiltering();
</span><del>- addToRuleSet(customPseudoElementSelector->value().impl(), m_shadowPseudoElementRules, ruleData);
</del><ins>+ addToRuleSet(customPseudoElementSelector->value(), m_shadowPseudoElementRules, ruleData);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -315,12 +315,12 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (idSelector) {
</span><del>- addToRuleSet(idSelector->value().impl(), m_idRules, ruleData);
</del><ins>+ addToRuleSet(idSelector->value(), m_idRules, ruleData);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (classSelector) {
</span><del>- addToRuleSet(classSelector->value().impl(), m_classRules, ruleData);
</del><ins>+ addToRuleSet(classSelector->value(), m_classRules, ruleData);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -335,8 +335,8 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (tagSelector) {
</span><del>- addToRuleSet(tagSelector->tagQName().localName().impl(), m_tagLocalNameRules, ruleData);
- addToRuleSet(tagSelector->tagLowercaseLocalName().impl(), m_tagLowercaseLocalNameRules, ruleData);
</del><ins>+ addToRuleSet(tagSelector->tagQName().localName(), m_tagLocalNameRules, ruleData);
+ addToRuleSet(tagSelector->tagLowercaseLocalName(), m_tagLowercaseLocalNameRules, ruleData);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecssRuleSeth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/RuleSet.h (214254 => 214255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/RuleSet.h        2017-03-22 17:18:27 UTC (rev 214254)
+++ trunk/Source/WebCore/css/RuleSet.h        2017-03-22 17:19:28 UTC (rev 214255)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #include <wtf/Forward.h>
</span><span class="cx"> #include <wtf/HashMap.h>
</span><span class="cx"> #include <wtf/text/AtomicString.h>
</span><ins>+#include <wtf/text/AtomicStringHash.h>
</ins><span class="cx"> #include <wtf/text/CString.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -158,7 +159,7 @@
</span><span class="cx"> ~RuleSet();
</span><span class="cx">
</span><span class="cx"> typedef Vector<RuleData, 1> RuleDataVector;
</span><del>- typedef HashMap<AtomicStringImpl*, std::unique_ptr<RuleDataVector>> AtomRuleMap;
</del><ins>+ typedef HashMap<AtomicString, std::unique_ptr<RuleDataVector>> AtomRuleMap;
</ins><span class="cx">
</span><span class="cx"> void addRulesFromSheet(StyleSheetContents&, const MediaQueryEvaluator&, StyleResolver* = 0);
</span><span class="cx">
</span><span class="lines">@@ -165,7 +166,7 @@
</span><span class="cx"> void addStyleRule(StyleRule*, AddRuleFlags);
</span><span class="cx"> void addRule(StyleRule*, unsigned selectorIndex, AddRuleFlags);
</span><span class="cx"> void addPageRule(StyleRulePage*);
</span><del>- void addToRuleSet(AtomicStringImpl* key, AtomRuleMap&, const RuleData&);
</del><ins>+ void addToRuleSet(const AtomicString& key, AtomRuleMap&, const RuleData&);
</ins><span class="cx"> void addRegionRule(StyleRuleRegion*, bool hasDocumentSecurityOrigin);
</span><span class="cx"> void shrinkToFit();
</span><span class="cx"> void disableAutoShrinkToFit() { m_autoShrinkToFitEnabled = false; }
</span><span class="lines">@@ -172,10 +173,10 @@
</span><span class="cx">
</span><span class="cx"> const RuleFeatureSet& features() const { return m_features; }
</span><span class="cx">
</span><del>- const RuleDataVector* idRules(AtomicStringImpl& key) const { return m_idRules.get(&key); }
- const RuleDataVector* classRules(AtomicStringImpl* key) const { return m_classRules.get(key); }
- const RuleDataVector* tagRules(AtomicStringImpl* key, bool isHTMLName) const;
- const RuleDataVector* shadowPseudoElementRules(AtomicStringImpl* key) const { return m_shadowPseudoElementRules.get(key); }
</del><ins>+ const RuleDataVector* idRules(const AtomicString& key) const { return m_idRules.get(key); }
+ const RuleDataVector* classRules(const AtomicString& key) const { return m_classRules.get(key); }
+ const RuleDataVector* tagRules(const AtomicString& key, bool isHTMLName) const;
+ const RuleDataVector* shadowPseudoElementRules(const AtomicString& key) const { return m_shadowPseudoElementRules.get(key); }
</ins><span class="cx"> const RuleDataVector* linkPseudoClassRules() const { return &m_linkPseudoClassRules; }
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx"> const RuleDataVector* cuePseudoRules() const { return &m_cuePseudoRules; }
</span><span class="lines">@@ -215,7 +216,7 @@
</span><span class="cx"> Vector<RuleSetSelectorPair> m_regionSelectorsAndRuleSets;
</span><span class="cx"> };
</span><span class="cx">
</span><del>-inline const RuleSet::RuleDataVector* RuleSet::tagRules(AtomicStringImpl* key, bool isHTMLName) const
</del><ins>+inline const RuleSet::RuleDataVector* RuleSet::tagRules(const AtomicString& key, bool isHTMLName) const
</ins><span class="cx"> {
</span><span class="cx"> const AtomRuleMap* tagRules;
</span><span class="cx"> if (isHTMLName)
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolverh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.h (214254 => 214255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.h        2017-03-22 17:18:27 UTC (rev 214254)
+++ trunk/Source/WebCore/css/StyleResolver.h        2017-03-22 17:19:28 UTC (rev 214255)
</span><span class="lines">@@ -535,20 +535,20 @@
</span><span class="cx"> {
</span><span class="cx"> ASSERT(!attributeName.isEmpty());
</span><span class="cx"> if (element.isHTMLElement())
</span><del>- return m_ruleSets.features().attributeCanonicalLocalNamesInRules.contains(attributeName.impl());
- return m_ruleSets.features().attributeLocalNamesInRules.contains(attributeName.impl());
</del><ins>+ return m_ruleSets.features().attributeCanonicalLocalNamesInRules.contains(attributeName);
+ return m_ruleSets.features().attributeLocalNamesInRules.contains(attributeName);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> inline bool StyleResolver::hasSelectorForClass(const AtomicString& classValue) const
</span><span class="cx"> {
</span><span class="cx"> ASSERT(!classValue.isEmpty());
</span><del>- return m_ruleSets.features().classesInRules.contains(classValue.impl());
</del><ins>+ return m_ruleSets.features().classesInRules.contains(classValue);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> inline bool StyleResolver::hasSelectorForId(const AtomicString& idValue) const
</span><span class="cx"> {
</span><span class="cx"> ASSERT(!idValue.isEmpty());
</span><del>- return m_ruleSets.features().idsInRules.contains(idValue.impl());
</del><ins>+ return m_ruleSets.features().idsInRules.contains(idValue);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> inline bool checkRegionSelector(const CSSSelector* regionSelector, const Element* regionElement)
</span></span></pre></div>
<a id="trunkSourceWebCorestyleAttributeChangeInvalidationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/AttributeChangeInvalidation.cpp (214254 => 214255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/AttributeChangeInvalidation.cpp        2017-03-22 17:18:27 UTC (rev 214254)
+++ trunk/Source/WebCore/style/AttributeChangeInvalidation.cpp        2017-03-22 17:19:28 UTC (rev 214255)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx"> static bool mayBeAffectedByAttributeChange(DocumentRuleSets& ruleSets, bool isHTML, const QualifiedName& attributeName)
</span><span class="cx"> {
</span><span class="cx"> auto& nameSet = isHTML ? ruleSets.features().attributeCanonicalLocalNamesInRules : ruleSets.features().attributeLocalNamesInRules;
</span><del>- return nameSet.contains(attributeName.localName().impl());
</del><ins>+ return nameSet.contains(attributeName.localName());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static bool mayBeAffectedByHostRules(const Element& element, const QualifiedName& attributeName)
</span><span class="lines">@@ -96,7 +96,7 @@
</span><span class="cx"> if (!childrenOfType<Element>(m_element).first())
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- auto* attributeRules = ruleSets.ancestorAttributeRulesForHTML(attributeName.localName().impl());
</del><ins>+ auto* attributeRules = ruleSets.ancestorAttributeRulesForHTML(attributeName.localName());
</ins><span class="cx"> if (!attributeRules)
</span><span class="cx"> return;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorestyleIdChangeInvalidationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/IdChangeInvalidation.cpp (214254 => 214255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/IdChangeInvalidation.cpp        2017-03-22 17:18:27 UTC (rev 214254)
+++ trunk/Source/WebCore/style/IdChangeInvalidation.cpp        2017-03-22 17:19:28 UTC (rev 214255)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx"> auto& shadowRuleSets = shadowRoot->styleScope().resolver().ruleSets();
</span><span class="cx"> if (shadowRuleSets.authorStyle().hostPseudoClassRules().isEmpty())
</span><span class="cx"> return false;
</span><del>- return shadowRuleSets.features().idsInRules.contains(changedId.impl());
</del><ins>+ return shadowRuleSets.features().idsInRules.contains(changedId);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static bool mayBeAffectedBySlottedRules(const Element& element, const AtomicString& changedId)
</span><span class="lines">@@ -52,7 +52,7 @@
</span><span class="cx"> auto& ruleSets = shadowRoot->styleScope().resolver().ruleSets();
</span><span class="cx"> if (ruleSets.authorStyle().slottedPseudoElementRules().isEmpty())
</span><span class="cx"> continue;
</span><del>- if (ruleSets.features().idsInRules.contains(changedId.impl()))
</del><ins>+ if (ruleSets.features().idsInRules.contains(changedId))
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx"> return false;
</span><span class="lines">@@ -65,7 +65,7 @@
</span><span class="cx">
</span><span class="cx"> auto& ruleSets = m_element.styleResolver().ruleSets();
</span><span class="cx">
</span><del>- bool mayAffectStyle = ruleSets.features().idsInRules.contains(changedId.impl())
</del><ins>+ bool mayAffectStyle = ruleSets.features().idsInRules.contains(changedId)
</ins><span class="cx"> || mayBeAffectedByHostRules(m_element, changedId)
</span><span class="cx"> || mayBeAffectedBySlottedRules(m_element, changedId);
</span><span class="cx">
</span><span class="lines">@@ -81,7 +81,7 @@
</span><span class="cx">
</span><span class="cx"> // This could be easily optimized for fine-grained descendant invalidation similar to ClassChangeInvalidation.
</span><span class="cx"> // However using ids for dynamic styling is rare and this is probably not worth the memory cost of the required data structures.
</span><del>- bool mayAffectDescendantStyle = ruleSets.features().idsMatchingAncestorsInRules.contains(changedId.impl());
</del><ins>+ bool mayAffectDescendantStyle = ruleSets.features().idsMatchingAncestorsInRules.contains(changedId);
</ins><span class="cx"> if (mayAffectDescendantStyle)
</span><span class="cx"> m_element.invalidateStyleForSubtree();
</span><span class="cx"> else
</span></span></pre></div>
<a id="trunkSourceWebCorestyleStyleSharingResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/StyleSharingResolver.cpp (214254 => 214255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StyleSharingResolver.cpp        2017-03-22 17:18:27 UTC (rev 214254)
+++ trunk/Source/WebCore/style/StyleSharingResolver.cpp        2017-03-22 17:19:28 UTC (rev 214255)
</span><span class="lines">@@ -90,7 +90,7 @@
</span><span class="cx"> return nullptr;
</span><span class="cx"> // Ids stop style sharing if they show up in the stylesheets.
</span><span class="cx"> auto& id = element.idForStyleResolution();
</span><del>- if (!id.isNull() && m_ruleSets.features().idsInRules.contains(id.impl()))
</del><ins>+ if (!id.isNull() && m_ruleSets.features().idsInRules.contains(id))
</ins><span class="cx"> return nullptr;
</span><span class="cx"> if (parentElementPreventsSharing(parentElement))
</span><span class="cx"> return nullptr;
</span><span class="lines">@@ -236,7 +236,7 @@
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> auto& candidateElementId = candidateElement.idForStyleResolution();
</span><del>- if (!candidateElementId.isNull() && m_ruleSets.features().idsInRules.contains(candidateElementId.impl()))
</del><ins>+ if (!candidateElementId.isNull() && m_ruleSets.features().idsInRules.contains(candidateElementId))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> bool isControl = is<HTMLFormControlElement>(candidateElement);
</span><span class="lines">@@ -340,7 +340,7 @@
</span><span class="cx"> bool SharingResolver::classNamesAffectedByRules(const SpaceSplitString& classNames) const
</span><span class="cx"> {
</span><span class="cx"> for (unsigned i = 0; i < classNames.size(); ++i) {
</span><del>- if (m_ruleSets.features().classesInRules.contains(classNames[i].impl()))
</del><ins>+ if (m_ruleSets.features().classesInRules.contains(classNames[i]))
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx"> return false;
</span></span></pre>
</div>
</div>
</body>
</html>