author | cku <cku@mozilla.com> |
Thu, 31 Aug 2017 12:21:39 +0800 | |
changeset 378150 | aa111604eaa34be601b91b32aa077939b4252c28 |
parent 378149 | b18cad4e3274cb2a6b92eb95779f099b79c4fd5d |
child 378151 | de726c1fbb1e85aad4ed2f3f3d91366024818739 |
push id | 94412 |
push user | archaeopteryx@coole-files.de |
push date | Fri, 01 Sep 2017 08:46:09 +0000 |
treeherder | mozilla-inbound@d56571d7f1be [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | longsonr |
bugs | 1395439, 218550 |
milestone | 57.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/layout/svg/nsSVGUtils.cpp +++ b/layout/svg/nsSVGUtils.cpp @@ -1108,33 +1108,40 @@ nsSVGUtils::GetBBox(nsIFrame* aFrame, ui MOZ_ASSERT(svg); nsIContent* content = aFrame->GetContent(); if (content->IsSVGElement() && !static_cast<const nsSVGElement*>(content)->HasValidDimensions()) { return gfxRect(); } + // Clean out flags which have no effects on returning bbox from now, so that + // we can cache and reuse ObjectBoundingBoxProperty() in the code below. + aFlags &= ~eIncludeOnlyCurrentFrameForNonSVGElement; + aFlags &= ~eUseFrameBoundsForOuterSVG; + if (!aFrame->IsSVGUseFrame()) { + aFlags &= ~eUseUserSpaceOfUseElement; + } + if (aFlags == eBBoxIncludeFillGeometry && // We only cache bbox in element's own user space !aToBoundsSpace) { gfxRect* prop = aFrame->GetProperty(ObjectBoundingBoxProperty()); if (prop) { return *prop; } } gfxMatrix matrix; if (aToBoundsSpace) { matrix = *aToBoundsSpace; } if (aFrame->IsSVGForeignObjectFrame() || - (aFrame->IsSVGUseFrame() && - (aFlags & nsSVGUtils::eUseUserSpaceOfUseElement))) { + aFlags & nsSVGUtils::eUseUserSpaceOfUseElement) { // The spec says getBBox "Returns the tight bounding box in *current user // space*". So we should really be doing this for all elements, but that // needs investigation to check that we won't break too much content. // NOTE: When changing this to apply to other frame types, make sure to // also update nsSVGUtils::FrameSpaceInCSSPxToUserSpaceOffset. MOZ_ASSERT(content->IsSVGElement(), "bad cast"); nsSVGElement *element = static_cast<nsSVGElement*>(content); matrix = element->PrependLocalTransformsTo(matrix, eChildToUserSpace);