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

Side by Side Diff: Source/core/css/StylePropertySet.cpp

Issue 23464095: WTF::notFound looks too much like a local variable. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/StyleInvalidationAnalysis.cpp ('k') | Source/core/css/StyleSheetContents.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
5 * Copyright (C) 2013 Intel Corporation. All rights reserved. 5 * Copyright (C) 2013 Intel Corporation. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 if (propertyAt(i).id() == CSSPropertyVariable) 131 if (propertyAt(i).id() == CSSPropertyVariable)
132 count++; 132 count++;
133 } 133 }
134 return count; 134 return count;
135 } 135 }
136 136
137 String StylePropertySet::variableValue(const AtomicString& name) const 137 String StylePropertySet::variableValue(const AtomicString& name) const
138 { 138 {
139 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); 139 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
140 size_t index = findVariableIndex(name); 140 size_t index = findVariableIndex(name);
141 if (index == notFound) 141 if (index == kNotFound)
142 return String(); 142 return String();
143 return toCSSVariableValue(propertyAt(index).value())->value(); 143 return toCSSVariableValue(propertyAt(index).value())->value();
144 } 144 }
145 145
146 bool MutableStylePropertySet::removeShorthandProperty(CSSPropertyID propertyID) 146 bool MutableStylePropertySet::removeShorthandProperty(CSSPropertyID propertyID)
147 { 147 {
148 StylePropertyShorthand shorthand = shorthandForProperty(propertyID); 148 StylePropertyShorthand shorthand = shorthandForProperty(propertyID);
149 if (!shorthand.length()) 149 if (!shorthand.length())
150 return false; 150 return false;
151 151
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 return indexOfShorthandForLonghand(prefixedShorthand, matchingShorthandsForL onghand(prefixingVariant)); 277 return indexOfShorthandForLonghand(prefixedShorthand, matchingShorthandsForL onghand(prefixingVariant));
278 } 278 }
279 279
280 bool MutableStylePropertySet::setVariableValue(const AtomicString& name, const S tring& value, bool important) 280 bool MutableStylePropertySet::setVariableValue(const AtomicString& name, const S tring& value, bool important)
281 { 281 {
282 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); 282 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
283 if (value.isEmpty()) 283 if (value.isEmpty())
284 return removeVariable(name); 284 return removeVariable(name);
285 285
286 size_t index = findVariableIndex(name); 286 size_t index = findVariableIndex(name);
287 if (index != notFound) { 287 if (index != kNotFound) {
288 CSSValue* cssValue = m_propertyVector.at(index).value(); 288 CSSValue* cssValue = m_propertyVector.at(index).value();
289 if (toCSSVariableValue(cssValue)->value() == value) 289 if (toCSSVariableValue(cssValue)->value() == value)
290 return false; 290 return false;
291 } 291 }
292 292
293 CSSProperty property(CSSPropertyVariable, CSSVariableValue::create(name, val ue), important); 293 CSSProperty property(CSSPropertyVariable, CSSVariableValue::create(name, val ue), important);
294 if (index == notFound) 294 if (index == kNotFound)
295 m_propertyVector.append(property); 295 m_propertyVector.append(property);
296 else 296 else
297 m_propertyVector.at(index) = property; 297 m_propertyVector.at(index) = property;
298 return true; 298 return true;
299 } 299 }
300 300
301 void MutableStylePropertySet::appendPrefixingVariantProperty(const CSSProperty& property) 301 void MutableStylePropertySet::appendPrefixingVariantProperty(const CSSProperty& property)
302 { 302 {
303 m_propertyVector.append(property); 303 m_propertyVector.append(property);
304 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id() ); 304 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id() );
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 } 491 }
492 492
493 size_t StylePropertySet::findVariableIndex(const AtomicString& name) const 493 size_t StylePropertySet::findVariableIndex(const AtomicString& name) const
494 { 494 {
495 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); 495 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
496 for (int i = propertyCount() - 1; i >= 0; --i) { 496 for (int i = propertyCount() - 1; i >= 0; --i) {
497 const PropertyReference& property = propertyAt(i); 497 const PropertyReference& property = propertyAt(i);
498 if (property.id() == CSSPropertyVariable && toCSSVariableValue(property. value())->name() == name) 498 if (property.id() == CSSPropertyVariable && toCSSVariableValue(property. value())->name() == name)
499 return i; 499 return i;
500 } 500 }
501 return notFound; 501 return kNotFound;
502 } 502 }
503 503
504 CSSProperty* MutableStylePropertySet::findCSSPropertyWithID(CSSPropertyID proper tyID) 504 CSSProperty* MutableStylePropertySet::findCSSPropertyWithID(CSSPropertyID proper tyID)
505 { 505 {
506 int foundPropertyIndex = findPropertyIndex(propertyID); 506 int foundPropertyIndex = findPropertyIndex(propertyID);
507 if (foundPropertyIndex == -1) 507 if (foundPropertyIndex == -1)
508 return 0; 508 return 0;
509 return &m_propertyVector.at(foundPropertyIndex); 509 return &m_propertyVector.at(foundPropertyIndex);
510 } 510 }
511 511
(...skipping 30 matching lines...) Expand all
542 } 542 }
543 // FIXME: This should use mass removal. 543 // FIXME: This should use mass removal.
544 for (unsigned i = 0; i < propertiesToRemove.size(); ++i) 544 for (unsigned i = 0; i < propertiesToRemove.size(); ++i)
545 removeProperty(propertiesToRemove[i]); 545 removeProperty(propertiesToRemove[i]);
546 } 546 }
547 547
548 bool MutableStylePropertySet::removeVariable(const AtomicString& name) 548 bool MutableStylePropertySet::removeVariable(const AtomicString& name)
549 { 549 {
550 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); 550 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
551 size_t index = findVariableIndex(name); 551 size_t index = findVariableIndex(name);
552 if (index == notFound) 552 if (index == kNotFound)
553 return false; 553 return false;
554 m_propertyVector.remove(index); 554 m_propertyVector.remove(index);
555 return true; 555 return true;
556 } 556 }
557 557
558 bool MutableStylePropertySet::clearVariables() 558 bool MutableStylePropertySet::clearVariables()
559 { 559 {
560 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); 560 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
561 CSSPropertyID variablesId = CSSPropertyVariable; 561 CSSPropertyID variablesId = CSSPropertyVariable;
562 return removePropertiesInSet(&variablesId, 1); 562 return removePropertiesInSet(&variablesId, 1);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 result.appendLiteral(": "); 651 result.appendLiteral(": ");
652 result.append(propertyValue()->cssText()); 652 result.append(propertyValue()->cssText());
653 if (isImportant()) 653 if (isImportant())
654 result.appendLiteral(" !important"); 654 result.appendLiteral(" !important");
655 result.append(';'); 655 result.append(';');
656 return result.toString(); 656 return result.toString();
657 } 657 }
658 658
659 659
660 } // namespace WebCore 660 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/StyleInvalidationAnalysis.cpp ('k') | Source/core/css/StyleSheetContents.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698