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, 2008, 2009, 2010, 2012 Apple Inc. All rights
reserved. | 3 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 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 23 matching lines...) Expand all Loading... |
34 class CSSRule; | 34 class CSSRule; |
35 class CSSRuleList; | 35 class CSSRuleList; |
36 class CSSStyleSheet; | 36 class CSSStyleSheet; |
37 class CSSStyleSheetResource; | 37 class CSSStyleSheetResource; |
38 class Document; | 38 class Document; |
39 class ExceptionState; | 39 class ExceptionState; |
40 class MediaQuerySet; | 40 class MediaQuerySet; |
41 class SecurityOrigin; | 41 class SecurityOrigin; |
42 class StyleSheetContents; | 42 class StyleSheetContents; |
43 | 43 |
| 44 enum StyleSheetUpdateType { |
| 45 PartialRuleUpdate, |
| 46 EntireStyleSheetUpdate |
| 47 }; |
| 48 |
44 class CSSStyleSheet : public StyleSheet { | 49 class CSSStyleSheet : public StyleSheet { |
45 public: | 50 public: |
46 static PassRefPtr<CSSStyleSheet> create(PassRefPtr<StyleSheetContents>, CSSI
mportRule* ownerRule = 0); | 51 static PassRefPtr<CSSStyleSheet> create(PassRefPtr<StyleSheetContents>, CSSI
mportRule* ownerRule = 0); |
47 static PassRefPtr<CSSStyleSheet> create(PassRefPtr<StyleSheetContents>, Node
* ownerNode); | 52 static PassRefPtr<CSSStyleSheet> create(PassRefPtr<StyleSheetContents>, Node
* ownerNode); |
48 static PassRefPtr<CSSStyleSheet> createInline(Node*, const KURL&, const Text
Position& startPosition = TextPosition::minimumPosition(), const String& encodin
g = String()); | 53 static PassRefPtr<CSSStyleSheet> createInline(Node*, const KURL&, const Text
Position& startPosition = TextPosition::minimumPosition(), const String& encodin
g = String()); |
49 | 54 |
50 virtual ~CSSStyleSheet(); | 55 virtual ~CSSStyleSheet(); |
51 | 56 |
52 virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE; | 57 virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE; |
53 virtual Node* ownerNode() const OVERRIDE { return m_ownerNode; } | 58 virtual Node* ownerNode() const OVERRIDE { return m_ownerNode; } |
(...skipping 10 matching lines...) Expand all Loading... |
64 // IE Extensions | 69 // IE Extensions |
65 PassRefPtr<CSSRuleList> rules(); | 70 PassRefPtr<CSSRuleList> rules(); |
66 int addRule(const String& selector, const String& style, int index, Exceptio
nState&); | 71 int addRule(const String& selector, const String& style, int index, Exceptio
nState&); |
67 int addRule(const String& selector, const String& style, ExceptionState&); | 72 int addRule(const String& selector, const String& style, ExceptionState&); |
68 void removeRule(unsigned index, ExceptionState& es) { deleteRule(index, es);
} | 73 void removeRule(unsigned index, ExceptionState& es) { deleteRule(index, es);
} |
69 | 74 |
70 // For CSSRuleList. | 75 // For CSSRuleList. |
71 unsigned length() const; | 76 unsigned length() const; |
72 CSSRule* item(unsigned index); | 77 CSSRule* item(unsigned index); |
73 | 78 |
74 virtual void clearOwnerNode() OVERRIDE { didMutate(); m_ownerNode = 0; } | 79 virtual void clearOwnerNode() OVERRIDE { didMutate(EntireStyleSheetUpdate);
m_ownerNode = 0; } |
75 virtual CSSRule* ownerRule() const OVERRIDE { return m_ownerRule; } | 80 virtual CSSRule* ownerRule() const OVERRIDE { return m_ownerRule; } |
76 virtual KURL baseURL() const OVERRIDE; | 81 virtual KURL baseURL() const OVERRIDE; |
77 virtual bool isLoading() const OVERRIDE; | 82 virtual bool isLoading() const OVERRIDE; |
78 | 83 |
79 void clearOwnerRule() { m_ownerRule = 0; } | 84 void clearOwnerRule() { m_ownerRule = 0; } |
80 Document* ownerDocument() const; | 85 Document* ownerDocument() const; |
81 MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); } | 86 MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); } |
82 void setMediaQueries(PassRefPtr<MediaQuerySet>); | 87 void setMediaQueries(PassRefPtr<MediaQuerySet>); |
83 void setTitle(const String& title) { m_title = title; } | 88 void setTitle(const String& title) { m_title = title; } |
84 | 89 |
85 class RuleMutationScope { | 90 class RuleMutationScope { |
86 WTF_MAKE_NONCOPYABLE(RuleMutationScope); | 91 WTF_MAKE_NONCOPYABLE(RuleMutationScope); |
87 public: | 92 public: |
88 RuleMutationScope(CSSStyleSheet*); | 93 RuleMutationScope(CSSStyleSheet*); |
89 RuleMutationScope(CSSRule*); | 94 RuleMutationScope(CSSRule*); |
90 ~RuleMutationScope(); | 95 ~RuleMutationScope(); |
91 | 96 |
92 private: | 97 private: |
93 CSSStyleSheet* m_styleSheet; | 98 CSSStyleSheet* m_styleSheet; |
94 }; | 99 }; |
95 | 100 |
96 void willMutateRules(); | 101 void willMutateRules(); |
97 void didMutateRules(); | 102 void didMutateRules(); |
98 void didMutate(); | 103 void didMutate(StyleSheetUpdateType = PartialRuleUpdate); |
99 | 104 |
100 void clearChildRuleCSSOMWrappers(); | 105 void clearChildRuleCSSOMWrappers(); |
101 void reattachChildRuleCSSOMWrappers(); | 106 void reattachChildRuleCSSOMWrappers(); |
102 | 107 |
103 StyleSheetContents* contents() const { return m_contents.get(); } | 108 StyleSheetContents* contents() const { return m_contents.get(); } |
104 | 109 |
105 bool isInline() const { return m_isInlineStylesheet; } | 110 bool isInline() const { return m_isInlineStylesheet; } |
106 TextPosition startPositionInSource() const { return m_startPosition; } | 111 TextPosition startPositionInSource() const { return m_startPosition; } |
107 | 112 |
108 private: | 113 private: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 151 |
147 inline CSSStyleSheet::RuleMutationScope::~RuleMutationScope() | 152 inline CSSStyleSheet::RuleMutationScope::~RuleMutationScope() |
148 { | 153 { |
149 if (m_styleSheet) | 154 if (m_styleSheet) |
150 m_styleSheet->didMutateRules(); | 155 m_styleSheet->didMutateRules(); |
151 } | 156 } |
152 | 157 |
153 } // namespace | 158 } // namespace |
154 | 159 |
155 #endif | 160 #endif |
OLD | NEW |