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

Unified Diff: Source/core/css/CSSCalculationValue.cpp

Issue 64293008: Wrap CSS length conversion arguments in an object (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: don't make it noncopyable ; clang doesn't do the RVO stuffs? Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/CSSCalculationValue.h ('k') | Source/core/css/CSSCalculationValueTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSCalculationValue.cpp
diff --git a/Source/core/css/CSSCalculationValue.cpp b/Source/core/css/CSSCalculationValue.cpp
index 44e3c339e415798bd3aa2bc38f9e39bf465d8be7..e27cba3a66db7d1722794fe52a7a0ceb7ee51532 100644
--- a/Source/core/css/CSSCalculationValue.cpp
+++ b/Source/core/css/CSSCalculationValue.cpp
@@ -178,9 +178,9 @@ double CSSCalcValue::doubleValue() const
return clampToPermittedRange(m_expression->doubleValue());
}
-double CSSCalcValue::computeLengthPx(const RenderStyle* currentStyle, const RenderStyle* rootStyle, double multiplier, bool computingFontSize) const
+double CSSCalcValue::computeLengthPx(const CSSToLengthConversionData& conversionData) const
{
- return clampToPermittedRange(m_expression->computeLengthPx(currentStyle, rootStyle, multiplier, computingFontSize));
+ return clampToPermittedRange(m_expression->computeLengthPx(conversionData));
}
CSSCalcExpressionNode::~CSSCalcExpressionNode()
@@ -223,18 +223,18 @@ public:
return m_value->isVariableName();
}
- virtual PassOwnPtr<CalcExpressionNode> toCalcValue(const RenderStyle* style, const RenderStyle* rootStyle, double zoom) const
+ virtual PassOwnPtr<CalcExpressionNode> toCalcValue(const CSSToLengthConversionData& conversionData) const
{
switch (m_category) {
case CalcNumber:
return adoptPtr(new CalcExpressionNumber(m_value->getFloatValue()));
case CalcLength:
- return adoptPtr(new CalcExpressionLength(Length(m_value->computeLength<float>(style, rootStyle, zoom), WebCore::Fixed)));
+ return adoptPtr(new CalcExpressionLength(Length(m_value->computeLength<float>(conversionData), WebCore::Fixed)));
case CalcPercent:
case CalcPercentLength: {
CSSPrimitiveValue* primitiveValue = m_value.get();
return adoptPtr(new CalcExpressionLength(primitiveValue
- ? primitiveValue->convertToLength<FixedConversion | PercentConversion>(style, rootStyle, zoom)
+ ? primitiveValue->convertToLength<FixedConversion | PercentConversion>(conversionData)
: Length(Undefined)));
}
// Only types that could be part of a Length expression can be converted
@@ -255,11 +255,11 @@ public:
return 0;
}
- virtual double computeLengthPx(const RenderStyle* currentStyle, const RenderStyle* rootStyle, double multiplier, bool computingFontSize) const
+ virtual double computeLengthPx(const CSSToLengthConversionData& conversionData) const
{
switch (m_category) {
case CalcLength:
- return m_value->computeLength<double>(currentStyle, rootStyle, multiplier, computingFontSize);
+ return m_value->computeLength<double>(conversionData);
case CalcPercent:
case CalcNumber:
return m_value->getDoubleValue();
@@ -420,12 +420,12 @@ public:
return !doubleValue();
}
- virtual PassOwnPtr<CalcExpressionNode> toCalcValue(const RenderStyle* style, const RenderStyle* rootStyle, double zoom) const
+ virtual PassOwnPtr<CalcExpressionNode> toCalcValue(const CSSToLengthConversionData& conversionData) const
{
- OwnPtr<CalcExpressionNode> left(m_leftSide->toCalcValue(style, rootStyle, zoom));
+ OwnPtr<CalcExpressionNode> left(m_leftSide->toCalcValue(conversionData));
if (!left)
return nullptr;
- OwnPtr<CalcExpressionNode> right(m_rightSide->toCalcValue(style, rootStyle, zoom));
+ OwnPtr<CalcExpressionNode> right(m_rightSide->toCalcValue(conversionData));
if (!right)
return nullptr;
return adoptPtr(new CalcExpressionBinaryOperation(left.release(), right.release(), m_operator));
@@ -436,10 +436,10 @@ public:
return evaluate(m_leftSide->doubleValue(), m_rightSide->doubleValue());
}
- virtual double computeLengthPx(const RenderStyle* currentStyle, const RenderStyle* rootStyle, double multiplier, bool computingFontSize) const
+ virtual double computeLengthPx(const CSSToLengthConversionData& conversionData) const
{
- const double leftValue = m_leftSide->computeLengthPx(currentStyle, rootStyle, multiplier, computingFontSize);
- const double rightValue = m_rightSide->computeLengthPx(currentStyle, rootStyle, multiplier, computingFontSize);
+ const double leftValue = m_leftSide->computeLengthPx(conversionData);
+ const double rightValue = m_rightSide->computeLengthPx(conversionData);
return evaluate(leftValue, rightValue);
}
« no previous file with comments | « Source/core/css/CSSCalculationValue.h ('k') | Source/core/css/CSSCalculationValueTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698