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

Unified Diff: Source/core/css/resolver/TransformBuilder.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/resolver/TransformBuilder.h ('k') | Source/core/css/resolver/ViewportStyleResolver.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/resolver/TransformBuilder.cpp
diff --git a/Source/core/css/resolver/TransformBuilder.cpp b/Source/core/css/resolver/TransformBuilder.cpp
index d6f344c40d3ebac4ceffc6a315447e51e61fbfa8..3779a01f6a58f28c9a632c76b73aa664fdf5ef6f 100644
--- a/Source/core/css/resolver/TransformBuilder.cpp
+++ b/Source/core/css/resolver/TransformBuilder.cpp
@@ -51,9 +51,9 @@ TransformBuilder::~TransformBuilder()
{
}
-static Length convertToFloatLength(CSSPrimitiveValue* primitiveValue, const RenderStyle* style, const RenderStyle* rootStyle, double multiplier)
+static Length convertToFloatLength(CSSPrimitiveValue* primitiveValue, const CSSToLengthConversionData& conversionData)
{
- return primitiveValue ? primitiveValue->convertToLength<FixedConversion | PercentConversion>(style, rootStyle, multiplier) : Length(Undefined);
+ return primitiveValue ? primitiveValue->convertToLength<FixedConversion | PercentConversion>(conversionData) : Length(Undefined);
}
static TransformOperation::OperationType getTransformOperationType(CSSTransformValue::TransformOperationType type)
@@ -85,14 +85,14 @@ static TransformOperation::OperationType getTransformOperationType(CSSTransformV
return TransformOperation::None;
}
-bool TransformBuilder::createTransformOperations(CSSValue* inValue, const RenderStyle* style, const RenderStyle* rootStyle, TransformOperations& outOperations)
+bool TransformBuilder::createTransformOperations(CSSValue* inValue, const CSSToLengthConversionData& conversionData, TransformOperations& outOperations)
{
if (!inValue || !inValue->isValueList()) {
outOperations.clear();
return false;
}
- float zoomFactor = style ? style->effectiveZoom() : 1;
+ float zoomFactor = conversionData.zoom();
TransformOperations operations;
for (CSSValueListIterator i = inValue; i.hasMore(); i.advance()) {
CSSValue* currValue = i.value();
@@ -169,13 +169,13 @@ bool TransformBuilder::createTransformOperations(CSSValue* inValue, const Render
Length tx = Length(0, Fixed);
Length ty = Length(0, Fixed);
if (transformValue->operationType() == CSSTransformValue::TranslateYTransformOperation)
- ty = convertToFloatLength(firstValue, style, rootStyle, zoomFactor);
+ ty = convertToFloatLength(firstValue, conversionData);
else {
- tx = convertToFloatLength(firstValue, style, rootStyle, zoomFactor);
+ tx = convertToFloatLength(firstValue, conversionData);
if (transformValue->operationType() != CSSTransformValue::TranslateXTransformOperation) {
if (transformValue->length() > 1) {
CSSPrimitiveValue* secondValue = toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(1));
- ty = convertToFloatLength(secondValue, style, rootStyle, zoomFactor);
+ ty = convertToFloatLength(secondValue, conversionData);
}
}
}
@@ -192,19 +192,19 @@ bool TransformBuilder::createTransformOperations(CSSValue* inValue, const Render
Length ty = Length(0, Fixed);
Length tz = Length(0, Fixed);
if (transformValue->operationType() == CSSTransformValue::TranslateZTransformOperation)
- tz = convertToFloatLength(firstValue, style, rootStyle, zoomFactor);
+ tz = convertToFloatLength(firstValue, conversionData);
else if (transformValue->operationType() == CSSTransformValue::TranslateYTransformOperation)
- ty = convertToFloatLength(firstValue, style, rootStyle, zoomFactor);
+ ty = convertToFloatLength(firstValue, conversionData);
else {
- tx = convertToFloatLength(firstValue, style, rootStyle, zoomFactor);
+ tx = convertToFloatLength(firstValue, conversionData);
if (transformValue->operationType() != CSSTransformValue::TranslateXTransformOperation) {
if (transformValue->length() > 2) {
CSSPrimitiveValue* thirdValue = toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(2));
- tz = convertToFloatLength(thirdValue, style, rootStyle, zoomFactor);
+ tz = convertToFloatLength(thirdValue, conversionData);
}
if (transformValue->length() > 1) {
CSSPrimitiveValue* secondValue = toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(1));
- ty = convertToFloatLength(secondValue, style, rootStyle, zoomFactor);
+ ty = convertToFloatLength(secondValue, conversionData);
}
}
}
@@ -307,7 +307,7 @@ bool TransformBuilder::createTransformOperations(CSSValue* inValue, const Render
case CSSTransformValue::PerspectiveTransformOperation: {
Length p = Length(0, Fixed);
if (firstValue->isLength())
- p = convertToFloatLength(firstValue, style, rootStyle, zoomFactor);
+ p = convertToFloatLength(firstValue, conversionData);
else {
// This is a quirk that should go away when 3d transforms are finalized.
double val = firstValue->getDoubleValue();
« no previous file with comments | « Source/core/css/resolver/TransformBuilder.h ('k') | Source/core/css/resolver/ViewportStyleResolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698