Bug 1320036 - Part 1. Correct objectBoundingBox region of a filter applied to an outer SVG element. r=jwatt

MozReview-Commit-ID: 8frACVe2gFE

--HG--
extra : rebase_source : f796c7ae084cc2af0960a0702167fe8211aa083a
extra : source : 43b17a8af53a4684abb4379a3fba95c9d424c77f
This commit is contained in:
cku 2017-03-15 18:36:53 +08:00
Родитель 7decdeb7c8
Коммит 8f0a57337e
4 изменённых файлов: 14 добавлений и 5 удалений

Просмотреть файл

@ -182,7 +182,9 @@ nsFilterInstance::nsFilterInstance(nsIFrame *aTargetFrame,
mTargetBBox = *aOverrideBBox;
} else {
MOZ_ASSERT(mTargetFrame, "Need to supply a frame when there's no aOverrideBBox");
mTargetBBox = nsSVGUtils::GetBBox(mTargetFrame);
mTargetBBox = nsSVGUtils::GetBBox(mTargetFrame,
nsSVGUtils::eUseFrameBoundsForOuterSVG |
nsSVGUtils::eBBoxIncludeFillGeometry);
}
// Compute user space to filter space transforms.

Просмотреть файл

@ -192,8 +192,8 @@ nsSVGIntegrationUtils::GetSVGCoordContextForNonSVGFrame(nsIFrame* aNonSVGFrame)
gfxRect
nsSVGIntegrationUtils::GetSVGBBoxForNonSVGFrame(nsIFrame* aNonSVGFrame)
{
NS_ASSERTION(!aNonSVGFrame->IsFrameOfType(nsIFrame::eSVG),
"SVG frames should not get here");
NS_ASSERTION(!(aNonSVGFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT),
"Frames with SVG layout should not get here");
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(aNonSVGFrame);
// 'r' is in "user space":

Просмотреть файл

@ -1097,7 +1097,10 @@ nsSVGUtils::GetBBox(nsIFrame *aFrame, uint32_t aFlags)
}
gfxRect bbox;
nsISVGChildFrame *svg = do_QueryFrame(aFrame);
if (svg || aFrame->IsSVGText()) {
const bool hasSVGLayout = aFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT;
if (hasSVGLayout || aFrame->IsSVGText() ||
// if we evaluate the following, |svg| can only be an outer-<svg> or null
(svg && !(aFlags & eUseFrameBoundsForOuterSVG))) {
// It is possible to apply a gradient, pattern, clipping path, mask or
// filter to text. When one of these facilities is applied to text
// the bounding box is the entire text element in all

Просмотреть файл

@ -403,7 +403,11 @@ public:
eBBoxIncludeStroke = 1 << 2,
eBBoxIncludeStrokeGeometry = 1 << 3,
eBBoxIncludeMarkers = 1 << 4,
eBBoxIncludeClipped = 1 << 5
eBBoxIncludeClipped = 1 << 5,
// Normally a getBBox call on outer-<svg> should only return the
// bounds of the elements children. This flag will cause the
// element's bounds to be returned instead.
eUseFrameBoundsForOuterSVG = 1 << 6
};
/**
* Get the SVG bbox (the SVG spec's simplified idea of bounds) of aFrame in