| 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 10 matching lines...) Expand all Loading... |
| 21 #include "config.h" | 21 #include "config.h" |
| 22 #include "core/css/CSSStyleSheet.h" | 22 #include "core/css/CSSStyleSheet.h" |
| 23 | 23 |
| 24 #include "bindings/core/v8/ExceptionState.h" | 24 #include "bindings/core/v8/ExceptionState.h" |
| 25 #include "bindings/core/v8/V8Binding.h" | 25 #include "bindings/core/v8/V8Binding.h" |
| 26 #include "bindings/core/v8/V8PerIsolateData.h" | 26 #include "bindings/core/v8/V8PerIsolateData.h" |
| 27 #include "core/HTMLNames.h" | 27 #include "core/HTMLNames.h" |
| 28 #include "core/SVGNames.h" | 28 #include "core/SVGNames.h" |
| 29 #include "core/css/CSSCharsetRule.h" | 29 #include "core/css/CSSCharsetRule.h" |
| 30 #include "core/css/CSSImportRule.h" | 30 #include "core/css/CSSImportRule.h" |
| 31 #include "core/css/parser/BisonCSSParser.h" | |
| 32 #include "core/css/CSSRuleList.h" | 31 #include "core/css/CSSRuleList.h" |
| 33 #include "core/css/MediaList.h" | 32 #include "core/css/MediaList.h" |
| 34 #include "core/css/StyleRule.h" | 33 #include "core/css/StyleRule.h" |
| 35 #include "core/css/StyleSheetContents.h" | 34 #include "core/css/StyleSheetContents.h" |
| 35 #include "core/css/parser/CSSParser.h" |
| 36 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
| 37 #include "core/dom/ExceptionCode.h" | 37 #include "core/dom/ExceptionCode.h" |
| 38 #include "core/dom/Node.h" | 38 #include "core/dom/Node.h" |
| 39 #include "core/frame/UseCounter.h" | 39 #include "core/frame/UseCounter.h" |
| 40 #include "core/html/HTMLStyleElement.h" | 40 #include "core/html/HTMLStyleElement.h" |
| 41 #include "core/inspector/InspectorInstrumentation.h" | 41 #include "core/inspector/InspectorInstrumentation.h" |
| 42 #include "core/svg/SVGStyleElement.h" | 42 #include "core/svg/SVGStyleElement.h" |
| 43 #include "platform/weborigin/SecurityOrigin.h" | 43 #include "platform/weborigin/SecurityOrigin.h" |
| 44 #include "wtf/text/StringBuilder.h" | 44 #include "wtf/text/StringBuilder.h" |
| 45 | 45 |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 | 303 |
| 304 unsigned CSSStyleSheet::insertRule(const String& ruleString, unsigned index, Exc
eptionState& exceptionState) | 304 unsigned CSSStyleSheet::insertRule(const String& ruleString, unsigned index, Exc
eptionState& exceptionState) |
| 305 { | 305 { |
| 306 ASSERT(m_childRuleCSSOMWrappers.isEmpty() || m_childRuleCSSOMWrappers.size()
== m_contents->ruleCount()); | 306 ASSERT(m_childRuleCSSOMWrappers.isEmpty() || m_childRuleCSSOMWrappers.size()
== m_contents->ruleCount()); |
| 307 | 307 |
| 308 if (index > length()) { | 308 if (index > length()) { |
| 309 exceptionState.throwDOMException(IndexSizeError, "The index provided ("
+ String::number(index) + ") is larger than the maximum index (" + String::numbe
r(length()) + ")."); | 309 exceptionState.throwDOMException(IndexSizeError, "The index provided ("
+ String::number(index) + ") is larger than the maximum index (" + String::numbe
r(length()) + ")."); |
| 310 return 0; | 310 return 0; |
| 311 } | 311 } |
| 312 CSSParserContext context(m_contents->parserContext(), UseCounter::getFrom(th
is)); | 312 CSSParserContext context(m_contents->parserContext(), UseCounter::getFrom(th
is)); |
| 313 BisonCSSParser p(context); | 313 RefPtrWillBeRawPtr<StyleRuleBase> rule = CSSParser::parseRule(context, m_con
tents.get(), ruleString); |
| 314 RefPtrWillBeRawPtr<StyleRuleBase> rule = p.parseRule(m_contents.get(), ruleS
tring); | |
| 315 | 314 |
| 316 if (!rule) { | 315 if (!rule) { |
| 317 exceptionState.throwDOMException(SyntaxError, "Failed to parse the rule
'" + ruleString + "'."); | 316 exceptionState.throwDOMException(SyntaxError, "Failed to parse the rule
'" + ruleString + "'."); |
| 318 return 0; | 317 return 0; |
| 319 } | 318 } |
| 320 RuleMutationScope mutationScope(this); | 319 RuleMutationScope mutationScope(this); |
| 321 | 320 |
| 322 bool success = m_contents->wrapperInsertRule(rule, index); | 321 bool success = m_contents->wrapperInsertRule(rule, index); |
| 323 if (!success) { | 322 if (!success) { |
| 324 exceptionState.throwDOMException(HierarchyRequestError, "Failed to inser
t the rule."); | 323 exceptionState.throwDOMException(HierarchyRequestError, "Failed to inser
t the rule."); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 visitor->trace(m_mediaQueries); | 459 visitor->trace(m_mediaQueries); |
| 461 visitor->trace(m_ownerNode); | 460 visitor->trace(m_ownerNode); |
| 462 visitor->trace(m_ownerRule); | 461 visitor->trace(m_ownerRule); |
| 463 visitor->trace(m_mediaCSSOMWrapper); | 462 visitor->trace(m_mediaCSSOMWrapper); |
| 464 visitor->trace(m_childRuleCSSOMWrappers); | 463 visitor->trace(m_childRuleCSSOMWrappers); |
| 465 visitor->trace(m_ruleListCSSOMWrapper); | 464 visitor->trace(m_ruleListCSSOMWrapper); |
| 466 StyleSheet::trace(visitor); | 465 StyleSheet::trace(visitor); |
| 467 } | 466 } |
| 468 | 467 |
| 469 } // namespace blink | 468 } // namespace blink |
| OLD | NEW |