diff options
Diffstat (limited to 'layout')
-rw-r--r-- | layout/style/nsCSSPseudoElements.h | 3 | ||||
-rw-r--r-- | layout/svg/nsSVGOuterSVGFrame.cpp | 44 | ||||
-rw-r--r-- | layout/svg/nsSVGOuterSVGFrame.h | 5 |
3 files changed, 37 insertions, 15 deletions
diff --git a/layout/style/nsCSSPseudoElements.h b/layout/style/nsCSSPseudoElements.h index 657ef663e..eaf8d966b 100644 --- a/layout/style/nsCSSPseudoElements.h +++ b/layout/style/nsCSSPseudoElements.h @@ -111,8 +111,7 @@ private: // which is a general gcc bug that we seem to have hit only on Android/x86. #if defined(ANDROID) && defined(__i386__) && defined(__GNUC__) && \ !defined(__clang__) -#if (MOZ_GCC_VERSION_AT_LEAST(4,8,0) && MOZ_GCC_VERSION_AT_MOST(4,8,4)) || \ - (MOZ_GCC_VERSION_AT_LEAST(4,9,0) && MOZ_GCC_VERSION_AT_MOST(4,9,2)) +#if (MOZ_GCC_VERSION_AT_LEAST(4,9,0) && MOZ_GCC_VERSION_AT_MOST(4,9,2)) __attribute__((noinline)) #endif #endif diff --git a/layout/svg/nsSVGOuterSVGFrame.cpp b/layout/svg/nsSVGOuterSVGFrame.cpp index 683f10bc7..aeadccbc5 100644 --- a/layout/svg/nsSVGOuterSVGFrame.cpp +++ b/layout/svg/nsSVGOuterSVGFrame.cpp @@ -979,21 +979,43 @@ nsSVGOuterSVGAnonChildFrame::GetType() const } bool -nsSVGOuterSVGAnonChildFrame::HasChildrenOnlyTransform(gfx::Matrix *aTransform) const +nsSVGOuterSVGAnonChildFrame::IsSVGTransformed(Matrix* aOwnTransform, + Matrix* aFromParentTransform) const { - // We must claim our nsSVGOuterSVGFrame's children-only transforms as our own - // so that the children we are used to wrap are transformed properly. + // Our elements 'transform' attribute is applied to our nsSVGOuterSVGFrame + // parent, and the element's children-only transforms are applied to us, the + // anonymous child frame. Since we are the child frame, we apply the + // children-only transforms as if they are our own transform. - SVGSVGElement *content = static_cast<SVGSVGElement*>(mContent); + SVGSVGElement* content = static_cast<SVGSVGElement*>(mContent); + + if (!content->HasChildrenOnlyTransform()) { + return false; + } + + // Outer-<svg> doesn't use x/y, so we can pass eChildToUserSpace here. + gfxMatrix ownMatrix = + content->PrependLocalTransformsTo(gfxMatrix(), eChildToUserSpace); - bool hasTransform = content->HasChildrenOnlyTransform(); + if (ownMatrix.IsIdentity()) { + return false; + } + + if (aOwnTransform) { + if (ownMatrix.HasNonTranslation()) { + // Note: viewBox, currentScale and currentTranslate should only + // produce a rectilinear transform. + // The nsDisplayTransform code will apply this transform to our frame, + // including to our frame position. We don't want our frame position to + // be scaled though, so we need to correct for that in the transform. + CSSPoint pos = CSSPixel::FromAppUnits(GetPosition()); + CSSPoint scaledPos = CSSPoint(ownMatrix._11 * pos.x, ownMatrix._22 * pos.y); + CSSPoint deltaPos = scaledPos - pos; + ownMatrix *= gfxMatrix::Translation(-deltaPos.x, -deltaPos.y); + } - if (hasTransform && aTransform) { - // Outer-<svg> doesn't use x/y, so we can pass eChildToUserSpace here. - gfxMatrix identity; - *aTransform = gfx::ToMatrix( - content->PrependLocalTransformsTo(identity, eChildToUserSpace)); + *aOwnTransform = gfx::ToMatrix(ownMatrix); } - return hasTransform; + return true; } diff --git a/layout/svg/nsSVGOuterSVGFrame.h b/layout/svg/nsSVGOuterSVGFrame.h index a08593678..6d29234ac 100644 --- a/layout/svg/nsSVGOuterSVGFrame.h +++ b/layout/svg/nsSVGOuterSVGFrame.h @@ -263,6 +263,9 @@ public: */ virtual nsIAtom* GetType() const override; + bool IsSVGTransformed(Matrix *aOwnTransform, + Matrix *aFromParentTransform) const override; + // nsSVGContainerFrame methods: virtual gfxMatrix GetCanvasTM() override { // GetCanvasTM returns the transform from an SVG frame to the frame's @@ -270,8 +273,6 @@ public: // set on us for any CSS border or padding on our nsSVGOuterSVGFrame. return static_cast<nsSVGOuterSVGFrame*>(GetParent())->GetCanvasTM(); } - - virtual bool HasChildrenOnlyTransform(Matrix *aTransform) const override; }; #endif |