| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 lengthArray.resize(CSSPrimitiveValue::LengthUnitTypeCount); | 63 lengthArray.resize(CSSPrimitiveValue::LengthUnitTypeCount); |
| 64 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; ++i) | 64 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; ++i) |
| 65 lengthArray.at(i) = 0; | 65 lengthArray.at(i) = 0; |
| 66 } | 66 } |
| 67 | 67 |
| 68 CSSLengthArray& setLengthArray(CSSLengthArray& lengthArray, String text) | 68 CSSLengthArray& setLengthArray(CSSLengthArray& lengthArray, String text) |
| 69 { | 69 { |
| 70 initLengthArray(lengthArray); | 70 initLengthArray(lengthArray); |
| 71 RefPtrWillBeRawPtr<MutableStylePropertySet> propertySet = MutableStyleProper
tySet::create(); | 71 RefPtrWillBeRawPtr<MutableStylePropertySet> propertySet = MutableStyleProper
tySet::create(); |
| 72 propertySet->setProperty(CSSPropertyLeft, text); | 72 propertySet->setProperty(CSSPropertyLeft, text); |
| 73 toCSSPrimitiveValue(propertySet->getPropertyCSSValue(CSSPropertyLeft).get())
->accumulateLengthArray(lengthArray); | 73 toCSSPrimitiveValue(propertySet->getPropertyCSSValue(CSSPropertyLeft))->accu
mulateLengthArray(lengthArray); |
| 74 return lengthArray; | 74 return lengthArray; |
| 75 } | 75 } |
| 76 | 76 |
| 77 bool lengthArraysEqual(CSSLengthArray& a, CSSLengthArray& b) | 77 bool lengthArraysEqual(CSSLengthArray& a, CSSLengthArray& b) |
| 78 { | 78 { |
| 79 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; ++i) { | 79 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; ++i) { |
| 80 if (a.at(i) != b.at(i)) | 80 if (a.at(i) != b.at(i)) |
| 81 return false; | 81 return false; |
| 82 } | 82 } |
| 83 return true; | 83 return true; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 | 187 |
| 188 expectation.at(CSSPrimitiveValue::UnitTypePixels) = 15; | 188 expectation.at(CSSPrimitiveValue::UnitTypePixels) = 15; |
| 189 expectation.at(CSSPrimitiveValue::UnitTypeFontSize) = 20; | 189 expectation.at(CSSPrimitiveValue::UnitTypeFontSize) = 20; |
| 190 expectation.at(CSSPrimitiveValue::UnitTypePercentage) = -40; | 190 expectation.at(CSSPrimitiveValue::UnitTypePercentage) = -40; |
| 191 EXPECT_TRUE(lengthArraysEqual(expectation, setLengthArray(actual, "calc((1 *
2) * (5px + 20em / 2) - 80% / (3 - 1) + 5px)"))); | 191 EXPECT_TRUE(lengthArraysEqual(expectation, setLengthArray(actual, "calc((1 *
2) * (5px + 20em / 2) - 80% / (3 - 1) + 5px)"))); |
| 192 } | 192 } |
| 193 | 193 |
| 194 } // anonymous namespace | 194 } // anonymous namespace |
| 195 | 195 |
| 196 } // namespace blink | 196 } // namespace blink |
| OLD | NEW |