Remove "document has no ::before and/or ::after rules" optimization.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Nov 2014 01:36:27 +0000 (01:36 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Nov 2014 01:36:27 +0000 (01:36 +0000)
<https://webkit.org/b/138897>

Reviewed by Antti Koivisto.

This optimization has been dead for a long time, since the default UA
style contains both ::before and ::after rules.

* css/RuleFeature.cpp:
(WebCore::recursivelyCollectFeaturesFromSelector):
(WebCore::RuleFeatureSet::add):
(WebCore::RuleFeatureSet::clear):
* css/RuleFeature.h:
(WebCore::RuleFeatureSet::RuleFeatureSet):
* css/StyleResolver.h:
(WebCore::StyleResolver::usesBeforeAfterRules): Deleted.
* dom/DocumentStyleSheetCollection.cpp:
(WebCore::DocumentStyleSheetCollection::DocumentStyleSheetCollection):
(WebCore::DocumentStyleSheetCollection::combineCSSFeatureFlags):
(WebCore::DocumentStyleSheetCollection::resetCSSFeatureFlags):
* dom/DocumentStyleSheetCollection.h:
(WebCore::DocumentStyleSheetCollection::usesBeforeAfterRules): Deleted.
(WebCore::DocumentStyleSheetCollection::setUsesBeforeAfterRulesOverride): Deleted.
* html/HTMLQuoteElement.cpp:
(WebCore::HTMLQuoteElement::insertedInto): Deleted.
* html/HTMLQuoteElement.h:
* style/StyleResolveTree.cpp:
(WebCore::Style::needsPseudoElement):

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

Source/WebCore/ChangeLog
Source/WebCore/css/RuleFeature.cpp
Source/WebCore/css/RuleFeature.h
Source/WebCore/css/StyleResolver.h
Source/WebCore/dom/DocumentStyleSheetCollection.cpp
Source/WebCore/dom/DocumentStyleSheetCollection.h
Source/WebCore/html/HTMLQuoteElement.cpp
Source/WebCore/html/HTMLQuoteElement.h
Source/WebCore/style/StyleResolveTree.cpp

index 291072d..f2bdae3 100644 (file)
@@ -1,3 +1,34 @@
+2014-11-19  Andreas Kling  <akling@apple.com>
+
+        Remove "document has no ::before and/or ::after rules" optimization.
+        <https://webkit.org/b/138897>
+
+        Reviewed by Antti Koivisto.
+
+        This optimization has been dead for a long time, since the default UA
+        style contains both ::before and ::after rules.
+
+        * css/RuleFeature.cpp:
+        (WebCore::recursivelyCollectFeaturesFromSelector):
+        (WebCore::RuleFeatureSet::add):
+        (WebCore::RuleFeatureSet::clear):
+        * css/RuleFeature.h:
+        (WebCore::RuleFeatureSet::RuleFeatureSet):
+        * css/StyleResolver.h:
+        (WebCore::StyleResolver::usesBeforeAfterRules): Deleted.
+        * dom/DocumentStyleSheetCollection.cpp:
+        (WebCore::DocumentStyleSheetCollection::DocumentStyleSheetCollection):
+        (WebCore::DocumentStyleSheetCollection::combineCSSFeatureFlags):
+        (WebCore::DocumentStyleSheetCollection::resetCSSFeatureFlags):
+        * dom/DocumentStyleSheetCollection.h:
+        (WebCore::DocumentStyleSheetCollection::usesBeforeAfterRules): Deleted.
+        (WebCore::DocumentStyleSheetCollection::setUsesBeforeAfterRulesOverride): Deleted.
+        * html/HTMLQuoteElement.cpp:
+        (WebCore::HTMLQuoteElement::insertedInto): Deleted.
+        * html/HTMLQuoteElement.h:
+        * style/StyleResolveTree.cpp:
+        (WebCore::Style::needsPseudoElement):
+
 2014-11-19  Myles C. Maxfield  <mmaxfield@apple.com>
 
         [OS X] Upright vertical text is completely broken for multi-code-unit codepoints
index 1ead8f3..a3fa98a 100644 (file)
@@ -53,10 +53,6 @@ static void recursivelyCollectFeaturesFromSelector(RuleFeatureSet& features, con
             case CSSSelector::PseudoElementFirstLetter:
                 features.usesFirstLetterRules = true;
                 break;
-            case CSSSelector::PseudoElementBefore:
-            case CSSSelector::PseudoElementAfter:
-                features.usesBeforeAfterRules = true;
-                break;
             default:
                 break;
             }
@@ -93,7 +89,6 @@ void RuleFeatureSet::add(const RuleFeatureSet& other)
     uncommonAttributeRules.appendVector(other.uncommonAttributeRules);
     usesFirstLineRules = usesFirstLineRules || other.usesFirstLineRules;
     usesFirstLetterRules = usesFirstLetterRules || other.usesFirstLetterRules;
-    usesBeforeAfterRules = usesBeforeAfterRules || other.usesBeforeAfterRules;
 }
 
 void RuleFeatureSet::clear()
@@ -106,7 +101,6 @@ void RuleFeatureSet::clear()
     uncommonAttributeRules.clear();
     usesFirstLineRules = false;
     usesFirstLetterRules = false;
-    usesBeforeAfterRules = false;
 }
 
 } // namespace WebCore
