~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/3rdparty/webkit/WebCore/dom/NodeRareData.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-11-02 18:30:08 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (15.2.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 88.
  • Revision ID: james.westby@ubuntu.com-20091102183008-b6a4gcs128mvfb3m
Tags: upstream-4.6.0~beta1
ImportĀ upstreamĀ versionĀ 4.6.0~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include "StringHash.h"
29
29
#include "QualifiedName.h"
30
30
#include <wtf/HashSet.h>
 
31
#include <wtf/PassOwnPtr.h>
31
32
#include <wtf/OwnPtr.h>
32
33
 
33
34
namespace WebCore {
36
37
    typedef HashSet<DynamicNodeList*> NodeListSet;
37
38
    NodeListSet m_listsWithCaches;
38
39
    
39
 
    DynamicNodeList::Caches m_childNodeListCaches;
 
40
    RefPtr<DynamicNodeList::Caches> m_childNodeListCaches;
40
41
    
41
 
    typedef HashMap<String, DynamicNodeList::Caches*> CacheMap;
 
42
    typedef HashMap<String, RefPtr<DynamicNodeList::Caches> > CacheMap;
42
43
    CacheMap m_classNodeListCaches;
43
44
    CacheMap m_nameNodeListCaches;
44
45
    
45
 
    typedef HashMap<QualifiedName, DynamicNodeList::Caches*> TagCacheMap;
 
46
    typedef HashMap<QualifiedName, RefPtr<DynamicNodeList::Caches> > TagCacheMap;
46
47
    TagCacheMap m_tagNodeListCaches;
47
 
    
48
 
    ~NodeListsNodeData()
 
48
 
 
49
    static PassOwnPtr<NodeListsNodeData> create()
49
50
    {
50
 
        deleteAllValues(m_classNodeListCaches);
51
 
        deleteAllValues(m_nameNodeListCaches);
52
 
        deleteAllValues(m_tagNodeListCaches);
 
51
        return new NodeListsNodeData;
53
52
    }
54
53
    
55
54
    void invalidateCaches();
56
55
    void invalidateCachesThatDependOnAttributes();
57
56
    bool isEmpty() const;
 
57
 
 
58
private:
 
59
    NodeListsNodeData()
 
60
        : m_childNodeListCaches(DynamicNodeList::Caches::create())
 
61
    {
 
62
    }
58
63
};
59
64
    
60
65
class NodeRareData {
81
86
    }
82
87
    
83
88
    void clearNodeLists() { m_nodeLists.clear(); }
84
 
    void setNodeLists(std::auto_ptr<NodeListsNodeData> lists) { m_nodeLists.set(lists.release()); }
 
89
    void setNodeLists(PassOwnPtr<NodeListsNodeData> lists) { m_nodeLists = lists; }
85
90
    NodeListsNodeData* nodeLists() const { return m_nodeLists.get(); }
86
91
    
87
92
    short tabIndex() const { return m_tabIndex; }
88
93
    void setTabIndexExplicitly(short index) { m_tabIndex = index; m_tabIndexWasSetExplicitly = true; }
89
94
    bool tabIndexSetExplicitly() const { return m_tabIndexWasSetExplicitly; }
90
95
 
91
 
    RegisteredEventListenerVector* listeners() { return m_eventListeners.get(); }
92
 
    RegisteredEventListenerVector& ensureListeners()
 
96
    EventTargetData* eventTargetData() { return m_eventTargetData.get(); }
 
97
    EventTargetData* ensureEventTargetData()
93
98
    {
94
 
        if (!m_eventListeners)
95
 
            m_eventListeners.set(new RegisteredEventListenerVector);
96
 
        return *m_eventListeners;
 
99
        if (!m_eventTargetData)
 
100
            m_eventTargetData.set(new EventTargetData);
 
101
        return m_eventTargetData.get();
97
102
    }
98
103
 
99
104
    bool isFocused() const { return m_isFocused; }
106
111
 
107
112
private:
108
113
    OwnPtr<NodeListsNodeData> m_nodeLists;
109
 
    OwnPtr<RegisteredEventListenerVector > m_eventListeners;
 
114
    OwnPtr<EventTargetData> m_eventTargetData;
110
115
    short m_tabIndex;
111
116
    bool m_tabIndexWasSetExplicitly : 1;
112
117
    bool m_isFocused : 1;