2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07: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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-03-26 04:58:59 -07:00
|
|
|
// Main header first:
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsSVGContainerFrame.h"
|
2012-03-26 04:58:59 -07:00
|
|
|
|
|
|
|
// Keep others in (case-insensitive) order:
|
2012-05-16 21:05:09 -07:00
|
|
|
#include "nsSVGEffects.h"
|
2012-03-18 03:32:02 -07:00
|
|
|
#include "nsSVGElement.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsSVGUtils.h"
|
2012-05-16 21:05:09 -07:00
|
|
|
#include "SVGAnimatedTransformList.h"
|
|
|
|
|
|
|
|
using namespace mozilla;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-04-28 21:31:34 -07:00
|
|
|
NS_QUERYFRAME_HEAD(nsSVGContainerFrame)
|
|
|
|
NS_QUERYFRAME_ENTRY(nsSVGContainerFrame)
|
|
|
|
NS_QUERYFRAME_TAIL_INHERITING(nsSVGContainerFrameBase)
|
|
|
|
|
2009-01-12 11:20:59 -08:00
|
|
|
NS_QUERYFRAME_HEAD(nsSVGDisplayContainerFrame)
|
2009-04-24 16:17:43 -07:00
|
|
|
NS_QUERYFRAME_ENTRY(nsSVGDisplayContainerFrame)
|
2009-01-12 11:20:59 -08:00
|
|
|
NS_QUERYFRAME_ENTRY(nsISVGChildFrame)
|
|
|
|
NS_QUERYFRAME_TAIL_INHERITING(nsSVGContainerFrame)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsIFrame*
|
|
|
|
NS_NewSVGContainerFrame(nsIPresShell* aPresShell,
|
|
|
|
nsStyleContext* aContext)
|
|
|
|
{
|
2012-03-10 11:28:06 -08:00
|
|
|
nsIFrame *frame = new (aPresShell) nsSVGContainerFrame(aContext);
|
|
|
|
// If we were called directly, then the frame is for a <defs> or
|
|
|
|
// an unknown element type. In both cases we prevent the content
|
|
|
|
// from displaying directly.
|
|
|
|
frame->AddStateBits(NS_STATE_SVG_NONDISPLAY_CHILD);
|
|
|
|
return frame;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_IMPL_FRAMEARENA_HELPERS(nsSVGContainerFrame)
|
|
|
|
NS_IMPL_FRAMEARENA_HELPERS(nsSVGDisplayContainerFrame)
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHODIMP
|
2011-08-24 13:54:30 -07:00
|
|
|
nsSVGContainerFrame::AppendFrames(ChildListID aListID,
|
2009-07-30 10:23:32 -07:00
|
|
|
nsFrameList& aFrameList)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-08-24 13:54:30 -07:00
|
|
|
return InsertFrames(aListID, mFrames.LastChild(), aFrameList);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-08-24 13:54:30 -07:00
|
|
|
nsSVGContainerFrame::InsertFrames(ChildListID aListID,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIFrame* aPrevFrame,
|
2009-07-30 10:23:32 -07:00
|
|
|
nsFrameList& aFrameList)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-08-24 13:54:30 -07:00
|
|
|
NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == this,
|
|
|
|
"inserting after sibling frame with different parent");
|
|
|
|
|
|
|
|
mFrames.InsertFrames(this, aPrevFrame, aFrameList);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-08-24 13:54:30 -07:00
|
|
|
nsSVGContainerFrame::RemoveFrame(ChildListID aListID,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIFrame* aOldFrame)
|
|
|
|
{
|
2011-08-24 13:54:30 -07:00
|
|
|
NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-09-18 04:09:36 -07:00
|
|
|
mFrames.DestroyFrame(aOldFrame);
|
|
|
|
return NS_OK;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2012-05-16 21:05:09 -07:00
|
|
|
bool
|
|
|
|
nsSVGContainerFrame::UpdateOverflow()
|
|
|
|
{
|
|
|
|
if (mState & NS_STATE_SVG_NONDISPLAY_CHILD) {
|
|
|
|
// We don't maintain overflow rects.
|
|
|
|
// XXX It would have be better if the restyle request hadn't even happened.
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return nsSVGContainerFrameBase::UpdateOverflow();
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHODIMP
|
2007-08-30 10:01:37 -07:00
|
|
|
nsSVGDisplayContainerFrame::Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2008-06-22 08:59:48 -07:00
|
|
|
if (!(GetStateBits() & NS_STATE_IS_OUTER_SVG)) {
|
2010-12-06 12:57:18 -08:00
|
|
|
AddStateBits(aParent->GetStateBits() &
|
2012-03-20 05:15:53 -07:00
|
|
|
(NS_STATE_SVG_NONDISPLAY_CHILD | NS_STATE_SVG_CLIPPATH_CHILD));
|
2008-06-22 08:59:48 -07:00
|
|
|
}
|
2012-03-10 11:28:06 -08:00
|
|
|
nsresult rv = nsSVGContainerFrame::Init(aContent, aParent, aPrevInFlow);
|
2007-08-30 10:01:37 -07:00
|
|
|
return rv;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2012-07-20 11:12:29 -07:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGDisplayContainerFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists)
|
|
|
|
{
|
2012-11-16 09:59:52 -08:00
|
|
|
if (mContent->IsSVG() &&
|
|
|
|
!static_cast<const nsSVGElement*>(mContent)->HasValidDimensions()) {
|
2012-07-20 11:12:29 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
return BuildDisplayListForNonBlockChildren(aBuilder, aDirtyRect, aLists);
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHODIMP
|
2011-08-24 13:54:30 -07:00
|
|
|
nsSVGDisplayContainerFrame::InsertFrames(ChildListID aListID,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIFrame* aPrevFrame,
|
2009-07-30 10:23:32 -07:00
|
|
|
nsFrameList& aFrameList)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2009-07-30 10:23:32 -07:00
|
|
|
// memorize first old frame after insertion point
|
|
|
|
// XXXbz once again, this would work a lot better if the nsIFrame
|
|
|
|
// methods returned framelist iterators....
|
|
|
|
nsIFrame* firstOldFrame = aPrevFrame ?
|
2011-08-24 13:54:30 -07:00
|
|
|
aPrevFrame->GetNextSibling() : GetChildList(aListID).FirstChild();
|
2009-07-30 10:23:32 -07:00
|
|
|
nsIFrame* firstNewFrame = aFrameList.FirstChild();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Insert the new frames
|
2011-08-24 13:54:30 -07:00
|
|
|
nsSVGContainerFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-03-20 05:15:53 -07:00
|
|
|
// If we are not a non-display SVG frame and we do not have a bounds update
|
|
|
|
// pending, then we need to schedule one for our new children:
|
|
|
|
if (!(GetStateBits() &
|
|
|
|
(NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN |
|
|
|
|
NS_STATE_SVG_NONDISPLAY_CHILD))) {
|
2009-07-30 10:23:32 -07:00
|
|
|
for (nsIFrame* kid = firstNewFrame; kid != firstOldFrame;
|
2007-10-19 04:07:08 -07:00
|
|
|
kid = kid->GetNextSibling()) {
|
2009-01-12 11:20:59 -08:00
|
|
|
nsISVGChildFrame* SVGFrame = do_QueryFrame(kid);
|
2007-10-19 04:07:08 -07:00
|
|
|
if (SVGFrame) {
|
2012-03-20 05:15:53 -07:00
|
|
|
NS_ABORT_IF_FALSE(!(kid->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD),
|
|
|
|
"Check for this explicitly in the |if|, then");
|
2012-07-15 17:42:50 -07:00
|
|
|
bool isFirstReflow = (kid->GetStateBits() & NS_FRAME_FIRST_REFLOW);
|
2012-03-20 05:15:53 -07:00
|
|
|
// Remove bits so that ScheduleBoundsUpdate will work:
|
|
|
|
kid->RemoveStateBits(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
|
|
|
|
NS_FRAME_HAS_DIRTY_CHILDREN);
|
|
|
|
// No need to invalidate the new kid's old bounds, so we just use
|
|
|
|
// nsSVGUtils::ScheduleBoundsUpdate.
|
2012-07-21 17:01:44 -07:00
|
|
|
nsSVGUtils::ScheduleReflowSVG(kid);
|
2012-07-15 17:42:50 -07:00
|
|
|
if (isFirstReflow) {
|
|
|
|
// Add back the NS_FRAME_FIRST_REFLOW bit:
|
|
|
|
kid->AddStateBits(NS_FRAME_FIRST_REFLOW);
|
|
|
|
}
|
2007-10-19 04:07:08 -07:00
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
}
|
2007-10-19 04:07:08 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-08-24 13:54:30 -07:00
|
|
|
nsSVGDisplayContainerFrame::RemoveFrame(ChildListID aListID,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIFrame* aOldFrame)
|
|
|
|
{
|
2012-03-20 05:15:53 -07:00
|
|
|
nsSVGUtils::InvalidateBounds(aOldFrame);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-08-24 13:54:30 -07:00
|
|
|
nsresult rv = nsSVGContainerFrame::RemoveFrame(aListID, aOldFrame);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-02-04 05:58:46 -08:00
|
|
|
if (!(GetStateBits() & (NS_STATE_SVG_NONDISPLAY_CHILD | NS_STATE_IS_OUTER_SVG))) {
|
2008-03-19 14:27:33 -07:00
|
|
|
nsSVGUtils::NotifyAncestorsOfFilterRegionChange(this);
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2012-05-16 21:05:09 -07:00
|
|
|
bool
|
|
|
|
nsSVGDisplayContainerFrame::IsSVGTransformed(gfxMatrix *aOwnTransform,
|
|
|
|
gfxMatrix *aFromParentTransform) const
|
|
|
|
{
|
|
|
|
bool foundTransform = false;
|
|
|
|
|
|
|
|
// Check if our parent has children-only transforms:
|
|
|
|
nsIFrame *parent = GetParent();
|
|
|
|
if (parent &&
|
|
|
|
parent->IsFrameOfType(nsIFrame::eSVG | nsIFrame::eSVGContainer)) {
|
|
|
|
foundTransform = static_cast<nsSVGContainerFrame*>(parent)->
|
|
|
|
HasChildrenOnlyTransform(aFromParentTransform);
|
|
|
|
}
|
|
|
|
|
2012-11-16 09:59:52 -08:00
|
|
|
if (mContent->IsSVG()) {
|
|
|
|
nsSVGElement *content = static_cast<nsSVGElement*>(mContent);
|
|
|
|
if (content->GetAnimatedTransformList() ||
|
|
|
|
content->GetAnimateMotionTransform()) {
|
|
|
|
if (aOwnTransform) {
|
|
|
|
*aOwnTransform = content->PrependLocalTransformsTo(gfxMatrix(),
|
|
|
|
nsSVGElement::eUserSpaceToParent);
|
|
|
|
}
|
|
|
|
foundTransform = true;
|
2012-05-16 21:05:09 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return foundTransform;
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsISVGChildFrame methods
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-03-02 00:28:59 -08:00
|
|
|
nsSVGDisplayContainerFrame::PaintSVG(nsRenderingContext* aContext,
|
2008-10-20 01:42:03 -07:00
|
|
|
const nsIntRect *aDirtyRect)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-07-20 11:12:29 -07:00
|
|
|
NS_ASSERTION(!NS_SVGDisplayListPaintingEnabled() ||
|
2012-09-05 21:58:47 -07:00
|
|
|
(mState & NS_STATE_SVG_NONDISPLAY_CHILD) ||
|
|
|
|
PresContext()->IsGlyph(),
|
2012-07-20 11:12:29 -07:00
|
|
|
"If display lists are enabled, only painting of non-display "
|
|
|
|
"SVG should take this code path");
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
const nsStyleDisplay *display = mStyleContext->GetStyleDisplay();
|
|
|
|
if (display->mOpacity == 0.0)
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
for (nsIFrame* kid = mFrames.FirstChild(); kid;
|
|
|
|
kid = kid->GetNextSibling()) {
|
2008-10-20 01:42:03 -07:00
|
|
|
nsSVGUtils::PaintFrameWithEffects(aContext, aDirtyRect, kid);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2008-08-25 02:23:54 -07:00
|
|
|
NS_IMETHODIMP_(nsIFrame*)
|
|
|
|
nsSVGDisplayContainerFrame::GetFrameForPoint(const nsPoint &aPoint)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-07-20 11:12:29 -07:00
|
|
|
NS_ASSERTION(!NS_SVGDisplayListHitTestingEnabled() ||
|
|
|
|
(mState & NS_STATE_SVG_NONDISPLAY_CHILD),
|
|
|
|
"If display lists are enabled, only hit-testing of a "
|
|
|
|
"clipPath's contents should take this code path");
|
2008-08-25 02:23:54 -07:00
|
|
|
return nsSVGUtils::HitTestChildren(this, aPoint);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP_(nsRect)
|
|
|
|
nsSVGDisplayContainerFrame::GetCoveredRegion()
|
|
|
|
{
|
|
|
|
return nsSVGUtils::GetCoveredRegion(mFrames);
|
|
|
|
}
|
|
|
|
|
2012-03-20 05:15:53 -07:00
|
|
|
void
|
2012-07-21 17:01:44 -07:00
|
|
|
nsSVGDisplayContainerFrame::ReflowSVG()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-07-21 17:01:44 -07:00
|
|
|
NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this),
|
|
|
|
"This call is probably a wasteful mistake");
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-03-20 05:15:53 -07:00
|
|
|
NS_ABORT_IF_FALSE(!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD),
|
2012-07-21 17:01:44 -07:00
|
|
|
"ReflowSVG mechanism not designed for this");
|
2012-03-20 05:15:53 -07:00
|
|
|
|
2012-05-16 21:05:09 -07:00
|
|
|
NS_ABORT_IF_FALSE(GetType() != nsGkAtoms::svgOuterSVGFrame,
|
|
|
|
"Do not call on outer-<svg>");
|
|
|
|
|
2012-07-21 17:01:44 -07:00
|
|
|
if (!nsSVGUtils::NeedsReflowSVG(this)) {
|
2012-03-20 05:15:53 -07:00
|
|
|
return;
|
|
|
|
}
|
2007-10-19 04:07:08 -07:00
|
|
|
|
2012-03-20 05:15:53 -07:00
|
|
|
// If the NS_FRAME_FIRST_REFLOW bit has been removed from our parent frame,
|
|
|
|
// then our outer-<svg> has previously had its initial reflow. In that case
|
|
|
|
// we need to make sure that that bit has been removed from ourself _before_
|
|
|
|
// recursing over our children to ensure that they know too. Otherwise, we
|
|
|
|
// need to remove it _after_ recursing over our children so that they know
|
|
|
|
// the initial reflow is currently underway.
|
|
|
|
|
|
|
|
bool outerSVGHasHadFirstReflow =
|
|
|
|
(GetParent()->GetStateBits() & NS_FRAME_FIRST_REFLOW) == 0;
|
|
|
|
|
|
|
|
if (outerSVGHasHadFirstReflow) {
|
|
|
|
mState &= ~NS_FRAME_FIRST_REFLOW; // tell our children
|
|
|
|
}
|
|
|
|
|
2012-05-16 21:05:09 -07:00
|
|
|
nsOverflowAreas overflowRects;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
for (nsIFrame* kid = mFrames.FirstChild(); kid;
|
|
|
|
kid = kid->GetNextSibling()) {
|
2009-01-12 11:20:59 -08:00
|
|
|
nsISVGChildFrame* SVGFrame = do_QueryFrame(kid);
|
2007-03-22 10:30:00 -07:00
|
|
|
if (SVGFrame) {
|
2012-03-20 05:15:53 -07:00
|
|
|
NS_ABORT_IF_FALSE(!(kid->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD),
|
|
|
|
"Check for this explicitly in the |if|, then");
|
2012-07-21 17:01:44 -07:00
|
|
|
SVGFrame->ReflowSVG();
|
2012-05-16 21:05:09 -07:00
|
|
|
|
|
|
|
// We build up our child frame overflows here instead of using
|
|
|
|
// nsLayoutUtils::UnionChildOverflow since SVG frame's all use the same
|
|
|
|
// frame list, and we're iterating over that list now anyway.
|
|
|
|
ConsiderChildOverflow(overflowRects, kid);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-16 21:05:09 -07:00
|
|
|
// <svg> can create an SVG viewport with an offset due to its
|
|
|
|
// x/y/width/height attributes, and <use> can introduce an offset with an
|
|
|
|
// empty mRect (any width/height is copied to an anonymous <svg> child).
|
|
|
|
// Other than that containers should not set mRect since all other offsets
|
|
|
|
// come from transforms, which are accounted for by nsDisplayTransform.
|
|
|
|
// Note that we rely on |overflow:visible| to allow display list items to be
|
|
|
|
// created for our children.
|
|
|
|
NS_ABORT_IF_FALSE(mContent->Tag() == nsGkAtoms::svg ||
|
|
|
|
(mContent->Tag() == nsGkAtoms::use &&
|
|
|
|
mRect.Size() == nsSize(0,0)) ||
|
|
|
|
mRect.IsEqualEdges(nsRect()),
|
|
|
|
"Only inner-<svg>/<use> is expected to have mRect set");
|
|
|
|
|
|
|
|
if (mState & NS_FRAME_FIRST_REFLOW) {
|
|
|
|
// Make sure we have our filter property (if any) before calling
|
|
|
|
// FinishAndStoreOverflow (subsequent filter changes are handled off
|
|
|
|
// nsChangeHint_UpdateEffects):
|
|
|
|
nsSVGEffects::UpdateEffects(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
FinishAndStoreOverflow(overflowRects, mRect.Size());
|
|
|
|
|
|
|
|
// Remove state bits after FinishAndStoreOverflow so that it doesn't
|
|
|
|
// invalidate on first reflow:
|
2007-03-22 10:30:00 -07:00
|
|
|
mState &= ~(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
|
|
|
|
NS_FRAME_HAS_DIRTY_CHILDREN);
|
|
|
|
}
|
|
|
|
|
2008-01-25 01:27:03 -08:00
|
|
|
void
|
2012-08-22 08:56:38 -07:00
|
|
|
nsSVGDisplayContainerFrame::NotifySVGChanged(uint32_t aFlags)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-03-11 08:53:36 -07:00
|
|
|
NS_ABORT_IF_FALSE(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
|
|
|
|
"Invalidation logic may need adjusting");
|
2008-01-25 01:27:03 -08:00
|
|
|
|
|
|
|
nsSVGUtils::NotifyChildrenOfSVGChange(this, aFlags);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2012-04-16 01:23:48 -07:00
|
|
|
SVGBBox
|
2011-09-30 02:25:37 -07:00
|
|
|
nsSVGDisplayContainerFrame::GetBBoxContribution(
|
|
|
|
const gfxMatrix &aToBBoxUserspace,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t aFlags)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-04-16 01:23:48 -07:00
|
|
|
SVGBBox bboxUnion;
|
2009-04-28 21:31:34 -07:00
|
|
|
|
|
|
|
nsIFrame* kid = mFrames.FirstChild();
|
|
|
|
while (kid) {
|
|
|
|
nsISVGChildFrame* svgKid = do_QueryFrame(kid);
|
|
|
|
if (svgKid) {
|
|
|
|
gfxMatrix transform = aToBBoxUserspace;
|
2010-08-07 02:38:11 -07:00
|
|
|
nsIContent *content = kid->GetContent();
|
2012-03-15 04:42:54 -07:00
|
|
|
if (content->IsSVG()) {
|
2010-08-07 02:38:11 -07:00
|
|
|
transform = static_cast<nsSVGElement*>(content)->
|
2012-02-17 00:12:47 -08:00
|
|
|
PrependLocalTransformsTo(aToBBoxUserspace);
|
2009-04-28 21:31:34 -07:00
|
|
|
}
|
2012-01-23 09:42:32 -08:00
|
|
|
// We need to include zero width/height vertical/horizontal lines, so we have
|
2012-04-16 01:23:48 -07:00
|
|
|
// to use UnionEdges.
|
|
|
|
bboxUnion.UnionEdges(svgKid->GetBBoxContribution(transform, aFlags));
|
2009-04-28 21:31:34 -07:00
|
|
|
}
|
|
|
|
kid = kid->GetNextSibling();
|
|
|
|
}
|
|
|
|
|
|
|
|
return bboxUnion;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|