OLD | NEW |
1 /** | 1 /** |
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) | 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) |
4 * Copyright (C) 2002, 2005, 2006 Apple Computer, Inc. | 4 * Copyright (C) 2002, 2005, 2006 Apple Computer, Inc. |
5 * Copyright (C) 2006 Samuel Weinig (sam@webkit.org) | 5 * Copyright (C) 2006 Samuel Weinig (sam@webkit.org) |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at the s
pecified | 81 // HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at the s
pecified |
82 // index, e.g., if an @import rule is inserted after a standard rule set
or other | 82 // index, e.g., if an @import rule is inserted after a standard rule set
or other |
83 // at-rule. | 83 // at-rule. |
84 ec = HIERARCHY_REQUEST_ERR; | 84 ec = HIERARCHY_REQUEST_ERR; |
85 return 0; | 85 return 0; |
86 } | 86 } |
87 | 87 |
88 newRule->setParent(this); | 88 newRule->setParent(this); |
89 unsigned returnedIndex = m_lstCSSRules->insertRule(newRule.get(), index); | 89 unsigned returnedIndex = m_lstCSSRules->insertRule(newRule.get(), index); |
90 | 90 |
91 // stylesheet() can only return 0 for computed style declarations. | 91 if (stylesheet()) |
92 stylesheet()->styleSheetChanged(); | 92 stylesheet()->styleSheetChanged(); |
93 | 93 |
94 return returnedIndex; | 94 return returnedIndex; |
95 } | 95 } |
96 | 96 |
97 void CSSMediaRule::deleteRule(unsigned index, ExceptionCode& ec) | 97 void CSSMediaRule::deleteRule(unsigned index, ExceptionCode& ec) |
98 { | 98 { |
99 if (index >= m_lstCSSRules->length()) { | 99 if (index >= m_lstCSSRules->length()) { |
100 // INDEX_SIZE_ERR: Raised if the specified index does not correspond to
a | 100 // INDEX_SIZE_ERR: Raised if the specified index does not correspond to
a |
101 // rule in the media rule list. | 101 // rule in the media rule list. |
102 ec = INDEX_SIZE_ERR; | 102 ec = INDEX_SIZE_ERR; |
103 return; | 103 return; |
104 } | 104 } |
105 | 105 |
106 m_lstCSSRules->deleteRule(index); | 106 m_lstCSSRules->deleteRule(index); |
107 | 107 |
108 // stylesheet() can only return 0 for computed style declarations. | 108 if (stylesheet()) |
109 stylesheet()->styleSheetChanged(); | 109 stylesheet()->styleSheetChanged(); |
110 } | 110 } |
111 | 111 |
112 String CSSMediaRule::cssText() const | 112 String CSSMediaRule::cssText() const |
113 { | 113 { |
114 String result = "@media "; | 114 String result = "@media "; |
115 if (m_lstMedia) { | 115 if (m_lstMedia) { |
116 result += m_lstMedia->mediaText(); | 116 result += m_lstMedia->mediaText(); |
117 result += " "; | 117 result += " "; |
118 } | 118 } |
119 result += "{ \n"; | 119 result += "{ \n"; |
120 | 120 |
121 if (m_lstCSSRules) { | 121 if (m_lstCSSRules) { |
122 unsigned len = m_lstCSSRules->length(); | 122 unsigned len = m_lstCSSRules->length(); |
123 for (unsigned i = 0; i < len; i++) { | 123 for (unsigned i = 0; i < len; i++) { |
124 result += " "; | 124 result += " "; |
125 result += m_lstCSSRules->item(i)->cssText(); | 125 result += m_lstCSSRules->item(i)->cssText(); |
126 result += "\n"; | 126 result += "\n"; |
127 } | 127 } |
128 } | 128 } |
129 | 129 |
130 result += "}"; | 130 result += "}"; |
131 return result; | 131 return result; |
132 } | 132 } |
133 | 133 |
134 } // namespace WebCore | 134 } // namespace WebCore |
OLD | NEW |