mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1921662 - Ignore transform-origin and such shenanigans in SVGGeometryElement::LocalTransform. r=longsonr a=RyanVM
We don't want the offsetted matrix, just the actual transform matrix specified on the element. Differential Revision: https://phabricator.services.mozilla.com/D224217
This commit is contained in:
parent
4456fe38a3
commit
6a7b110017
@ -15,6 +15,7 @@
|
||||
#include "SVGGeometryProperty.h"
|
||||
#include "SVGPathElement.h"
|
||||
#include "SVGRectElement.h"
|
||||
#include "nsStyleTransformMatrix.h"
|
||||
#include "mozilla/dom/DOMPointBinding.h"
|
||||
#include "mozilla/dom/SVGLengthBinding.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
@ -248,9 +249,15 @@ gfx::Matrix SVGGeometryElement::LocalTransform() const {
|
||||
if (!f || !f->IsTransformed()) {
|
||||
return result;
|
||||
}
|
||||
Matrix4x4Flagged matrix = nsDisplayTransform::GetResultingTransformMatrix(
|
||||
f, nsPoint(), f->PresContext()->AppUnitsPerDevPixel(),
|
||||
nsDisplayTransform::INCLUDE_PERSPECTIVE);
|
||||
nsStyleTransformMatrix::TransformReferenceBox refBox(f);
|
||||
const float a2d = f->PresContext()->AppUnitsPerDevPixel();
|
||||
nsDisplayTransform::FrameTransformProperties props(f, refBox, a2d);
|
||||
if (!props.HasTransform()) {
|
||||
return result;
|
||||
}
|
||||
auto matrix = nsStyleTransformMatrix::ReadTransforms(
|
||||
props.mTranslate, props.mRotate, props.mScale,
|
||||
props.mMotion.ptrOr(nullptr), props.mTransform, refBox, a2d);
|
||||
if (!matrix.IsIdentity()) {
|
||||
std::ignore = matrix.CanDraw2D(&result);
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
<!doctype html>
|
||||
<svg width="200" height="200" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<path id="guide" d="M 0 100 H 200" stroke="black" stroke-width="2" />
|
||||
<text x="0" y="0">
|
||||
<textPath xlink:href="#guide" font-size="40">XXXX</textPath>
|
||||
</text>
|
||||
</svg>
|
@ -0,0 +1,12 @@
|
||||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
|
||||
<link rel="author" title="Mozilla" href="https://mozilla.org">
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1921662">
|
||||
<link rel="match" href="text-path-transformed-ref.html">
|
||||
<svg width="200" height="200" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<path id="guide" d="M 0 50 H 200" stroke="black" transform="scale(2)" />
|
||||
<text x="0" y="0">
|
||||
<textPath xlink:href="#guide" font-size="40">XXXX</textPath>
|
||||
</text>
|
||||
</svg>
|
Loading…
Reference in New Issue
Block a user