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

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

Issue 963733002: [svg2] Make 'width' and 'height' presentation attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebaseline some EX tests [Mac Win] Created 5 years, 9 months 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 | « Source/core/css/CSSPrimitiveValue.h ('k') | Source/core/layout/svg/LayoutSVGForeignObject.cpp » ('j') | 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 } 145 }
146 146
147 StringToUnitTable& unitTable() 147 StringToUnitTable& unitTable()
148 { 148 {
149 DEFINE_STATIC_LOCAL(StringToUnitTable, unitTable, (createStringToUnitTable() )); 149 DEFINE_STATIC_LOCAL(StringToUnitTable, unitTable, (createStringToUnitTable() ));
150 return unitTable; 150 return unitTable;
151 } 151 }
152 152
153 } // namespace 153 } // namespace
154 154
155 float CSSPrimitiveValue::clampToCSSLengthRange(double value)
156 {
157 return clampTo<float>(value, minValueForCssLength, maxValueForCssLength);
158 }
159
155 void CSSPrimitiveValue::initUnitTable() 160 void CSSPrimitiveValue::initUnitTable()
156 { 161 {
157 // Make sure we initialize this during blink initialization 162 // Make sure we initialize this during blink initialization
158 // to avoid racy static local initialization. 163 // to avoid racy static local initialization.
159 unitTable(); 164 unitTable();
160 } 165 }
161 166
162 CSSPrimitiveValue::UnitType CSSPrimitiveValue::fromName(const String& unit) 167 CSSPrimitiveValue::UnitType CSSPrimitiveValue::fromName(const String& unit)
163 { 168 {
164 return unitTable().get(unit.lower()); 169 return unitTable().get(unit.lower());
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 return roundForImpreciseConversion<int>(computeLengthDouble(conversionData)) ; 584 return roundForImpreciseConversion<int>(computeLengthDouble(conversionData)) ;
580 } 585 }
581 586
582 template<> unsigned CSSPrimitiveValue::computeLength(const CSSToLengthConversion Data& conversionData) 587 template<> unsigned CSSPrimitiveValue::computeLength(const CSSToLengthConversion Data& conversionData)
583 { 588 {
584 return roundForImpreciseConversion<unsigned>(computeLengthDouble(conversionD ata)); 589 return roundForImpreciseConversion<unsigned>(computeLengthDouble(conversionD ata));
585 } 590 }
586 591
587 template<> Length CSSPrimitiveValue::computeLength(const CSSToLengthConversionDa ta& conversionData) 592 template<> Length CSSPrimitiveValue::computeLength(const CSSToLengthConversionDa ta& conversionData)
588 { 593 {
589 return Length(clampTo<float>(computeLengthDouble(conversionData), minValueFo rCssLength, maxValueForCssLength), Fixed); 594 return Length(clampToCSSLengthRange(computeLengthDouble(conversionData)), Fi xed);
590 } 595 }
591 596
592 template<> short CSSPrimitiveValue::computeLength(const CSSToLengthConversionDat a& conversionData) 597 template<> short CSSPrimitiveValue::computeLength(const CSSToLengthConversionDat a& conversionData)
593 { 598 {
594 return roundForImpreciseConversion<short>(computeLengthDouble(conversionData )); 599 return roundForImpreciseConversion<short>(computeLengthDouble(conversionData ));
595 } 600 }
596 601
597 template<> unsigned short CSSPrimitiveValue::computeLength(const CSSToLengthConv ersionData& conversionData) 602 template<> unsigned short CSSPrimitiveValue::computeLength(const CSSToLengthConv ersionData& conversionData)
598 { 603 {
599 return roundForImpreciseConversion<unsigned short>(computeLengthDouble(conve rsionData)); 604 return roundForImpreciseConversion<unsigned short>(computeLengthDouble(conve rsionData));
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 visitor->trace(m_value.shape); 1261 visitor->trace(m_value.shape);
1257 break; 1262 break;
1258 default: 1263 default:
1259 break; 1264 break;
1260 } 1265 }
1261 #endif 1266 #endif
1262 CSSValue::traceAfterDispatch(visitor); 1267 CSSValue::traceAfterDispatch(visitor);
1263 } 1268 }
1264 1269
1265 } // namespace blink 1270 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/CSSPrimitiveValue.h ('k') | Source/core/layout/svg/LayoutSVGForeignObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698