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

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

Issue 1471653002: Assert that unit type conversion works in accumulateLengthArray (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | no next file » | 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, 2012 Apple Inc. All rights reserv ed. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2012 Apple Inc. All rights reserv ed.
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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 void CSSPrimitiveValue::accumulateLengthArray(CSSLengthArray& lengthArray, CSSLe ngthTypeArray& lengthTypeArray, double multiplier) const 433 void CSSPrimitiveValue::accumulateLengthArray(CSSLengthArray& lengthArray, CSSLe ngthTypeArray& lengthTypeArray, double multiplier) const
434 { 434 {
435 ASSERT(lengthArray.size() == LengthUnitTypeCount); 435 ASSERT(lengthArray.size() == LengthUnitTypeCount);
436 436
437 if (type() == UnitType::Calc) { 437 if (type() == UnitType::Calc) {
438 cssCalcValue()->accumulateLengthArray(lengthArray, lengthTypeArray, mult iplier); 438 cssCalcValue()->accumulateLengthArray(lengthArray, lengthTypeArray, mult iplier);
439 return; 439 return;
440 } 440 }
441 441
442 LengthUnitType lengthType; 442 LengthUnitType lengthType;
443 if (unitTypeToLengthUnitType(type(), lengthType)) { 443 bool conversionSuccess = unitTypeToLengthUnitType(type(), lengthType);
444 lengthArray.at(lengthType) += m_value.num * conversionToCanonicalUnitsSc aleFactor(type()) * multiplier; 444 ASSERT_UNUSED(conversionSuccess, conversionSuccess);
445 lengthTypeArray.set(lengthType); 445 lengthArray.at(lengthType) += m_value.num * conversionToCanonicalUnitsScaleF actor(type()) * multiplier;
446 } 446 lengthTypeArray.set(lengthType);
447 } 447 }
448 448
449 void CSSPrimitiveValue::accumulateLengthArray(CSSLengthArray& lengthArray, doubl e multiplier) const 449 void CSSPrimitiveValue::accumulateLengthArray(CSSLengthArray& lengthArray, doubl e multiplier) const
450 { 450 {
451 CSSLengthTypeArray lengthTypeArray; 451 CSSLengthTypeArray lengthTypeArray;
452 lengthTypeArray.resize(CSSPrimitiveValue::LengthUnitTypeCount); 452 lengthTypeArray.resize(CSSPrimitiveValue::LengthUnitTypeCount);
453 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; ++i) 453 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; ++i)
454 lengthTypeArray.clear(i); 454 lengthTypeArray.clear(i);
455 return CSSPrimitiveValue::accumulateLengthArray(lengthArray, lengthTypeArray , multiplier); 455 return CSSPrimitiveValue::accumulateLengthArray(lengthArray, lengthTypeArray , multiplier);
456 } 456 }
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 visitor->trace(m_value.calc); 842 visitor->trace(m_value.calc);
843 break; 843 break;
844 default: 844 default:
845 break; 845 break;
846 } 846 }
847 #endif 847 #endif
848 CSSValue::traceAfterDispatch(visitor); 848 CSSValue::traceAfterDispatch(visitor);
849 } 849 }
850 850
851 } // namespace blink 851 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698