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 18 matching lines...) Expand all Loading... |
29 #include "core/css/CSSImportRule.h" | 29 #include "core/css/CSSImportRule.h" |
30 #include "core/css/parser/BisonCSSParser.h" | 30 #include "core/css/parser/BisonCSSParser.h" |
31 #include "core/css/CSSRuleList.h" | 31 #include "core/css/CSSRuleList.h" |
32 #include "core/css/MediaList.h" | 32 #include "core/css/MediaList.h" |
33 #include "core/css/StyleRule.h" | 33 #include "core/css/StyleRule.h" |
34 #include "core/css/StyleSheetContents.h" | 34 #include "core/css/StyleSheetContents.h" |
35 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
36 #include "core/dom/ExceptionCode.h" | 36 #include "core/dom/ExceptionCode.h" |
37 #include "core/dom/Node.h" | 37 #include "core/dom/Node.h" |
38 #include "core/frame/UseCounter.h" | 38 #include "core/frame/UseCounter.h" |
| 39 #include "core/html/HTMLStyleElement.h" |
39 #include "core/inspector/InspectorInstrumentation.h" | 40 #include "core/inspector/InspectorInstrumentation.h" |
| 41 #include "core/svg/SVGStyleElement.h" |
40 #include "platform/weborigin/SecurityOrigin.h" | 42 #include "platform/weborigin/SecurityOrigin.h" |
41 #include "wtf/text/StringBuilder.h" | 43 #include "wtf/text/StringBuilder.h" |
42 | 44 |
43 namespace WebCore { | 45 namespace WebCore { |
44 | 46 |
45 class StyleSheetCSSRuleList FINAL : public CSSRuleList { | 47 class StyleSheetCSSRuleList FINAL : public CSSRuleList { |
46 public: | 48 public: |
47 StyleSheetCSSRuleList(CSSStyleSheet* sheet) : m_styleSheet(sheet) { } | 49 StyleSheetCSSRuleList(CSSStyleSheet* sheet) : m_styleSheet(sheet) { } |
48 | 50 |
49 private: | 51 private: |
50 virtual void ref() OVERRIDE { m_styleSheet->ref(); } | 52 virtual void ref() OVERRIDE { m_styleSheet->ref(); } |
51 virtual void deref() OVERRIDE { m_styleSheet->deref(); } | 53 virtual void deref() OVERRIDE { m_styleSheet->deref(); } |
52 | 54 |
53 virtual unsigned length() const OVERRIDE { return m_styleSheet->length(); } | 55 virtual unsigned length() const OVERRIDE { return m_styleSheet->length(); } |
54 virtual CSSRule* item(unsigned index) const OVERRIDE { return m_styleSheet->
item(index); } | 56 virtual CSSRule* item(unsigned index) const OVERRIDE { return m_styleSheet->
item(index); } |
55 | 57 |
56 virtual CSSStyleSheet* styleSheet() const OVERRIDE { return m_styleSheet; } | 58 virtual CSSStyleSheet* styleSheet() const OVERRIDE { return m_styleSheet; } |
57 | 59 |
58 CSSStyleSheet* m_styleSheet; | 60 CSSStyleSheet* m_styleSheet; |
59 }; | 61 }; |
60 | 62 |
61 #if !ASSERT_DISABLED | 63 #if !ASSERT_DISABLED |
62 static bool isAcceptableCSSStyleSheetParent(Node* parentNode) | 64 static bool isAcceptableCSSStyleSheetParent(Node* parentNode) |
63 { | 65 { |
64 // Only these nodes can be parents of StyleSheets, and they need to call cle
arOwnerNode() when moved out of document. | 66 // Only these nodes can be parents of StyleSheets, and they need to call cle
arOwnerNode() when moved out of document. |
65 return !parentNode | 67 return !parentNode |
66 || parentNode->isDocumentNode() | 68 || parentNode->isDocumentNode() |
67 || parentNode->hasTagName(HTMLNames::linkTag) | 69 || isHTMLLinkElement(*parentNode) |
68 || parentNode->hasTagName(HTMLNames::styleTag) | 70 || isHTMLStyleElement(*parentNode) |
69 || parentNode->hasTagName(SVGNames::styleTag) | 71 || isSVGStyleElement(*parentNode) |
70 || parentNode->nodeType() == Node::PROCESSING_INSTRUCTION_NODE; | 72 || parentNode->nodeType() == Node::PROCESSING_INSTRUCTION_NODE; |
71 } | 73 } |
72 #endif | 74 #endif |
73 | 75 |
74 PassRefPtrWillBeRawPtr<CSSStyleSheet> CSSStyleSheet::create(PassRefPtrWillBeRawP
tr<StyleSheetContents> sheet, CSSImportRule* ownerRule) | 76 PassRefPtrWillBeRawPtr<CSSStyleSheet> CSSStyleSheet::create(PassRefPtrWillBeRawP
tr<StyleSheetContents> sheet, CSSImportRule* ownerRule) |
75 { | 77 { |
76 return adoptRefWillBeRefCountedGarbageCollected(new CSSStyleSheet(sheet, own
erRule)); | 78 return adoptRefWillBeRefCountedGarbageCollected(new CSSStyleSheet(sheet, own
erRule)); |
77 } | 79 } |
78 | 80 |
79 PassRefPtrWillBeRawPtr<CSSStyleSheet> CSSStyleSheet::create(PassRefPtrWillBeRawP
tr<StyleSheetContents> sheet, Node* ownerNode) | 81 PassRefPtrWillBeRawPtr<CSSStyleSheet> CSSStyleSheet::create(PassRefPtrWillBeRawP
tr<StyleSheetContents> sheet, Node* ownerNode) |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 void CSSStyleSheet::trace(Visitor* visitor) | 417 void CSSStyleSheet::trace(Visitor* visitor) |
416 { | 418 { |
417 visitor->trace(m_contents); | 419 visitor->trace(m_contents); |
418 visitor->trace(m_mediaQueries); | 420 visitor->trace(m_mediaQueries); |
419 visitor->trace(m_ownerRule); | 421 visitor->trace(m_ownerRule); |
420 visitor->trace(m_mediaCSSOMWrapper); | 422 visitor->trace(m_mediaCSSOMWrapper); |
421 visitor->trace(m_childRuleCSSOMWrappers); | 423 visitor->trace(m_childRuleCSSOMWrappers); |
422 } | 424 } |
423 | 425 |
424 } | 426 } |
OLD | NEW |