| 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, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
| 14 * | 14 * |
| 15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
| 16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
| 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
| 19 */ | 19 */ |
| 20 | 20 |
| 21 #include "core/css/CSSPrimitiveValue.h" | 21 #include "core/css/CSSPrimitiveValue.h" |
| 22 | 22 |
| 23 #include "core/css/CSSCalculationValue.h" | 23 #include "core/css/CSSCalculationValue.h" |
| 24 #include "core/css/CSSHelper.h" | 24 #include "core/css/CSSHelper.h" |
| 25 #include "core/css/CSSMarkup.h" | 25 #include "core/css/CSSMarkup.h" |
| 26 #include "core/css/CSSToLengthConversionData.h" | 26 #include "core/css/CSSToLengthConversionData.h" |
| 27 #include "core/css/CSSValuePool.h" | 27 #include "core/css/CSSValuePool.h" |
| 28 #include "core/css/StyleSheetContents.h" | |
| 29 #include "core/dom/Node.h" | |
| 30 #include "core/style/ComputedStyle.h" | |
| 31 #include "platform/LayoutUnit.h" | 28 #include "platform/LayoutUnit.h" |
| 32 #include "platform/fonts/FontMetrics.h" | |
| 33 #include "wtf/StdLibExtras.h" | 29 #include "wtf/StdLibExtras.h" |
| 34 #include "wtf/text/StringBuffer.h" | |
| 35 #include "wtf/text/StringBuilder.h" | |
| 36 | 30 |
| 37 using namespace WTF; | 31 using namespace WTF; |
| 38 | 32 |
| 39 namespace blink { | 33 namespace blink { |
| 40 | 34 |
| 41 namespace { | 35 namespace { |
| 42 | 36 |
| 43 // Max/min values for CSS, needs to slightly smaller/larger than the true max/mi
n values to allow for rounding without overflowing. | 37 // Max/min values for CSS, needs to slightly smaller/larger than the true max/mi
n values to allow for rounding without overflowing. |
| 44 // Subtract two (rather than one) to allow for values to be converted to float a
nd back without exceeding the LayoutUnit::max. | 38 // Subtract two (rather than one) to allow for values to be converted to float a
nd back without exceeding the LayoutUnit::max. |
| 45 const int maxValueForCssLength = INT_MAX / kFixedPointDenominator - 2; | 39 const int maxValueForCssLength = INT_MAX / kFixedPointDenominator - 2; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 case CSSPrimitiveValue::UnitType::Integer: | 133 case CSSPrimitiveValue::UnitType::Integer: |
| 140 result = pool.numberCacheValue(intValue); | 134 result = pool.numberCacheValue(intValue); |
| 141 if (!result) | 135 if (!result) |
| 142 result = pool.setNumberCacheValue(intValue, new CSSPrimitiveValue(va
lue, CSSPrimitiveValue::UnitType::Integer)); | 136 result = pool.setNumberCacheValue(intValue, new CSSPrimitiveValue(va
lue, CSSPrimitiveValue::UnitType::Integer)); |
| 143 return result; | 137 return result; |
| 144 default: | 138 default: |
| 145 return new CSSPrimitiveValue(value, type); | 139 return new CSSPrimitiveValue(value, type); |
| 146 } | 140 } |
| 147 } | 141 } |
| 148 | 142 |
| 149 CSSPrimitiveValue* CSSPrimitiveValue::create(const Length& value, const Computed
Style& style) | |
| 150 { | |
| 151 return CSSPrimitiveValue::create(value, style.effectiveZoom()); | |
| 152 } | |
| 153 | |
| 154 using CSSTextCache = PersistentHeapHashMap<WeakMember<const CSSPrimitiveValue>,
String>; | 143 using CSSTextCache = PersistentHeapHashMap<WeakMember<const CSSPrimitiveValue>,
String>; |
| 155 | 144 |
| 156 static CSSTextCache& cssTextCache() | 145 static CSSTextCache& cssTextCache() |
| 157 { | 146 { |
| 158 DEFINE_STATIC_LOCAL(CSSTextCache, cache, ()); | 147 DEFINE_STATIC_LOCAL(CSSTextCache, cache, ()); |
| 159 return cache; | 148 return cache; |
| 160 } | 149 } |
| 161 | 150 |
| 162 CSSPrimitiveValue::UnitType CSSPrimitiveValue::typeWithCalcResolved() const | 151 CSSPrimitiveValue::UnitType CSSPrimitiveValue::typeWithCalcResolved() const |
| 163 { | 152 { |
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 case UnitType::Calc: | 761 case UnitType::Calc: |
| 773 visitor->trace(m_value.calc); | 762 visitor->trace(m_value.calc); |
| 774 break; | 763 break; |
| 775 default: | 764 default: |
| 776 break; | 765 break; |
| 777 } | 766 } |
| 778 CSSValue::traceAfterDispatch(visitor); | 767 CSSValue::traceAfterDispatch(visitor); |
| 779 } | 768 } |
| 780 | 769 |
| 781 } // namespace blink | 770 } // namespace blink |
| OLD | NEW |