mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 18:51:28 +00:00
Bug 1823269 - Simplify SVGUtils::GetCanvasTM r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D172948
This commit is contained in:
parent
19e0568f4d
commit
4efc5e5de1
@ -341,24 +341,24 @@ nsIFrame* SVGUtils::GetOuterSVGFrameAndCoveredRegion(nsIFrame* aFrame,
|
|||||||
gfxMatrix SVGUtils::GetCanvasTM(nsIFrame* aFrame) {
|
gfxMatrix SVGUtils::GetCanvasTM(nsIFrame* aFrame) {
|
||||||
// XXX yuck, we really need a common interface for GetCanvasTM
|
// XXX yuck, we really need a common interface for GetCanvasTM
|
||||||
|
|
||||||
if (!aFrame->IsFrameOfType(nsIFrame::eSVG)) {
|
if (!aFrame->HasAnyStateBits(NS_FRAME_SVG_LAYOUT)) {
|
||||||
return GetCSSPxToDevPxMatrix(aFrame);
|
return GetCSSPxToDevPxMatrix(aFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutFrameType type = aFrame->Type();
|
if (aFrame->IsSVGForeignObjectFrame()) {
|
||||||
if (type == LayoutFrameType::SVGForeignObject) {
|
|
||||||
return static_cast<SVGForeignObjectFrame*>(aFrame)->GetCanvasTM();
|
return static_cast<SVGForeignObjectFrame*>(aFrame)->GetCanvasTM();
|
||||||
}
|
}
|
||||||
if (type == LayoutFrameType::SVGOuterSVG) {
|
|
||||||
return GetCSSPxToDevPxMatrix(aFrame);
|
|
||||||
}
|
|
||||||
|
|
||||||
SVGContainerFrame* containerFrame = do_QueryFrame(aFrame);
|
if (SVGContainerFrame* containerFrame = do_QueryFrame(aFrame)) {
|
||||||
if (containerFrame) {
|
|
||||||
return containerFrame->GetCanvasTM();
|
return containerFrame->GetCanvasTM();
|
||||||
}
|
}
|
||||||
|
|
||||||
return static_cast<SVGGeometryFrame*>(aFrame)->GetCanvasTM();
|
MOZ_ASSERT(aFrame->GetParent()->IsFrameOfType(nsIFrame::eSVGContainer));
|
||||||
|
|
||||||
|
auto* parent = static_cast<SVGContainerFrame*>(aFrame->GetParent());
|
||||||
|
auto* content = static_cast<SVGElement*>(aFrame->GetContent());
|
||||||
|
|
||||||
|
return content->PrependLocalTransformsTo(parent->GetCanvasTM());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SVGUtils::IsSVGTransformed(const nsIFrame* aFrame,
|
bool SVGUtils::IsSVGTransformed(const nsIFrame* aFrame,
|
||||||
|
Loading…
Reference in New Issue
Block a user