2005-01-25 06:55:03 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2005-01-25 06:55:03 +03:00
|
|
|
|
2012-03-26 15:58:59 +04:00
|
|
|
// Main header first:
|
2012-03-20 16:15:55 +04:00
|
|
|
#include "nsSVGClipPathFrame.h"
|
|
|
|
|
2012-03-26 15:58:59 +04:00
|
|
|
// Keep others in (case-insensitive) order:
|
|
|
|
#include "gfxContext.h"
|
|
|
|
#include "nsGkAtoms.h"
|
2012-03-20 16:15:55 +04:00
|
|
|
#include "nsRenderingContext.h"
|
2013-01-18 23:52:40 +04:00
|
|
|
#include "mozilla/dom/SVGClipPathElement.h"
|
2012-03-26 15:58:59 +04:00
|
|
|
#include "nsSVGEffects.h"
|
|
|
|
#include "nsSVGUtils.h"
|
2005-01-25 06:55:03 +03:00
|
|
|
|
2013-01-18 23:52:40 +04:00
|
|
|
using namespace mozilla::dom;
|
|
|
|
|
2005-01-25 06:55:03 +03:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Implementation
|
|
|
|
|
2005-11-11 05:36:29 +03:00
|
|
|
nsIFrame*
|
2009-01-19 21:31:34 +03:00
|
|
|
NS_NewSVGClipPathFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
2005-01-25 06:55:03 +03:00
|
|
|
{
|
2006-03-27 01:30:36 +04:00
|
|
|
return new (aPresShell) nsSVGClipPathFrame(aContext);
|
2005-01-25 06:55:03 +03:00
|
|
|
}
|
|
|
|
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_IMPL_FRAMEARENA_HELPERS(nsSVGClipPathFrame)
|
|
|
|
|
2007-04-17 13:01:52 +04:00
|
|
|
nsresult
|
2012-03-02 12:28:59 +04:00
|
|
|
nsSVGClipPathFrame::ClipPaint(nsRenderingContext* aContext,
|
2008-09-11 04:24:16 +04:00
|
|
|
nsIFrame* aParent,
|
2009-07-23 12:35:59 +04:00
|
|
|
const gfxMatrix &aMatrix)
|
2005-01-25 06:55:03 +03:00
|
|
|
{
|
2006-02-09 22:34:01 +03:00
|
|
|
// If the flag is set when we get here, it means this clipPath frame
|
|
|
|
// has already been used painting the current clip, and the document
|
|
|
|
// has a clip reference loop.
|
|
|
|
if (mInUse) {
|
|
|
|
NS_WARNING("Clip loop detected!");
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2007-04-17 13:01:52 +04:00
|
|
|
AutoClipPathReferencer clipRef(this);
|
2006-02-09 22:34:01 +03:00
|
|
|
|
2010-02-26 12:58:42 +03:00
|
|
|
mClipParent = aParent;
|
2011-09-26 01:04:32 +04:00
|
|
|
if (mClipParentMatrix) {
|
|
|
|
*mClipParentMatrix = aMatrix;
|
|
|
|
} else {
|
|
|
|
mClipParentMatrix = new gfxMatrix(aMatrix);
|
|
|
|
}
|
2005-01-25 06:55:03 +03:00
|
|
|
|
2012-06-15 13:06:34 +04:00
|
|
|
gfxContext *gfx = aContext->ThebesContext();
|
2006-01-20 20:00:43 +03:00
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
nsISVGChildFrame *singleClipPathChild = nullptr;
|
2005-01-25 06:55:03 +03:00
|
|
|
|
2012-06-15 13:06:34 +04:00
|
|
|
if (IsTrivial(&singleClipPathChild)) {
|
|
|
|
// Notify our child that it's painting as part of a clipPath, and that
|
|
|
|
// we only require it to draw its path (it should skip filling, etc.):
|
|
|
|
SVGAutoRenderState mode(aContext, SVGAutoRenderState::CLIP);
|
|
|
|
|
|
|
|
if (!singleClipPathChild) {
|
|
|
|
// We have no children - the spec says clip away everything:
|
|
|
|
gfx->Rectangle(gfxRect());
|
|
|
|
} else {
|
|
|
|
singleClipPathChild->NotifySVGChanged(
|
|
|
|
nsISVGChildFrame::TRANSFORM_CHANGED);
|
2012-07-30 18:20:58 +04:00
|
|
|
singleClipPathChild->PaintSVG(aContext, nullptr);
|
2012-06-15 13:06:34 +04:00
|
|
|
}
|
|
|
|
gfx->Clip();
|
|
|
|
gfx->NewPath();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2010-02-26 12:58:42 +03:00
|
|
|
|
2012-06-15 13:06:34 +04:00
|
|
|
// Seems like this is a non-trivial clipPath, so we need to use a clip mask.
|
|
|
|
|
|
|
|
// Notify our children that they're painting into a clip mask:
|
|
|
|
SVGAutoRenderState mode(aContext, SVGAutoRenderState::CLIP_MASK);
|
|
|
|
|
|
|
|
// Check if this clipPath is itself clipped by another clipPath:
|
2010-02-26 12:58:42 +03:00
|
|
|
nsSVGClipPathFrame *clipPathFrame =
|
2012-07-30 18:20:58 +04:00
|
|
|
nsSVGEffects::GetEffectProperties(this).GetClipPathFrame(nullptr);
|
2011-09-29 10:19:26 +04:00
|
|
|
bool referencedClipIsTrivial;
|
2010-02-26 12:58:42 +03:00
|
|
|
if (clipPathFrame) {
|
|
|
|
referencedClipIsTrivial = clipPathFrame->IsTrivial();
|
|
|
|
gfx->Save();
|
|
|
|
if (referencedClipIsTrivial) {
|
|
|
|
clipPathFrame->ClipPaint(aContext, aParent, aMatrix);
|
|
|
|
} else {
|
2014-01-23 22:26:40 +04:00
|
|
|
gfx->PushGroup(gfxContentType::ALPHA);
|
2010-02-26 12:58:42 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-01-25 06:55:03 +03:00
|
|
|
for (nsIFrame* kid = mFrames.FirstChild(); kid;
|
|
|
|
kid = kid->GetNextSibling()) {
|
2009-01-12 22:20:59 +03:00
|
|
|
nsISVGChildFrame* SVGFrame = do_QueryFrame(kid);
|
2005-01-25 06:55:03 +03:00
|
|
|
if (SVGFrame) {
|
2008-01-25 12:27:03 +03:00
|
|
|
// The CTM of each frame referencing us can be different.
|
2012-07-23 15:00:43 +04:00
|
|
|
SVGFrame->NotifySVGChanged(nsISVGChildFrame::TRANSFORM_CHANGED);
|
2010-02-26 12:58:42 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool isOK = true;
|
2010-02-26 12:58:42 +03:00
|
|
|
nsSVGClipPathFrame *clipPathFrame =
|
|
|
|
nsSVGEffects::GetEffectProperties(kid).GetClipPathFrame(&isOK);
|
2010-03-02 12:31:07 +03:00
|
|
|
if (!isOK) {
|
|
|
|
continue;
|
|
|
|
}
|
2010-02-26 12:58:42 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool isTrivial;
|
2010-02-26 12:58:42 +03:00
|
|
|
|
|
|
|
if (clipPathFrame) {
|
|
|
|
isTrivial = clipPathFrame->IsTrivial();
|
|
|
|
gfx->Save();
|
|
|
|
if (isTrivial) {
|
|
|
|
clipPathFrame->ClipPaint(aContext, aParent, aMatrix);
|
|
|
|
} else {
|
2014-01-23 22:26:40 +04:00
|
|
|
gfx->PushGroup(gfxContentType::ALPHA);
|
2010-02-26 12:58:42 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
SVGFrame->PaintSVG(aContext, nullptr);
|
2010-02-26 12:58:42 +03:00
|
|
|
|
|
|
|
if (clipPathFrame) {
|
|
|
|
if (!isTrivial) {
|
|
|
|
gfx->PopGroupToSource();
|
|
|
|
|
|
|
|
nsRefPtr<gfxPattern> clipMaskSurface;
|
2014-01-23 22:26:40 +04:00
|
|
|
gfx->PushGroup(gfxContentType::ALPHA);
|
2010-02-26 12:58:42 +03:00
|
|
|
|
|
|
|
clipPathFrame->ClipPaint(aContext, aParent, aMatrix);
|
|
|
|
clipMaskSurface = gfx->PopGroup();
|
|
|
|
|
|
|
|
if (clipMaskSurface) {
|
|
|
|
gfx->Mask(clipMaskSurface);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gfx->Restore();
|
|
|
|
}
|
2005-01-25 06:55:03 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-26 12:58:42 +03:00
|
|
|
if (clipPathFrame) {
|
|
|
|
if (!referencedClipIsTrivial) {
|
|
|
|
gfx->PopGroupToSource();
|
|
|
|
|
|
|
|
nsRefPtr<gfxPattern> clipMaskSurface;
|
2014-01-23 22:26:40 +04:00
|
|
|
gfx->PushGroup(gfxContentType::ALPHA);
|
2010-02-26 12:58:42 +03:00
|
|
|
|
|
|
|
clipPathFrame->ClipPaint(aContext, aParent, aMatrix);
|
|
|
|
clipMaskSurface = gfx->PopGroup();
|
|
|
|
|
|
|
|
if (clipMaskSurface) {
|
|
|
|
gfx->Mask(clipMaskSurface);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gfx->Restore();
|
|
|
|
}
|
|
|
|
|
2005-01-25 06:55:03 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
2008-09-11 04:24:16 +04:00
|
|
|
nsSVGClipPathFrame::ClipHitTest(nsIFrame* aParent,
|
2009-07-23 12:35:59 +04:00
|
|
|
const gfxMatrix &aMatrix,
|
2008-08-25 13:23:54 +04:00
|
|
|
const nsPoint &aPoint)
|
2005-01-25 06:55:03 +03:00
|
|
|
{
|
2006-02-09 22:34:01 +03:00
|
|
|
// If the flag is set when we get here, it means this clipPath frame
|
|
|
|
// has already been used in hit testing against the current clip,
|
|
|
|
// and the document has a clip reference loop.
|
|
|
|
if (mInUse) {
|
|
|
|
NS_WARNING("Clip loop detected!");
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2006-02-09 22:34:01 +03:00
|
|
|
}
|
2007-04-17 13:01:52 +04:00
|
|
|
AutoClipPathReferencer clipRef(this);
|
2006-02-09 22:34:01 +03:00
|
|
|
|
2010-02-26 12:58:42 +03:00
|
|
|
mClipParent = aParent;
|
2011-09-26 01:04:32 +04:00
|
|
|
if (mClipParentMatrix) {
|
|
|
|
*mClipParentMatrix = aMatrix;
|
|
|
|
} else {
|
|
|
|
mClipParentMatrix = new gfxMatrix(aMatrix);
|
|
|
|
}
|
2005-01-25 06:55:03 +03:00
|
|
|
|
2010-02-26 12:58:42 +03:00
|
|
|
nsSVGClipPathFrame *clipPathFrame =
|
2012-07-30 18:20:58 +04:00
|
|
|
nsSVGEffects::GetEffectProperties(this).GetClipPathFrame(nullptr);
|
2010-02-26 12:58:42 +03:00
|
|
|
if (clipPathFrame && !clipPathFrame->ClipHitTest(aParent, aMatrix, aPoint))
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2010-02-26 12:58:42 +03:00
|
|
|
|
2005-01-25 06:55:03 +03:00
|
|
|
for (nsIFrame* kid = mFrames.FirstChild(); kid;
|
|
|
|
kid = kid->GetNextSibling()) {
|
2009-01-12 22:20:59 +03:00
|
|
|
nsISVGChildFrame* SVGFrame = do_QueryFrame(kid);
|
2005-01-25 06:55:03 +03:00
|
|
|
if (SVGFrame) {
|
2005-11-16 22:57:47 +03:00
|
|
|
// Notify the child frame that we may be working with a
|
|
|
|
// different transform, so it can update its covered region
|
|
|
|
// (used to shortcut hit testing).
|
2008-01-25 12:27:03 +03:00
|
|
|
SVGFrame->NotifySVGChanged(nsISVGChildFrame::TRANSFORM_CHANGED);
|
2005-11-16 22:57:47 +03:00
|
|
|
|
2008-08-25 13:23:54 +04:00
|
|
|
if (SVGFrame->GetFrameForPoint(aPoint))
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2005-01-25 06:55:03 +03:00
|
|
|
}
|
|
|
|
}
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2005-01-25 06:55:03 +03:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
2012-06-15 13:06:34 +04:00
|
|
|
nsSVGClipPathFrame::IsTrivial(nsISVGChildFrame **aSingleChild)
|
2006-01-20 20:00:43 +03:00
|
|
|
{
|
2010-02-26 12:58:42 +03:00
|
|
|
// If the clip path is clipped then it's non-trivial
|
2012-07-30 18:20:58 +04:00
|
|
|
if (nsSVGEffects::GetEffectProperties(this).GetClipPathFrame(nullptr))
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2010-02-26 12:58:42 +03:00
|
|
|
|
2012-06-15 13:06:34 +04:00
|
|
|
if (aSingleChild) {
|
2012-07-30 18:20:58 +04:00
|
|
|
*aSingleChild = nullptr;
|
2012-06-15 13:06:34 +04:00
|
|
|
}
|
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
nsISVGChildFrame *foundChild = nullptr;
|
2006-01-20 20:00:43 +03:00
|
|
|
|
|
|
|
for (nsIFrame* kid = mFrames.FirstChild(); kid;
|
|
|
|
kid = kid->GetNextSibling()) {
|
2009-01-12 22:20:59 +03:00
|
|
|
nsISVGChildFrame *svgChild = do_QueryFrame(kid);
|
2006-06-29 02:04:48 +04:00
|
|
|
if (svgChild) {
|
|
|
|
// We consider a non-trivial clipPath to be one containing
|
|
|
|
// either more than one svg child and/or a svg container
|
2007-04-17 13:01:52 +04:00
|
|
|
if (foundChild || svgChild->IsDisplayContainer())
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2010-02-26 12:58:42 +03:00
|
|
|
|
|
|
|
// or where the child is itself clipped
|
2012-07-30 18:20:58 +04:00
|
|
|
if (nsSVGEffects::GetEffectProperties(kid).GetClipPathFrame(nullptr))
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2010-02-26 12:58:42 +03:00
|
|
|
|
2012-06-15 13:06:34 +04:00
|
|
|
foundChild = svgChild;
|
2006-01-20 20:00:43 +03:00
|
|
|
}
|
|
|
|
}
|
2012-06-15 13:06:34 +04:00
|
|
|
if (aSingleChild) {
|
|
|
|
*aSingleChild = foundChild;
|
|
|
|
}
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2006-01-20 20:00:43 +03:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
2010-03-02 12:31:07 +03:00
|
|
|
nsSVGClipPathFrame::IsValid()
|
|
|
|
{
|
|
|
|
if (mInUse) {
|
|
|
|
NS_WARNING("Clip loop detected!");
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2010-03-02 12:31:07 +03:00
|
|
|
}
|
|
|
|
AutoClipPathReferencer clipRef(this);
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool isOK = true;
|
2010-03-02 12:31:07 +03:00
|
|
|
nsSVGEffects::GetEffectProperties(this).GetClipPathFrame(&isOK);
|
|
|
|
if (!isOK) {
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2010-03-02 12:31:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
for (nsIFrame* kid = mFrames.FirstChild(); kid;
|
|
|
|
kid = kid->GetNextSibling()) {
|
|
|
|
|
|
|
|
nsIAtom *type = kid->GetType();
|
|
|
|
|
|
|
|
if (type == nsGkAtoms::svgUseFrame) {
|
2011-08-25 00:54:30 +04:00
|
|
|
for (nsIFrame* grandKid = kid->GetFirstPrincipalChild(); grandKid;
|
2010-03-02 12:31:07 +03:00
|
|
|
grandKid = grandKid->GetNextSibling()) {
|
|
|
|
|
|
|
|
nsIAtom *type = grandKid->GetType();
|
|
|
|
|
|
|
|
if (type != nsGkAtoms::svgPathGeometryFrame &&
|
2013-12-20 20:38:51 +04:00
|
|
|
type != nsGkAtoms::svgTextFrame) {
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2010-03-02 12:31:07 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (type != nsGkAtoms::svgPathGeometryFrame &&
|
2013-12-20 20:38:51 +04:00
|
|
|
type != nsGkAtoms::svgTextFrame) {
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2010-03-02 12:31:07 +03:00
|
|
|
}
|
|
|
|
}
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2010-03-02 12:31:07 +03:00
|
|
|
}
|
|
|
|
|
2014-02-18 11:47:48 +04:00
|
|
|
nsresult
|
2012-08-22 19:56:38 +04:00
|
|
|
nsSVGClipPathFrame::AttributeChanged(int32_t aNameSpaceID,
|
2010-03-24 19:54:48 +03:00
|
|
|
nsIAtom* aAttribute,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aModType)
|
2010-03-24 19:54:48 +03:00
|
|
|
{
|
2011-09-19 16:59:52 +04:00
|
|
|
if (aNameSpaceID == kNameSpaceID_None) {
|
|
|
|
if (aAttribute == nsGkAtoms::transform) {
|
2012-06-23 18:18:49 +04:00
|
|
|
nsSVGEffects::InvalidateDirectRenderingObservers(this);
|
2011-09-19 16:59:52 +04:00
|
|
|
nsSVGUtils::NotifyChildrenOfSVGChange(this,
|
|
|
|
nsISVGChildFrame::TRANSFORM_CHANGED);
|
|
|
|
}
|
|
|
|
if (aAttribute == nsGkAtoms::clipPathUnits) {
|
|
|
|
nsSVGEffects::InvalidateRenderingObservers(this);
|
|
|
|
}
|
2010-03-24 19:54:48 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return nsSVGClipPathFrameBase::AttributeChanged(aNameSpaceID,
|
|
|
|
aAttribute, aModType);
|
|
|
|
}
|
|
|
|
|
2013-03-20 05:47:48 +04:00
|
|
|
void
|
2009-01-19 21:31:34 +03:00
|
|
|
nsSVGClipPathFrame::Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow)
|
|
|
|
{
|
2013-01-08 07:22:41 +04:00
|
|
|
NS_ASSERTION(aContent->IsSVG(nsGkAtoms::clipPath),
|
|
|
|
"Content is not an SVG clipPath!");
|
2009-01-19 21:31:34 +03:00
|
|
|
|
2010-12-06 23:57:18 +03:00
|
|
|
AddStateBits(NS_STATE_SVG_CLIPPATH_CHILD);
|
2013-03-20 05:47:48 +04:00
|
|
|
nsSVGClipPathFrameBase::Init(aContent, aParent, aPrevInFlow);
|
2009-01-19 21:31:34 +03:00
|
|
|
}
|
|
|
|
|
2005-04-01 23:56:08 +04:00
|
|
|
nsIAtom *
|
|
|
|
nsSVGClipPathFrame::GetType() const
|
|
|
|
{
|
2006-12-26 20:47:52 +03:00
|
|
|
return nsGkAtoms::svgClipPathFrame;
|
2005-04-01 23:56:08 +04:00
|
|
|
}
|
|
|
|
|
2009-04-29 08:31:34 +04:00
|
|
|
gfxMatrix
|
2013-09-11 11:27:45 +04:00
|
|
|
nsSVGClipPathFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot)
|
2005-01-25 06:55:03 +03:00
|
|
|
{
|
2013-01-18 23:52:40 +04:00
|
|
|
SVGClipPathElement *content = static_cast<SVGClipPathElement*>(mContent);
|
2007-04-27 12:42:51 +04:00
|
|
|
|
2013-12-27 00:13:57 +04:00
|
|
|
gfxMatrix tm =
|
2012-02-17 12:12:47 +04:00
|
|
|
content->PrependLocalTransformsTo(mClipParentMatrix ?
|
2013-12-27 00:13:57 +04:00
|
|
|
*mClipParentMatrix : gfxMatrix());
|
2006-04-20 19:24:51 +04:00
|
|
|
|
2013-12-27 00:13:57 +04:00
|
|
|
return nsSVGUtils::AdjustMatrixForUnits(tm,
|
2013-01-18 23:52:40 +04:00
|
|
|
&content->mEnumAttributes[SVGClipPathElement::CLIPPATHUNITS],
|
2007-12-04 07:40:52 +03:00
|
|
|
mClipParent);
|
2005-01-25 06:55:03 +03:00
|
|
|
}
|
2014-05-13 05:24:35 +04:00
|
|
|
|
|
|
|
SVGBBox
|
|
|
|
nsSVGClipPathFrame::GetBBoxForClipPathFrame(const SVGBBox &aBBox,
|
|
|
|
const gfxMatrix &aMatrix)
|
|
|
|
{
|
|
|
|
nsIContent* node = GetContent()->GetFirstChild();
|
|
|
|
SVGBBox unionBBox, tmpBBox;
|
|
|
|
for (; node; node = node->GetNextSibling()) {
|
|
|
|
nsIFrame *frame =
|
|
|
|
static_cast<nsSVGElement*>(node)->GetPrimaryFrame();
|
|
|
|
if (frame) {
|
|
|
|
nsISVGChildFrame *svg = do_QueryFrame(frame);
|
|
|
|
if (svg) {
|
|
|
|
tmpBBox = svg->GetBBoxContribution(mozilla::gfx::ToMatrix(aMatrix),
|
|
|
|
nsSVGUtils::eBBoxIncludeFill);
|
|
|
|
nsSVGEffects::EffectProperties effectProperties =
|
|
|
|
nsSVGEffects::GetEffectProperties(frame);
|
|
|
|
bool isOK = true;
|
|
|
|
nsSVGClipPathFrame *clipPathFrame =
|
|
|
|
effectProperties.GetClipPathFrame(&isOK);
|
|
|
|
if (clipPathFrame && isOK) {
|
|
|
|
tmpBBox = clipPathFrame->GetBBoxForClipPathFrame(tmpBBox, aMatrix);
|
|
|
|
}
|
|
|
|
tmpBBox.Intersect(aBBox);
|
|
|
|
unionBBox.UnionEdges(tmpBBox);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
nsSVGEffects::EffectProperties props =
|
|
|
|
nsSVGEffects::GetEffectProperties(this);
|
|
|
|
if (props.mClipPath) {
|
|
|
|
bool isOK = true;
|
|
|
|
nsSVGClipPathFrame *clipPathFrame = props.GetClipPathFrame(&isOK);
|
|
|
|
if (clipPathFrame && isOK) {
|
|
|
|
tmpBBox = clipPathFrame->GetBBoxForClipPathFrame(aBBox, aMatrix);
|
|
|
|
unionBBox.Intersect(tmpBBox);
|
|
|
|
} else if (!isOK) {
|
|
|
|
unionBBox = SVGBBox();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return unionBBox;
|
|
|
|
}
|