index ec68f4b..0aad811 100644 (file)
@@ -48,7 +48,6 @@ struct RuleFeatureSet {
     RuleFeatureSet()
         : usesFirstLineRules(false)
         , usesFirstLetterRules(false)
-        , usesBeforeAfterRules(false)
     { }
 
     void add(const RuleFeatureSet&);
@@ -64,7 +63,6 @@ struct RuleFeatureSet {
     Vector<RuleFeature> uncommonAttributeRules;
     bool usesFirstLineRules;
     bool usesFirstLetterRules;
-    bool usesBeforeAfterRules;
 };
 
 } // namespace WebCore
index b2ca96b..a7a5ac2 100644 (file)
@@ -232,7 +232,6 @@ public:
     bool usesSiblingRules() const { return !m_ruleSets.features().siblingRules.isEmpty(); }
     bool usesFirstLineRules() const { return m_ruleSets.features().usesFirstLineRules; }
     bool usesFirstLetterRules() const { return m_ruleSets.features().usesFirstLetterRules; }
-    bool usesBeforeAfterRules() const { return m_ruleSets.features().usesBeforeAfterRules; }
     
     void invalidateMatchedPropertiesCache();
 
index b200f12..2448a3e 100644 (file)
@@ -60,8 +60,6 @@ DocumentStyleSheetCollection::DocumentStyleSheetCollection(Document& document)
     , m_usesSiblingRulesOverride(false)
     , m_usesFirstLineRules(false)
     , m_usesFirstLetterRules(false)
-    , m_usesBeforeAfterRules(false)
-    , m_usesBeforeAfterRulesOverride(false)
     , m_usesRemUnits(false)
 {
 }
@@ -73,7 +71,6 @@ void DocumentStyleSheetCollection::combineCSSFeatureFlags()
     m_usesSiblingRules = m_usesSiblingRules || styleResolver.usesSiblingRules();
     m_usesFirstLineRules = m_usesFirstLineRules || styleResolver.usesFirstLineRules();
     m_usesFirstLetterRules = m_usesFirstLetterRules || styleResolver.usesFirstLetterRules();
-    m_usesBeforeAfterRules = m_usesBeforeAfterRules || styleResolver.usesBeforeAfterRules();
 }
 
 void DocumentStyleSheetCollection::resetCSSFeatureFlags()
@@ -82,7 +79,6 @@ void DocumentStyleSheetCollection::resetCSSFeatureFlags()
     m_usesSiblingRules = styleResolver.usesSiblingRules();
     m_usesFirstLineRules = styleResolver.usesFirstLineRules();
     m_usesFirstLetterRules = styleResolver.usesFirstLetterRules();
-    m_usesBeforeAfterRules = styleResolver.usesBeforeAfterRules();
 }
 
 CSSStyleSheet* DocumentStyleSheetCollection::pageUserSheet()
index 9c8265d..586d4e7 100644 (file)
@@ -105,8 +105,6 @@ public:
     void setUsesSiblingRulesOverride(bool b) { m_usesSiblingRulesOverride = b; }
     bool usesFirstLineRules() const { return m_usesFirstLineRules; }
     bool usesFirstLetterRules() const { return m_usesFirstLetterRules; }
-    bool usesBeforeAfterRules() const { return m_usesBeforeAfterRules || m_usesBeforeAfterRulesOverride; }
-    void setUsesBeforeAfterRulesOverride(bool b) { m_usesBeforeAfterRulesOverride = b; }
     bool usesRemUnits() const { return m_usesRemUnits; }
     void setUsesRemUnit(bool b) { m_usesRemUnits = b; }
 
@@ -162,8 +160,6 @@ private:
     bool m_usesSiblingRulesOverride;
     bool m_usesFirstLineRules;
     bool m_usesFirstLetterRules;
-    bool m_usesBeforeAfterRules;
-    bool m_usesBeforeAfterRulesOverride;
     bool m_usesRemUnits;
 };
 
index 96d2d91..27a4ddc 100644 (file)
@@ -42,14 +42,6 @@ PassRefPtr<HTMLQuoteElement> HTMLQuoteElement::create(const QualifiedName& tagNa
     return adoptRef(new HTMLQuoteElement(tagName, document));
 }
 
-Node::InsertionNotificationRequest HTMLQuoteElement::insertedInto(ContainerNode& insertionPoint)
-{
-    if (hasTagName(qTag))
-        document().styleSheetCollection().setUsesBeforeAfterRulesOverride(true);
-
-    return HTMLElement::insertedInto(insertionPoint);
-}
-
 bool HTMLQuoteElement::isURLAttribute(const Attribute& attribute) const
 {
     return attribute.name() == citeAttr || HTMLElement::isURLAttribute(attribute);
index 13ff919..6fb7f30 100644 (file)
@@ -36,7 +36,6 @@ public:
 private:
     HTMLQuoteElement(const QualifiedName&, Document&);
     
-    virtual InsertionNotificationRequest insertedInto(ContainerNode&) override;
     virtual bool isURLAttribute(const Attribute&) const override;
 };
 
index 446ee51..ce55141 100644 (file)
@@ -579,8 +579,6 @@ static void resetStyleForNonRenderedDescendants(Element& current)
 
 static bool needsPseudoElement(Element& current, PseudoId pseudoId)
 {
-    if (!current.document().styleSheetCollection().usesBeforeAfterRules())
-        return false;
     if (!current.renderer() || !current.renderer()->canHaveGeneratedChildren())
         return false;
     if (current.isPseudoElement())