Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 658 // We do not apply the zoom factor when we are computing the value of the fo nt-size property. The zooming | 658 // We do not apply the zoom factor when we are computing the value of the fo nt-size property. The zooming |
| 659 // for font sizes is much more complicated, since we have to worry about enf orcing the minimum font size preference | 659 // for font sizes is much more complicated, since we have to worry about enf orcing the minimum font size preference |
| 660 // as well as enforcing the implicit "smart minimum." | 660 // as well as enforcing the implicit "smart minimum." |
| 661 double result = getDoubleValue() * factor; | 661 double result = getDoubleValue() * factor; |
| 662 if (isFontRelativeLength()) | 662 if (isFontRelativeLength()) |
| 663 return result; | 663 return result; |
| 664 | 664 |
| 665 return result * conversionData.zoom(); | 665 return result * conversionData.zoom(); |
| 666 } | 666 } |
| 667 | 667 |
| 668 void CSSPrimitiveValue::accumulateLengthArray(CSSLengthArray& lengthArray, doubl e multiplier) const | 668 void CSSPrimitiveValue::accumulateLengthArray(CSSLengthArray& lengthArray, CSSLe ngthTypeArray& lengthTypeArray, double multiplier) const |
| 669 { | 669 { |
| 670 ASSERT(lengthArray.size() == LengthUnitTypeCount); | 670 ASSERT(lengthArray.size() == LengthUnitTypeCount); |
| 671 | 671 |
| 672 if (m_primitiveUnitType == CSS_CALC) { | 672 if (m_primitiveUnitType == CSS_CALC) { |
| 673 cssCalcValue()->accumulateLengthArray(lengthArray, multiplier); | 673 cssCalcValue()->accumulateLengthArray(lengthArray, multiplier); |
| 674 return; | 674 return; |
| 675 } | 675 } |
| 676 | 676 |
| 677 LengthUnitType lengthType; | 677 LengthUnitType lengthType; |
| 678 if (unitTypeToLengthUnitType(static_cast<UnitType>(m_primitiveUnitType), len gthType)) | 678 if (unitTypeToLengthUnitType(static_cast<UnitType>(m_primitiveUnitType), len gthType)) { |
| 679 lengthArray.at(lengthType) += m_value.num * conversionToCanonicalUnitsSc aleFactor(static_cast<UnitType>(m_primitiveUnitType)) * multiplier; | 679 lengthArray.at(lengthType) += m_value.num * conversionToCanonicalUnitsSc aleFactor(static_cast<UnitType>(m_primitiveUnitType)) * multiplier; |
| 680 lengthTypeArray.set(lengthType); | |
| 681 } | |
| 682 } | |
| 683 | |
| 684 void CSSPrimitiveValue::accumulateLengthArray(CSSLengthArray& lengthArray, doubl e multiplier) const | |
| 685 { | |
| 686 CSSLengthTypeArray zeroLengthTypeArray; | |
|
samli
2014/12/22 06:23:10
lengthTypeArray is fine
evemj (not active)
2014/12/22 23:05:15
Done.
| |
| 687 zeroLengthTypeArray.resize(CSSPrimitiveValue::LengthUnitTypeCount); | |
| 688 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; ++i) | |
| 689 zeroLengthTypeArray.clear(i); | |
| 690 return accumulateLengthArray(lengthArray, zeroLengthTypeArray, multiplier); | |
| 680 } | 691 } |
| 681 | 692 |
| 682 double CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor(UnitType unitTyp e) | 693 double CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor(UnitType unitTyp e) |
| 683 { | 694 { |
| 684 double factor = 1.0; | 695 double factor = 1.0; |
| 685 // FIXME: the switch can be replaced by an array of scale factors. | 696 // FIXME: the switch can be replaced by an array of scale factors. |
| 686 switch (unitType) { | 697 switch (unitType) { |
| 687 // These are "canonical" units in their respective categories. | 698 // These are "canonical" units in their respective categories. |
| 688 case CSS_PX: | 699 case CSS_PX: |
| 689 case CSS_DEG: | 700 case CSS_DEG: |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1225 visitor->trace(m_value.shape); | 1236 visitor->trace(m_value.shape); |
| 1226 break; | 1237 break; |
| 1227 default: | 1238 default: |
| 1228 break; | 1239 break; |
| 1229 } | 1240 } |
| 1230 #endif | 1241 #endif |
| 1231 CSSValue::traceAfterDispatch(visitor); | 1242 CSSValue::traceAfterDispatch(visitor); |
| 1232 } | 1243 } |
| 1233 | 1244 |
| 1234 } // namespace blink | 1245 } // namespace blink |
| OLD | NEW |