OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "CachedCSSStyleSheet.h" | 30 #include "CachedCSSStyleSheet.h" |
31 #include "Document.h" | 31 #include "Document.h" |
32 #include "ExceptionCode.h" | 32 #include "ExceptionCode.h" |
33 #include "HTMLNames.h" | 33 #include "HTMLNames.h" |
34 #include "MediaList.h" | 34 #include "MediaList.h" |
35 #include "Node.h" | 35 #include "Node.h" |
36 #include "SVGNames.h" | 36 #include "SVGNames.h" |
37 #include "SecurityOrigin.h" | 37 #include "SecurityOrigin.h" |
38 #include "StyleRule.h" | 38 #include "StyleRule.h" |
39 #include "StyleSheetContents.h" | 39 #include "StyleSheetContents.h" |
40 #include "WebCoreMemoryInstrumentation.h" | |
41 #include <wtf/MemoryInstrumentationVector.h> | |
42 #include <wtf/text/StringBuilder.h> | 40 #include <wtf/text/StringBuilder.h> |
43 | 41 |
44 namespace WebCore { | 42 namespace WebCore { |
45 | 43 |
46 class StyleSheetCSSRuleList : public CSSRuleList { | 44 class StyleSheetCSSRuleList : public CSSRuleList { |
47 public: | 45 public: |
48 StyleSheetCSSRuleList(CSSStyleSheet* sheet) : m_styleSheet(sheet) { } | 46 StyleSheetCSSRuleList(CSSStyleSheet* sheet) : m_styleSheet(sheet) { } |
49 | 47 |
50 private: | 48 private: |
51 virtual void ref() { m_styleSheet->ref(); } | 49 virtual void ref() { m_styleSheet->ref(); } |
52 virtual void deref() { m_styleSheet->deref(); } | 50 virtual void deref() { m_styleSheet->deref(); } |
53 | 51 |
54 virtual unsigned length() const { return m_styleSheet->length(); } | 52 virtual unsigned length() const { return m_styleSheet->length(); } |
55 virtual CSSRule* item(unsigned index) const { return m_styleSheet->item(inde
x); } | 53 virtual CSSRule* item(unsigned index) const { return m_styleSheet->item(inde
x); } |
56 | 54 |
57 virtual CSSStyleSheet* styleSheet() const { return m_styleSheet; } | 55 virtual CSSStyleSheet* styleSheet() const { return m_styleSheet; } |
58 | 56 |
59 virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const OVE
RRIDE | |
60 { | |
61 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); | |
62 info.addMember(m_styleSheet, "styleSheet"); | |
63 } | |
64 | |
65 CSSStyleSheet* m_styleSheet; | 57 CSSStyleSheet* m_styleSheet; |
66 }; | 58 }; |
67 | 59 |
68 #if !ASSERT_DISABLED | 60 #if !ASSERT_DISABLED |
69 static bool isAcceptableCSSStyleSheetParent(Node* parentNode) | 61 static bool isAcceptableCSSStyleSheetParent(Node* parentNode) |
70 { | 62 { |
71 // Only these nodes can be parents of StyleSheets, and they need to call cle
arOwnerNode() when moved out of document. | 63 // Only these nodes can be parents of StyleSheets, and they need to call cle
arOwnerNode() when moved out of document. |
72 return !parentNode | 64 return !parentNode |
73 || parentNode->isDocumentNode() | 65 || parentNode->isDocumentNode() |
74 || parentNode->hasTagName(HTMLNames::linkTag) | 66 || parentNode->hasTagName(HTMLNames::linkTag) |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 164 |
173 void CSSStyleSheet::reattachChildRuleCSSOMWrappers() | 165 void CSSStyleSheet::reattachChildRuleCSSOMWrappers() |
174 { | 166 { |
175 for (unsigned i = 0; i < m_childRuleCSSOMWrappers.size(); ++i) { | 167 for (unsigned i = 0; i < m_childRuleCSSOMWrappers.size(); ++i) { |
176 if (!m_childRuleCSSOMWrappers[i]) | 168 if (!m_childRuleCSSOMWrappers[i]) |
177 continue; | 169 continue; |
178 m_childRuleCSSOMWrappers[i]->reattach(m_contents->ruleAt(i)); | 170 m_childRuleCSSOMWrappers[i]->reattach(m_contents->ruleAt(i)); |
179 } | 171 } |
180 } | 172 } |
181 | 173 |
182 void CSSStyleSheet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const | |
183 { | |
184 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); | |
185 info.addMember(m_contents, "contents"); | |
186 info.addMember(m_title, "title"); | |
187 info.addMember(m_mediaQueries, "mediaQueries"); | |
188 info.addMember(m_ownerNode, "ownerNode"); | |
189 info.addMember(m_ownerRule, "ownerRule"); | |
190 info.addMember(m_mediaCSSOMWrapper, "mediaCSSOMWrapper"); | |
191 info.addMember(m_childRuleCSSOMWrappers, "childRuleCSSOMWrappers"); | |
192 info.addMember(m_ruleListCSSOMWrapper, "ruleListCSSOMWrapper"); | |
193 } | |
194 | |
195 void CSSStyleSheet::setDisabled(bool disabled) | 174 void CSSStyleSheet::setDisabled(bool disabled) |
196 { | 175 { |
197 if (disabled == m_isDisabled) | 176 if (disabled == m_isDisabled) |
198 return; | 177 return; |
199 m_isDisabled = disabled; | 178 m_isDisabled = disabled; |
200 | 179 |
201 didMutate(); | 180 didMutate(); |
202 } | 181 } |
203 | 182 |
204 void CSSStyleSheet::setMediaQueries(PassRefPtr<MediaQuerySet> mediaQueries) | 183 void CSSStyleSheet::setMediaQueries(PassRefPtr<MediaQuerySet> mediaQueries) |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 root = root->parentStyleSheet(); | 365 root = root->parentStyleSheet(); |
387 return root->ownerNode() ? root->ownerNode()->document() : 0; | 366 return root->ownerNode() ? root->ownerNode()->document() : 0; |
388 } | 367 } |
389 | 368 |
390 void CSSStyleSheet::clearChildRuleCSSOMWrappers() | 369 void CSSStyleSheet::clearChildRuleCSSOMWrappers() |
391 { | 370 { |
392 m_childRuleCSSOMWrappers.clear(); | 371 m_childRuleCSSOMWrappers.clear(); |
393 } | 372 } |
394 | 373 |
395 } | 374 } |
OLD | NEW |