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

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

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 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 * (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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 } 267 }
268 268
269 unsigned CSSStyleSheet::insertRule(const String& ruleString, 269 unsigned CSSStyleSheet::insertRule(const String& ruleString,
270 unsigned index, 270 unsigned index,
271 ExceptionState& exceptionState) { 271 ExceptionState& exceptionState) {
272 DCHECK(m_childRuleCSSOMWrappers.isEmpty() || 272 DCHECK(m_childRuleCSSOMWrappers.isEmpty() ||
273 m_childRuleCSSOMWrappers.size() == m_contents->ruleCount()); 273 m_childRuleCSSOMWrappers.size() == m_contents->ruleCount());
274 274
275 if (index > length()) { 275 if (index > length()) {
276 exceptionState.throwDOMException( 276 exceptionState.throwDOMException(
277 IndexSizeError, "The index provided (" + String::number(index) + 277 IndexSizeError,
278 ") is larger than the maximum index (" + 278 "The index provided (" + String::number(index) +
279 String::number(length()) + ")."); 279 ") is larger than the maximum index (" + String::number(length()) +
280 ").");
280 return 0; 281 return 0;
281 } 282 }
282 const CSSParserContext* context = 283 const CSSParserContext* context =
283 CSSParserContext::createWithStyleSheet(m_contents->parserContext(), this); 284 CSSParserContext::createWithStyleSheet(m_contents->parserContext(), this);
284 StyleRuleBase* rule = 285 StyleRuleBase* rule =
285 CSSParser::parseRule(context, m_contents.get(), ruleString); 286 CSSParser::parseRule(context, m_contents.get(), ruleString);
286 287
287 if (!rule) { 288 if (!rule) {
288 exceptionState.throwDOMException( 289 exceptionState.throwDOMException(
289 SyntaxError, "Failed to parse the rule '" + ruleString + "'."); 290 SyntaxError, "Failed to parse the rule '" + ruleString + "'.");
(...skipping 24 matching lines...) Expand all
314 UseCounter::CSSStyleSheetInsertRuleOptionalArg); 315 UseCounter::CSSStyleSheetInsertRuleOptionalArg);
315 return insertRule(rule, 0, exceptionState); 316 return insertRule(rule, 0, exceptionState);
316 } 317 }
317 318
318 void CSSStyleSheet::deleteRule(unsigned index, ExceptionState& exceptionState) { 319 void CSSStyleSheet::deleteRule(unsigned index, ExceptionState& exceptionState) {
319 DCHECK(m_childRuleCSSOMWrappers.isEmpty() || 320 DCHECK(m_childRuleCSSOMWrappers.isEmpty() ||
320 m_childRuleCSSOMWrappers.size() == m_contents->ruleCount()); 321 m_childRuleCSSOMWrappers.size() == m_contents->ruleCount());
321 322
322 if (index >= length()) { 323 if (index >= length()) {
323 exceptionState.throwDOMException( 324 exceptionState.throwDOMException(
324 IndexSizeError, "The index provided (" + String::number(index) + 325 IndexSizeError,
325 ") is larger than the maximum index (" + 326 "The index provided (" + String::number(index) +
326 String::number(length() - 1) + ")."); 327 ") is larger than the maximum index (" +
328 String::number(length() - 1) + ").");
327 return; 329 return;
328 } 330 }
329 RuleMutationScope mutationScope(this); 331 RuleMutationScope mutationScope(this);
330 332
331 bool success = m_contents->wrapperDeleteRule(index); 333 bool success = m_contents->wrapperDeleteRule(index);
332 if (!success) { 334 if (!success) {
333 exceptionState.throwDOMException(InvalidStateError, 335 exceptionState.throwDOMException(InvalidStateError,
334 "Failed to delete rule"); 336 "Failed to delete rule");
335 return; 337 return;
336 } 338 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 visitor->trace(m_deviceDependentMediaQueryResults); 451 visitor->trace(m_deviceDependentMediaQueryResults);
450 visitor->trace(m_ownerNode); 452 visitor->trace(m_ownerNode);
451 visitor->trace(m_ownerRule); 453 visitor->trace(m_ownerRule);
452 visitor->trace(m_mediaCSSOMWrapper); 454 visitor->trace(m_mediaCSSOMWrapper);
453 visitor->trace(m_childRuleCSSOMWrappers); 455 visitor->trace(m_childRuleCSSOMWrappers);
454 visitor->trace(m_ruleListCSSOMWrapper); 456 visitor->trace(m_ruleListCSSOMWrapper);
455 StyleSheet::trace(visitor); 457 StyleSheet::trace(visitor);
456 } 458 }
457 459
458 } // namespace blink 460 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSSelector.h ('k') | third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698