SVG Text NG: Fix dynamic update of "transform" attribute

Bug: 1266389
Change-Id: Ic2ccb7d0c5cbda5c310b4455321dc30627d0e592
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3260674
Auto-Submit: Kent Tamura <tkent@chromium.org>
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#938204}
diff --git a/svg/coordinate-systems/svgtransformlist-replaceitem.html b/svg/coordinate-systems/svgtransformlist-replaceitem.html
new file mode 100644
index 0000000..3322dc9
--- /dev/null
+++ b/svg/coordinate-systems/svgtransformlist-replaceitem.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<link rel="help" href="https://svgwg.org/svg2-draft/coords.html#InterfaceSVGTransformList">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+
+<svg width="800" height="600" xmlns="http://www.w3.org/2000/svg">
+<text id="text" x="200" y="200"
+      transform="scale(1) translate(0 0)">123</text>
+<text id="ref" x="200" y="200"
+      transform="scale(10 1) translate(0 0)">123</text>
+</svg>
+
+<script>
+test(() => {
+  const referenceBox = document.querySelector('#ref').getBBox();
+  const root = document.querySelector('svg');
+  const text = document.querySelector('#text');
+
+  // Make the transform of #text same as #ref.
+  const scale = root.createSVGTransform();
+  scale.setScale(10, 1);
+  text.transform.baseVal.replaceItem(scale, 0);
+
+  const box = text.getBBox();
+  assert_equals(box.y, referenceBox.y);
+  assert_equals(box.height, referenceBox.height);
+}, 'Dynamic update of transform; replaceItem()');
+</script>
+</body>