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:
|
2009-04-24 16:17:43 -07:00
|
|
|
#include "nsSVGInnerSVGFrame.h"
|
2012-03-20 05:15:55 -07:00
|
|
|
|
2012-03-26 04:58:59 -07:00
|
|
|
// Keep others in (case-insensitive) order:
|
2014-08-07 00:09:31 -07:00
|
|
|
#include "gfx2DGlue.h"
|
2012-03-26 04:58:59 -07:00
|
|
|
#include "gfxContext.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIFrame.h"
|
|
|
|
#include "nsISVGChildFrame.h"
|
|
|
|
#include "nsSVGContainerFrame.h"
|
2012-06-30 04:20:46 -07:00
|
|
|
#include "nsSVGIntegrationUtils.h"
|
2013-01-09 15:02:45 -08:00
|
|
|
#include "mozilla/dom/SVGSVGElement.h"
|
|
|
|
|
|
|
|
using namespace mozilla;
|
|
|
|
using namespace mozilla::dom;
|
2014-08-07 00:09:31 -07:00
|
|
|
using namespace mozilla::gfx;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsIFrame*
|
2009-01-19 10:31:34 -08:00
|
|
|
NS_NewSVGInnerSVGFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2007-07-25 02:16:02 -07:00
|
|
|
return new (aPresShell) nsSVGInnerSVGFrame(aContext);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_IMPL_FRAMEARENA_HELPERS(nsSVGInnerSVGFrame)
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsIFrame methods
|
|
|
|
|
2009-01-12 11:20:59 -08:00
|
|
|
NS_QUERYFRAME_HEAD(nsSVGInnerSVGFrame)
|
2009-04-24 16:17:43 -07:00
|
|
|
NS_QUERYFRAME_ENTRY(nsSVGInnerSVGFrame)
|
2009-01-12 11:20:59 -08:00
|
|
|
NS_QUERYFRAME_ENTRY(nsISVGSVGFrame)
|
|
|
|
NS_QUERYFRAME_TAIL_INHERITING(nsSVGInnerSVGFrameBase)
|
|
|
|
|
2009-01-19 10:31:34 -08:00
|
|
|
#ifdef DEBUG
|
2013-03-19 18:47:48 -07:00
|
|
|
void
|
2014-05-24 15:20:40 -07:00
|
|
|
nsSVGInnerSVGFrame::Init(nsIContent* aContent,
|
|
|
|
nsContainerFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow)
|
2009-01-19 10:31:34 -08:00
|
|
|
{
|
2013-01-07 19:22:41 -08:00
|
|
|
NS_ASSERTION(aContent->IsSVG(nsGkAtoms::svg),
|
|
|
|
"Content is not an SVG 'svg' element!");
|
2009-01-19 10:31:34 -08:00
|
|
|
|
2013-03-19 18:47:48 -07:00
|
|
|
nsSVGInnerSVGFrameBase::Init(aContent, aParent, aPrevInFlow);
|
2009-01-19 10:31:34 -08:00
|
|
|
}
|
|
|
|
#endif /* DEBUG */
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIAtom *
|
|
|
|
nsSVGInnerSVGFrame::GetType() const
|
|
|
|
{
|
|
|
|
return nsGkAtoms::svgInnerSVGFrame;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsISVGChildFrame methods
|
|
|
|
|
2014-02-19 14:34:31 -08:00
|
|
|
nsresult
|
2014-10-31 13:08:54 -07:00
|
|
|
nsSVGInnerSVGFrame::PaintSVG(gfxContext& aContext,
|
2014-08-29 12:42:07 -07:00
|
|
|
const gfxMatrix& aTransform,
|
|
|
|
const nsIntRect *aDirtyRect)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-07-20 11:12:29 -07:00
|
|
|
NS_ASSERTION(!NS_SVGDisplayListPaintingEnabled() ||
|
2013-07-12 00:13:07 -07:00
|
|
|
(mState & NS_FRAME_IS_NONDISPLAY),
|
2012-07-20 11:12:29 -07:00
|
|
|
"If display lists are enabled, only painting of non-display "
|
|
|
|
"SVG should take this code path");
|
|
|
|
|
2008-01-27 12:39:27 -08:00
|
|
|
gfxContextAutoSaveRestore autoSR;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-02-16 13:51:02 -08:00
|
|
|
if (StyleDisplay()->IsScrollableOverflow()) {
|
2008-01-27 12:39:27 -08:00
|
|
|
float x, y, width, height;
|
2013-01-09 15:02:45 -08:00
|
|
|
static_cast<SVGSVGElement*>(mContent)->
|
2012-07-30 07:20:58 -07:00
|
|
|
GetAnimatedLengthValues(&x, &y, &width, &height, nullptr);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-01-27 12:39:27 -08:00
|
|
|
if (width <= 0 || height <= 0) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-10-31 13:08:54 -07:00
|
|
|
autoSR.SetContext(&aContext);
|
2009-06-18 04:31:25 -07:00
|
|
|
gfxRect clipRect =
|
|
|
|
nsSVGUtils::GetClipRectForFrame(this, x, y, width, height);
|
2014-10-31 13:08:54 -07:00
|
|
|
nsSVGUtils::SetClipRect(&aContext, aTransform, clipRect);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2014-08-29 12:42:07 -07:00
|
|
|
return nsSVGInnerSVGFrameBase::PaintSVG(aContext, aTransform, aDirtyRect);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2014-07-06 05:55:43 -07:00
|
|
|
nsRect
|
|
|
|
nsSVGInnerSVGFrame::GetCoveredRegion()
|
|
|
|
{
|
|
|
|
float x, y, w, h;
|
|
|
|
static_cast<SVGSVGElement*>(mContent)->
|
|
|
|
GetAnimatedLengthValues(&x, &y, &w, &h, nullptr);
|
|
|
|
if (w < 0.0f) w = 0.0f;
|
|
|
|
if (h < 0.0f) h = 0.0f;
|
|
|
|
// GetCanvasTM includes the x,y translation
|
|
|
|
nsRect bounds = nsSVGUtils::ToCanvasBounds(gfxRect(0.0, 0.0, w, h),
|
2014-09-08 04:28:50 -07:00
|
|
|
GetCanvasTM(),
|
2014-07-06 05:55:43 -07:00
|
|
|
PresContext());
|
|
|
|
|
|
|
|
if (!StyleDisplay()->IsScrollableOverflow()) {
|
|
|
|
bounds.UnionRect(bounds, nsSVGUtils::GetCoveredRegion(mFrames));
|
|
|
|
}
|
|
|
|
return bounds;
|
|
|
|
}
|
|
|
|
|
2012-05-16 21:05:09 -07:00
|
|
|
void
|
2012-07-21 17:01:44 -07:00
|
|
|
nsSVGInnerSVGFrame::ReflowSVG()
|
2012-05-16 21:05:09 -07:00
|
|
|
{
|
|
|
|
// mRect must be set before FinishAndStoreOverflow is called in order
|
|
|
|
// for our overflow areas to be clipped correctly.
|
|
|
|
float x, y, width, height;
|
2013-01-09 15:02:45 -08:00
|
|
|
static_cast<SVGSVGElement*>(mContent)->
|
2012-07-30 07:20:58 -07:00
|
|
|
GetAnimatedLengthValues(&x, &y, &width, &height, nullptr);
|
2012-05-16 21:05:09 -07:00
|
|
|
mRect = nsLayoutUtils::RoundGfxRectToAppRect(
|
|
|
|
gfxRect(x, y, width, height),
|
|
|
|
PresContext()->AppUnitsPerCSSPixel());
|
Bug 997735 - Invalidate when reflowing SVG containers. r=roc
Without this patch, when changing the x/y attributes of svg:use, innerSVG and foreignObject, we were relying on the transform changes of the children to trigger the right invalidations. However, changes to those attributes can also change the filter region. And there's a difference between moving children in a fixed filter region and moving the filter region along with the children: In the first case, we wouldn't need to invalidate anything outside the old filter region, because those parts of the children would be clipped away anyway. But when the filter region changes, we need to invalidate both the old and the new filter region. Also, when the filter has primitives without inputs, e.g. flood or turbulence, the filtered frame needs to be invalidate even if it has no children.
2014-04-23 02:48:07 -07:00
|
|
|
|
|
|
|
// If we have a filter, we need to invalidate ourselves because filter
|
|
|
|
// output can change even if none of our descendants need repainting.
|
|
|
|
if (StyleSVGReset()->HasFilters()) {
|
|
|
|
InvalidateFrame();
|
|
|
|
}
|
|
|
|
|
2012-07-21 17:01:44 -07:00
|
|
|
nsSVGInnerSVGFrameBase::ReflowSVG();
|
2012-05-16 21:05:09 -07:00
|
|
|
}
|
|
|
|
|
2008-01-25 01:27:03 -08:00
|
|
|
void
|
2012-08-22 08:56:38 -07:00
|
|
|
nsSVGInnerSVGFrame::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
|
|
|
if (aFlags & COORD_CONTEXT_CHANGED) {
|
|
|
|
|
2013-01-09 15:02:45 -08:00
|
|
|
SVGSVGElement *svg = static_cast<SVGSVGElement*>(mContent);
|
2008-01-25 01:27:03 -08:00
|
|
|
|
2012-06-23 09:36:46 -07:00
|
|
|
bool xOrYIsPercentage =
|
2013-01-09 15:02:47 -08:00
|
|
|
svg->mLengthAttributes[SVGSVGElement::ATTR_X].IsPercentage() ||
|
|
|
|
svg->mLengthAttributes[SVGSVGElement::ATTR_Y].IsPercentage();
|
2012-06-23 09:36:46 -07:00
|
|
|
bool widthOrHeightIsPercentage =
|
2013-01-09 15:02:47 -08:00
|
|
|
svg->mLengthAttributes[SVGSVGElement::ATTR_WIDTH].IsPercentage() ||
|
|
|
|
svg->mLengthAttributes[SVGSVGElement::ATTR_HEIGHT].IsPercentage();
|
2012-06-23 09:36:46 -07:00
|
|
|
|
|
|
|
if (xOrYIsPercentage || widthOrHeightIsPercentage) {
|
|
|
|
// Ancestor changes can't affect how we render from the perspective of
|
|
|
|
// any rendering observers that we may have, so we don't need to
|
|
|
|
// invalidate them. We also don't need to invalidate ourself, since our
|
|
|
|
// changed ancestor will have invalidated its entire area, which includes
|
|
|
|
// our area.
|
|
|
|
// For perf reasons we call this before calling NotifySVGChanged() below.
|
2012-07-21 17:01:44 -07:00
|
|
|
nsSVGUtils::ScheduleReflowSVG(this);
|
2012-06-23 09:36:46 -07:00
|
|
|
}
|
|
|
|
|
2008-01-25 01:27:03 -08:00
|
|
|
// Coordinate context changes affect mCanvasTM if we have a
|
|
|
|
// percentage 'x' or 'y', or if we have a percentage 'width' or 'height' AND
|
|
|
|
// a 'viewBox'.
|
|
|
|
|
|
|
|
if (!(aFlags & TRANSFORM_CHANGED) &&
|
2012-06-23 09:36:46 -07:00
|
|
|
(xOrYIsPercentage ||
|
2013-02-26 08:58:06 -08:00
|
|
|
(widthOrHeightIsPercentage && svg->HasViewBoxRect()))) {
|
2008-01-25 01:27:03 -08:00
|
|
|
aFlags |= TRANSFORM_CHANGED;
|
|
|
|
}
|
|
|
|
|
2013-02-26 08:58:06 -08:00
|
|
|
if (svg->HasViewBoxRect() || !widthOrHeightIsPercentage) {
|
2012-05-19 06:50:07 -07:00
|
|
|
// Remove COORD_CONTEXT_CHANGED, since we establish the coordinate
|
|
|
|
// context for our descendants and this notification won't change its
|
|
|
|
// dimensions:
|
|
|
|
aFlags &= ~COORD_CONTEXT_CHANGED;
|
|
|
|
|
2012-07-23 04:00:43 -07:00
|
|
|
if (!aFlags) {
|
2012-05-19 06:50:07 -07:00
|
|
|
return; // No notification flags left
|
|
|
|
}
|
|
|
|
}
|
2008-01-25 01:27:03 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (aFlags & TRANSFORM_CHANGED) {
|
|
|
|
// make sure our cached transform matrix gets (lazily) updated
|
2012-07-30 07:20:58 -07:00
|
|
|
mCanvasTM = nullptr;
|
2008-01-25 01:27:03 -08:00
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-01-25 01:27:03 -08:00
|
|
|
nsSVGInnerSVGFrameBase::NotifySVGChanged(aFlags);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2014-02-17 23:47:48 -08:00
|
|
|
nsresult
|
2012-08-22 08:56:38 -07:00
|
|
|
nsSVGInnerSVGFrame::AttributeChanged(int32_t aNameSpaceID,
|
2010-10-07 12:19:32 -07:00
|
|
|
nsIAtom* aAttribute,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aModType)
|
2010-10-07 12:19:32 -07:00
|
|
|
{
|
2012-08-15 04:58:06 -07:00
|
|
|
if (aNameSpaceID == kNameSpaceID_None &&
|
2013-07-12 00:13:07 -07:00
|
|
|
!(GetStateBits() & NS_FRAME_IS_NONDISPLAY)) {
|
2012-05-16 21:05:09 -07:00
|
|
|
|
2013-01-09 15:02:45 -08:00
|
|
|
SVGSVGElement* content = static_cast<SVGSVGElement*>(mContent);
|
2012-05-16 21:05:09 -07:00
|
|
|
|
2010-10-07 12:19:32 -07:00
|
|
|
if (aAttribute == nsGkAtoms::width ||
|
2011-09-30 01:25:01 -07:00
|
|
|
aAttribute == nsGkAtoms::height) {
|
2014-11-06 01:30:11 -08:00
|
|
|
nsLayoutUtils::PostRestyleEvent(
|
|
|
|
mContent->AsElement(), nsRestyleHint(0),
|
|
|
|
nsChangeHint_InvalidateRenderingObservers);
|
2012-11-28 01:42:13 -08:00
|
|
|
nsSVGUtils::ScheduleReflowSVG(this);
|
2011-09-30 01:25:01 -07:00
|
|
|
|
2012-05-16 21:05:09 -07:00
|
|
|
if (content->HasViewBoxOrSyntheticViewBox()) {
|
2011-09-30 01:25:01 -07:00
|
|
|
// make sure our cached transform matrix gets (lazily) updated
|
2012-07-30 07:20:58 -07:00
|
|
|
mCanvasTM = nullptr;
|
2012-05-16 21:05:09 -07:00
|
|
|
content->ChildrenOnlyTransformChanged();
|
2011-09-30 01:25:01 -07:00
|
|
|
nsSVGUtils::NotifyChildrenOfSVGChange(this, TRANSFORM_CHANGED);
|
|
|
|
} else {
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t flags = COORD_CONTEXT_CHANGED;
|
2012-03-03 01:21:09 -08:00
|
|
|
if (mCanvasTM && mCanvasTM->IsSingular()) {
|
2012-07-30 07:20:58 -07:00
|
|
|
mCanvasTM = nullptr;
|
2012-03-03 01:21:09 -08:00
|
|
|
flags |= TRANSFORM_CHANGED;
|
|
|
|
}
|
|
|
|
nsSVGUtils::NotifyChildrenOfSVGChange(this, flags);
|
2011-09-30 01:25:01 -07:00
|
|
|
}
|
|
|
|
|
2010-10-07 12:19:32 -07:00
|
|
|
} else if (aAttribute == nsGkAtoms::transform ||
|
2011-09-30 01:25:01 -07:00
|
|
|
aAttribute == nsGkAtoms::preserveAspectRatio ||
|
|
|
|
aAttribute == nsGkAtoms::viewBox ||
|
2010-10-07 12:19:32 -07:00
|
|
|
aAttribute == nsGkAtoms::x ||
|
|
|
|
aAttribute == nsGkAtoms::y) {
|
|
|
|
// make sure our cached transform matrix gets (lazily) updated
|
2012-07-30 07:20:58 -07:00
|
|
|
mCanvasTM = nullptr;
|
2010-10-07 12:19:32 -07:00
|
|
|
|
2011-09-30 01:25:01 -07:00
|
|
|
nsSVGUtils::NotifyChildrenOfSVGChange(
|
|
|
|
this, aAttribute == nsGkAtoms::viewBox ?
|
|
|
|
TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED : TRANSFORM_CHANGED);
|
2012-05-16 21:05:09 -07:00
|
|
|
|
2013-05-23 00:04:21 -07:00
|
|
|
// We don't invalidate for transform changes (the layers code does that).
|
|
|
|
// Also note that SVGTransformableElement::GetAttributeChangeHint will
|
|
|
|
// return nsChangeHint_UpdateOverflow for "transform" attribute changes
|
|
|
|
// and cause DoApplyRenderingChangeToTree to make the SchedulePaint call.
|
|
|
|
|
2013-04-25 02:18:42 -07:00
|
|
|
if (aAttribute == nsGkAtoms::x || aAttribute == nsGkAtoms::y) {
|
2014-11-06 01:30:11 -08:00
|
|
|
nsLayoutUtils::PostRestyleEvent(
|
|
|
|
mContent->AsElement(), nsRestyleHint(0),
|
|
|
|
nsChangeHint_InvalidateRenderingObservers);
|
2013-04-25 02:18:42 -07:00
|
|
|
nsSVGUtils::ScheduleReflowSVG(this);
|
|
|
|
} else if (aAttribute == nsGkAtoms::viewBox ||
|
|
|
|
(aAttribute == nsGkAtoms::preserveAspectRatio &&
|
|
|
|
content->HasViewBoxOrSyntheticViewBox())) {
|
2012-05-16 21:05:09 -07:00
|
|
|
content->ChildrenOnlyTransformChanged();
|
2013-02-11 15:25:56 -08:00
|
|
|
// SchedulePaint sets a global state flag so we only need to call it once
|
|
|
|
// (on ourself is fine), not once on each child (despite bug 828240).
|
|
|
|
SchedulePaint();
|
2012-05-16 21:05:09 -07:00
|
|
|
}
|
2010-10-07 12:19:32 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2014-02-19 14:34:31 -08:00
|
|
|
nsIFrame*
|
2014-08-07 00:09:31 -07:00
|
|
|
nsSVGInnerSVGFrame::GetFrameForPoint(const gfxPoint& aPoint)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-07-20 11:12:29 -07:00
|
|
|
NS_ASSERTION(!NS_SVGDisplayListHitTestingEnabled() ||
|
2013-07-12 00:13:07 -07:00
|
|
|
(mState & NS_FRAME_IS_NONDISPLAY),
|
2012-07-20 11:12:29 -07:00
|
|
|
"If display lists are enabled, only hit-testing of non-display "
|
|
|
|
"SVG should take this code path");
|
|
|
|
|
2013-02-16 13:51:02 -08:00
|
|
|
if (StyleDisplay()->IsScrollableOverflow()) {
|
2014-08-07 00:09:31 -07:00
|
|
|
Rect clip;
|
|
|
|
static_cast<nsSVGElement*>(mContent)->
|
|
|
|
GetAnimatedLengthValues(&clip.x, &clip.y,
|
|
|
|
&clip.width, &clip.height, nullptr);
|
|
|
|
if (!clip.Contains(ToPoint(aPoint))) {
|
2012-07-30 07:20:58 -07:00
|
|
|
return nullptr;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-25 02:23:54 -07:00
|
|
|
return nsSVGInnerSVGFrameBase::GetFrameForPoint(aPoint);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsISVGSVGFrame methods:
|
|
|
|
|
2012-02-04 05:58:46 -08:00
|
|
|
void
|
2012-08-22 08:56:38 -07:00
|
|
|
nsSVGInnerSVGFrame::NotifyViewportOrTransformChanged(uint32_t aFlags)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-05-03 09:05:53 -07:00
|
|
|
// The dimensions of inner-<svg> frames are purely defined by their "width"
|
|
|
|
// and "height" attributes, and transform changes can only occur as a result
|
|
|
|
// of changes to their "width", "height", "viewBox" or "preserveAspectRatio"
|
|
|
|
// attributes. Changes to all of these attributes are handled in
|
|
|
|
// AttributeChanged(), so we should never be called.
|
|
|
|
NS_ERROR("Not called for nsSVGInnerSVGFrame");
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsSVGContainerFrame methods:
|
|
|
|
|
2009-04-28 21:31:34 -07:00
|
|
|
gfxMatrix
|
2014-09-08 04:28:50 -07:00
|
|
|
nsSVGInnerSVGFrame::GetCanvasTM()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
if (!mCanvasTM) {
|
2014-05-24 15:20:41 -07:00
|
|
|
NS_ASSERTION(GetParent(), "null parent");
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-05-24 15:20:41 -07:00
|
|
|
nsSVGContainerFrame *parent = static_cast<nsSVGContainerFrame*>(GetParent());
|
2013-01-09 15:02:45 -08:00
|
|
|
SVGSVGElement *content = static_cast<SVGSVGElement*>(mContent);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-09-08 04:28:50 -07:00
|
|
|
gfxMatrix tm = content->PrependLocalTransformsTo(parent->GetCanvasTM());
|
2009-04-28 21:31:34 -07:00
|
|
|
|
2013-12-26 12:13:57 -08:00
|
|
|
mCanvasTM = new gfxMatrix(tm);
|
2009-04-28 21:31:34 -07:00
|
|
|
}
|
2011-09-25 14:04:32 -07:00
|
|
|
return *mCanvasTM;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2012-05-16 21:05:09 -07:00
|
|
|
bool
|
2013-12-29 15:35:53 -08:00
|
|
|
nsSVGInnerSVGFrame::HasChildrenOnlyTransform(gfx::Matrix *aTransform) const
|
2012-05-16 21:05:09 -07:00
|
|
|
{
|
2013-01-09 15:02:45 -08:00
|
|
|
SVGSVGElement *content = static_cast<SVGSVGElement*>(mContent);
|
2012-05-16 21:05:09 -07:00
|
|
|
|
|
|
|
if (content->HasViewBoxOrSyntheticViewBox()) {
|
|
|
|
// XXX Maybe return false if the transform is the identity transform?
|
|
|
|
if (aTransform) {
|
2013-12-29 22:50:17 -08:00
|
|
|
*aTransform = content->GetViewBoxTransform();
|
2012-05-16 21:05:09 -07:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|