darin@apple.com | faced26 | 2009-01-12 07:44:27 +0000 | [diff] [blame] | 1 | /* |
darin@apple.com | f5247d1 | 2010-06-13 17:29:10 +0000 | [diff] [blame] | 2 | * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved. |
dsmith@webkit.org | bee65b5 | 2008-09-26 02:36:38 +0000 | [diff] [blame] | 3 | * Copyright (C) 2008 David Smith <catfish.man@gmail.com> |
| 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Library General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Library General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU Library General Public License |
| 16 | * along with this library; see the file COPYING.LIB. If not, write to |
| 17 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 | * Boston, MA 02110-1301, USA. |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | #ifndef ElementRareData_h |
| 23 | #define ElementRareData_h |
| 24 | |
commit-queue@webkit.org | 691d04f | 2010-10-29 09:32:14 +0000 | [diff] [blame] | 25 | #include "ClassList.h" |
weinig@apple.com | 96a2cf9 | 2010-06-30 23:15:15 +0000 | [diff] [blame] | 26 | #include "DatasetDOMStringMap.h" |
dsmith@webkit.org | bee65b5 | 2008-09-26 02:36:38 +0000 | [diff] [blame] | 27 | #include "Element.h" |
kling@webkit.org | a3a65e3 | 2012-01-01 21:05:42 +0000 | [diff] [blame] | 28 | #include "HTMLCollection.h" |
caio.oliveira@openbossa.org | 26b85d3 | 2012-03-08 17:42:28 +0000 | [diff] [blame^] | 29 | #include "NamedNodeMap.h" |
dsmith@webkit.org | bee65b5 | 2008-09-26 02:36:38 +0000 | [diff] [blame] | 30 | #include "NodeRareData.h" |
shinyak@chromium.org | fea4824 | 2012-02-27 06:50:19 +0000 | [diff] [blame] | 31 | #include "ShadowTree.h" |
weinig@apple.com | 96a2cf9 | 2010-06-30 23:15:15 +0000 | [diff] [blame] | 32 | #include <wtf/OwnPtr.h> |
dsmith@webkit.org | bee65b5 | 2008-09-26 02:36:38 +0000 | [diff] [blame] | 33 | |
| 34 | namespace WebCore { |
alp@webkit.org | 2122a04 | 2008-10-03 12:38:12 +0000 | [diff] [blame] | 35 | |
dsmith@webkit.org | bee65b5 | 2008-09-26 02:36:38 +0000 | [diff] [blame] | 36 | class ElementRareData : public NodeRareData { |
| 37 | public: |
darin@apple.com | faced26 | 2009-01-12 07:44:27 +0000 | [diff] [blame] | 38 | ElementRareData(); |
morrita@google.com | d75075c | 2011-01-20 01:24:40 +0000 | [diff] [blame] | 39 | virtual ~ElementRareData(); |
darin@apple.com | 929b907 | 2008-12-13 22:53:55 +0000 | [diff] [blame] | 40 | |
darin@apple.com | faced26 | 2009-01-12 07:44:27 +0000 | [diff] [blame] | 41 | void resetComputedStyle(); |
alp@webkit.org | 2122a04 | 2008-10-03 12:38:12 +0000 | [diff] [blame] | 42 | |
darin@apple.com | 929b907 | 2008-12-13 22:53:55 +0000 | [diff] [blame] | 43 | using NodeRareData::needsFocusAppearanceUpdateSoonAfterAttach; |
| 44 | using NodeRareData::setNeedsFocusAppearanceUpdateSoonAfterAttach; |
| 45 | |
kling@webkit.org | fe42004 | 2012-01-07 09:35:21 +0000 | [diff] [blame] | 46 | typedef FixedArray<OwnPtr<HTMLCollection>, NumNodeCollectionTypes> CachedHTMLCollectionArray; |
kling@webkit.org | a3a65e3 | 2012-01-01 21:05:42 +0000 | [diff] [blame] | 47 | |
| 48 | bool hasCachedHTMLCollections() const |
| 49 | { |
| 50 | return m_cachedCollections; |
| 51 | } |
| 52 | |
kling@webkit.org | a3a65e3 | 2012-01-01 21:05:42 +0000 | [diff] [blame] | 53 | HTMLCollection* ensureCachedHTMLCollection(Element* element, CollectionType type) |
| 54 | { |
| 55 | if (!m_cachedCollections) |
| 56 | m_cachedCollections = adoptPtr(new CachedHTMLCollectionArray); |
| 57 | |
kling@webkit.org | fe42004 | 2012-01-07 09:35:21 +0000 | [diff] [blame] | 58 | OwnPtr<HTMLCollection>& collection = (*m_cachedCollections)[type - FirstNodeCollectionType]; |
kling@webkit.org | a3a65e3 | 2012-01-01 21:05:42 +0000 | [diff] [blame] | 59 | if (!collection) |
| 60 | collection = HTMLCollection::create(element, type); |
| 61 | return collection.get(); |
| 62 | } |
| 63 | |
| 64 | OwnPtr<CachedHTMLCollectionArray> m_cachedCollections; |
| 65 | |
eae@chromium.org | 5b93f41 | 2011-08-15 23:51:21 +0000 | [diff] [blame] | 66 | LayoutSize m_minimumSizeForResizing; |
hyatt@apple.com | dec0cbf2 | 2008-10-17 00:25:33 +0000 | [diff] [blame] | 67 | RefPtr<RenderStyle> m_computedStyle; |
dglazkov@chromium.org | d505a10 | 2011-06-29 06:05:16 +0000 | [diff] [blame] | 68 | AtomicString m_shadowPseudoId; |
weinig@apple.com | 96a2cf9 | 2010-06-30 23:15:15 +0000 | [diff] [blame] | 69 | |
| 70 | OwnPtr<DatasetDOMStringMap> m_datasetDOMStringMap; |
commit-queue@webkit.org | 691d04f | 2010-10-29 09:32:14 +0000 | [diff] [blame] | 71 | OwnPtr<ClassList> m_classList; |
shinyak@chromium.org | 1fae308 | 2012-02-28 08:05:51 +0000 | [diff] [blame] | 72 | OwnPtr<ShadowTree> m_shadowTree; |
caio.oliveira@openbossa.org | 26b85d3 | 2012-03-08 17:42:28 +0000 | [diff] [blame^] | 73 | OwnPtr<NamedNodeMap> m_attributeMap; |
jer.noble@apple.com | 366ebb0 | 2011-05-30 02:05:30 +0000 | [diff] [blame] | 74 | |
mitz@apple.com | 2933312 | 2011-07-10 15:37:30 +0000 | [diff] [blame] | 75 | bool m_styleAffectedByEmpty; |
| 76 | |
jer.noble@apple.com | 366ebb0 | 2011-05-30 02:05:30 +0000 | [diff] [blame] | 77 | #if ENABLE(FULLSCREEN_API) |
| 78 | bool m_containsFullScreenElement; |
| 79 | #endif |
dsmith@webkit.org | bee65b5 | 2008-09-26 02:36:38 +0000 | [diff] [blame] | 80 | }; |
| 81 | |
| 82 | inline IntSize defaultMinimumSizeForResizing() |
| 83 | { |
| 84 | return IntSize(INT_MAX, INT_MAX); |
| 85 | } |
| 86 | |
darin@apple.com | faced26 | 2009-01-12 07:44:27 +0000 | [diff] [blame] | 87 | inline ElementRareData::ElementRareData() |
rolandsteiner@chromium.org | 2ce77d7 | 2012-02-15 09:17:20 +0000 | [diff] [blame] | 88 | : NodeRareData() |
| 89 | , m_minimumSizeForResizing(defaultMinimumSizeForResizing()) |
mitz@apple.com | 2933312 | 2011-07-10 15:37:30 +0000 | [diff] [blame] | 90 | , m_styleAffectedByEmpty(false) |
jer.noble@apple.com | 366ebb0 | 2011-05-30 02:05:30 +0000 | [diff] [blame] | 91 | #if ENABLE(FULLSCREEN_API) |
| 92 | , m_containsFullScreenElement(false) |
| 93 | #endif |
dsmith@webkit.org | bee65b5 | 2008-09-26 02:36:38 +0000 | [diff] [blame] | 94 | { |
| 95 | } |
| 96 | |
morrita@google.com | d75075c | 2011-01-20 01:24:40 +0000 | [diff] [blame] | 97 | inline ElementRareData::~ElementRareData() |
| 98 | { |
shinyak@chromium.org | 1fae308 | 2012-02-28 08:05:51 +0000 | [diff] [blame] | 99 | ASSERT(!m_shadowTree); |
morrita@google.com | d75075c | 2011-01-20 01:24:40 +0000 | [diff] [blame] | 100 | } |
| 101 | |
darin@apple.com | faced26 | 2009-01-12 07:44:27 +0000 | [diff] [blame] | 102 | inline void ElementRareData::resetComputedStyle() |
dsmith@webkit.org | bee65b5 | 2008-09-26 02:36:38 +0000 | [diff] [blame] | 103 | { |
hyatt@apple.com | dec0cbf2 | 2008-10-17 00:25:33 +0000 | [diff] [blame] | 104 | m_computedStyle.clear(); |
dsmith@webkit.org | bee65b5 | 2008-09-26 02:36:38 +0000 | [diff] [blame] | 105 | } |
| 106 | |
| 107 | } |
alp@webkit.org | 2122a04 | 2008-10-03 12:38:12 +0000 | [diff] [blame] | 108 | #endif // ElementRareData_h |