| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 2  * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 
| 3  * Copyright (C) 2012 Apple Inc. All rights reserved. | 3  * Copyright (C) 2012 Apple Inc. All rights reserved. | 
| 4  * | 4  * | 
| 5  * Redistribution and use in source and binary forms, with or without | 5  * Redistribution and use in source and binary forms, with or without | 
| 6  * modification, are permitted provided that the following conditions | 6  * modification, are permitted provided that the following conditions | 
| 7  * are met: | 7  * are met: | 
| 8  * | 8  * | 
| 9  * 1. Redistributions of source code must retain the above | 9  * 1. Redistributions of source code must retain the above | 
| 10  *    copyright notice, this list of conditions and the following | 10  *    copyright notice, this list of conditions and the following | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
| 25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | 25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | 
| 26  * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF | 26  * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF | 
| 27  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 27  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 
| 28  * SUCH DAMAGE. | 28  * SUCH DAMAGE. | 
| 29  */ | 29  */ | 
| 30 | 30 | 
| 31 #include "config.h" | 31 #include "config.h" | 
| 32 #include "core/css/CSSGroupingRule.h" | 32 #include "core/css/CSSGroupingRule.h" | 
| 33 | 33 | 
| 34 #include "bindings/core/v8/ExceptionState.h" | 34 #include "bindings/core/v8/ExceptionState.h" | 
|  | 35 #include "core/css/parser/BisonCSSParser.h" | 
| 35 #include "core/css/CSSRuleList.h" | 36 #include "core/css/CSSRuleList.h" | 
| 36 #include "core/css/CSSStyleSheet.h" | 37 #include "core/css/CSSStyleSheet.h" | 
| 37 #include "core/css/parser/CSSParser.h" |  | 
| 38 #include "core/dom/ExceptionCode.h" | 38 #include "core/dom/ExceptionCode.h" | 
| 39 #include "core/frame/UseCounter.h" | 39 #include "core/frame/UseCounter.h" | 
| 40 #include "wtf/text/StringBuilder.h" | 40 #include "wtf/text/StringBuilder.h" | 
| 41 | 41 | 
| 42 namespace blink { | 42 namespace blink { | 
| 43 | 43 | 
| 44 CSSGroupingRule::CSSGroupingRule(StyleRuleGroup* groupRule, CSSStyleSheet* paren
     t) | 44 CSSGroupingRule::CSSGroupingRule(StyleRuleGroup* groupRule, CSSStyleSheet* paren
     t) | 
| 45     : CSSRule(parent) | 45     : CSSRule(parent) | 
| 46     , m_groupRule(groupRule) | 46     , m_groupRule(groupRule) | 
| 47     , m_childRuleCSSOMWrappers(groupRule->childRules().size()) | 47     , m_childRuleCSSOMWrappers(groupRule->childRules().size()) | 
| (...skipping 15 matching lines...) Expand all  Loading... | 
| 63 { | 63 { | 
| 64     ASSERT(m_childRuleCSSOMWrappers.size() == m_groupRule->childRules().size()); | 64     ASSERT(m_childRuleCSSOMWrappers.size() == m_groupRule->childRules().size()); | 
| 65 | 65 | 
| 66     if (index > m_groupRule->childRules().size()) { | 66     if (index > m_groupRule->childRules().size()) { | 
| 67         exceptionState.throwDOMException(IndexSizeError, "the index " + String::
     number(index) + " must be less than or equal to the length of the rule list."); | 67         exceptionState.throwDOMException(IndexSizeError, "the index " + String::
     number(index) + " must be less than or equal to the length of the rule list."); | 
| 68         return 0; | 68         return 0; | 
| 69     } | 69     } | 
| 70 | 70 | 
| 71     CSSStyleSheet* styleSheet = parentStyleSheet(); | 71     CSSStyleSheet* styleSheet = parentStyleSheet(); | 
| 72     CSSParserContext context(parserContext(), UseCounter::getFrom(styleSheet)); | 72     CSSParserContext context(parserContext(), UseCounter::getFrom(styleSheet)); | 
| 73     RefPtrWillBeRawPtr<StyleRuleBase> newRule = CSSParser::parseRule(context, st
     yleSheet ? styleSheet->contents() : 0, ruleString); | 73     BisonCSSParser parser(context); | 
|  | 74     RefPtrWillBeRawPtr<StyleRuleBase> newRule = parser.parseRule(styleSheet ? st
     yleSheet->contents() : 0, ruleString); | 
| 74     if (!newRule) { | 75     if (!newRule) { | 
| 75         exceptionState.throwDOMException(SyntaxError, "the rule '" + ruleString 
     + "' is invalid and cannot be parsed."); | 76         exceptionState.throwDOMException(SyntaxError, "the rule '" + ruleString 
     + "' is invalid and cannot be parsed."); | 
| 76         return 0; | 77         return 0; | 
| 77     } | 78     } | 
| 78 | 79 | 
| 79     if (newRule->isImportRule()) { | 80     if (newRule->isImportRule()) { | 
| 80         // FIXME: an HierarchyRequestError should also be thrown for a @charset 
     or a nested | 81         // FIXME: an HierarchyRequestError should also be thrown for a @charset 
     or a nested | 
| 81         // @media rule. They are currently not getting parsed, resulting in a Sy
     ntaxError | 82         // @media rule. They are currently not getting parsed, resulting in a Sy
     ntaxError | 
| 82         // to get raised above. | 83         // to get raised above. | 
| 83         exceptionState.throwDOMException(HierarchyRequestError, "'@import' rules
      cannot be inserted inside a group rule."); | 84         exceptionState.throwDOMException(HierarchyRequestError, "'@import' rules
      cannot be inserted inside a group rule."); | 
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 156 { | 157 { | 
| 157     CSSRule::trace(visitor); | 158     CSSRule::trace(visitor); | 
| 158 #if ENABLE(OILPAN) | 159 #if ENABLE(OILPAN) | 
| 159     visitor->trace(m_childRuleCSSOMWrappers); | 160     visitor->trace(m_childRuleCSSOMWrappers); | 
| 160 #endif | 161 #endif | 
| 161     visitor->trace(m_groupRule); | 162     visitor->trace(m_groupRule); | 
| 162     visitor->trace(m_ruleListCSSOMWrapper); | 163     visitor->trace(m_ruleListCSSOMWrapper); | 
| 163 } | 164 } | 
| 164 | 165 | 
| 165 } // namespace blink | 166 } // namespace blink | 
| OLD | NEW | 
|---|