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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 for (unsigned i = 0; i < m_importRules.size(); ++i) { | 53 for (unsigned i = 0; i < m_importRules.size(); ++i) { |
54 if (StyleSheetContents* sheet = m_importRules[i]->styleSheet()) | 54 if (StyleSheetContents* sheet = m_importRules[i]->styleSheet()) |
55 size += sheet->estimatedSizeInBytes(); | 55 size += sheet->estimatedSizeInBytes(); |
56 } | 56 } |
57 return size; | 57 return size; |
58 } | 58 } |
59 | 59 |
60 StyleSheetContents::StyleSheetContents(StyleRuleImport* ownerRule, const String&
originalURL, const CSSParserContext& context) | 60 StyleSheetContents::StyleSheetContents(StyleRuleImport* ownerRule, const String&
originalURL, const CSSParserContext& context) |
61 : m_ownerRule(ownerRule) | 61 : m_ownerRule(ownerRule) |
62 , m_originalURL(originalURL) | 62 , m_originalURL(originalURL) |
| 63 , m_defaultNamespace(starAtom) |
63 , m_hasSyntacticallyValidCSSHeader(true) | 64 , m_hasSyntacticallyValidCSSHeader(true) |
64 , m_didLoadErrorOccur(false) | 65 , m_didLoadErrorOccur(false) |
65 , m_isMutable(false) | 66 , m_isMutable(false) |
66 , m_isInMemoryCache(false) | 67 , m_isInMemoryCache(false) |
67 , m_hasFontFaceRule(false) | 68 , m_hasFontFaceRule(false) |
68 , m_hasMediaQueries(false) | 69 , m_hasMediaQueries(false) |
69 , m_hasSingleOwnerDocument(true) | 70 , m_hasSingleOwnerDocument(true) |
70 , m_parserContext(context) | 71 , m_parserContext(context) |
71 { | 72 { |
72 } | 73 } |
73 | 74 |
74 StyleSheetContents::StyleSheetContents(const StyleSheetContents& o) | 75 StyleSheetContents::StyleSheetContents(const StyleSheetContents& o) |
75 : m_ownerRule(nullptr) | 76 : m_ownerRule(nullptr) |
76 , m_originalURL(o.m_originalURL) | 77 , m_originalURL(o.m_originalURL) |
77 , m_importRules(o.m_importRules.size()) | 78 , m_importRules(o.m_importRules.size()) |
78 , m_childRules(o.m_childRules.size()) | 79 , m_childRules(o.m_childRules.size()) |
79 , m_namespaces(o.m_namespaces) | 80 , m_namespaces(o.m_namespaces) |
| 81 , m_defaultNamespace(o.m_defaultNamespace) |
80 , m_hasSyntacticallyValidCSSHeader(o.m_hasSyntacticallyValidCSSHeader) | 82 , m_hasSyntacticallyValidCSSHeader(o.m_hasSyntacticallyValidCSSHeader) |
81 , m_didLoadErrorOccur(false) | 83 , m_didLoadErrorOccur(false) |
82 , m_isMutable(false) | 84 , m_isMutable(false) |
83 , m_isInMemoryCache(false) | 85 , m_isInMemoryCache(false) |
84 , m_hasFontFaceRule(o.m_hasFontFaceRule) | 86 , m_hasFontFaceRule(o.m_hasFontFaceRule) |
85 , m_hasMediaQueries(o.m_hasMediaQueries) | 87 , m_hasMediaQueries(o.m_hasMediaQueries) |
86 , m_hasSingleOwnerDocument(true) | 88 , m_hasSingleOwnerDocument(true) |
87 , m_parserContext(o.m_parserContext) | 89 , m_parserContext(o.m_parserContext) |
88 { | 90 { |
89 ASSERT(o.isCacheable()); | 91 ASSERT(o.isCacheable()); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 } | 253 } |
252 index -= m_importRules.size(); | 254 index -= m_importRules.size(); |
253 | 255 |
254 if (m_childRules[index]->isFontFaceRule()) | 256 if (m_childRules[index]->isFontFaceRule()) |
255 notifyRemoveFontFaceRule(toStyleRuleFontFace(m_childRules[index].get()))
; | 257 notifyRemoveFontFaceRule(toStyleRuleFontFace(m_childRules[index].get()))
; |
256 m_childRules.remove(index); | 258 m_childRules.remove(index); |
257 } | 259 } |
258 | 260 |
259 void StyleSheetContents::parserAddNamespace(const AtomicString& prefix, const At
omicString& uri) | 261 void StyleSheetContents::parserAddNamespace(const AtomicString& prefix, const At
omicString& uri) |
260 { | 262 { |
261 if (uri.isNull() || prefix.isNull()) | 263 ASSERT(!uri.isNull()); |
| 264 if (prefix.isNull()) { |
| 265 m_defaultNamespace = uri; |
262 return; | 266 return; |
| 267 } |
263 PrefixNamespaceURIMap::AddResult result = m_namespaces.add(prefix, uri); | 268 PrefixNamespaceURIMap::AddResult result = m_namespaces.add(prefix, uri); |
264 if (result.isNewEntry) | 269 if (result.isNewEntry) |
265 return; | 270 return; |
266 result.storedValue->value = uri; | 271 result.storedValue->value = uri; |
267 } | 272 } |
268 | 273 |
269 const AtomicString& StyleSheetContents::determineNamespace(const AtomicString& p
refix) | 274 const AtomicString& StyleSheetContents::determineNamespace(const AtomicString& p
refix) |
270 { | 275 { |
271 if (prefix.isNull()) | 276 if (prefix.isNull()) |
272 return nullAtom; // No namespace. If an element/attribute has a namespac
e, we won't match it. | 277 return nullAtom; // No namespace. If an element/attribute has a namespac
e, we won't match it. |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 visitor->trace(m_ownerRule); | 630 visitor->trace(m_ownerRule); |
626 visitor->trace(m_importRules); | 631 visitor->trace(m_importRules); |
627 visitor->trace(m_childRules); | 632 visitor->trace(m_childRules); |
628 visitor->trace(m_loadingClients); | 633 visitor->trace(m_loadingClients); |
629 visitor->trace(m_completedClients); | 634 visitor->trace(m_completedClients); |
630 visitor->trace(m_ruleSet); | 635 visitor->trace(m_ruleSet); |
631 #endif | 636 #endif |
632 } | 637 } |
633 | 638 |
634 } | 639 } |
OLD | NEW |