Commit 590d7284 authored by Chany Arpin-Plante's avatar Chany Arpin-Plante Committed by Commit Bot

Fix CSS typed OM CSSSkewX and CSSSkewY toMatrix method to use degrees instead of radians.

The toMatrix method of a CSSTransformComponent should return a DOMMatrix
representing the object transformation.
https://www.w3.org/TR/css-typed-om-1/#dom-csstransformcomponent-tomatrix

The skewXSelf and skewYSelf methods used to apply a transformation on a
matrix must be provided with an angle parameter expressed in degrees.
https://www.w3.org/TR/geometry-1/#dom-dommatrix-skewxself
https://www.w3.org/TR/geometry-1/#dom-dommatrix-skewyself

Since the angles passed to the skewXSelf and skewYSelf were in radians,
DOMMatrix returned by the toMatrix method of those two components was incorrect.

R=alancutter@chromium.org

Change-Id: I5edc1cdf1493184584154723508c6e20c212ac92
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2242008
Commit-Queue: Alan Cutter <alancutter@chromium.org>
Reviewed-by: default avatarAlan Cutter <alancutter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#786632}
parent 65425cb2
......@@ -183,6 +183,7 @@ Changwan Hong <changwan.hong@navercorp.com>
Changyeon Kim <cyzero.kim@samsung.com>
Chanho Park <parkch98@gmail.com>
Chansik Yun <chansik.yun@gmail.com>
Chany Arpin-Plante <chany.arpin@gmail.com>
Chaobin Zhang <zhchbin@gmail.com>
Charles Vaughn <cvaughn@gmail.com>
Cheng Zhao <zcbenz@gmail.com>
......
......@@ -52,7 +52,7 @@ CSSSkewX* CSSSkewX::FromCSSValue(const CSSFunctionValue& value) {
}
DOMMatrix* CSSSkewX::toMatrix(ExceptionState&) const {
CSSUnitValue* ax = ax_->to(CSSPrimitiveValue::UnitType::kRadians);
CSSUnitValue* ax = ax_->to(CSSPrimitiveValue::UnitType::kDegrees);
DCHECK(ax);
DOMMatrix* result = DOMMatrix::Create();
result->skewXSelf(ax->value());
......
......@@ -52,7 +52,7 @@ CSSSkewY* CSSSkewY::FromCSSValue(const CSSFunctionValue& value) {
}
DOMMatrix* CSSSkewY::toMatrix(ExceptionState&) const {
CSSUnitValue* ay = ay_->to(CSSPrimitiveValue::UnitType::kRadians);
CSSUnitValue* ay = ay_->to(CSSPrimitiveValue::UnitType::kDegrees);
DCHECK(ay);
DOMMatrix* result = DOMMatrix::Create();
result->skewYSelf(ay->value());
......
......@@ -51,7 +51,7 @@ test(() => {
test(() => {
const component = new CSSSkewX(
new CSSUnitValue(10, 'rad'),
new CSSUnitValue(10, 'deg'),
);
const expectedMatrix = (new DOMMatrixReadOnly()).skewX(10);
assert_matrix_approx_equals(component.toMatrix(), expectedMatrix, gEpsilon);
......@@ -59,7 +59,7 @@ test(() => {
test(() => {
const component = new CSSSkewY(
new CSSUnitValue(10, 'rad'),
new CSSUnitValue(10, 'deg'),
);
const expectedMatrix = (new DOMMatrixReadOnly()).skewY(10);
assert_matrix_approx_equals(component.toMatrix(), expectedMatrix, gEpsilon);
......
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