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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 } | 282 } |
283 | 283 |
284 unsigned CSSStyleSheet::insertRule(const String& ruleString, unsigned index, Exc
eptionState& exceptionState) | 284 unsigned CSSStyleSheet::insertRule(const String& ruleString, unsigned index, Exc
eptionState& exceptionState) |
285 { | 285 { |
286 ASSERT(m_childRuleCSSOMWrappers.isEmpty() || m_childRuleCSSOMWrappers.size()
== m_contents->ruleCount()); | 286 ASSERT(m_childRuleCSSOMWrappers.isEmpty() || m_childRuleCSSOMWrappers.size()
== m_contents->ruleCount()); |
287 | 287 |
288 if (index > length()) { | 288 if (index > length()) { |
289 exceptionState.throwDOMException(IndexSizeError, "The index provided ("
+ String::number(index) + ") is larger than the maximum index (" + String::numbe
r(length()) + ")."); | 289 exceptionState.throwDOMException(IndexSizeError, "The index provided ("
+ String::number(index) + ") is larger than the maximum index (" + String::numbe
r(length()) + ")."); |
290 return 0; | 290 return 0; |
291 } | 291 } |
292 CSSParserContext context(m_contents->parserContext(), UseCounter::getFrom(th
is)); | 292 Document* ownerDoc = ownerDocument(); |
| 293 CSSParserContext context(m_contents->parserContext(), ownerDoc ? ownerDoc->f
rame() : 0, UseCounter::getFrom(this)); |
293 RefPtrWillBeRawPtr<StyleRuleBase> rule = CSSParser::parseRule(context, m_con
tents.get(), ruleString); | 294 RefPtrWillBeRawPtr<StyleRuleBase> rule = CSSParser::parseRule(context, m_con
tents.get(), ruleString); |
294 | 295 |
295 // FIXME: @namespace rules have special handling in the CSSOM spec, but it | 296 // FIXME: @namespace rules have special handling in the CSSOM spec, but it |
296 // mostly doesn't make sense since we don't support CSSNamespaceRule | 297 // mostly doesn't make sense since we don't support CSSNamespaceRule |
297 if (!rule || rule->isNamespaceRule()) { | 298 if (!rule || rule->isNamespaceRule()) { |
298 exceptionState.throwDOMException(SyntaxError, "Failed to parse the rule
'" + ruleString + "'."); | 299 exceptionState.throwDOMException(SyntaxError, "Failed to parse the rule
'" + ruleString + "'."); |
299 return 0; | 300 return 0; |
300 } | 301 } |
301 RuleMutationScope mutationScope(this); | 302 RuleMutationScope mutationScope(this); |
302 | 303 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 visitor->trace(m_mediaQueries); | 447 visitor->trace(m_mediaQueries); |
447 visitor->trace(m_ownerNode); | 448 visitor->trace(m_ownerNode); |
448 visitor->trace(m_ownerRule); | 449 visitor->trace(m_ownerRule); |
449 visitor->trace(m_mediaCSSOMWrapper); | 450 visitor->trace(m_mediaCSSOMWrapper); |
450 visitor->trace(m_childRuleCSSOMWrappers); | 451 visitor->trace(m_childRuleCSSOMWrappers); |
451 visitor->trace(m_ruleListCSSOMWrapper); | 452 visitor->trace(m_ruleListCSSOMWrapper); |
452 StyleSheet::trace(visitor); | 453 StyleSheet::trace(visitor); |
453 } | 454 } |
454 | 455 |
455 } // namespace blink | 456 } // namespace blink |
OLD | NEW |