| 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" |
| 28 #include "platform/LayoutUnit.h" | 31 #include "platform/LayoutUnit.h" |
| 32 #include "platform/fonts/FontMetrics.h" |
| 29 #include "wtf/StdLibExtras.h" | 33 #include "wtf/StdLibExtras.h" |
| 34 #include "wtf/text/StringBuffer.h" |
| 35 #include "wtf/text/StringBuilder.h" |
| 30 | 36 |
| 31 using namespace WTF; | 37 using namespace WTF; |
| 32 | 38 |
| 33 namespace blink { | 39 namespace blink { |
| 34 | 40 |
| 35 namespace { | 41 namespace { |
| 36 | 42 |
| 37 // Max/min values for CSS, needs to slightly smaller/larger than the true max/mi
n values to allow for rounding without overflowing. | 43 // Max/min values for CSS, needs to slightly smaller/larger than the true max/mi
n values to allow for rounding without overflowing. |
| 38 // Subtract two (rather than one) to allow for values to be converted to float a
nd back without exceeding the LayoutUnit::max. | 44 // Subtract two (rather than one) to allow for values to be converted to float a
nd back without exceeding the LayoutUnit::max. |
| 39 const int maxValueForCssLength = INT_MAX / kFixedPointDenominator - 2; | 45 const int maxValueForCssLength = INT_MAX / kFixedPointDenominator - 2; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 case CSSPrimitiveValue::UnitType::Integer: | 139 case CSSPrimitiveValue::UnitType::Integer: |
| 134 result = pool.numberCacheValue(intValue); | 140 result = pool.numberCacheValue(intValue); |
| 135 if (!result) | 141 if (!result) |
| 136 result = pool.setNumberCacheValue(intValue, new CSSPrimitiveValue(va
lue, CSSPrimitiveValue::UnitType::Integer)); | 142 result = pool.setNumberCacheValue(intValue, new CSSPrimitiveValue(va
lue, CSSPrimitiveValue::UnitType::Integer)); |
| 137 return result; | 143 return result; |
| 138 default: | 144 default: |
| 139 return new CSSPrimitiveValue(value, type); | 145 return new CSSPrimitiveValue(value, type); |
| 140 } | 146 } |
| 141 } | 147 } |
| 142 | 148 |
| 149 CSSPrimitiveValue* CSSPrimitiveValue::create(const Length& value, const Computed
Style& style) |
| 150 { |
| 151 return CSSPrimitiveValue::create(value, style.effectiveZoom()); |
| 152 } |
| 153 |
| 143 using CSSTextCache = PersistentHeapHashMap<WeakMember<const CSSPrimitiveValue>,
String>; | 154 using CSSTextCache = PersistentHeapHashMap<WeakMember<const CSSPrimitiveValue>,
String>; |
| 144 | 155 |
| 145 static CSSTextCache& cssTextCache() | 156 static CSSTextCache& cssTextCache() |
| 146 { | 157 { |
| 147 DEFINE_STATIC_LOCAL(CSSTextCache, cache, ()); | 158 DEFINE_STATIC_LOCAL(CSSTextCache, cache, ()); |
| 148 return cache; | 159 return cache; |
| 149 } | 160 } |
| 150 | 161 |
| 151 CSSPrimitiveValue::UnitType CSSPrimitiveValue::typeWithCalcResolved() const | 162 CSSPrimitiveValue::UnitType CSSPrimitiveValue::typeWithCalcResolved() const |
| 152 { | 163 { |
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 case UnitType::Calc: | 772 case UnitType::Calc: |
| 762 visitor->trace(m_value.calc); | 773 visitor->trace(m_value.calc); |
| 763 break; | 774 break; |
| 764 default: | 775 default: |
| 765 break; | 776 break; |
| 766 } | 777 } |
| 767 CSSValue::traceAfterDispatch(visitor); | 778 CSSValue::traceAfterDispatch(visitor); |
| 768 } | 779 } |
| 769 | 780 |
| 770 } // namespace blink | 781 } // namespace blink |
| OLD | NEW |