Commit 18c14a13 authored by Aaron Krajeski's avatar Aaron Krajeski Committed by Chromium LUCI CQ

Make constructors for blink::TransformationMatrix explicit

I lost a few hours to this when changing a signature and having no idea
what was going on:

https://chromium-review.googlesource.com/c/chromium/src/+/2564189

I guess they're against the style guide for a reason!

Bug: 1140535
Change-Id: I79b534db6b1752b73689cb032aaa24a0e326ac38
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2564817Reviewed-by: default avatarAlexander Cooper <alcooper@chromium.org>
Reviewed-by: default avatarFernando Serboncini <fserb@chromium.org>
Reviewed-by: default avatarJuanmi Huertas <juanmihd@chromium.org>
Commit-Queue: Aaron Krajeski <aaronhk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832014}
parent 0fcfe4c1
......@@ -297,7 +297,7 @@ DOMMatrix* DOMMatrix::invertSelf() {
if (is2d_) {
AffineTransform affine_transform = matrix_.ToAffineTransform();
if (affine_transform.IsInvertible()) {
matrix_ = affine_transform.Inverse();
matrix_ = TransformationMatrix(affine_transform.Inverse());
return this;
}
} else {
......
......@@ -210,10 +210,11 @@ const LayoutObject* SVGLayoutSupport::PushMappingToContainer(
if (parent->IsSVGRoot()) {
TransformationMatrix matrix(
To<LayoutSVGRoot>(parent)->LocalToBorderBoxTransform());
matrix.Multiply(object->LocalToSVGParentTransform());
matrix.Multiply(TransformationMatrix(object->LocalToSVGParentTransform()));
geometry_map.Push(object, matrix);
} else {
geometry_map.Push(object, object->LocalToSVGParentTransform());
geometry_map.Push(
object, TransformationMatrix(object->LocalToSVGParentTransform()));
}
return parent;
......
......@@ -477,8 +477,8 @@ AffineTransform SVGSVGElement::LocalCoordinateSpaceTransform(
// At the SVG/HTML boundary (aka LayoutSVGRoot), we need to apply the
// localToBorderBoxTransform to map an element from SVG viewport
// coordinates to CSS box coordinates.
matrix.Multiply(
To<LayoutSVGRoot>(layout_object)->LocalToBorderBoxTransform());
matrix.Multiply(TransformationMatrix(
To<LayoutSVGRoot>(layout_object)->LocalToBorderBoxTransform()));
// Drop any potential non-affine parts, because we're not able to convey
// that information further anyway until getScreenCTM returns a DOMMatrix
// (4x4 matrix.)
......
......@@ -71,7 +71,7 @@ base::Optional<TransformationMatrix> XRAnchor::MojoFromObject() const {
return base::nullopt;
}
return mojo_from_anchor_->ToTransform().matrix();
return TransformationMatrix(mojo_from_anchor_->ToTransform().matrix());
}
void XRAnchor::Delete() {
......
......@@ -27,8 +27,8 @@ XRPose* XRHitTestResult::getPose(XRSpace* other) {
auto maybe_other_space_native_from_mojo = other->NativeFromMojo();
DCHECK(maybe_other_space_native_from_mojo);
blink::TransformationMatrix mojo_from_this =
mojo_from_this_.ToTransform().matrix();
auto mojo_from_this =
TransformationMatrix(mojo_from_this_.ToTransform().matrix());
auto other_native_from_mojo = *maybe_other_space_native_from_mojo;
auto other_offset_from_other_native = other->OffsetFromNativeMatrix();
......@@ -77,7 +77,8 @@ ScriptPromise XRHitTestResult::createAnchor(ScriptState* script_state,
auto space_from_mojo = mojo_from_space.Inverse();
auto space_from_anchor =
space_from_mojo * (mojo_from_this_.ToTransform().matrix());
space_from_mojo *
TransformationMatrix(mojo_from_this_.ToTransform().matrix());
if (plane_id_) {
DVLOG(2) << __func__
......
......@@ -42,7 +42,7 @@ base::Optional<TransformationMatrix> XRImageTrackingResult::MojoFromObject()
return base::nullopt;
}
return mojo_from_this_->ToTransform().matrix();
return TransformationMatrix(mojo_from_this_->ToTransform().matrix());
}
XRSpace* XRImageTrackingResult::imageSpace() const {
......
......@@ -63,7 +63,7 @@ base::Optional<TransformationMatrix> XRPlane::MojoFromObject() const {
return base::nullopt;
}
return mojo_from_plane_->ToTransform().matrix();
return TransformationMatrix(mojo_from_plane_->ToTransform().matrix());
}
String XRPlane::orientation() const {
......@@ -127,7 +127,8 @@ ScriptPromise XRPlane::createAnchor(ScriptState* script_state,
auto space_from_mojo = mojo_from_space.Inverse();
// We'll create an anchor located at the current plane's pose:
auto space_from_anchor =
space_from_mojo * (mojo_from_plane_->ToTransform().matrix());
space_from_mojo *
TransformationMatrix(mojo_from_plane_->ToTransform().matrix());
return session_->CreatePlaneAnchorHelper(
script_state, space_from_anchor,
......
......@@ -83,7 +83,7 @@ class PLATFORM_EXPORT TransformationMatrix {
TransformationMatrix() {
MakeIdentity();
}
TransformationMatrix(const AffineTransform&);
explicit TransformationMatrix(const AffineTransform&);
TransformationMatrix(const TransformationMatrix& t) {
*this = t;
}
......@@ -114,7 +114,7 @@ class PLATFORM_EXPORT TransformationMatrix {
SetMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41,
m42, m43, m44);
}
TransformationMatrix(const SkMatrix44& matrix) {
explicit TransformationMatrix(const SkMatrix44& matrix) {
SetMatrix(
matrix.get(0, 0), matrix.get(1, 0), matrix.get(2, 0), matrix.get(3, 0),
matrix.get(0, 1), matrix.get(1, 1), matrix.get(2, 1), matrix.get(3, 1),
......
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