Changeset 148619 in webkit
- Timestamp:
- Apr 17, 2013 11:27:43 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r148618 r148619 1 2013-04-17 Dirk Schulze <krit@webkit.org> 2 3 Make lengthConversion methods and arguments const 4 https://bugs.webkit.org/show_bug.cgi?id=114749 5 6 Reviewed by Andreas Kling. 7 8 Refactoring, no new tests. 9 10 * css/CSSCalculationValue.cpp: 11 (WebCore::CSSCalcValue::computeLengthPx): 12 (WebCore::CSSCalcPrimitiveValue::toCalcValue): 13 (WebCore::CSSCalcPrimitiveValue::computeLengthPx): 14 (WebCore::CSSCalcBinaryOperation::toCalcValue): 15 (WebCore::CSSCalcBinaryOperation::computeLengthPx): 16 * css/CSSCalculationValue.h: 17 (WebCore::CSSCalcValue::toCalcValue): 18 (CSSCalcValue): 19 * css/CSSPrimitiveValue.cpp: 20 (WebCore::CSSPrimitiveValue::computeLength): 21 (WebCore::CSSPrimitiveValue::computeLengthDouble): 22 (WebCore::CSSPrimitiveValue::viewportPercentageLength): 23 * css/CSSPrimitiveValue.h: 24 (CSSPrimitiveValue): 25 * css/CSSPrimitiveValueMappings.h: 26 (WebCore::CSSPrimitiveValue::convertToLength): 27 * css/StyleResolver.cpp: 28 (WebCore::StyleResolver::convertToIntLength): 29 (WebCore::StyleResolver::convertToFloatLength): 30 * css/StyleResolver.h: 31 (StyleResolver): 32 1 33 2013-04-17 Bruno de Oliveira Abinader <bruno.abinader@basyskom.com> 2 34 -
trunk/Source/WebCore/css/CSSCalculationValue.cpp
r142904 r148619 129 129 } 130 130 131 double CSSCalcValue::computeLengthPx( RenderStyle* currentStyle,RenderStyle* rootStyle, double multiplier, bool computingFontSize) const131 double CSSCalcValue::computeLengthPx(const RenderStyle* currentStyle, const RenderStyle* rootStyle, double multiplier, bool computingFontSize) const 132 132 { 133 133 return clampToPermittedRange(m_expression->computeLengthPx(currentStyle, rootStyle, multiplier, computingFontSize)); … … 169 169 #endif 170 170 171 virtual PassOwnPtr<CalcExpressionNode> toCalcValue( RenderStyle* style,RenderStyle* rootStyle, double zoom) const171 virtual PassOwnPtr<CalcExpressionNode> toCalcValue(const RenderStyle* style, const RenderStyle* rootStyle, double zoom) const 172 172 { 173 173 switch (m_category) { … … 210 210 } 211 211 212 virtual double computeLengthPx( RenderStyle* currentStyle,RenderStyle* rootStyle, double multiplier, bool computingFontSize) const212 virtual double computeLengthPx(const RenderStyle* currentStyle, const RenderStyle* rootStyle, double multiplier, bool computingFontSize) const 213 213 { 214 214 switch (m_category) { … … 315 315 } 316 316 317 virtual PassOwnPtr<CalcExpressionNode> toCalcValue( RenderStyle* style,RenderStyle* rootStyle, double zoom) const317 virtual PassOwnPtr<CalcExpressionNode> toCalcValue(const RenderStyle* style, const RenderStyle* rootStyle, double zoom) const 318 318 { 319 319 OwnPtr<CalcExpressionNode> left(m_leftSide->toCalcValue(style, rootStyle, zoom)); … … 331 331 } 332 332 333 virtual double computeLengthPx( RenderStyle* currentStyle,RenderStyle* rootStyle, double multiplier, bool computingFontSize) const333 virtual double computeLengthPx(const RenderStyle* currentStyle, const RenderStyle* rootStyle, double multiplier, bool computingFontSize) const 334 334 { 335 335 const double leftValue = m_leftSide->computeLengthPx(currentStyle, rootStyle, multiplier, computingFontSize); -
trunk/Source/WebCore/css/CSSCalculationValue.h
r142444 r148619 68 68 virtual ~CSSCalcExpressionNode() = 0; 69 69 virtual bool isZero() const = 0; 70 virtual PassOwnPtr<CalcExpressionNode> toCalcValue( RenderStyle*,RenderStyle* rootStyle, double zoom = 1.0) const = 0;70 virtual PassOwnPtr<CalcExpressionNode> toCalcValue(const RenderStyle*, const RenderStyle* rootStyle, double zoom = 1.0) const = 0; 71 71 virtual double doubleValue() const = 0; 72 virtual double computeLengthPx( RenderStyle* currentStyle,RenderStyle* rootStyle, double multiplier = 1.0, bool computingFontSize = false) const = 0;72 virtual double computeLengthPx(const RenderStyle* currentStyle, const RenderStyle* rootStyle, double multiplier = 1.0, bool computingFontSize = false) const = 0; 73 73 virtual String customCssText() const = 0; 74 74 #if ENABLE(CSS_VARIABLES) … … 99 99 static PassRefPtr<CSSCalcValue> create(CalculationValue*); 100 100 101 PassRefPtr<CalculationValue> toCalcValue( RenderStyle* style,RenderStyle* rootStyle, double zoom = 1.0) const101 PassRefPtr<CalculationValue> toCalcValue(const RenderStyle* style, const RenderStyle* rootStyle, double zoom = 1.0) const 102 102 { 103 103 return CalculationValue::create(m_expression->toCalcValue(style, rootStyle, zoom), m_nonNegative ? CalculationRangeNonNegative : CalculationRangeAll); … … 107 107 double doubleValue() const; 108 108 bool isNegative() const { return m_expression->doubleValue() < 0; } 109 double computeLengthPx( RenderStyle* currentStyle,RenderStyle* rootStyle, double multiplier = 1.0, bool computingFontSize = false) const;109 double computeLengthPx(const RenderStyle* currentStyle, const RenderStyle* rootStyle, double multiplier = 1.0, bool computingFontSize = false) const; 110 110 111 111 String customCssText() const; -
trunk/Source/WebCore/css/CSSPrimitiveValue.cpp
r145168 r148619 482 482 } 483 483 484 template<> int CSSPrimitiveValue::computeLength( RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)484 template<> int CSSPrimitiveValue::computeLength(const RenderStyle* style, const RenderStyle* rootStyle, float multiplier, bool computingFontSize) const 485 485 { 486 486 return roundForImpreciseConversion<int>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize)); 487 487 } 488 488 489 template<> unsigned CSSPrimitiveValue::computeLength( RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)489 template<> unsigned CSSPrimitiveValue::computeLength(const RenderStyle* style, const RenderStyle* rootStyle, float multiplier, bool computingFontSize) const 490 490 { 491 491 return roundForImpreciseConversion<unsigned>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize)); 492 492 } 493 493 494 template<> Length CSSPrimitiveValue::computeLength( RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)494 template<> Length CSSPrimitiveValue::computeLength(const RenderStyle* style, const RenderStyle* rootStyle, float multiplier, bool computingFontSize) const 495 495 { 496 496 #if ENABLE(SUBPIXEL_LAYOUT) … … 501 501 } 502 502 503 template<> short CSSPrimitiveValue::computeLength( RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)503 template<> short CSSPrimitiveValue::computeLength(const RenderStyle* style, const RenderStyle* rootStyle, float multiplier, bool computingFontSize) const 504 504 { 505 505 return roundForImpreciseConversion<short>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize)); 506 506 } 507 507 508 template<> unsigned short CSSPrimitiveValue::computeLength( RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)508 template<> unsigned short CSSPrimitiveValue::computeLength(const RenderStyle* style, const RenderStyle* rootStyle, float multiplier, bool computingFontSize) const 509 509 { 510 510 return roundForImpreciseConversion<unsigned short>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize)); 511 511 } 512 512 513 template<> float CSSPrimitiveValue::computeLength( RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)513 template<> float CSSPrimitiveValue::computeLength(const RenderStyle* style, const RenderStyle* rootStyle, float multiplier, bool computingFontSize) const 514 514 { 515 515 return static_cast<float>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize)); 516 516 } 517 517 518 template<> double CSSPrimitiveValue::computeLength( RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)518 template<> double CSSPrimitiveValue::computeLength(const RenderStyle* style, const RenderStyle* rootStyle, float multiplier, bool computingFontSize) const 519 519 { 520 520 return computeLengthDouble(style, rootStyle, multiplier, computingFontSize); 521 521 } 522 522 523 double CSSPrimitiveValue::computeLengthDouble( RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)523 double CSSPrimitiveValue::computeLengthDouble(const RenderStyle* style, const RenderStyle* rootStyle, float multiplier, bool computingFontSize) const 524 524 { 525 525 if (m_primitiveUnitType == CSS_CALC) … … 1170 1170 } 1171 1171 1172 Length CSSPrimitiveValue::viewportPercentageLength() 1172 Length CSSPrimitiveValue::viewportPercentageLength() const 1173 1173 { 1174 1174 ASSERT(isViewportPercentageLength()); -
trunk/Source/WebCore/css/CSSPrimitiveValue.h
r148186 r148619 255 255 * and some tool to calibrate. 256 256 */ 257 template<typename T> T computeLength( RenderStyle* currStyle, RenderStyle* rootStyle, float multiplier = 1.0f, bool computingFontSize = false);257 template<typename T> T computeLength(const RenderStyle* currStyle, const RenderStyle* rootStyle, float multiplier = 1.0f, bool computingFontSize = false) const; 258 258 259 259 // Converts to a Length, mapping various unit types appropriately. 260 template<int> Length convertToLength( RenderStyle* currStyle, RenderStyle* rootStyle, double multiplier = 1.0, bool computingFontSize = false);260 template<int> Length convertToLength(const RenderStyle* currStyle, const RenderStyle* rootStyle, double multiplier = 1.0, bool computingFontSize = false) const; 261 261 262 262 // use with care!!! … … 321 321 void addSubresourceStyleURLs(ListHashSet<KURL>&, const StyleSheetContents*) const; 322 322 323 Length viewportPercentageLength() ;323 Length viewportPercentageLength() const; 324 324 325 325 PassRefPtr<CSSPrimitiveValue> cloneForCSSOM() const; … … 366 366 bool getDoubleValueInternal(UnitTypes targetUnitType, double* result) const; 367 367 368 double computeLengthDouble( RenderStyle* currentStyle, RenderStyle* rootStyle, float multiplier, bool computingFontSize);368 double computeLengthDouble(const RenderStyle* currentStyle, const RenderStyle* rootStyle, float multiplier, bool computingFontSize) const; 369 369 370 370 union { -
trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h
r148208 r148619 4276 4276 }; 4277 4277 4278 template<int supported> Length CSSPrimitiveValue::convertToLength( RenderStyle* style, RenderStyle* rootStyle, double multiplier, bool computingFontSize)4278 template<int supported> Length CSSPrimitiveValue::convertToLength(const RenderStyle* style, const RenderStyle* rootStyle, double multiplier, bool computingFontSize) const 4279 4279 { 4280 4280 #if ENABLE(CSS_VARIABLES) -
trunk/Source/WebCore/css/StyleResolver.cpp
r148395 r148619 1686 1686 // this is mostly boring stuff on how to apply a certain rule to the renderstyle... 1687 1687 1688 Length StyleResolver::convertToIntLength( CSSPrimitiveValue* primitiveValue, RenderStyle* style,RenderStyle* rootStyle, double multiplier)1688 Length StyleResolver::convertToIntLength(const CSSPrimitiveValue* primitiveValue, const RenderStyle* style, const RenderStyle* rootStyle, double multiplier) 1689 1689 { 1690 1690 return primitiveValue ? primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | FractionConversion | ViewportPercentageConversion>(style, rootStyle, multiplier) : Length(Undefined); 1691 1691 } 1692 1692 1693 Length StyleResolver::convertToFloatLength( CSSPrimitiveValue* primitiveValue, RenderStyle* style,RenderStyle* rootStyle, double multiplier)1693 Length StyleResolver::convertToFloatLength(const CSSPrimitiveValue* primitiveValue, const RenderStyle* style, const RenderStyle* rootStyle, double multiplier) 1694 1694 { 1695 1695 return primitiveValue ? primitiveValue->convertToLength<FixedFloatConversion | PercentConversion | CalculatedConversion | FractionConversion | ViewportPercentageConversion>(style, rootStyle, multiplier) : Length(Undefined); -
trunk/Source/WebCore/css/StyleResolver.h
r148363 r148619 560 560 bool applyPropertyToVisitedLinkStyle() const { return m_state.applyPropertyToVisitedLinkStyle(); } 561 561 562 static Length convertToIntLength( CSSPrimitiveValue*, RenderStyle*,RenderStyle* rootStyle, double multiplier = 1);563 static Length convertToFloatLength( CSSPrimitiveValue*, RenderStyle*,RenderStyle* rootStyle, double multiplier = 1);562 static Length convertToIntLength(const CSSPrimitiveValue*, const RenderStyle*, const RenderStyle* rootStyle, double multiplier = 1); 563 static Length convertToFloatLength(const CSSPrimitiveValue*, const RenderStyle*, const RenderStyle* rootStyle, double multiplier = 1); 564 564 565 565 CSSToStyleMap* styleMap() { return &m_styleMap; }
Note: See TracChangeset
for help on using the changeset viewer.