Commit 182115f0 authored by Emil A Eklund's avatar Emil A Eklund Committed by Commit Bot

Revert "[CSS] Treat viewport-relative units as computationally independent"

This is a speculative revert in order to either confirm or eliminate it
as a source for a hard to track down persistent performance regression.

This reverts r679183 (commit 6b846d36).

Bug: 993476
Tbr: pdr@chromium.org
Change-Id: I37566d32fb0853590e72299fdc0f281c712bf027
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1764195
Commit-Queue: Emil A Eklund <eae@chromium.org>
Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#689475}
parent f87aad19
...@@ -126,14 +126,6 @@ bool CSSNumericLiteralValue::AccumulateLengthArray(CSSLengthArray& length_array, ...@@ -126,14 +126,6 @@ bool CSSNumericLiteralValue::AccumulateLengthArray(CSSLengthArray& length_array,
return true; return true;
} }
bool CSSNumericLiteralValue::IsComputationallyIndependent() const {
if (!IsLength())
return true;
if (IsViewportPercentageLength())
return true;
return !IsRelativeUnit(GetType());
}
static String FormatNumber(double number, const char* suffix) { static String FormatNumber(double number, const char* suffix) {
#if defined(OS_WIN) && _MSC_VER < 1900 #if defined(OS_WIN) && _MSC_VER < 1900
unsigned oldFormat = _set_output_format(_TWO_DIGIT_EXPONENT); unsigned oldFormat = _set_output_format(_TWO_DIGIT_EXPONENT);
......
...@@ -47,7 +47,9 @@ class CORE_EXPORT CSSNumericLiteralValue : public CSSPrimitiveValue { ...@@ -47,7 +47,9 @@ class CORE_EXPORT CSSNumericLiteralValue : public CSSPrimitiveValue {
bool IsZero() const { return !DoubleValue(); } bool IsZero() const { return !DoubleValue(); }
bool IsComputationallyIndependent() const; bool IsComputationallyIndependent() const {
return !IsLength() || !IsRelativeUnit(GetType());
}
double DoubleValue() const { return num_; } double DoubleValue() const { return num_; }
double ComputeSeconds() const; double ComputeSeconds() const;
......
...@@ -197,10 +197,9 @@ class CORE_EXPORT CSSPrimitiveValue : public CSSValue { ...@@ -197,10 +197,9 @@ class CORE_EXPORT CSSPrimitiveValue : public CSSValue {
static bool IsFlex(UnitType unit) { return unit == UnitType::kFraction; } static bool IsFlex(UnitType unit) { return unit == UnitType::kFraction; }
bool IsFlex() const; bool IsFlex() const;
// https://drafts.css-houdini.org/css-properties-values-api-1/#computationally-independent // Returns false when |this| is a length or a math function mixing percentage
// A property value is computationally independent if it can be converted into // with length, and relative length units are involved. Returns true in all
// a computed value using only the value of the property on the element, and // other cases.
// "global" information that cannot be changed by CSS.
bool IsComputationallyIndependent() const; bool IsComputationallyIndependent() const;
// Creates either a |CSSNumericLiteralValue| or a |CSSMathFunctionValue|, // Creates either a |CSSNumericLiteralValue| or a |CSSMathFunctionValue|,
......
...@@ -54,8 +54,6 @@ assert_valid("<percentage>", "-9.3e3%"); ...@@ -54,8 +54,6 @@ assert_valid("<percentage>", "-9.3e3%");
assert_valid("<length-percentage>", "-54%"); assert_valid("<length-percentage>", "-54%");
assert_valid("<length-percentage>", "0"); assert_valid("<length-percentage>", "0");
assert_valid("<length-percentage>", "calc(-11px + 10.4%)"); assert_valid("<length-percentage>", "calc(-11px + 10.4%)");
assert_valid("<length>", "10vmin");
assert_valid("<percentage> | <length>+", "calc(100vh - 10px) 30px");
assert_valid("<number>", "-109"); assert_valid("<number>", "-109");
assert_valid("<number>", "2.3e4"); assert_valid("<number>", "2.3e4");
...@@ -185,12 +183,14 @@ assert_invalid("<length>", "10%"); ...@@ -185,12 +183,14 @@ assert_invalid("<length>", "10%");
assert_invalid("<length>", "calc(5px + 10%)"); assert_invalid("<length>", "calc(5px + 10%)");
assert_invalid("<length>", "calc(5px * 3px / 6px)"); assert_invalid("<length>", "calc(5px * 3px / 6px)");
assert_invalid("<length>", "10em"); assert_invalid("<length>", "10em");
assert_invalid("<length>", "10vmin");
assert_invalid("<length>", "calc(4px + 3em)"); assert_invalid("<length>", "calc(4px + 3em)");
assert_invalid("<length>", "calc(4px + calc(8 * 2em))"); assert_invalid("<length>", "calc(4px + calc(8 * 2em))");
assert_invalid("<length>+", "calc(2ex + 16px)"); assert_invalid("<length>+", "calc(2ex + 16px)");
assert_invalid("<length>+", "10px calc(20px + 4rem)"); assert_invalid("<length>+", "10px calc(20px + 4rem)");
assert_invalid("<length>+", ""); assert_invalid("<length>+", "");
assert_invalid("<length>#", ""); assert_invalid("<length>#", "");
assert_invalid("<percentage> | <length>+", "calc(100vh - 10px) 30px");
assert_invalid("<length>", "10px;"); assert_invalid("<length>", "10px;");
assert_invalid("<length-percentage>", "calc(2px + 10% + 7ex)"); assert_invalid("<length-percentage>", "calc(2px + 10% + 7ex)");
assert_invalid("<percentage>", "0"); assert_invalid("<percentage>", "0");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment