3 * Copyright (C) 2008 Apple Computer, Inc.
4 * Copyright (C) 2008 David Smith <catfish.man@gmail.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
23 #ifndef NodeRareData_h
24 #define NodeRareData_h
26 #include "DynamicNodeList.h"
27 #include "StringHash.h"
28 #include <wtf/HashSet.h>
29 #include <wtf/OwnPtr.h>
33 struct NodeListsNodeData
{
34 typedef HashSet
<DynamicNodeList
*> NodeListSet
;
35 NodeListSet m_listsWithCaches
;
37 DynamicNodeList::Caches m_childNodeListCaches
;
39 typedef HashMap
<String
, DynamicNodeList::Caches
*> CacheMap
;
40 CacheMap m_classNodeListCaches
;
41 CacheMap m_nameNodeListCaches
;
45 deleteAllValues(m_classNodeListCaches
);
46 deleteAllValues(m_nameNodeListCaches
);
49 void invalidateCaches();
50 void invalidateCachesThatDependOnAttributes();
59 , m_tabIndexSetExplicitly(false)
60 , m_needsFocusAppearanceUpdateSoonAfterAttach(false)
64 typedef HashMap
<const Node
*, NodeRareData
*> NodeRareDataMap
;
66 static NodeRareDataMap
& rareDataMap()
68 static NodeRareDataMap
* dataMap
= new NodeRareDataMap
;
72 static NodeRareData
* rareDataFromMap(const Node
* node
)
74 return rareDataMap().get(node
);
77 void clearNodeLists() { m_nodeLists
.clear(); }
78 void setNodeLists(std::auto_ptr
<NodeListsNodeData
> lists
) { m_nodeLists
.set(lists
.release()); }
79 NodeListsNodeData
* nodeLists() const { return m_nodeLists
.get(); }
81 short tabIndex() const { return m_tabIndex
; }
82 void setTabIndexExplicitly(short index
) { m_tabIndex
= index
; m_tabIndexSetExplicitly
= true; }
83 bool tabIndexSetExplicitly() const { return m_tabIndexSetExplicitly
; }
88 OwnPtr
<NodeListsNodeData
> m_nodeLists
;
90 bool m_tabIndexSetExplicitly
: 1;
92 bool m_needsFocusAppearanceUpdateSoonAfterAttach
: 1; //for ElementRareData