Commit be9eef8a authored by Hwanseung Lee's avatar Hwanseung Lee Committed by Commit Bot

[css-typed-om] is2D attribute should be not have default value

CSSMatrixComponentOptions's is2D should be not have default value
present, it has default value as false.
when second paramter is not CSSMatrixComponentOptions
in CSSMatrixComponent's constructor, is2D will be false.
it seems work well like spec but it was not match spec.
so sync up with spec.

https://drafts.css-houdini.org/css-typed-om-1/#dictdef-cssmatrixcomponentoptions

Bug: 795151
Change-Id: Ib6ac6ad3793b029d079f50d787994b4bf058b7fe
Reviewed-on: https://chromium-review.googlesource.com/824282
Commit-Queue: Darren Shen <shend@chromium.org>
Reviewed-by: default avatarDarren Shen <shend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524341}
parent 91db9942
...@@ -71,6 +71,19 @@ for (let params of testParams) { ...@@ -71,6 +71,19 @@ for (let params of testParams) {
}, "toString is correct for " + params.cssText); }, "toString is correct for " + params.cssText);
} }
test(() => {
for (let param of testParams) {
let matrixComponent = new CSSMatrixComponent(param.input, {});
assert_equals(matrixComponent.is2D, param.input.is2D);
matrixComponent = new CSSMatrixComponent(param.input, {is2D: undefined});
assert_equals(matrixComponent.is2D, param.input.is2D);
matrixComponent = new CSSMatrixComponent(param.input, undefined);
assert_equals(matrixComponent.is2D, param.input.is2D);
matrixComponent = new CSSMatrixComponent(param.input, null);
assert_equals(matrixComponent.is2D, param.input.is2D);
}
}, "is2D value should be matrix's is2D when second parameter is not CSSMatrixComponentOptions");
test(() => { test(() => {
assert_throws(new TypeError(), () => { new CSSMatrixComponent(); }); assert_throws(new TypeError(), () => { new CSSMatrixComponent(); });
assert_throws(new TypeError(), () => { new CSSMatrixComponent(0); }); assert_throws(new TypeError(), () => { new CSSMatrixComponent(0); });
......
...@@ -29,7 +29,8 @@ DOMMatrix* To2DMatrix(DOMMatrixReadOnly* matrix) { ...@@ -29,7 +29,8 @@ DOMMatrix* To2DMatrix(DOMMatrixReadOnly* matrix) {
CSSMatrixComponent* CSSMatrixComponent::Create( CSSMatrixComponent* CSSMatrixComponent::Create(
DOMMatrixReadOnly* matrix, DOMMatrixReadOnly* matrix,
const CSSMatrixComponentOptions& options) { const CSSMatrixComponentOptions& options) {
return new CSSMatrixComponent(matrix, options.is2D() || matrix->is2D()); return new CSSMatrixComponent(
matrix, options.hasIs2D() ? options.is2D() : matrix->is2D());
} }
const DOMMatrix* CSSMatrixComponent::AsMatrix(ExceptionState&) const { const DOMMatrix* CSSMatrixComponent::AsMatrix(ExceptionState&) const {
......
...@@ -5,6 +5,6 @@ ...@@ -5,6 +5,6 @@
// Options for creating a CSSMatrixComponent. See CSSMatrixComponent for usage. // Options for creating a CSSMatrixComponent. See CSSMatrixComponent for usage.
// Spec: https://drafts.css-houdini.org/css-typed-om/#dictdef-cssmatrixcomponentoptions // Spec: https://drafts.css-houdini.org/css-typed-om/#dictdef-cssmatrixcomponentoptions
dictionary CSSMatrixComponentOptions { dictionary CSSMatrixComponentOptions {
boolean is2D = false; boolean is2D;
}; };
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