REGRESSION(r196629): Messages text size only changes for sending text, conversation...
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Apr 2016 12:26:49 +0000 (12:26 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Apr 2016 12:26:49 +0000 (12:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=156287
<rdar://problem/24264756>

Reviewed by Andreas Kling.

Source/WebCore:

* css/RuleFeature.cpp:
(WebCore::RuleFeatureSet::recursivelyCollectFeaturesFromSelector):
(WebCore::makeAttributeSelectorKey):

    Include attribute value to the key. Otherwise we may deduplicate selectors that are not indentical.

(WebCore::RuleFeatureSet::collectFeatures):
(WebCore::RuleFeatureSet::add):

    Use HashMap::ensure().

* css/RuleFeature.h:

LayoutTests:

* fast/css/style-invalidation-attribute-change-descendants-expected.txt:
* fast/css/style-invalidation-attribute-change-descendants.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199099 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/css/style-invalidation-attribute-change-descendants-expected.txt
LayoutTests/fast/css/style-invalidation-attribute-change-descendants.html
Source/WebCore/ChangeLog
Source/WebCore/css/RuleFeature.cpp
Source/WebCore/css/RuleFeature.h

index e7d41b1..cd93005 100644 (file)
@@ -1,3 +1,14 @@
+2016-04-06  Antti Koivisto  <antti@apple.com>
+
+        REGRESSION(r196629): Messages text size only changes for sending text, conversation text size does not change
+        https://bugs.webkit.org/show_bug.cgi?id=156287
+        <rdar://problem/24264756>
+
+        Reviewed by Andreas Kling.
+
+        * fast/css/style-invalidation-attribute-change-descendants-expected.txt:
+        * fast/css/style-invalidation-attribute-change-descendants.html:
+
 2016-04-06  Manuel Rego Casasnovas  <rego@igalia.com>
 
         [css-grid] Fix positioned children in RTL
index ca4b287..55942ad 100644 (file)
@@ -154,6 +154,11 @@ PASS testStyleChangeType("root", "NoStyleChange") || testStyleChangeType("root",
 PASS testStyleChangeType("target", "InlineStyleChange") is true
 PASS testStyleChangeType("inert", "NoStyleChange") is true
 PASS hasExpectedStyle is true
+Setting attribute 'myattr' value 'value11'
+PASS testStyleChangeType("root", "NoStyleChange") || testStyleChangeType("root", "InlineStyleChange") is true
+PASS testStyleChangeType("target", "InlineStyleChange") is true
+PASS testStyleChangeType("inert", "NoStyleChange") is true
+PASS hasExpectedStyle is true
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 754c798..7292131 100644 (file)
@@ -46,6 +46,10 @@ root:not([mynotattr]) target {
     color: rgb(10, 0, 0);
 }
 
+[myattr=value11] target {
+    color: rgb(11, 0, 0);
+}
+
 </style>
 </head>
 <body>
@@ -251,6 +255,10 @@ setAttribute('mynotattr', 'value');
 testStyleInvalidation("InlineStyleChange");
 checkStyle(1);
 
+setAttribute('myattr', 'value11');
+testStyleInvalidation("InlineStyleChange");
+checkStyle(11);
+
 </script>
 <script src="../../resources/js-test-post.js"></script>
 </html>
index 701de00..d66bb4a 100644 (file)
@@ -1,3 +1,24 @@
+2016-04-06  Antti Koivisto  <antti@apple.com>
+
+        REGRESSION(r196629): Messages text size only changes for sending text, conversation text size does not change
+        https://bugs.webkit.org/show_bug.cgi?id=156287
+        <rdar://problem/24264756>
+
+        Reviewed by Andreas Kling.
+
+        * css/RuleFeature.cpp:
+        (WebCore::RuleFeatureSet::recursivelyCollectFeaturesFromSelector):
+        (WebCore::makeAttributeSelectorKey):
+
+            Include attribute value to the key. Otherwise we may deduplicate selectors that are not indentical.
+
+        (WebCore::RuleFeatureSet::collectFeatures):
+        (WebCore::RuleFeatureSet::add):
+
+            Use HashMap::ensure().
+
+        * css/RuleFeature.h:
+
 2016-04-06  Manuel Rego Casasnovas  <rego@igalia.com>
 
         [css-grid] Fix positioned children in RTL
index a578067..6f4ffad 100644 (file)
@@ -84,11 +84,11 @@ void RuleFeatureSet::recursivelyCollectFeaturesFromSelector(SelectorFeatures& se
     } while (selector);
 }
 
-static std::pair<AtomicStringImpl*, unsigned> makeAttributeSelectorKey(const CSSSelector& selector)
+static RuleFeatureSet::AttributeRules::SelectorKey makeAttributeSelectorKey(const CSSSelector& selector)
 {
     bool caseInsensitive = selector.attributeValueMatchingIsCaseInsensitive();
     unsigned matchAndCase = static_cast<unsigned>(selector.match()) << 1 | caseInsensitive;
-    return std::make_pair(selector.attributeCanonicalLocalName().impl(), matchAndCase);
+    return std::make_pair(selector.attributeCanonicalLocalName().impl(), std::make_pair(selector.value().impl(), matchAndCase));
 }
 
 void RuleFeatureSet::collectFeatures(const RuleData& ruleData)
@@ -100,16 +100,16 @@ void RuleFeatureSet::collectFeatures(const RuleData& ruleData)
     if (ruleData.containsUncommonAttributeSelector())
         uncommonAttributeRules.append(RuleFeature(ruleData.rule(), ruleData.selectorIndex(), ruleData.hasDocumentSecurityOrigin()));
     for (auto* className : selectorFeatures.classesMatchingAncestors) {
-        auto addResult = ancestorClassRules.add(className, nullptr);
-        if (addResult.isNewEntry)
-            addResult.iterator->value = std::make_unique<Vector<RuleFeature>>();
+        auto addResult = ancestorClassRules.ensure(className, [] {
+            return std::make_unique<Vector<RuleFeature>>();
+        });
         addResult.iterator->value->append(RuleFeature(ruleData.rule(), ruleData.selectorIndex(), ruleData.hasDocumentSecurityOrigin()));
     }
     for (auto* selector : selectorFeatures.attributeSelectorsMatchingAncestors) {
         // Hashing by attributeCanonicalLocalName makes this HTML specific.
-        auto addResult = ancestorAttributeRulesForHTML.add(selector->attributeCanonicalLocalName().impl(), nullptr);
-        if (addResult.isNewEntry)
-            addResult.iterator->value = std::make_unique<AttributeRules>();
+        auto addResult = ancestorAttributeRulesForHTML.ensure(selector->attributeCanonicalLocalName().impl(), [] {
+            return std::make_unique<AttributeRules>();
+        });
         auto& rules = *addResult.iterator->value;
         rules.features.append(RuleFeature(ruleData.rule(), ruleData.selectorIndex(), ruleData.hasDocumentSecurityOrigin()));
         // Deduplicate selectors.
@@ -127,16 +127,15 @@ void RuleFeatureSet::add(const RuleFeatureSet& other)
     siblingRules.appendVector(other.siblingRules);
     uncommonAttributeRules.appendVector(other.uncommonAttributeRules);
     for (auto& keyValuePair : other.ancestorClassRules) {
-        auto addResult = ancestorClassRules.add(keyValuePair.key, nullptr);
-        if (addResult.isNewEntry)
-            addResult.iterator->value = std::make_unique<Vector<RuleFeature>>(*keyValuePair.value);
-        else
-            addResult.iterator->value->appendVector(*keyValuePair.value);
+        auto addResult = ancestorClassRules.ensure(keyValuePair.key, [] {
+            return std::make_unique<Vector<RuleFeature>>();
+        });
+        addResult.iterator->value->appendVector(*keyValuePair.value);
     }
     for (auto& keyValuePair : other.ancestorAttributeRulesForHTML) {
-        auto addResult = ancestorAttributeRulesForHTML.add(keyValuePair.key, nullptr);
-        if (addResult.isNewEntry)
-            addResult.iterator->value = std::make_unique<AttributeRules>();
+        auto addResult = ancestorAttributeRulesForHTML.ensure(keyValuePair.key, [] {
+            return std::make_unique<AttributeRules>();
+        });
         auto& rules = *addResult.iterator->value;
         rules.features.appendVector(keyValuePair.value->features);
         for (auto& selectorPair : keyValuePair.value->selectors)
index 9ce5edb..97dd00d 100644 (file)
@@ -61,7 +61,8 @@ struct RuleFeatureSet {
     HashMap<AtomicStringImpl*, std::unique_ptr<Vector<RuleFeature>>> ancestorClassRules;
 
     struct AttributeRules {
-        HashMap<std::pair<AtomicStringImpl*, unsigned>, const CSSSelector*> selectors;
+        using SelectorKey = std::pair<AtomicStringImpl*, std::pair<AtomicStringImpl*, unsigned>>;
+        HashMap<SelectorKey, const CSSSelector*> selectors;
         Vector<RuleFeature> features;
     };
     HashMap<AtomicStringImpl*, std::unique_ptr<AttributeRules>> ancestorAttributeRulesForHTML;