Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: third_party/WebKit/Source/core/css/CSSGroupingRule.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 { 62 {
63 ASSERT(m_childRuleCSSOMWrappers.size() == m_groupRule->childRules().size()); 63 ASSERT(m_childRuleCSSOMWrappers.size() == m_groupRule->childRules().size());
64 64
65 if (index > m_groupRule->childRules().size()) { 65 if (index > m_groupRule->childRules().size()) {
66 exceptionState.throwDOMException(IndexSizeError, "the index " + String:: number(index) + " must be less than or equal to the length of the rule list."); 66 exceptionState.throwDOMException(IndexSizeError, "the index " + String:: number(index) + " must be less than or equal to the length of the rule list.");
67 return 0; 67 return 0;
68 } 68 }
69 69
70 CSSStyleSheet* styleSheet = parentStyleSheet(); 70 CSSStyleSheet* styleSheet = parentStyleSheet();
71 CSSParserContext context(parserContext(), UseCounter::getFrom(styleSheet)); 71 CSSParserContext context(parserContext(), UseCounter::getFrom(styleSheet));
72 RefPtrWillBeRawPtr<StyleRuleBase> newRule = CSSParser::parseRule(context, st yleSheet ? styleSheet->contents() : nullptr, ruleString); 72 RawPtr<StyleRuleBase> newRule = CSSParser::parseRule(context, styleSheet ? s tyleSheet->contents() : nullptr, ruleString);
73 if (!newRule) { 73 if (!newRule) {
74 exceptionState.throwDOMException(SyntaxError, "the rule '" + ruleString + "' is invalid and cannot be parsed."); 74 exceptionState.throwDOMException(SyntaxError, "the rule '" + ruleString + "' is invalid and cannot be parsed.");
75 return 0; 75 return 0;
76 } 76 }
77 77
78 if (newRule->isNamespaceRule()) { 78 if (newRule->isNamespaceRule()) {
79 exceptionState.throwDOMException(HierarchyRequestError, "'@namespace' ru les cannot be inserted inside a group rule."); 79 exceptionState.throwDOMException(HierarchyRequestError, "'@namespace' ru les cannot be inserted inside a group rule.");
80 return 0; 80 return 0;
81 } 81 }
82 82
83 if (newRule->isImportRule()) { 83 if (newRule->isImportRule()) {
84 // FIXME: an HierarchyRequestError should also be thrown for a nested @m edia rule. They are 84 // FIXME: an HierarchyRequestError should also be thrown for a nested @m edia rule. They are
85 // currently not getting parsed, resulting in a SyntaxError to get raise d above. 85 // currently not getting parsed, resulting in a SyntaxError to get raise d above.
86 exceptionState.throwDOMException(HierarchyRequestError, "'@import' rules cannot be inserted inside a group rule."); 86 exceptionState.throwDOMException(HierarchyRequestError, "'@import' rules cannot be inserted inside a group rule.");
87 return 0; 87 return 0;
88 } 88 }
89 CSSStyleSheet::RuleMutationScope mutationScope(this); 89 CSSStyleSheet::RuleMutationScope mutationScope(this);
90 90
91 m_groupRule->wrapperInsertRule(index, newRule); 91 m_groupRule->wrapperInsertRule(index, newRule);
92 92
93 m_childRuleCSSOMWrappers.insert(index, RefPtrWillBeMember<CSSRule>(nullptr)) ; 93 m_childRuleCSSOMWrappers.insert(index, Member<CSSRule>(nullptr));
94 return index; 94 return index;
95 } 95 }
96 96
97 void CSSGroupingRule::deleteRule(unsigned index, ExceptionState& exceptionState) 97 void CSSGroupingRule::deleteRule(unsigned index, ExceptionState& exceptionState)
98 { 98 {
99 ASSERT(m_childRuleCSSOMWrappers.size() == m_groupRule->childRules().size()); 99 ASSERT(m_childRuleCSSOMWrappers.size() == m_groupRule->childRules().size());
100 100
101 if (index >= m_groupRule->childRules().size()) { 101 if (index >= m_groupRule->childRules().size()) {
102 exceptionState.throwDOMException(IndexSizeError, "the index " + String:: number(index) + " is greated than the length of the rule list."); 102 exceptionState.throwDOMException(IndexSizeError, "the index " + String:: number(index) + " is greated than the length of the rule list.");
103 return; 103 return;
(...skipping 21 matching lines...) Expand all
125 unsigned CSSGroupingRule::length() const 125 unsigned CSSGroupingRule::length() const
126 { 126 {
127 return m_groupRule->childRules().size(); 127 return m_groupRule->childRules().size();
128 } 128 }
129 129
130 CSSRule* CSSGroupingRule::item(unsigned index) const 130 CSSRule* CSSGroupingRule::item(unsigned index) const
131 { 131 {
132 if (index >= length()) 132 if (index >= length())
133 return nullptr; 133 return nullptr;
134 ASSERT(m_childRuleCSSOMWrappers.size() == m_groupRule->childRules().size()); 134 ASSERT(m_childRuleCSSOMWrappers.size() == m_groupRule->childRules().size());
135 RefPtrWillBeMember<CSSRule>& rule = m_childRuleCSSOMWrappers[index]; 135 Member<CSSRule>& rule = m_childRuleCSSOMWrappers[index];
136 if (!rule) 136 if (!rule)
137 rule = m_groupRule->childRules()[index]->createCSSOMWrapper(const_cast<C SSGroupingRule*>(this)); 137 rule = m_groupRule->childRules()[index]->createCSSOMWrapper(const_cast<C SSGroupingRule*>(this));
138 return rule.get(); 138 return rule.get();
139 } 139 }
140 140
141 CSSRuleList* CSSGroupingRule::cssRules() const 141 CSSRuleList* CSSGroupingRule::cssRules() const
142 { 142 {
143 if (!m_ruleListCSSOMWrapper) 143 if (!m_ruleListCSSOMWrapper)
144 m_ruleListCSSOMWrapper = LiveCSSRuleList<CSSGroupingRule>::create(const_ cast<CSSGroupingRule*>(this)); 144 m_ruleListCSSOMWrapper = LiveCSSRuleList<CSSGroupingRule>::create(const_ cast<CSSGroupingRule*>(this));
145 return m_ruleListCSSOMWrapper.get(); 145 return m_ruleListCSSOMWrapper.get();
(...skipping 13 matching lines...) Expand all
159 { 159 {
160 CSSRule::trace(visitor); 160 CSSRule::trace(visitor);
161 #if ENABLE(OILPAN) 161 #if ENABLE(OILPAN)
162 visitor->trace(m_childRuleCSSOMWrappers); 162 visitor->trace(m_childRuleCSSOMWrappers);
163 #endif 163 #endif
164 visitor->trace(m_groupRule); 164 visitor->trace(m_groupRule);
165 visitor->trace(m_ruleListCSSOMWrapper); 165 visitor->trace(m_ruleListCSSOMWrapper);
166 } 166 }
167 167
168 } // namespace blink 168 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698