⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 102063 in webkit


Ignore:
Timestamp:
Dec 5, 2011, 4:15:16 PM (15 years ago)
Author:
Darin Adler
Message:

Change RuleSet to use HashMap<OwnPtr>
https://bugs.webkit.org/show_bug.cgi?id=73783

Reviewed by Andreas Kling.

  • css/CSSStyleSelector.cpp: Make RuleSet::AtomRuleMap use OwnPtr for the mapped values.

(WebCore::RuleSet::addToRuleSet): Use add instead of get/set to set up a new entry in the
map or find the old entry in the map.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r102062 r102063  
     12011-12-05  Darin Adler  <darin@apple.com>
     2
     3        Change RuleSet to use HashMap<OwnPtr>
     4        https://bugs.webkit.org/show_bug.cgi?id=73783
     5
     6        Reviewed by Andreas Kling.
     7
     8        * css/CSSStyleSelector.cpp: Make RuleSet::AtomRuleMap use OwnPtr for the mapped values.
     9        (WebCore::RuleSet::addToRuleSet): Use add instead of get/set to set up a new entry in the
     10        map or find the old entry in the map.
     11
    1122011-12-05  Mario Sanchez Prada  <msanchez@igalia.com>
    213
  • trunk/Source/WebCore/css/CSSStyleSelector.cpp

    r101899 r102063  
    5555#include "CSSValueList.h"
    5656#include "CursorList.h"
    57 #if ENABLE(CSS_FILTERS)
    58 #include "FilterOperation.h"
    59 #endif
    6057#include "FontFamilyValue.h"
    6158#include "FontFeatureValue.h"
     
    103100#include "TranslateTransformOperation.h"
    104101#include "UserAgentStyleSheets.h"
    105 #if ENABLE(CSS_FILTERS)
    106 #include "WebKitCSSFilterValue.h"
    107 #endif
    108102#include "WebKitCSSKeyframeRule.h"
    109103#include "WebKitCSSKeyframesRule.h"
     
    114108#include <wtf/StdLibExtras.h>
    115109#include <wtf/Vector.h>
     110
     111#if ENABLE(CSS_FILTERS)
     112#include "FilterOperation.h"
     113#include "WebKitCSSFilterValue.h"
     114#endif
    116115
    117116#if ENABLE(DASHBOARD_SUPPORT)
     
    204203public:
    205204    RuleSet();
    206     ~RuleSet();
    207 
    208     typedef HashMap<AtomicStringImpl*, Vector<RuleData>*> AtomRuleMap;
     205
     206    typedef HashMap<AtomicStringImpl*, OwnPtr<Vector<RuleData> > > AtomRuleMap;
    209207
    210208    void addRulesFromSheet(CSSStyleSheet*, const MediaQueryEvaluator&, CSSStyleSelector* = 0);
     
    213211    void addRule(CSSStyleRule* rule, CSSSelector* sel);
    214212    void addPageRule(CSSPageRule*);
    215     void addToRuleSet(AtomicStringImpl* key, AtomRuleMap& map,
    216                       CSSStyleRule* rule, CSSSelector* sel);
     213    void addToRuleSet(AtomicStringImpl* key, AtomRuleMap&, CSSStyleRule*, CSSSelector*);
    217214    void shrinkToFit();
    218215    void disableAutoShrinkToFit() { m_autoShrinkToFitEnabled = false; }
     
    18591856}
    18601857
    1861 RuleSet::~RuleSet()
    1862 {
    1863     deleteAllValues(m_idRules);
    1864     deleteAllValues(m_classRules);
    1865     deleteAllValues(m_shadowPseudoElementRules);
    1866     deleteAllValues(m_tagRules);
    1867 }
    1868 
    1869 
    1870 void RuleSet::addToRuleSet(AtomicStringImpl* key, AtomRuleMap& map,
    1871                               CSSStyleRule* rule, CSSSelector* sel)
    1872 {
    1873     if (!key) return;
    1874     Vector<RuleData>* rules = map.get(key);
    1875     if (!rules) {
    1876         rules = new Vector<RuleData>;
    1877         map.set(key, rules);
    1878     }
    1879     rules->append(RuleData(rule, sel, m_ruleCount++));
     1858void RuleSet::addToRuleSet(AtomicStringImpl* key, AtomRuleMap& map, CSSStyleRule* rule, CSSSelector* selector)
     1859{
     1860    if (!key)
     1861        return;
     1862    OwnPtr<Vector<RuleData> >& rules = map.add(key, nullptr).first->second;
     1863    if (!rules)
     1864        rules = adoptPtr(new Vector<RuleData>);
     1865    rules->append(RuleData(rule, selector, m_ruleCount++));
    18801866}
    18811867
Note: See TracChangeset for help on using the changeset viewer.