Bug 1259861 - Move everything else into the mozilla namespace in layout/svg r=dholbert

Also: adjust include paths to be consistent for usages of various SVG headers,
and remove unused SVG includes (mostly for "utils" classes),
and drop stray "ns" from already-renamed SVG classes in various code comments.

Differential Revision: https://phabricator.services.mozilla.com/D83140
This commit is contained in:
longsonr 2020-07-11 02:20:20 +00:00
Родитель 0729560a01
Коммит 875f5e88ac
112 изменённых файлов: 773 добавлений и 828 удалений

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

@ -244,7 +244,6 @@
#include "mozilla/SMILAnimationController.h"
#include "imgIContainer.h"
#include "nsSVGUtils.h"
#include "nsRefreshDriver.h"

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

@ -8,6 +8,7 @@
#include "mozilla/AnimationComparator.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/PresShell.h"
#include "mozilla/SVGUtils.h"
#include "mozilla/dom/AnimatableBinding.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/HTMLInputElement.h"
@ -18,7 +19,6 @@
#include "nsIRadioVisitor.h"
#include "nsIFormControl.h"
#include "nsLayoutUtils.h"
#include "nsSVGUtils.h"
#include "nsWindowSizes.h"
namespace mozilla {
@ -411,8 +411,7 @@ static void QueryNodesFromRect(DocumentOrShadowRoot& aRoot, const nsRect& aRect,
// SVG 'text' element's SVGTextFrame doesn't respond to hit-testing, so
// if 'content' is a child of such an element then we need to manually
// defer to the parent here.
if (aMultiple == Multiple::Yes &&
!nsSVGUtils::IsInSVGTextSubtree(frame)) {
if (aMultiple == Multiple::Yes && !SVGUtils::IsInSVGTextSubtree(frame)) {
continue;
}

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

@ -98,7 +98,6 @@
#include "nsPIDOMWindow.h"
#include "mozilla/dom/DOMRect.h"
#include "nsSVGUtils.h"
#include "nsLayoutUtils.h"
#include "nsGkAtoms.h"
#include "ChildIterator.h"

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

@ -68,7 +68,6 @@
#include "nsFrameLoader.h"
#include "nsPIDOMWindow.h"
#include "nsSVGUtils.h"
#include "nsLayoutUtils.h"
#include "nsGkAtoms.h"
#include "nsContentUtils.h"

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

@ -8,9 +8,9 @@
#include "mozilla/dom/DOMRect.h"
#include "mozilla/dom/Document.h"
#include "mozilla/SVGUtils.h"
#include "nsIContent.h"
#include "nsIContentInlines.h"
#include "nsSVGUtils.h"
#include <limits>
namespace mozilla {
@ -62,7 +62,7 @@ static nsSize GetTargetSize(Element* aTarget, ResizeObserverBoxOptions aBox) {
// Per the spec, SVG size is always its bounding box size no matter what
// box option you choose, because SVG elements do not use standard CSS box
// model.
gfxRect bbox = nsSVGUtils::GetBBox(frame);
gfxRect bbox = SVGUtils::GetBBox(frame);
size.width = NSFloatPixelsToAppUnits(bbox.width, AppUnitsPerCSSPixel());
size.height = NSFloatPixelsToAppUnits(bbox.height, AppUnitsPerCSSPixel());
} else {

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

@ -86,7 +86,6 @@
#include "nsRange.h"
#include "nsString.h"
#include "nsStyleConsts.h"
#include "nsSVGUtils.h"
#include "nsTextNode.h"
#include "nsUnicharUtils.h"
#include "nsWindowSizes.h"

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

@ -137,7 +137,7 @@ void HTMLScriptElement::SetText(const nsAString& aValue, ErrorResult& aRv) {
aRv = nsContentUtils::SetNodeTextContent(this, aValue, true);
}
// variation of this code in nsSVGScriptElement - check if changes
// variation of this code in SVGScriptElement - check if changes
// need to be transfered when modifying
bool HTMLScriptElement::GetScriptType(nsAString& aType) {
@ -176,7 +176,7 @@ void HTMLScriptElement::FreezeExecutionAttrs(Document* aOwnerDoc) {
mIsModule = aOwnerDoc->ModuleScriptsEnabled() && !type.IsEmpty() &&
type.LowerCaseEqualsASCII("module");
// variation of this code in nsSVGScriptElement - check if changes
// variation of this code in SVGScriptElement - check if changes
// need to be transfered when modifying. Note that we don't use GetSrc here
// because it will return the base URL when the attr value is "".
nsAutoString src;

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

@ -311,7 +311,7 @@ nsresult SMILTimedElement::EndElementAt(double aOffsetSeconds) {
}
//----------------------------------------------------------------------
// nsSVGAnimationElement methods
// SVGAnimationElement methods
SMILTimeValue SMILTimedElement::GetStartTime() const {
return mElementState == STATE_WAITING || mElementState == STATE_ACTIVE

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

@ -87,7 +87,7 @@ class SMILTimedElement {
nsresult EndElementAt(double aOffsetSeconds);
/**
* Methods for supporting the nsSVGAnimationElement interface.
* Methods for supporting the SVGAnimationElement interface.
*/
/**

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

@ -10,6 +10,7 @@
#include "mozilla/ArrayUtils.h"
#include "mozilla/Maybe.h"
#include "mozilla/SMILValue.h"
#include "mozilla/SVGIntegrationUtils.h"
#include "mozilla/dom/SVGViewportElement.h"
#include "DOMSVGAnimatedLength.h"
#include "DOMSVGLength.h"
@ -19,7 +20,6 @@
#include "nsTextFormatter.h"
#include "SMILFloatType.h"
#include "SVGAttrTearoffTable.h"
#include "nsSVGIntegrationUtils.h"
using namespace mozilla::dom;
@ -158,7 +158,7 @@ float NonSVGFrameUserSpaceMetrics::GetExLength() const {
}
gfx::Size NonSVGFrameUserSpaceMetrics::GetSize() const {
return nsSVGIntegrationUtils::GetSVGCoordContextForNonSVGFrame(mFrame);
return SVGIntegrationUtils::GetSVGCoordContextForNonSVGFrame(mFrame);
}
float UserSpaceMetricsWithSize::GetAxisLength(uint8_t aCtxType) const {

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

@ -198,7 +198,7 @@ void SVGAnimatedTransformList::SMILAnimatedTransformList::ParseValue(
MOZ_ASSERT(aResult.IsNull(), "Unexpected type for SMIL value");
static_assert(SVGTransformSMILData::NUM_SIMPLE_PARAMS == 3,
"nsSVGSMILTransform constructor should be expecting array "
"SVGSMILTransform constructor should be expecting array "
"with 3 params");
float params[3] = {0.f};

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

@ -34,7 +34,7 @@ class SVGCircleElement final : public SVGCircleElementBase {
public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
// nsSVGSVGElement methods:
// SVGSVGElement methods:
virtual bool HasValidDimensions() const override;
// SVGGeometryElement methods:

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

@ -17,6 +17,7 @@
#include "mozilla/PresShell.h"
#include "mozilla/RefPtr.h"
#include "mozilla/SVGContextPaint.h"
#include "mozilla/SVGUtils.h"
#include "mozilla/TextUtils.h"
#include "nsComputedDOMStyle.h"
#include "nsContainerFrame.h"
@ -25,7 +26,6 @@
#include "nsIScriptError.h"
#include "nsLayoutUtils.h"
#include "nsMathUtils.h"
#include "nsSVGUtils.h"
#include "nsWhitespaceTokenizer.h"
#include "SVGAnimationElement.h"
#include "SVGAnimatedPreserveAspectRatio.h"
@ -481,7 +481,7 @@ static gfx::Matrix GetCTMInternal(SVGElement* aElement, bool aScreenCTM,
gfxMatrix ret;
if (auto* f = e->GetPrimaryFrame()) {
ret = nsSVGUtils::GetTransformMatrixInUserSpace(f);
ret = SVGUtils::GetTransformMatrixInUserSpace(f);
} else {
// FIXME: Ideally we should also return the correct matrix
// for display:none, but currently transform related code relies

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

@ -71,7 +71,7 @@ enum SVGTransformTypes {
/**
* Functions generally used by SVG Content classes. Functions here
* should not generally depend on layout methods/classes e.g. nsSVGUtils
* should not generally depend on layout methods/classes e.g. SVGUtils
*/
class SVGContentUtils {
public:
@ -88,9 +88,9 @@ class SVGContentUtils {
/**
* Activates the animation element aContent as a result of navigation to the
* fragment identifier that identifies aContent. aContent must be an instance
* of nsSVGAnimationElement.
* of SVGAnimationElement.
*
* This is just a shim to allow nsSVGAnimationElement::ActivateByHyperlink to
* This is just a shim to allow SVGAnimationElement::ActivateByHyperlink to
* be called from layout/base without adding to that directory's include
* paths.
*/

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

@ -165,7 +165,7 @@ class SVGElement : public SVGElementBase // nsIContent
SVGTransformTypes aWhich = eAllTransforms) const;
// Setter for to set the current <animateMotion> transformation
// Only visible for nsSVGGraphicElement, so it's a no-op here, and that
// Only visible for SVGGraphicElement, so it's a no-op here, and that
// subclass has the useful implementation.
virtual void SetAnimateMotionTransform(
const mozilla::gfx::Matrix* aMatrix) { /*no-op*/
@ -281,7 +281,7 @@ class SVGElement : public SVGElementBase // nsIContent
SVGAnimatedLengthList* GetAnimatedLengthList(uint8_t aAttrEnum);
virtual SVGAnimatedPointList* GetAnimatedPointList() { return nullptr; }
virtual SVGAnimatedPathSegList* GetAnimPathSegList() {
// DOM interface 'SVGAnimatedPathData' (*inherited* by nsSVGPathElement)
// DOM interface 'SVGAnimatedPathData' (*inherited* by SVGPathElement)
// has a member called 'animatedPathSegList' member, so we have a shorter
// name so we don't get hidden by the GetAnimatedPathSegList declared by
// NS_DECL_NSIDOMSVGANIMATEDPATHDATA.

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

@ -34,7 +34,7 @@ class SVGEllipseElement final : public SVGEllipseElementBase {
public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
// nsSVGSVGElement methods:
// SVGSVGElement methods:
virtual bool HasValidDimensions() const override;
// SVGGeometryElement methods:

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

@ -6,7 +6,6 @@
#include "mozilla/dom/SVGFEBlendElement.h"
#include "mozilla/dom/SVGFEBlendElementBinding.h"
#include "nsSVGUtils.h"
NS_IMPL_NS_NEW_SVG_ELEMENT(FEBlend)

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

@ -8,7 +8,6 @@
#include "DOMSVGAnimatedNumberList.h"
#include "mozilla/dom/SVGFEColorMatrixElementBinding.h"
#include "nsSVGUtils.h"
#define NUM_ENTRIES_IN_4x5_MATRIX 20

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

@ -8,7 +8,6 @@
#include "mozilla/dom/SVGComponentTransferFunctionElement.h"
#include "mozilla/dom/SVGFEComponentTransferElementBinding.h"
#include "nsSVGUtils.h"
#include "mozilla/gfx/2D.h"
NS_IMPL_NS_NEW_SVG_ELEMENT(FEComponentTransfer)

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

@ -10,7 +10,6 @@
#include "mozilla/UniquePtr.h"
#include "mozilla/UniquePtrExtensions.h"
#include "DOMSVGAnimatedNumberList.h"
#include "nsSVGUtils.h"
NS_IMPL_NS_NEW_SVG_ELEMENT(FEConvolveMatrix)

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

@ -7,7 +7,6 @@
#include "mozilla/dom/SVGFEDiffuseLightingElement.h"
#include "mozilla/dom/SVGFEDiffuseLightingElementBinding.h"
#include "mozilla/SVGFilterInstance.h"
#include "nsSVGUtils.h"
NS_IMPL_NS_NEW_SVG_ELEMENT(FEDiffuseLighting)

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

@ -7,7 +7,6 @@
#include "mozilla/dom/SVGFEDisplacementMapElement.h"
#include "mozilla/dom/SVGFEDisplacementMapElementBinding.h"
#include "mozilla/SVGFilterInstance.h"
#include "nsSVGUtils.h"
NS_IMPL_NS_NEW_SVG_ELEMENT(FEDisplacementMap)

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

@ -7,7 +7,6 @@
#include "mozilla/dom/SVGFEGaussianBlurElement.h"
#include "mozilla/dom/SVGFEGaussianBlurElementBinding.h"
#include "mozilla/SVGFilterInstance.h"
#include "nsSVGUtils.h"
NS_IMPL_NS_NEW_SVG_ELEMENT(FEGaussianBlur)

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

@ -7,6 +7,7 @@
#include "mozilla/dom/SVGFEImageElement.h"
#include "mozilla/EventStates.h"
#include "mozilla/SVGObserverUtils.h"
#include "mozilla/dom/SVGFEImageElementBinding.h"
#include "mozilla/dom/SVGFilterElement.h"
#include "mozilla/dom/UserActivation.h"
@ -14,9 +15,7 @@
#include "mozilla/RefPtr.h"
#include "nsContentUtils.h"
#include "nsLayoutUtils.h"
#include "nsSVGUtils.h"
#include "nsNetUtil.h"
#include "SVGObserverUtils.h"
#include "imgIContainer.h"
#include "gfx2DGlue.h"

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

@ -7,7 +7,6 @@
#include "mozilla/dom/SVGFESpecularLightingElement.h"
#include "mozilla/dom/SVGFESpecularLightingElementBinding.h"
#include "mozilla/SVGFilterInstance.h"
#include "nsSVGUtils.h"
NS_IMPL_NS_NEW_SVG_ELEMENT(FESpecularLighting)

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

@ -7,7 +7,6 @@
#include "mozilla/dom/SVGFETurbulenceElement.h"
#include "mozilla/dom/SVGFETurbulenceElementBinding.h"
#include "mozilla/SVGFilterInstance.h"
#include "nsSVGUtils.h"
NS_IMPL_NS_NEW_SVG_ELEMENT(FETurbulence)

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

@ -13,8 +13,6 @@
#include "mozilla/dom/SVGLengthBinding.h"
#include "mozilla/dom/SVGUnitTypesBinding.h"
#include "nsQueryObject.h"
#include "nsSVGUtils.h"
#include "SVGObserverUtils.h"
NS_IMPL_NS_NEW_SVG_ELEMENT(Filter)

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

@ -42,7 +42,7 @@ class SVGFilterElement : public SVGFilterElementBase {
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
// nsSVGSVGElement methods:
// SVGSVGElement methods:
virtual bool HasValidDimensions() const override;
// WebIDL

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

@ -21,7 +21,6 @@
#include "mozilla/ComputedStyle.h"
#include "mozilla/SVGContentUtils.h"
#include "mozilla/SVGFilterInstance.h"
#include "nsSVGUtils.h"
#include "mozilla/dom/SVGComponentTransferFunctionElement.h"
#include "mozilla/dom/SVGElement.h"
#include "mozilla/dom/SVGFEDistantLightElement.h"

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

@ -9,7 +9,6 @@
#include "DOMSVGPoint.h"
#include "gfxPlatform.h"
#include "nsCOMPtr.h"
#include "nsSVGUtils.h"
#include "SVGAnimatedLength.h"
#include "SVGCircleElement.h"
#include "SVGEllipseElement.h"

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

@ -76,7 +76,7 @@ class SVGImageElement : public SVGImageElementBase,
const Matrix* aToNonScalingStrokeSpace = nullptr) override;
virtual already_AddRefed<Path> BuildPath(PathBuilder* aBuilder) override;
// nsSVGSVGElement methods:
// SVGSVGElement methods:
virtual bool HasValidDimensions() const override;
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;

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

@ -50,7 +50,7 @@ class SVGMarkerElement : public SVGMarkerElementBase {
// nsIContent interface
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* name) const override;
// nsSVGSVGElement methods:
// SVGSVGElement methods:
virtual bool HasValidDimensions() const override;
// public helpers

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

@ -39,7 +39,7 @@ class SVGMaskElement final : public SVGMaskElementBase {
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
// nsSVGSVGElement methods:
// SVGSVGElement methods:
virtual bool HasValidDimensions() const override;
// WebIDL

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

@ -41,7 +41,7 @@ class SVGPathElement final : public SVGPathElementBase {
// nsIContent interface
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* name) const override;
// nsSVGSVGElement methods:
// SVGSVGElement methods:
virtual bool HasValidDimensions() const override;
// SVGGeometryElement methods:

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

@ -48,7 +48,7 @@ class SVGPatternElement final : public SVGPatternElementBase {
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
// nsSVGSVGElement methods:
// SVGSVGElement methods:
virtual bool HasValidDimensions() const override;
virtual mozilla::SVGAnimatedTransformList* GetAnimatedTransformList(

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

@ -33,7 +33,7 @@ class SVGRectElement final : public SVGRectElementBase {
public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
// nsSVGSVGElement methods:
// SVGSVGElement methods:
virtual bool HasValidDimensions() const override;
// SVGGeometryElement methods:

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

@ -18,6 +18,7 @@
#include "mozilla/PresShell.h"
#include "mozilla/SMILAnimationController.h"
#include "mozilla/SMILTimeContainer.h"
#include "mozilla/SVGUtils.h"
#include "DOMSVGAngle.h"
#include "DOMSVGLength.h"
@ -26,7 +27,6 @@
#include "nsFrameSelection.h"
#include "nsIFrame.h"
#include "ISVGSVGFrame.h"
#include "nsSVGUtils.h"
NS_IMPL_NS_NEW_SVG_ELEMENT_CHECK_PARSER(SVG)
@ -464,7 +464,7 @@ int32_t SVGSVGElement::GetIntrinsicWidth() {
// know the length isn't a percentage so the context won't be used (and we
// need to pass the element to be able to resolve em/ex units).
float width = mLengthAttributes[ATTR_WIDTH].GetAnimValue(this);
return nsSVGUtils::ClampToInt(width);
return SVGUtils::ClampToInt(width);
}
int32_t SVGSVGElement::GetIntrinsicHeight() {
@ -476,7 +476,7 @@ int32_t SVGSVGElement::GetIntrinsicHeight() {
// know the length isn't a percentage so the context won't be used (and we
// need to pass the element to be able to resolve em/ex units).
float height = mLengthAttributes[ATTR_HEIGHT].GetAnimValue(this);
return nsSVGUtils::ClampToInt(height);
return SVGUtils::ClampToInt(height);
}
void SVGSVGElement::FlushImageTransformInvalidation() {

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

@ -7,8 +7,8 @@
#include "mozilla/dom/SVGSwitchElement.h"
#include "nsLayoutUtils.h"
#include "nsSVGUtils.h"
#include "mozilla/Preferences.h"
#include "mozilla/SVGUtils.h"
#include "mozilla/dom/SVGSwitchElementBinding.h"
class nsIFrame;
@ -57,7 +57,7 @@ void SVGSwitchElement::MaybeInvalidate() {
if (frame) {
nsLayoutUtils::PostRestyleEvent(this, RestyleHint{0},
nsChangeHint_InvalidateRenderingObservers);
nsSVGUtils::ScheduleReflowSVG(frame);
SVGUtils::ScheduleReflowSVG(frame);
}
mActiveChild = newActiveChild;

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

@ -10,8 +10,6 @@
#include "mozilla/dom/SVGGraphicsElement.h"
#include "nsCOMPtr.h"
class nsSVGSwitchFrame;
nsresult NS_NewSVGSwitchElement(
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
@ -21,8 +19,6 @@ namespace dom {
typedef SVGGraphicsElement SVGSwitchElementBase;
class SVGSwitchElement final : public SVGSwitchElementBase {
friend class ::nsSVGSwitchFrame;
protected:
friend nsresult(::NS_NewSVGSwitchElement(
nsIContent** aResult,

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

@ -16,9 +16,9 @@
#include "mozilla/ISVGDisplayableFrame.h"
#include "mozilla/SVGContentUtils.h"
#include "mozilla/SVGTextFrame.h"
#include "mozilla/SVGUtils.h"
#include "nsContentUtils.h"
#include "nsIFrame.h"
#include "nsSVGUtils.h"
using namespace mozilla::gfx;
@ -172,19 +172,19 @@ already_AddRefed<SVGRect> SVGTransformableElement::GetBBox(
ISVGDisplayableFrame* svgframe = do_QueryFrame(frame);
if (!svgframe) {
if (!nsSVGUtils::IsInSVGTextSubtree(frame)) {
if (!SVGUtils::IsInSVGTextSubtree(frame)) {
return ZeroBBox(*this);
}
// For <tspan>, <textPath>, the frame is an nsInlineFrame or
// nsBlockFrame, |svgframe| will be a nullptr.
// We implement their getBBox directly here instead of in
// nsSVGUtils::GetBBox, because nsSVGUtils::GetBBox is more
// SVGUtils::GetBBox, because SVGUtils::GetBBox is more
// or less used for other purpose elsewhere. e.g. gradient
// code assumes GetBBox of <tspan> returns the bbox of the
// outer <text>.
// TODO: cleanup this sort of usecase of nsSVGUtils::GetBBox,
// then move this code nsSVGUtils::GetBBox.
// TODO: cleanup this sort of usecase of SVGUtils::GetBBox,
// then move this code SVGUtils::GetBBox.
SVGTextFrame* text =
static_cast<SVGTextFrame*>(nsLayoutUtils::GetClosestFrameOfType(
frame->GetParent(), LayoutFrameType::SVGText));
@ -207,33 +207,32 @@ already_AddRefed<SVGRect> SVGTransformableElement::GetBBox(
if (!NS_SVGNewGetBBoxEnabled()) {
return do_AddRef(new SVGRect(
this, ToRect(nsSVGUtils::GetBBox(
frame, nsSVGUtils::eBBoxIncludeFillGeometry |
nsSVGUtils::eUseUserSpaceOfUseElement))));
this, ToRect(SVGUtils::GetBBox(
frame, SVGUtils::eBBoxIncludeFillGeometry |
SVGUtils::eUseUserSpaceOfUseElement))));
}
uint32_t flags = 0;
if (aOptions.mFill) {
flags |= nsSVGUtils::eBBoxIncludeFill;
flags |= SVGUtils::eBBoxIncludeFill;
}
if (aOptions.mStroke) {
flags |= nsSVGUtils::eBBoxIncludeStroke;
flags |= SVGUtils::eBBoxIncludeStroke;
}
if (aOptions.mMarkers) {
flags |= nsSVGUtils::eBBoxIncludeMarkers;
flags |= SVGUtils::eBBoxIncludeMarkers;
}
if (aOptions.mClipped) {
flags |= nsSVGUtils::eBBoxIncludeClipped;
flags |= SVGUtils::eBBoxIncludeClipped;
}
if (flags == 0) {
return do_AddRef(new SVGRect(this, gfx::Rect()));
}
if (flags == nsSVGUtils::eBBoxIncludeMarkers ||
flags == nsSVGUtils::eBBoxIncludeClipped) {
flags |= nsSVGUtils::eBBoxIncludeFill;
if (flags == SVGUtils::eBBoxIncludeMarkers ||
flags == SVGUtils::eBBoxIncludeClipped) {
flags |= SVGUtils::eBBoxIncludeFill;
}
flags |= nsSVGUtils::eUseUserSpaceOfUseElement;
return do_AddRef(
new SVGRect(this, ToRect(nsSVGUtils::GetBBox(frame, flags))));
flags |= SVGUtils::eUseUserSpaceOfUseElement;
return do_AddRef(new SVGRect(this, ToRect(SVGUtils::GetBBox(frame, flags))));
}
already_AddRefed<SVGMatrix> SVGTransformableElement::GetCTM() {

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

@ -313,7 +313,7 @@ void SVGUseElement::UpdateShadowTree() {
});
// make sure target is valid type for <use>
// QIable nsSVGGraphicsElement would eliminate enumerating all elements
// QIable SVGGraphicsElement would eliminate enumerating all elements
if (!targetElement ||
!targetElement->IsAnyOfSVGElements(
nsGkAtoms::svg, nsGkAtoms::symbol, nsGkAtoms::g, nsGkAtoms::path,
@ -529,7 +529,7 @@ SVGElement::StringAttributesInfo SVGUseElement::GetStringInfo() {
SVGUseFrame* SVGUseElement::GetFrame() const {
nsIFrame* frame = GetPrimaryFrame();
// We might be a plain nsSVGContainerFrame if we didn't pass the conditional
// We might be a plain SVGContainerFrame if we didn't pass the conditional
// processing checks.
if (!frame || !frame->IsSVGUseFrame()) {
MOZ_ASSERT_IF(frame, frame->Type() == LayoutFrameType::None);

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

@ -12,7 +12,6 @@
#include "mozilla/webrender/WebRenderAPI.h"
#include "mozilla/webrender/WebRenderTypes.h"
#include "Units.h"
#include "nsSVGIntegrationUtils.h" // for WrFiltersHolder
class nsDisplayTransform;

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

@ -12,6 +12,7 @@
#include "mozilla/layers/WebRenderMessages.h"
#include "mozilla/layers/WebRenderScrollData.h"
#include "mozilla/layers/WebRenderUserData.h"
#include "mozilla/SVGIntegrationUtils.h" // for WrFiltersHolder
#include "nsDisplayList.h"
#include "nsIFrame.h"
#include "DisplayItemCache.h"

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

@ -15,6 +15,7 @@
#include "mozilla/Maybe.h"
#include "mozilla/MozPromise.h"
#include "mozilla/StaticPrefs_apz.h"
#include "mozilla/SVGIntegrationUtils.h" // for WrFiltersHolder
#include "mozilla/layers/APZTestData.h"
#include "mozilla/layers/FocusTarget.h"
#include "mozilla/layers/IpcResourceUpdateQueue.h"

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

@ -10,6 +10,7 @@
#include "mozilla/PresShell.h"
#include "mozilla/SMILAnimationController.h"
#include "mozilla/SVGContextPaint.h"
#include "mozilla/SVGUtils.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/FontTableURIProtocolHandler.h"
@ -27,7 +28,6 @@
#include "nsStringStream.h"
#include "nsStreamUtils.h"
#include "nsIPrincipal.h"
#include "nsSVGUtils.h"
#include "nsContentUtils.h"
#include "gfxFont.h"
#include "gfxContext.h"
@ -205,7 +205,7 @@ void gfxSVGGlyphs::RenderGlyph(gfxContext* aContext, uint32_t aGlyphId,
AutoSetRestoreSVGContextPaint autoSetRestore(
*aContextPaint, *glyph->OwnerDoc()->AsSVGDocument());
nsSVGUtils::PaintSVGGlyph(glyph, aContext);
SVGUtils::PaintSVGGlyph(glyph, aContext);
}
bool gfxSVGGlyphs::GetGlyphExtents(uint32_t aGlyphId,
@ -215,7 +215,7 @@ bool gfxSVGGlyphs::GetGlyphExtents(uint32_t aGlyphId,
NS_ASSERTION(glyph,
"No glyph element. Should check with HasSVGGlyph() first!");
return nsSVGUtils::GetSVGGlyphExtents(glyph, aSVGToAppSpace, aResult);
return SVGUtils::GetSVGGlyphExtents(glyph, aSVGToAppSpace, aResult);
}
Element* gfxSVGGlyphs::GetGlyphElement(uint32_t aGlyphId) {

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

@ -254,7 +254,7 @@ class SVGDrawingCallback : public gfxDrawingCallback {
uint32_t mImageFlags;
};
// Based loosely on nsSVGIntegrationUtils' PaintFrameCallback::operator()
// Based loosely on SVGIntegrationUtils' PaintFrameCallback::operator()
bool SVGDrawingCallback::operator()(gfxContext* aContext,
const gfxRect& aFillRect,
const SamplingFilter aSamplingFilter,

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

@ -117,7 +117,7 @@ LOCAL_INCLUDES += [
'/dom/svg',
# We need to instantiate the decoders
'/image/decoders',
# Because VectorImage.cpp includes nsSVGUtils.h and SVGObserverUtils.h
# Because VectorImage.cpp includes SVGUtils.h and SVGObserverUtils.h
'/layout/svg',
# For URI-related functionality
'/netwerk/base',

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

@ -7,6 +7,7 @@
#include "GeometryUtils.h"
#include "mozilla/PresShell.h"
#include "mozilla/SVGUtils.h"
#include "mozilla/dom/CharacterData.h"
#include "mozilla/dom/DOMPointBinding.h"
#include "mozilla/dom/GeometryUtilsBinding.h"
@ -19,7 +20,6 @@
#include "nsIFrame.h"
#include "nsCSSFrameConstructor.h"
#include "nsLayoutUtils.h"
#include "nsSVGUtils.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -143,7 +143,7 @@ static nsIFrame* GetFirstNonAnonymousFrameForNode(nsINode* aNode) {
*/
static nsRect GetBoxRectForFrame(nsIFrame** aFrame, CSSBoxType aType) {
nsRect r;
nsIFrame* f = nsSVGUtils::GetOuterSVGFrameAndCoveredRegion(*aFrame, &r);
nsIFrame* f = SVGUtils::GetOuterSVGFrameAndCoveredRegion(*aFrame, &r);
if (f && f != *aFrame) {
// For non-outer SVG frames, the BoxType is ignored.
*aFrame = f;

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

@ -28,7 +28,7 @@ RayReferenceData::RayReferenceData(const nsIFrame* aFrame) {
// for calculating the path length. We may need to update this.
// https://github.com/w3c/fxtf-drafts/issues/369
// FIXME: Bug 1579294: SVG layout may get a |container| with empty mRect
// (e.g. nsSVGOuterSVGAnonChildFrame), which makes the path length zero.
// (e.g. SVGOuterSVGAnonChildFrame), which makes the path length zero.
const nsIFrame* container = aFrame->GetContainingBlock();
if (!container) {
// If there is no parent frame, it's impossible to calculate the path

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

@ -11,6 +11,7 @@
#include "mozilla/ComputedStyle.h"
#include "mozilla/ComputedStyleInlines.h"
#include "mozilla/DocumentStyleRootIterator.h"
#include "mozilla/EffectSet.h"
#include "mozilla/GeckoBindings.h"
#include "mozilla/LayerAnimationInfo.h"
#include "mozilla/layers/AnimationInfo.h"
@ -20,8 +21,13 @@
#include "mozilla/ServoBindings.h"
#include "mozilla/ServoStyleSetInlines.h"
#include "mozilla/StaticPrefs_layout.h"
#include "mozilla/SVGIntegrationUtils.h"
#include "mozilla/SVGObserverUtils.h"
#include "mozilla/SVGTextFrame.h"
#include "mozilla/SVGUtils.h"
#include "mozilla/Unused.h"
#include "mozilla/ViewportFrame.h"
#include "mozilla/IntegerRange.h"
#include "mozilla/dom/ChildIterator.h"
#include "mozilla/dom/DocumentInlines.h"
#include "mozilla/dom/ElementInlines.h"
@ -45,12 +51,7 @@
#include "nsStyleUtil.h"
#include "nsTransitionManager.h"
#include "StickyScrollContainer.h"
#include "mozilla/EffectSet.h"
#include "mozilla/IntegerRange.h"
#include "SVGObserverUtils.h"
#include "SVGTextFrame.h"
#include "ActiveLayerTracker.h"
#include "nsSVGIntegrationUtils.h"
#ifdef ACCESSIBILITY
# include "nsAccessibilityService.h"
@ -653,7 +654,7 @@ static nsIFrame* GetFrameForChildrenOnlyTransformHint(nsIFrame* aFrame) {
if (aFrame->IsSVGOuterSVGFrame()) {
aFrame = aFrame->PrincipalChildList().FirstChild();
MOZ_ASSERT(aFrame->IsSVGOuterSVGAnonChildFrame(),
"Where is the nsSVGOuterSVGFrame's anon child??");
"Where is the SVGOuterSVGFrame's anon child??");
}
MOZ_ASSERT(aFrame->IsFrameOfType(nsIFrame::eSVG | nsIFrame::eSVGContainer),
"Children-only transforms only expected on SVG frames");
@ -928,7 +929,7 @@ static bool ContainingBlockChangeAffectsDescendants(
nsIFrame* outOfFlow = nsPlaceholderFrame::GetRealFrameForPlaceholder(f);
// If SVG text frames could appear here, they could confuse us since
// they ignore their position style ... but they can't.
NS_ASSERTION(!nsSVGUtils::IsInSVGTextSubtree(outOfFlow),
NS_ASSERTION(!SVGUtils::IsInSVGTextSubtree(outOfFlow),
"SVG text frames can't be out of flow");
auto* display = outOfFlow->StyleDisplay();
if (display->IsAbsolutelyPositionedStyle()) {
@ -1028,7 +1029,7 @@ static void DoApplyRenderingChangeToTree(nsIFrame* aFrame,
aFrame->IsFrameOfType(nsIFrame::eSVG) &&
!aFrame->IsSVGOuterSVGFrame()) {
// Need to update our overflow rects:
nsSVGUtils::ScheduleReflowSVG(aFrame);
SVGUtils::ScheduleReflowSVG(aFrame);
}
ActiveLayerTracker::NotifyNeedsRepaint(aFrame);
@ -1039,7 +1040,7 @@ static void DoApplyRenderingChangeToTree(nsIFrame* aFrame,
needInvalidatingPaint = true;
ActiveLayerTracker::NotifyRestyle(aFrame, eCSSProperty_opacity);
if (nsSVGIntegrationUtils::UsingEffectsForFrame(aFrame)) {
if (SVGIntegrationUtils::UsingEffectsForFrame(aFrame)) {
// SVG effects paints the opacity without using
// nsDisplayOpacity. We need to invalidate manually.
aFrame->InvalidateFrameSubtree();
@ -1543,9 +1544,9 @@ void RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList) {
// opacity layer change hint when we do opacity optimization for SVG.
// We can't do it in nsStyleEffects::CalcDifference() just like we do
// for the optimization for 0.99 over opacity values since we have no way
// to call nsSVGUtils::CanOptimizeOpacity() there.
// to call SVGUtils::CanOptimizeOpacity() there.
if ((hint & nsChangeHint_UpdateOpacityLayer) &&
nsSVGUtils::CanOptimizeOpacity(frame)) {
SVGUtils::CanOptimizeOpacity(frame)) {
hint &= ~nsChangeHint_UpdateOpacityLayer;
hint |= nsChangeHint_RepaintFrame;
}

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

@ -119,7 +119,7 @@
#include "nsMathMLParts.h"
#include "mozilla/dom/SVGTests.h"
#include "nsSVGUtils.h"
#include "mozilla/SVGUtils.h"
#include "nsRefreshDriver.h"
#include "nsTextNode.h"
@ -354,7 +354,7 @@ static inline bool IsDisplayContents(const nsIContent* aContent) {
*/
static bool IsFrameForSVG(const nsIFrame* aFrame) {
return aFrame->IsFrameOfType(nsIFrame::eSVG) ||
nsSVGUtils::IsInSVGTextSubtree(aFrame);
SVGUtils::IsInSVGTextSubtree(aFrame);
}
static bool IsLastContinuationForColumnContent(const nsIFrame* aFrame) {
@ -956,7 +956,7 @@ nsContainerFrame* nsFrameConstructorState::GetGeometricParent(
// float to "none"? That's OK per CSS 2.1, as far as I can tell.
if (aContentParentFrame &&
nsSVGUtils::IsInSVGTextSubtree(aContentParentFrame)) {
SVGUtils::IsInSVGTextSubtree(aContentParentFrame)) {
return aContentParentFrame;
}
@ -2455,7 +2455,7 @@ void nsCSSFrameConstructor::SetUpDocElementContainingBlock(
ViewportFrame [fixed-cb]
nsHTMLScrollFrame
nsCanvasFrame [abs-cb]
root element frame (nsBlockFrame, nsSVGOuterSVGFrame,
root element frame (nsBlockFrame, SVGOuterSVGFrame,
nsTableWrapperFrame, nsPlaceholderFrame)
Galley presentation, XUL
@ -2471,7 +2471,7 @@ void nsCSSFrameConstructor::SetUpDocElementContainingBlock(
nsPageFrame
nsPageContentFrame [fixed-cb]
nsCanvasFrame [abs-cb]
root element frame (nsBlockFrame, nsSVGOuterSVGFrame,
root element frame (nsBlockFrame, SVGOuterSVGFrame,
nsTableWrapperFrame, nsPlaceholderFrame)
Print-preview presentation, non-XUL
@ -2482,7 +2482,7 @@ void nsCSSFrameConstructor::SetUpDocElementContainingBlock(
nsPageFrame
nsPageContentFrame [fixed-cb]
nsCanvasFrame [abs-cb]
root element frame (nsBlockFrame, nsSVGOuterSVGFrame,
root element frame (nsBlockFrame, SVGOuterSVGFrame,
nsTableWrapperFrame, nsPlaceholderFrame)
Print/print preview of XUL is not supported.
@ -3177,9 +3177,8 @@ const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindTextData(const Text& aTextContent,
nsIFrame* aParentFrame) {
if (aParentFrame && IsFrameForSVG(aParentFrame)) {
nsIFrame* ancestorFrame =
nsSVGUtils::GetFirstNonAAncestorFrame(aParentFrame);
if (!ancestorFrame || !nsSVGUtils::IsInSVGTextSubtree(ancestorFrame)) {
nsIFrame* ancestorFrame = SVGUtils::GetFirstNonAAncestorFrame(aParentFrame);
if (!ancestorFrame || !SVGUtils::IsInSVGTextSubtree(ancestorFrame)) {
return nullptr;
}
@ -4569,7 +4568,7 @@ nsIFrame* nsCSSFrameConstructor::ConstructNonScrollableBlockWithConstructor(
if ((aDisplay->IsAbsolutelyPositionedStyle() || aDisplay->IsFloatingStyle() ||
aDisplay->DisplayInside() == StyleDisplayInside::FlowRoot ||
clipPaginatedOverflow) &&
!nsSVGUtils::IsInSVGTextSubtree(aParentFrame)) {
!SVGUtils::IsInSVGTextSubtree(aParentFrame)) {
flags = NS_BLOCK_FORMATTING_CONTEXT_STATE_BITS;
if (clipPaginatedOverflow) {
flags |= NS_BLOCK_CLIP_PAGINATED_OVERFLOW;
@ -4902,12 +4901,12 @@ nsCSSFrameConstructor::FindSVGData(const Element& aElement,
}
if (tag == nsGkAtoms::svg && !parentIsSVG) {
// We need outer <svg> elements to have an nsSVGOuterSVGFrame regardless
// We need outer <svg> elements to have an SVGOuterSVGFrame regardless
// of whether they fail conditional processing attributes, since various
// SVG frames assume that one exists. We handle the non-rendering
// of failing outer <svg> element contents like <switch> statements,
// and do the PassesConditionalProcessingTests call in
// nsSVGOuterSVGFrame::Init.
// SVGOuterSVGFrame::Init.
static const FrameConstructionData sOuterSVGData =
FULL_CTOR_FCDATA(0, &nsCSSFrameConstructor::ConstructOuterSVG);
return &sOuterSVGData;
@ -4923,7 +4922,7 @@ nsCSSFrameConstructor::FindSVGData(const Element& aElement,
if (tests && !tests->PassesConditionalProcessingTests()) {
// Elements with failing conditional processing attributes never get
// rendered. Note that this is not where we select which frame in a
// <switch> to render! That happens in nsSVGSwitchFrame::PaintSVG.
// <switch> to render! That happens in SVGSwitchFrame::PaintSVG.
if (aIsWithinSVGText) {
// SVGTextFrame doesn't handle conditional processing attributes,
// so don't create frames for descendants of <text> with failing
@ -4931,7 +4930,7 @@ nsCSSFrameConstructor::FindSVGData(const Element& aElement,
// is correct.
return &sSuppressData;
}
// If we're not inside <text>, create an nsSVGContainerFrame (which is a
// If we're not inside <text>, create an SVGContainerFrame (which is a
// frame that doesn't render) so that paint servers can still be referenced,
// even if they live inside an element with failing conditional processing
// attributes.
@ -5122,7 +5121,7 @@ void nsCSSFrameConstructor::DoAddFrameConstructionItems(
ItemFlags aFlags) {
auto flags = aFlags + ItemFlag::AllowPageBreak;
if (aParentFrame) {
if (nsSVGUtils::IsInSVGTextSubtree(aParentFrame)) {
if (SVGUtils::IsInSVGTextSubtree(aParentFrame)) {
flags += ItemFlag::IsWithinSVGText;
}
if (aParentFrame->IsBlockFrame() && aParentFrame->GetParent() &&
@ -9945,7 +9944,7 @@ void nsCSSFrameConstructor::CreateLetterFrame(
const nsStyleDisplay* display = sc->StyleDisplay();
nsFirstLetterFrame* letterFrame;
if (display->IsFloatingStyle() &&
!nsSVGUtils::IsInSVGTextSubtree(aParentFrame)) {
!SVGUtils::IsInSVGTextSubtree(aParentFrame)) {
// Make a floating first-letter frame
letterFrame = CreateFloatingLetterFrame(state, aTextContent, textFrame,
aParentFrame, parentComputedStyle,

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

@ -1466,7 +1466,7 @@ class nsCSSFrameConstructor final : public nsFrameManager {
mozilla::PseudoStyleType aInnerPseudo, bool aCandidateRootFrame);
/**
* Construct an nsSVGOuterSVGFrame.
* Construct an SVGOuterSVGFrame.
*/
nsIFrame* ConstructOuterSVG(nsFrameConstructorState& aState,
FrameConstructionItem& aItem,
@ -1475,7 +1475,7 @@ class nsCSSFrameConstructor final : public nsFrameManager {
nsFrameList& aFrameList);
/**
* Construct an nsSVGMarkerFrame.
* Construct an SVGMarkerFrame.
*/
nsIFrame* ConstructMarker(nsFrameConstructorState& aState,
FrameConstructionItem& aItem,

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

@ -33,7 +33,10 @@
#include "mozilla/StaticPrefs_image.h"
#include "mozilla/StaticPrefs_layers.h"
#include "mozilla/StaticPrefs_layout.h"
#include "mozilla/SVGImageContext.h"
#include "mozilla/SVGIntegrationUtils.h"
#include "mozilla/SVGTextFrame.h"
#include "mozilla/SVGUtils.h"
#include "mozilla/Unused.h"
#include "mozilla/ViewportFrame.h"
#include "mozilla/ViewportUtils.h"
@ -106,9 +109,6 @@
#include "nsTableWrapperFrame.h"
#include "nsTextFrame.h"
#include "nsFontInflationData.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSVGUtils.h"
#include "SVGImageContext.h"
#include "nsStyleStructInlines.h"
#include "nsStyleTransformMatrix.h"
#include "nsIFrameInlines.h"
@ -2355,7 +2355,7 @@ nsPoint GetEventCoordinatesRelativeTo(nsIWidget* aWidget,
/* If we encountered a transform, we can't do simple arithmetic to figure
* out how to convert back to aFrame's coordinates and must use the CTM.
*/
if (transformFound || nsSVGUtils::IsInSVGTextSubtree(frame)) {
if (transformFound || SVGUtils::IsInSVGTextSubtree(frame)) {
return nsLayoutUtils::TransformRootPointToFrame(ViewportType::Visual,
aFrame, widgetToView);
}
@ -3111,7 +3111,7 @@ static Rect TransformGfxRectToAncestor(
}
static SVGTextFrame* GetContainingSVGTextFrame(const nsIFrame* aFrame) {
if (!nsSVGUtils::IsInSVGTextSubtree(aFrame)) {
if (!SVGUtils::IsInSVGTextSubtree(aFrame)) {
return nullptr;
}
@ -4520,7 +4520,7 @@ struct BoxToRect : public nsLayoutUtils::BoxCallback {
virtual void AddBox(nsIFrame* aFrame) override {
nsRect r;
nsIFrame* outer = nsSVGUtils::GetOuterSVGFrameAndCoveredRegion(aFrame, &r);
nsIFrame* outer = SVGUtils::GetOuterSVGFrameAndCoveredRegion(aFrame, &r);
if (!outer) {
outer = aFrame;
switch (mFlags & nsLayoutUtils::RECTS_WHICH_BOX_MASK) {
@ -8595,7 +8595,7 @@ nscoord nsLayoutUtils::InflationMinFontSizeFor(const nsIFrame* aFrame) {
}
float nsLayoutUtils::FontSizeInflationFor(const nsIFrame* aFrame) {
if (nsSVGUtils::IsInSVGTextSubtree(aFrame)) {
if (SVGUtils::IsInSVGTextSubtree(aFrame)) {
const nsIFrame* container = aFrame;
while (!container->IsSVGTextFrame()) {
container = container->GetParent();
@ -10039,8 +10039,8 @@ static nsRect ComputeSVGReferenceRect(nsIFrame* aFrame,
// The size of stroke-box is not correct if this graphic element has
// specific stroke-linejoin or stroke-linecap.
gfxRect bbox =
nsSVGUtils::GetBBox(aFrame, nsSVGUtils::eBBoxIncludeFillGeometry |
nsSVGUtils::eBBoxIncludeStroke);
SVGUtils::GetBBox(aFrame, SVGUtils::eBBoxIncludeFillGeometry |
SVGUtils::eBBoxIncludeStroke);
r = nsLayoutUtils::RoundGfxRectToAppRect(bbox, AppUnitsPerCSSPixel());
break;
}
@ -10080,14 +10080,14 @@ static nsRect ComputeSVGReferenceRect(nsIFrame* aFrame,
case StyleGeometryBox::MarginBox:
case StyleGeometryBox::FillBox: {
gfxRect bbox =
nsSVGUtils::GetBBox(aFrame, nsSVGUtils::eBBoxIncludeFillGeometry);
SVGUtils::GetBBox(aFrame, SVGUtils::eBBoxIncludeFillGeometry);
r = nsLayoutUtils::RoundGfxRectToAppRect(bbox, AppUnitsPerCSSPixel());
break;
}
default: {
MOZ_ASSERT_UNREACHABLE("unknown StyleGeometryBox type");
gfxRect bbox =
nsSVGUtils::GetBBox(aFrame, nsSVGUtils::eBBoxIncludeFillGeometry);
SVGUtils::GetBBox(aFrame, SVGUtils::eBBoxIncludeFillGeometry);
r = nsLayoutUtils::RoundGfxRectToAppRect(bbox, AppUnitsPerCSSPixel());
break;
}
@ -10188,7 +10188,7 @@ nsPoint nsLayoutUtils::ComputeOffsetToUserSpace(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame) {
nsPoint offsetToBoundingBox =
aBuilder->ToReferenceFrame(aFrame) -
nsSVGIntegrationUtils::GetOffsetToBoundingBox(aFrame);
SVGIntegrationUtils::GetOffsetToBoundingBox(aFrame);
if (!aFrame->IsFrameOfType(nsIFrame::eSVG)) {
// Snap the offset if the reference frame is not a SVG frame, since other
// frames will be snapped to pixel when rendering.
@ -10212,7 +10212,7 @@ nsPoint nsLayoutUtils::ComputeOffsetToUserSpace(nsDisplayListBuilder* aBuilder,
// frame's position so that SVG painting can later add it again and the
// frame is painted in the right place.
gfxPoint toUserSpaceGfx =
nsSVGUtils::FrameSpaceInCSSPxToUserSpaceOffset(aFrame);
SVGUtils::FrameSpaceInCSSPxToUserSpaceOffset(aFrame);
nsPoint toUserSpace =
nsPoint(nsPresContext::CSSPixelsToAppUnits(float(toUserSpaceGfx.x)),
nsPresContext::CSSPixelsToAppUnits(float(toUserSpaceGfx.y)));

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

@ -51,8 +51,7 @@
#include "nsFocusManager.h"
#include "nsListControlFrame.h"
#include "mozilla/dom/HTMLInputElement.h"
#include "SVGElementFactory.h"
#include "nsSVGUtils.h"
#include "mozilla/dom/SVGElementFactory.h"
#include "nsMathMLAtoms.h"
#include "nsMathMLOperators.h"
#include "Navigator.h"

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

@ -28,6 +28,7 @@
#include "nsIFrameInlines.h"
#include "CounterStyleManager.h"
#include <algorithm>
#include "mozilla/SVGUtils.h"
#include "mozilla/dom/HTMLInputElement.h"
#include "nsGridContainerFrame.h"
@ -2502,7 +2503,7 @@ void SizeComputationInput::InitOffsets(WritingMode aWM, nscoord aPercentBasis,
ComputedPhysicalPadding() = LayoutDevicePixel::ToAppUnits(
widgetPadding, presContext->AppUnitsPerDevPixel());
needPaddingProp = false;
} else if (nsSVGUtils::IsInSVGTextSubtree(mFrame)) {
} else if (SVGUtils::IsInSVGTextSubtree(mFrame)) {
ComputedPhysicalPadding().SizeTo(0, 0, 0, 0);
needPaddingProp = false;
} else if (aPadding) { // padding is an input arg
@ -2551,7 +2552,7 @@ void SizeComputationInput::InitOffsets(WritingMode aWM, nscoord aPercentBasis,
presContext->DeviceContext(), mFrame, disp->mAppearance);
ComputedPhysicalBorderPadding() = LayoutDevicePixel::ToAppUnits(
border, presContext->AppUnitsPerDevPixel());
} else if (nsSVGUtils::IsInSVGTextSubtree(mFrame)) {
} else if (SVGUtils::IsInSVGTextSubtree(mFrame)) {
ComputedPhysicalBorderPadding().SizeTo(0, 0, 0, 0);
} else if (aBorder) { // border is an input arg
ComputedPhysicalBorderPadding() = *aBorder;
@ -2828,7 +2829,7 @@ nscoord ReflowInput::CalcLineHeight(nsIContent* aContent,
bool SizeComputationInput::ComputeMargin(WritingMode aWM,
nscoord aPercentBasis) {
// SVG text frames have no margin.
if (nsSVGUtils::IsInSVGTextSubtree(mFrame)) {
if (SVGUtils::IsInSVGTextSubtree(mFrame)) {
return false;
}

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

@ -19,6 +19,7 @@
#include "mozilla/PresShell.h"
#include "mozilla/StaticPrefs_browser.h"
#include "mozilla/StaticPrefs_layout.h"
#include "mozilla/SVGUtils.h"
#include "mozilla/ToString.h"
#include "mozilla/UniquePtr.h"
@ -533,7 +534,7 @@ nsresult nsBlockFrame::GetFrameName(nsAString& aResult) const {
void nsBlockFrame::InvalidateFrame(uint32_t aDisplayItemKey,
bool aRebuildDisplayItems) {
if (nsSVGUtils::IsInSVGTextSubtree(this)) {
if (SVGUtils::IsInSVGTextSubtree(this)) {
NS_ASSERTION(GetParent()->IsSVGTextFrame(),
"unexpected block frame in SVG text");
GetParent()->InvalidateFrame();
@ -545,7 +546,7 @@ void nsBlockFrame::InvalidateFrame(uint32_t aDisplayItemKey,
void nsBlockFrame::InvalidateFrameWithRect(const nsRect& aRect,
uint32_t aDisplayItemKey,
bool aRebuildDisplayItems) {
if (nsSVGUtils::IsInSVGTextSubtree(this)) {
if (SVGUtils::IsInSVGTextSubtree(this)) {
NS_ASSERTION(GetParent()->IsSVGTextFrame(),
"unexpected block frame in SVG text");
GetParent()->InvalidateFrame();
@ -2188,7 +2189,7 @@ void nsBlockFrame::MarkLineDirty(LineIterator aLine,
static inline bool IsAlignedLeft(StyleTextAlign aAlignment,
StyleDirection aDirection,
uint8_t aUnicodeBidi, nsIFrame* aFrame) {
return nsSVGUtils::IsInSVGTextSubtree(aFrame) ||
return SVGUtils::IsInSVGTextSubtree(aFrame) ||
StyleTextAlign::Left == aAlignment ||
(((StyleTextAlign::Start == aAlignment &&
StyleDirection::Ltr == aDirection) ||
@ -4870,7 +4871,7 @@ bool nsBlockFrame::PlaceLine(BlockReflowInput& aState,
* In other words, isLastLine really means isLastLineAndWeCare.
*/
const bool isLastLine =
!nsSVGUtils::IsInSVGTextSubtree(this) &&
!SVGUtils::IsInSVGTextSubtree(this) &&
styleText->TextAlignForLastLine() != styleText->mTextAlign &&
(aLineLayout.GetLineEndsInBR() || IsLastLine(aState, aLine));
@ -5472,7 +5473,7 @@ void nsBlockFrame::AppendFrames(ChildListID aListID, nsFrameList& aFrameList) {
printf("\n");
#endif
if (nsSVGUtils::IsInSVGTextSubtree(this)) {
if (SVGUtils::IsInSVGTextSubtree(this)) {
MOZ_ASSERT(GetParent()->IsSVGTextFrame(),
"unexpected block frame in SVG text");
// Workaround for bug 1399425 in case this bit has been removed from the

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

@ -233,7 +233,7 @@ FRAME_STATE_BIT(Generic, 42, NS_FRAME_FONT_INFLATION_FLOW_ROOT)
// This bit is set on SVG frames that are laid out using SVG's coordinate
// system based layout (as opposed to any of the CSS layout models). Note that
// this does not include nsSVGOuterSVGFrame since it takes part is CSS layout.
// this does not include SVGOuterSVGFrame since it takes part in CSS layout.
FRAME_STATE_BIT(Generic, 43, NS_FRAME_SVG_LAYOUT)
// This bit is set if a frame has a multi-column ancestor (i.e.

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

@ -59,7 +59,6 @@
#include "ScrollbarActivity.h"
#include "nsRefreshDriver.h"
#include "nsStyleConsts.h"
#include "nsSVGIntegrationUtils.h"
#include "nsIScrollPositionListener.h"
#include "StickyScrollContainer.h"
#include "nsIFrameInlines.h"

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

@ -30,6 +30,8 @@
#include "mozilla/SVGMaskFrame.h"
#include "mozilla/SVGObserverUtils.h"
#include "mozilla/SVGTextFrame.h"
#include "mozilla/SVGIntegrationUtils.h"
#include "mozilla/SVGUtils.h"
#include "mozilla/ToString.h"
#include "mozilla/ViewportUtils.h"
@ -88,7 +90,6 @@
#include "nsBoxLayoutState.h"
#include "nsBlockFrame.h"
#include "nsDisplayList.h"
#include "nsSVGIntegrationUtils.h"
#include "nsChangeHint.h"
#include "nsDeckFrame.h"
#include "nsSubDocumentFrame.h"
@ -567,7 +568,7 @@ static bool IsFontSizeInflationContainer(nsIFrame* aFrame,
}
static void MaybeScheduleReflowSVGNonDisplayText(nsIFrame* aFrame) {
if (!nsSVGUtils::IsInSVGTextSubtree(aFrame)) {
if (!SVGUtils::IsInSVGTextSubtree(aFrame)) {
return;
}
@ -1654,7 +1655,7 @@ const nsIFrame::ChildListID nsIFrame::kNoReflowPrincipalList;
nsMargin nsIFrame::GetUsedMargin() const {
nsMargin margin(0, 0, 0, 0);
if (((mState & NS_FRAME_FIRST_REFLOW) && !(mState & NS_FRAME_IN_REFLOW)) ||
nsSVGUtils::IsInSVGTextSubtree(this))
SVGUtils::IsInSVGTextSubtree(this))
return margin;
nsMargin* m = GetProperty(UsedMarginProperty());
@ -1675,7 +1676,7 @@ nsMargin nsIFrame::GetUsedMargin() const {
nsMargin nsIFrame::GetUsedBorder() const {
nsMargin border(0, 0, 0, 0);
if (((mState & NS_FRAME_FIRST_REFLOW) && !(mState & NS_FRAME_IN_REFLOW)) ||
nsSVGUtils::IsInSVGTextSubtree(this))
SVGUtils::IsInSVGTextSubtree(this))
return border;
// Theme methods don't use const-ness.
@ -1704,7 +1705,7 @@ nsMargin nsIFrame::GetUsedBorder() const {
nsMargin nsIFrame::GetUsedPadding() const {
nsMargin padding(0, 0, 0, 0);
if (((mState & NS_FRAME_FIRST_REFLOW) && !(mState & NS_FRAME_IN_REFLOW)) ||
nsSVGUtils::IsInSVGTextSubtree(this))
SVGUtils::IsInSVGTextSubtree(this))
return padding;
// Theme methods don't use const-ness.
@ -1890,7 +1891,7 @@ bool nsIFrame::Extend3DContext(const nsStyleDisplay* aStyleDisplay,
return !ShouldApplyOverflowClipping(disp) &&
!GetClipPropClipRect(disp, effects, GetSize()) &&
!nsSVGIntegrationUtils::UsingEffectsForFrame(this);
!SVGIntegrationUtils::UsingEffectsForFrame(this);
}
bool nsIFrame::Combines3DTransformWithAncestors(
@ -2996,15 +2997,15 @@ static Maybe<nsRect> ComputeClipForMaskItem(nsDisplayListBuilder* aBuilder,
nsIFrame* aMaskedFrame) {
const nsStyleSVGReset* svgReset = aMaskedFrame->StyleSVGReset();
nsSVGUtils::MaskUsage maskUsage;
nsSVGUtils::DetermineMaskUsage(aMaskedFrame, false, maskUsage);
SVGUtils::MaskUsage maskUsage;
SVGUtils::DetermineMaskUsage(aMaskedFrame, false, maskUsage);
nsPoint offsetToUserSpace =
nsLayoutUtils::ComputeOffsetToUserSpace(aBuilder, aMaskedFrame);
int32_t devPixelRatio = aMaskedFrame->PresContext()->AppUnitsPerDevPixel();
gfxPoint devPixelOffsetToUserSpace =
nsLayoutUtils::PointToGfxPoint(offsetToUserSpace, devPixelRatio);
gfxMatrix cssToDevMatrix = nsSVGUtils::GetCSSPxToDevPxMatrix(aMaskedFrame);
gfxMatrix cssToDevMatrix = SVGUtils::GetCSSPxToDevPxMatrix(aMaskedFrame);
nsPoint toReferenceFrame;
aBuilder->FindReferenceFrameFor(aMaskedFrame, &toReferenceFrame);
@ -3018,11 +3019,11 @@ static Maybe<nsRect> ComputeClipForMaskItem(nsDisplayListBuilder* aBuilder,
combinedClip = Some(ThebesRect(*result));
}
} else if (maskUsage.shouldApplyClipPath) {
gfxRect result = nsSVGUtils::GetBBox(
gfxRect result = SVGUtils::GetBBox(
aMaskedFrame,
nsSVGUtils::eBBoxIncludeClipped | nsSVGUtils::eBBoxIncludeFill |
nsSVGUtils::eBBoxIncludeMarkers | nsSVGUtils::eBBoxIncludeStroke |
nsSVGUtils::eDoNotClipToBBoxOfContentInsideClipPath);
SVGUtils::eBBoxIncludeClipped | SVGUtils::eBBoxIncludeFill |
SVGUtils::eBBoxIncludeMarkers | SVGUtils::eBBoxIncludeStroke |
SVGUtils::eDoNotClipToBBoxOfContentInsideClipPath);
combinedClip = Some(cssToDevMatrix.TransformBounds(result));
} else {
// The code for this case is adapted from ComputeMaskGeometry().
@ -3206,7 +3207,7 @@ void nsIFrame::BuildDisplayListForStackingContext(
// NeedsActiveLayer was to change, which we don't currently do.
const bool useOpacity =
HasVisualOpacity(disp, effects, effectSetForOpacity) &&
!nsSVGUtils::CanOptimizeOpacity(this);
!SVGUtils::CanOptimizeOpacity(this);
const bool isTransformed = IsTransformed(disp);
const bool hasPerspective = isTransformed && HasPerspective(disp);
@ -3330,16 +3331,16 @@ void nsIFrame::BuildDisplayListForStackingContext(
}
bool usingFilter = effects->HasFilters();
bool usingMask = nsSVGIntegrationUtils::UsingMaskOrClipPathForFrame(this);
bool usingMask = SVGIntegrationUtils::UsingMaskOrClipPathForFrame(this);
bool usingSVGEffects = usingFilter || usingMask;
nsRect visibleRectOutsideSVGEffects = visibleRect;
nsDisplayList hoistedScrollInfoItemsStorage;
if (usingSVGEffects) {
dirtyRect =
nsSVGIntegrationUtils::GetRequiredSourceForInvalidArea(this, dirtyRect);
visibleRect = nsSVGIntegrationUtils::GetRequiredSourceForInvalidArea(
this, visibleRect);
SVGIntegrationUtils::GetRequiredSourceForInvalidArea(this, dirtyRect);
visibleRect =
SVGIntegrationUtils::GetRequiredSourceForInvalidArea(this, visibleRect);
aBuilder->EnterSVGEffectsContents(this, &hoistedScrollInfoItemsStorage);
}
@ -5518,7 +5519,7 @@ static FrameTarget GetSelectionClosestFrame(nsIFrame* aFrame,
kid->FindCloserFrameForSelection(aPoint, &closest);
}
if (closest.mFrame) {
if (nsSVGUtils::IsInSVGTextSubtree(closest.mFrame))
if (SVGUtils::IsInSVGTextSubtree(closest.mFrame))
return FrameTarget(closest.mFrame, false, false);
return GetSelectionClosestFrameForChild(closest.mFrame, aPoint, aFlags);
}
@ -5638,7 +5639,7 @@ nsIFrame::ContentOffsets nsIFrame::GetContentOffsetsFromPoint(
nsPoint pt;
if (closest.frame != this) {
if (nsSVGUtils::IsInSVGTextSubtree(closest.frame)) {
if (SVGUtils::IsInSVGTextSubtree(closest.frame)) {
pt = nsLayoutUtils::TransformAncestorPointToFrame(
RelativeTo{closest.frame}, aPoint, RelativeTo{this});
} else {
@ -7287,7 +7288,7 @@ static nsRect ComputeEffectsRect(nsIFrame* aFrame, const nsRect& aOverflowRect,
if (aFrame->StyleEffects()->HasFilters()) {
SetOrUpdateRectValuedProperty(aFrame, nsIFrame::PreEffectsBBoxProperty(),
r);
r = nsSVGUtils::GetPostFilterVisualOverflowRect(aFrame, aOverflowRect);
r = SVGUtils::GetPostFilterVisualOverflowRect(aFrame, aOverflowRect);
}
return r;
}
@ -7323,10 +7324,10 @@ static nsRect ComputeEffectsRect(nsIFrame* aFrame, const nsRect& aOverflowRect,
// only one heap-allocated rect per frame and it will be cleaned up when
// the frame dies.
if (nsSVGIntegrationUtils::UsingOverflowAffectingEffects(aFrame)) {
if (SVGIntegrationUtils::UsingOverflowAffectingEffects(aFrame)) {
SetOrUpdateRectValuedProperty(aFrame, nsIFrame::PreEffectsBBoxProperty(),
r);
r = nsSVGIntegrationUtils::ComputePostEffectsVisualOverflowRect(aFrame, r);
r = SVGIntegrationUtils::ComputePostEffectsVisualOverflowRect(aFrame, r);
}
return r;
@ -9928,7 +9929,7 @@ static StyleVerticalAlignKeyword ConvertSVGDominantBaselineToVerticalAlign(
}
Maybe<StyleVerticalAlignKeyword> nsIFrame::VerticalAlignEnum() const {
if (nsSVGUtils::IsInSVGTextSubtree(this)) {
if (SVGUtils::IsInSVGTextSubtree(this)) {
StyleDominantBaseline dominantBaseline = StyleSVG()->mDominantBaseline;
return Some(ConvertSVGDominantBaselineToVerticalAlign(dominantBaseline));
}
@ -10712,7 +10713,7 @@ bool nsIFrame::IsStackingContext(const nsStyleDisplay* aStyleDisplay,
// but the spec says it acts like the rest of these
ChildrenHavePerspective(aStyleDisplay) ||
aStyleEffects->mMixBlendMode != StyleBlend::Normal ||
nsSVGIntegrationUtils::UsingEffectsForFrame(this) ||
SVGIntegrationUtils::UsingEffectsForFrame(this) ||
aStyleDisplay->IsPositionForcingStackingContext() ||
ZIndex().isSome() ||
(aStyleDisplay->mWillChange.bits &
@ -10971,12 +10972,12 @@ CompositorHitTestInfo nsIFrame::GetCompositorHitTestInfo(
// Anything that didn't match the above conditions is visible to hit-testing.
result = CompositorHitTestFlags::eVisibleToHitTest;
if (nsSVGIntegrationUtils::UsingMaskOrClipPathForFrame(this)) {
if (SVGIntegrationUtils::UsingMaskOrClipPathForFrame(this)) {
// If WebRender is enabled, simple clip-paths can be converted into WR
// clips that WR knows how to hit-test against, so we don't need to mark
// it as an irregular area.
if (!gfxVars::UseWebRender() ||
!nsSVGIntegrationUtils::UsingSimpleClipPathForFrame(this)) {
!SVGIntegrationUtils::UsingSimpleClipPathForFrame(this)) {
result += CompositorHitTestFlags::eIrregularArea;
}
}

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

@ -1060,10 +1060,10 @@ class nsIFrame : public nsQueryFrame {
*
* Frames that are laid out according to SVG's coordinate space based rules
* (frames with the NS_FRAME_SVG_LAYOUT bit set, which *excludes*
* nsSVGOuterSVGFrame) are different. Many frames of this type do not set or
* SVGOuterSVGFrame) are different. Many frames of this type do not set or
* use mRect, in which case the frame rect is undefined. The exceptions are:
*
* - nsSVGInnerSVGFrame
* - SVGInnerSVGFrame
* - SVGGeometryFrame (used for <path>, <circle>, etc.)
* - SVGImageFrame
* - SVGForeignObjectFrame
@ -3316,7 +3316,7 @@ class nsIFrame : public nsQueryFrame {
bool IsBlockFrameOrSubclass() const;
/**
* Returns true if the frame is an instance of nsSVGGeometryFrame or one
* Returns true if the frame is an instance of SVGGeometryFrame or one
* of its subclasses.
*/
inline bool IsSVGGeometryFrameOrSubclass() const;

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

@ -14,6 +14,8 @@
#include "mozilla/PresShell.h"
#include "mozilla/RestyleManager.h"
#include "mozilla/ServoStyleSet.h"
#include "mozilla/SVGTextFrame.h"
#include "mozilla/SVGUtils.h"
#include "nsLineLayout.h"
#include "nsBlockFrame.h"
#include "nsPlaceholderFrame.h"
@ -22,7 +24,6 @@
#include "nsPresContextInlines.h"
#include "nsCSSAnonBoxes.h"
#include "nsDisplayList.h"
#include "SVGTextFrame.h"
#include "nsStyleChangeList.h"
#ifdef DEBUG
@ -54,7 +55,7 @@ nsresult nsInlineFrame::GetFrameName(nsAString& aResult) const {
void nsInlineFrame::InvalidateFrame(uint32_t aDisplayItemKey,
bool aRebuildDisplayItems) {
if (nsSVGUtils::IsInSVGTextSubtree(this)) {
if (SVGUtils::IsInSVGTextSubtree(this)) {
nsIFrame* svgTextFrame = nsLayoutUtils::GetClosestFrameOfType(
GetParent(), LayoutFrameType::SVGText);
svgTextFrame->InvalidateFrame();
@ -66,7 +67,7 @@ void nsInlineFrame::InvalidateFrame(uint32_t aDisplayItemKey,
void nsInlineFrame::InvalidateFrameWithRect(const nsRect& aRect,
uint32_t aDisplayItemKey,
bool aRebuildDisplayItems) {
if (nsSVGUtils::IsInSVGTextSubtree(this)) {
if (SVGUtils::IsInSVGTextSubtree(this)) {
nsIFrame* svgTextFrame = nsLayoutUtils::GetClosestFrameOfType(
GetParent(), LayoutFrameType::SVGText);
svgTextFrame->InvalidateFrame();
@ -379,7 +380,7 @@ nsresult nsInlineFrame::AttributeChanged(int32_t aNameSpaceID,
return rv;
}
if (nsSVGUtils::IsInSVGTextSubtree(this)) {
if (SVGUtils::IsInSVGTextSubtree(this)) {
SVGTextFrame* f = static_cast<SVGTextFrame*>(
nsLayoutUtils::GetClosestFrameOfType(this, LayoutFrameType::SVGText));
f->HandleAttributeChangeInDescendant(mContent->AsElement(), aNameSpaceID,

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

@ -9,9 +9,10 @@
#include "nsLineLayout.h"
#include "mozilla/ComputedStyle.h"
#include "mozilla/SVGTextFrame.h"
#include "mozilla/SVGUtils.h"
#include "LayoutLogging.h"
#include "SVGTextFrame.h"
#include "nsBlockFrame.h"
#include "nsFontMetrics.h"
#include "nsStyleConsts.h"
@ -79,8 +80,7 @@ nsLineLayout::nsLineLayout(nsPresContext* aPresContext,
mDirtyNextLine(false),
mLineAtStart(false),
mHasRuby(false),
mSuppressLineWrap(
nsSVGUtils::IsInSVGTextSubtree(aOuterReflowInput->mFrame))
mSuppressLineWrap(SVGUtils::IsInSVGTextSubtree(aOuterReflowInput->mFrame))
#ifdef DEBUG
,
mSpansAllocated(0),
@ -1715,7 +1715,7 @@ void nsLineLayout::AdjustLeadings(nsIFrame* spanFrame, PerSpanData* psd,
static float GetInflationForBlockDirAlignment(nsIFrame* aFrame,
nscoord aInflationMinFontSize) {
if (nsSVGUtils::IsInSVGTextSubtree(aFrame)) {
if (SVGUtils::IsInSVGTextSubtree(aFrame)) {
const nsIFrame* container =
nsLayoutUtils::GetClosestFrameOfType(aFrame, LayoutFrameType::SVGText);
NS_ASSERTION(container, "expected to find an ancestor SVGTextFrame");
@ -3081,7 +3081,7 @@ void nsLineLayout::TextAlignLine(nsLineBox* aLine, bool aIsLastLine) {
StyleTextAlign textAlign =
aIsLastLine ? mStyleText->TextAlignForLastLine() : mStyleText->mTextAlign;
bool isSVG = nsSVGUtils::IsInSVGTextSubtree(mBlockReflowInput->mFrame);
bool isSVG = SVGUtils::IsInSVGTextSubtree(mBlockReflowInput->mFrame);
bool doTextAlign = remainingISize > 0;
int32_t additionalGaps = 0;

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

@ -22,6 +22,7 @@
#include "mozilla/StaticPrefs_svg.h"
#include "mozilla/StaticPresData.h"
#include "mozilla/SVGTextFrame.h"
#include "mozilla/SVGUtils.h"
#include "mozilla/TextEditor.h"
#include "mozilla/TextEvents.h"
#include "mozilla/BinarySearch.h"
@ -331,13 +332,13 @@ class nsTextPaintStyle {
// SVG text has its own painting process, so we should never get its stroke
// property from here.
nscolor GetWebkitTextStrokeColor() {
if (nsSVGUtils::IsInSVGTextSubtree(mFrame)) {
if (SVGUtils::IsInSVGTextSubtree(mFrame)) {
return 0;
}
return mFrame->StyleText()->mWebkitTextStrokeColor.CalcColor(mFrame);
}
float GetWebkitTextStrokeWidth() {
if (nsSVGUtils::IsInSVGTextSubtree(mFrame)) {
if (SVGUtils::IsInSVGTextSubtree(mFrame)) {
return 0.0f;
}
nscoord coord = mFrame->StyleText()->mWebkitTextStrokeWidth;
@ -656,7 +657,7 @@ static void InvalidateFrameDueToGlyphsChanged(nsIFrame* aFrame) {
// to reflow the SVGTextFrame. (This is similar to reflowing the
// SVGTextFrame in response to style changes, in
// SVGTextFrame::DidSetComputedStyle.)
if (nsSVGUtils::IsInSVGTextSubtree(f) &&
if (SVGUtils::IsInSVGTextSubtree(f) &&
f->HasAnyStateBits(NS_FRAME_IS_NONDISPLAY)) {
auto svgTextFrame = static_cast<SVGTextFrame*>(
nsLayoutUtils::GetClosestFrameOfType(f, LayoutFrameType::SVGText));
@ -1744,7 +1745,7 @@ static gfxFloat GetMinTabAdvanceAppUnits(const gfxTextRun* aTextRun) {
}
static float GetSVGFontSizeScaleFactor(nsIFrame* aFrame) {
if (!nsSVGUtils::IsInSVGTextSubtree(aFrame)) {
if (!SVGUtils::IsInSVGTextSubtree(aFrame)) {
return 1.0f;
}
auto container =
@ -1759,7 +1760,7 @@ static nscoord LetterSpacing(nsIFrame* aFrame,
aStyleText = aFrame->StyleText();
}
if (nsSVGUtils::IsInSVGTextSubtree(aFrame)) {
if (SVGUtils::IsInSVGTextSubtree(aFrame)) {
if (!StaticPrefs::svg_text_spacing_enabled()) {
return 0;
}
@ -1782,7 +1783,7 @@ static nscoord WordSpacing(nsIFrame* aFrame, const gfxTextRun* aTextRun,
aStyleText = aFrame->StyleText();
}
if (nsSVGUtils::IsInSVGTextSubtree(aFrame)) {
if (SVGUtils::IsInSVGTextSubtree(aFrame)) {
// SVG text can have a scaling factor applied so that very small or very
// large font-sizes don't suffer from poor glyph placement due to app unit
// rounding. The used word-spacing value must be scaled by the same
@ -1805,7 +1806,7 @@ static nscoord WordSpacing(nsIFrame* aFrame, const gfxTextRun* aTextRun,
// letter-spacing or word-spacing is present.
static gfx::ShapedTextFlags GetSpacingFlags(
nsIFrame* aFrame, const nsStyleText* aStyleText = nullptr) {
if (nsSVGUtils::IsInSVGTextSubtree(aFrame) &&
if (SVGUtils::IsInSVGTextSubtree(aFrame) &&
!StaticPrefs::svg_text_spacing_enabled()) {
return gfx::ShapedTextFlags();
}
@ -2189,7 +2190,7 @@ already_AddRefed<gfxTextRun> BuildTextRunsScanner::BuildTextRunForFrames(
uint32_t nextBreakIndex = 0;
nsTextFrame* nextBreakBeforeFrame = GetNextBreakBeforeFrame(&nextBreakIndex);
bool isSVG = nsSVGUtils::IsInSVGTextSubtree(mLineContainer);
bool isSVG = SVGUtils::IsInSVGTextSubtree(mLineContainer);
bool enabledJustification =
(mLineContainer->StyleText()->mTextAlign == StyleTextAlign::Justify ||
mLineContainer->StyleText()->mTextAlignLast ==
@ -3827,7 +3828,7 @@ bool nsTextPaintStyle::EnsureSufficientContrast(nscolor* aForeColor,
}
nscolor nsTextPaintStyle::GetTextColor() {
if (nsSVGUtils::IsInSVGTextSubtree(mFrame)) {
if (SVGUtils::IsInSVGTextSubtree(mFrame)) {
if (!mResolveColors) return NS_SAME_AS_FOREGROUND_COLOR;
const nsStyleSVG* style = mFrame->StyleSVG();
@ -4104,7 +4105,7 @@ bool nsTextPaintStyle::InitSelectionColorsAndShadow() {
// the text color remains intact.
if (mSelectionTextColor == NS_DONT_CHANGE_COLOR) {
nscolor frameColor =
nsSVGUtils::IsInSVGTextSubtree(mFrame)
SVGUtils::IsInSVGTextSubtree(mFrame)
? mFrame->GetVisitedDependentColor(&nsStyleSVG::mFill)
: mFrame->GetVisitedDependentColor(
&nsStyleText::mWebkitTextFillColor);
@ -4112,7 +4113,7 @@ bool nsTextPaintStyle::InitSelectionColorsAndShadow() {
EnsureDifferentColors(frameColor, mSelectionBGColor);
} else if (mSelectionTextColor == NS_CHANGE_COLOR_IF_SAME_AS_BG) {
nscolor frameColor =
nsSVGUtils::IsInSVGTextSubtree(mFrame)
SVGUtils::IsInSVGTextSubtree(mFrame)
? mFrame->GetVisitedDependentColor(&nsStyleSVG::mFill)
: mFrame->GetVisitedDependentColor(
&nsStyleText::mWebkitTextFillColor);
@ -4627,7 +4628,7 @@ nsTextFrame* nsTextFrame::LastContinuation() const {
void nsTextFrame::InvalidateFrame(uint32_t aDisplayItemKey,
bool aRebuildDisplayItems) {
if (nsSVGUtils::IsInSVGTextSubtree(this)) {
if (SVGUtils::IsInSVGTextSubtree(this)) {
nsIFrame* svgTextFrame = nsLayoutUtils::GetClosestFrameOfType(
GetParent(), LayoutFrameType::SVGText);
svgTextFrame->InvalidateFrame();
@ -4639,7 +4640,7 @@ void nsTextFrame::InvalidateFrame(uint32_t aDisplayItemKey,
void nsTextFrame::InvalidateFrameWithRect(const nsRect& aRect,
uint32_t aDisplayItemKey,
bool aRebuildDisplayItems) {
if (nsSVGUtils::IsInSVGTextSubtree(this)) {
if (SVGUtils::IsInSVGTextSubtree(this)) {
nsIFrame* svgTextFrame = nsLayoutUtils::GetClosestFrameOfType(
GetParent(), LayoutFrameType::SVGText);
svgTextFrame->InvalidateFrame();
@ -4874,7 +4875,7 @@ void nsTextFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
Maybe<bool> isSelected;
if ((HasAnyStateBits(TEXT_NO_RENDERED_GLYPHS) ||
(isTextTransparent && !StyleText()->HasTextShadow())) &&
aBuilder->IsForPainting() && !nsSVGUtils::IsInSVGTextSubtree(this)) {
aBuilder->IsForPainting() && !SVGUtils::IsInSVGTextSubtree(this)) {
isSelected.emplace(IsSelected());
if (!isSelected.value()) {
TextDecorations textDecs;
@ -5055,7 +5056,7 @@ void nsTextFrame::GetTextDecorations(
nscolor color;
if (useOverride) {
color = overrideColor;
} else if (nsSVGUtils::IsInSVGTextSubtree(this)) {
} else if (SVGUtils::IsInSVGTextSubtree(this)) {
// XXX We might want to do something with text-decoration-color when
// painting SVG text, but it's not clear what we should do. We
// at least need SVG text decorations to paint with 'fill' if
@ -5135,7 +5136,7 @@ void nsTextFrame::GetTextDecorations(
static float GetInflationForTextDecorations(nsIFrame* aFrame,
nscoord aInflationMinFontSize) {
if (nsSVGUtils::IsInSVGTextSubtree(aFrame)) {
if (SVGUtils::IsInSVGTextSubtree(aFrame)) {
auto container =
nsLayoutUtils::GetClosestFrameOfType(aFrame, LayoutFrameType::SVGText);
MOZ_ASSERT(container);
@ -6513,7 +6514,7 @@ nscolor nsTextFrame::GetCaretColorAt(int32_t aOffset) {
}
bool isSolidTextColor = true;
if (nsSVGUtils::IsInSVGTextSubtree(this)) {
if (SVGUtils::IsInSVGTextSubtree(this)) {
const nsStyleSVG* style = StyleSVG();
if (!style->mFill.kind.IsNone() && !style->mFill.kind.IsColor()) {
isSolidTextColor = false;
@ -9537,7 +9538,7 @@ void nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
lineContainer->StyleText()->mTextAlignLast ==
StyleTextAlignLast::Justify ||
shouldSuppressLineBreak) &&
!nsSVGUtils::IsInSVGTextSubtree(lineContainer)) {
!SVGUtils::IsInSVGTextSubtree(lineContainer)) {
AddStateBits(TEXT_JUSTIFICATION_ENABLED);
Range range(uint32_t(offset), uint32_t(offset + charsFit));
aLineLayout.SetJustificationInfo(provider.ComputeJustification(range));

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

@ -40,6 +40,7 @@
#include "mozilla/StaticPrefs_gfx.h"
#include "mozilla/StaticPrefs_layers.h"
#include "mozilla/StaticPrefs_layout.h"
#include "mozilla/SVGIntegrationUtils.h"
#include "mozilla/Unused.h"
#include "mozilla/dom/EffectsInfo.h"
#include "mozilla/dom/ProfileTimelineMarkerBinding.h"
@ -58,7 +59,6 @@
#include "nsLayoutUtils.h"
#include "nsPresContext.h"
#include "nsPrintfCString.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSubDocumentFrame.h"
#include "nsTransitionManager.h"
@ -5461,7 +5461,7 @@ void FrameLayerBuilder::AddPaintedDisplayItem(PaintedLayerData* aLayerData,
invalid = visible.ToOutsidePixels(paintedData->mAppUnitsPerDevPixel);
}
if (aItem.mLayerState == LayerState::LAYER_SVG_EFFECTS) {
invalid = nsSVGIntegrationUtils::AdjustInvalidAreaForSVGEffects(
invalid = SVGIntegrationUtils::AdjustInvalidAreaForSVGEffects(
aItem.mItem->Frame(), aItem.mItem->ToReferenceFrame(), invalid);
}
if (!invalid.IsEmpty()) {

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

@ -48,8 +48,6 @@
#include "nsCSSFrameConstructor.h"
#include "nsCSSProps.h"
#include "nsContentUtils.h"
#include "SVGObserverUtils.h"
#include "nsSVGIntegrationUtils.h"
#include "gfxDrawable.h"
#include "GeckoProfiler.h"
#include "nsCSSRenderingBorders.h"

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

@ -33,6 +33,8 @@
#include "mozilla/StaticPrefs_gfx.h"
#include "mozilla/StaticPrefs_layers.h"
#include "mozilla/StaticPrefs_layout.h"
#include "mozilla/SVGIntegrationUtils.h"
#include "mozilla/SVGUtils.h"
#include "mozilla/ViewportUtils.h"
#include "nsCSSRendering.h"
#include "nsCSSRenderingGradients.h"
@ -41,8 +43,6 @@
#include "nsStyleTransformMatrix.h"
#include "nsTransitionManager.h"
#include "gfxMatrix.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSVGUtils.h"
#include "nsLayoutUtils.h"
#include "nsIScrollableFrame.h"
#include "nsIFrameInlines.h"
@ -1975,7 +1975,7 @@ bool nsDisplayListBuilder::ShouldBuildScrollInfoItemsForHoisting() const {
* ScrollFrameWillBuildScrollInfoLayer() in nsSliderFrame.cpp.
*/
for (nsIFrame* frame : mSVGEffectsFrames) {
if (nsSVGIntegrationUtils::UsesSVGEffectsNotSupportedInCompositor(frame)) {
if (SVGIntegrationUtils::UsesSVGEffectsNotSupportedInCompositor(frame)) {
return true;
}
}
@ -5913,7 +5913,7 @@ bool nsDisplayOpacity::ShouldFlattenAway(nsDisplayListBuilder* aBuilder) {
const bool usingLayers = !aBuilder->IsPaintingForWebRender();
if (ApplyToFilterOrMask(usingLayers)) {
MOZ_ASSERT(nsSVGIntegrationUtils::UsingEffectsForFrame(mFrame));
MOZ_ASSERT(SVGIntegrationUtils::UsingEffectsForFrame(mFrame));
mChildOpacityState = ChildOpacityState::Applied;
return true;
}
@ -7562,7 +7562,7 @@ Matrix4x4 nsDisplayTransform::GetResultingTransformMatrixInternal(
// Apply any translation due to 'transform-origin' and/or 'transform-box':
result.ChangeBasis(aProperties.mToTransformOrigin);
// See the comment for nsSVGContainerFrame::HasChildrenOnlyTransform for
// See the comment for SVGContainerFrame::HasChildrenOnlyTransform for
// an explanation of what children-only transforms are.
bool parentHasChildrenOnlyTransform =
hasSVGTransforms && !parentsChildrenOnlyTransform.IsIdentity();
@ -9010,18 +9010,18 @@ void nsDisplayEffectsBase::HitTest(nsDisplayListBuilder* aBuilder,
const nsRect& aRect, HitTestState* aState,
nsTArray<nsIFrame*>* aOutFrames) {
nsPoint rectCenter(aRect.x + aRect.width / 2, aRect.y + aRect.height / 2);
if (nsSVGIntegrationUtils::HitTestFrameForEffects(
if (SVGIntegrationUtils::HitTestFrameForEffects(
mFrame, rectCenter - ToReferenceFrame())) {
mList.HitTest(aBuilder, aRect, aState, aOutFrames);
}
}
gfxRect nsDisplayEffectsBase::BBoxInUserSpace() const {
return nsSVGUtils::GetBBox(mFrame);
return SVGUtils::GetBBox(mFrame);
}
gfxPoint nsDisplayEffectsBase::UserSpaceOffset() const {
return nsSVGUtils::FrameSpaceInCSSPxToUserSpaceOffset(mFrame);
return SVGUtils::FrameSpaceInCSSPxToUserSpaceOffset(mFrame);
}
void nsDisplayEffectsBase::ComputeInvalidationRegion(
@ -9062,7 +9062,7 @@ bool nsDisplayEffectsBase::ValidateSVGFrame() {
return true;
}
typedef nsSVGIntegrationUtils::PaintFramesParams PaintFramesParams;
typedef SVGIntegrationUtils::PaintFramesParams PaintFramesParams;
static void ComputeMaskGeometry(PaintFramesParams& aParams) {
// Properties are added lazily and may have been removed by a restyle, so
@ -9222,12 +9222,12 @@ bool nsDisplayMasksAndClipPaths::PaintMask(nsDisplayListBuilder* aBuilder,
imgDrawingParams imgParams(aBuilder->GetImageDecodeFlags());
nsRect borderArea = nsRect(ToReferenceFrame(), mFrame->GetSize());
nsSVGIntegrationUtils::PaintFramesParams params(
*aMaskContext, mFrame, mBounds, borderArea, aBuilder, nullptr,
mHandleOpacity, imgParams);
SVGIntegrationUtils::PaintFramesParams params(*aMaskContext, mFrame, mBounds,
borderArea, aBuilder, nullptr,
mHandleOpacity, imgParams);
ComputeMaskGeometry(params);
bool maskIsComplete = false;
bool painted = nsSVGIntegrationUtils::PaintMask(params, maskIsComplete);
bool painted = SVGIntegrationUtils::PaintMask(params, maskIsComplete);
if (aMaskPainted) {
*aMaskPainted = painted;
}
@ -9263,7 +9263,7 @@ bool nsDisplayMasksAndClipPaths::CanPaintOnMaskLayer(LayerManager* aManager) {
return false;
}
if (!nsSVGIntegrationUtils::IsMaskResourceReady(mFrame)) {
if (!SVGIntegrationUtils::IsMaskResourceReady(mFrame)) {
return false;
}
@ -9339,13 +9339,13 @@ void nsDisplayMasksAndClipPaths::PaintAsLayer(nsDisplayListBuilder* aBuilder,
imgDrawingParams imgParams(aBuilder->GetImageDecodeFlags());
nsRect borderArea = nsRect(ToReferenceFrame(), mFrame->GetSize());
nsSVGIntegrationUtils::PaintFramesParams params(
*aCtx, mFrame, GetPaintRect(), borderArea, aBuilder, aManager,
mHandleOpacity, imgParams);
SVGIntegrationUtils::PaintFramesParams params(*aCtx, mFrame, GetPaintRect(),
borderArea, aBuilder, aManager,
mHandleOpacity, imgParams);
ComputeMaskGeometry(params);
nsSVGIntegrationUtils::PaintMaskAndClipPath(params);
SVGIntegrationUtils::PaintMaskAndClipPath(params);
context->PopClip();
@ -9366,13 +9366,13 @@ void nsDisplayMasksAndClipPaths::PaintWithContentsPaintCallback(
imgDrawingParams imgParams(aBuilder->GetImageDecodeFlags());
nsRect borderArea = nsRect(ToReferenceFrame(), mFrame->GetSize());
nsSVGIntegrationUtils::PaintFramesParams params(*aCtx, mFrame, GetPaintRect(),
borderArea, aBuilder, nullptr,
mHandleOpacity, imgParams);
SVGIntegrationUtils::PaintFramesParams params(*aCtx, mFrame, GetPaintRect(),
borderArea, aBuilder, nullptr,
mHandleOpacity, imgParams);
ComputeMaskGeometry(params);
nsSVGIntegrationUtils::PaintMaskAndClipPath(params, aPaintChildren);
SVGIntegrationUtils::PaintMaskAndClipPath(params, aPaintChildren);
context->PopClip();
@ -9385,7 +9385,7 @@ static Maybe<wr::WrClipId> CreateSimpleClipRegion(
nsIFrame* frame = aDisplayItem.Frame();
auto* style = frame->StyleSVGReset();
MOZ_ASSERT(style->HasClipPath() || style->HasMask());
if (!nsSVGIntegrationUtils::UsingSimpleClipPathForFrame(frame)) {
if (!SVGIntegrationUtils::UsingSimpleClipPathForFrame(frame)) {
return Nothing();
}
@ -9449,7 +9449,7 @@ static Maybe<wr::WrClipId> CreateSimpleClipRegion(
// without using a mask image.
//
// And if you _really really_ need to add an exception, add it to
// nsSVGIntegrationUtils::UsingSimpleClipPathForFrame
// SVGIntegrationUtils::UsingSimpleClipPathForFrame
MOZ_ASSERT_UNREACHABLE("Unhandled shape id?");
return Nothing();
}
@ -9522,7 +9522,7 @@ bool nsDisplayMasksAndClipPaths::CreateWebRenderCommands(
void nsDisplayMasksAndClipPaths::SelectOpacityOptimization(
const bool aUsingLayers) {
if (aUsingLayers ||
!nsSVGIntegrationUtils::UsingSimpleClipPathForFrame(mFrame)) {
!SVGIntegrationUtils::UsingSimpleClipPathForFrame(mFrame)) {
// Handle opacity in mask and clip-path drawing code.
SetHandleOpacity();
MOZ_ASSERT(!mApplyOpacityWithSimpleClipPath);
@ -9632,7 +9632,7 @@ bool nsDisplayBackdropRootContainer::CreateWebRenderCommands(
/* static */
bool nsDisplayBackdropFilters::CanCreateWebRenderCommands(
nsDisplayListBuilder* aBuilder, nsIFrame* aFrame) {
return nsSVGIntegrationUtils::CanCreateWebRenderFiltersForFrame(aFrame);
return SVGIntegrationUtils::CanCreateWebRenderFiltersForFrame(aFrame);
}
bool nsDisplayBackdropFilters::CreateWebRenderCommands(
@ -9644,10 +9644,10 @@ bool nsDisplayBackdropFilters::CreateWebRenderCommands(
WrFiltersHolder wrFilters;
Maybe<nsRect> filterClip;
auto filterChain = mFrame->StyleEffects()->mBackdropFilters.AsSpan();
if (!nsSVGIntegrationUtils::CreateWebRenderCSSFilters(filterChain, mFrame,
wrFilters) &&
!nsSVGIntegrationUtils::BuildWebRenderFilters(mFrame, filterChain,
wrFilters, filterClip)) {
if (!SVGIntegrationUtils::CreateWebRenderCSSFilters(filterChain, mFrame,
wrFilters) &&
!SVGIntegrationUtils::BuildWebRenderFilters(mFrame, filterChain,
wrFilters, filterClip)) {
return false;
}
@ -9728,7 +9728,7 @@ LayerState nsDisplayFilters::GetLayerState(
bool nsDisplayFilters::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) {
nsPoint offset = ToReferenceFrame();
nsRect dirtyRect = nsSVGIntegrationUtils::GetRequiredSourceForInvalidArea(
nsRect dirtyRect = SVGIntegrationUtils::GetRequiredSourceForInvalidArea(
mFrame, GetPaintRect() - offset) +
offset;
@ -9761,15 +9761,15 @@ void nsDisplayFilters::PaintAsLayer(nsDisplayListBuilder* aBuilder,
gfxContext* aCtx, LayerManager* aManager) {
imgDrawingParams imgParams(aBuilder->GetImageDecodeFlags());
nsRect borderArea = nsRect(ToReferenceFrame(), mFrame->GetSize());
nsSVGIntegrationUtils::PaintFramesParams params(
*aCtx, mFrame, GetPaintRect(), borderArea, aBuilder, aManager,
mHandleOpacity, imgParams);
nsSVGIntegrationUtils::PaintFilter(params);
SVGIntegrationUtils::PaintFramesParams params(*aCtx, mFrame, GetPaintRect(),
borderArea, aBuilder, aManager,
mHandleOpacity, imgParams);
SVGIntegrationUtils::PaintFilter(params);
nsDisplayFiltersGeometry::UpdateDrawResult(this, imgParams.result);
}
bool nsDisplayFilters::CanCreateWebRenderCommands() {
return nsSVGIntegrationUtils::CanCreateWebRenderFiltersForFrame(mFrame);
return SVGIntegrationUtils::CanCreateWebRenderFiltersForFrame(mFrame);
}
bool nsDisplayFilters::CreateWebRenderCommands(
@ -9783,10 +9783,10 @@ bool nsDisplayFilters::CreateWebRenderCommands(
WrFiltersHolder wrFilters;
Maybe<nsRect> filterClip;
auto filterChain = mFrame->StyleEffects()->mFilters.AsSpan();
if (!nsSVGIntegrationUtils::CreateWebRenderCSSFilters(filterChain, mFrame,
wrFilters) &&
!nsSVGIntegrationUtils::BuildWebRenderFilters(mFrame, filterChain,
wrFilters, filterClip)) {
if (!SVGIntegrationUtils::CreateWebRenderCSSFilters(filterChain, mFrame,
wrFilters) &&
!SVGIntegrationUtils::BuildWebRenderFilters(mFrame, filterChain,
wrFilters, filterClip)) {
return false;
}

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

@ -24,8 +24,8 @@
#include "nsIFrame.h"
#include "nsStyleStructInlines.h"
#include "mozilla/ISVGDisplayableFrame.h"
#include "mozilla/SVGIntegrationUtils.h"
#include "mozilla/SVGObserverUtils.h"
#include "nsSVGIntegrationUtils.h"
using namespace mozilla;
using namespace mozilla::gfx;
@ -243,7 +243,7 @@ CSSSizeOrRatio nsImageRenderer::ComputeIntrinsicSize() {
int32_t appUnitsPerDevPixel =
mForFrame->PresContext()->AppUnitsPerDevPixel();
result.SetSize(IntSizeToAppUnits(
nsSVGIntegrationUtils::GetContinuationUnionSize(mPaintServerFrame)
SVGIntegrationUtils::GetContinuationUnionSize(mPaintServerFrame)
.ToNearestPixels(appUnitsPerDevPixel),
appUnitsPerDevPixel));
}
@ -699,10 +699,10 @@ already_AddRefed<gfxDrawable> nsImageRenderer::DrawableForElement(
// Don't allow creating images that are too big
if (aContext.GetDrawTarget()->CanCreateSimilarDrawTarget(imageSize,
format)) {
drawable = nsSVGIntegrationUtils::DrawableFromPaintServer(
drawable = SVGIntegrationUtils::DrawableFromPaintServer(
mPaintServerFrame, mForFrame, mSize, imageSize,
aContext.GetDrawTarget(), aContext.CurrentMatrixDouble(),
nsSVGIntegrationUtils::FLAG_SYNC_DECODE_IMAGES);
SVGIntegrationUtils::FLAG_SYNC_DECODE_IMAGES);
}
return drawable.forget();

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

@ -6,15 +6,16 @@
#include "nsFontFaceUtils.h"
#include "gfxTextRun.h"
#include "gfxUserFontSet.h"
#include "mozilla/PresShell.h"
#include "mozilla/RestyleManager.h"
#include "mozilla/SVGUtils.h"
#include "nsFontMetrics.h"
#include "nsIFrame.h"
#include "nsLayoutUtils.h"
#include "nsPlaceholderFrame.h"
#include "nsTArray.h"
#include "SVGTextFrame.h"
using namespace mozilla;
@ -89,12 +90,12 @@ static FontUsageKind FrameFontUsage(nsIFrame* aFrame,
// TODO(emilio): Can we use the restyle-hint machinery instead of this?
static void ScheduleReflow(PresShell* aPresShell, nsIFrame* aFrame) {
nsIFrame* f = aFrame;
if (f->IsFrameOfType(nsIFrame::eSVG) || nsSVGUtils::IsInSVGTextSubtree(f)) {
if (f->IsFrameOfType(nsIFrame::eSVG) || SVGUtils::IsInSVGTextSubtree(f)) {
// SVG frames (and the non-SVG descendants of an SVGTextFrame) need special
// reflow handling. We need to search upwards for the first displayed
// nsSVGOuterSVGFrame or non-SVG frame, which is the frame we can call
// SVGOuterSVGFrame or non-SVG frame, which is the frame we can call
// FrameNeedsReflow on. (This logic is based on
// nsSVGUtils::ScheduleReflowSVG and
// SVGUtils::ScheduleReflowSVG and
// SVGTextFrame::ScheduleReflowSVGNonDisplayText.)
if (f->HasAnyStateBits(NS_FRAME_IS_NONDISPLAY)) {
while (f) {
@ -106,7 +107,7 @@ static void ScheduleReflow(PresShell* aPresShell, nsIFrame* aFrame) {
return;
}
if (f->IsSVGOuterSVGFrame() || !(f->IsFrameOfType(nsIFrame::eSVG) ||
nsSVGUtils::IsInSVGTextSubtree(f))) {
SVGUtils::IsInSVGTextSubtree(f))) {
break;
}
f->AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);

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

@ -14,9 +14,9 @@
#include "nsIFrame.h"
#include "nsStyleStruct.h"
#include "nsIContent.h" // for GetParent()
#include "nsTextFrame.h" // for nsTextFrame::ShouldSuppressLineBreak
#include "nsSVGUtils.h" // for nsSVGUtils::IsInSVGTextSubtree
#include "nsIContent.h" // for GetParent()
#include "nsTextFrame.h" // for nsTextFrame::ShouldSuppressLineBreak
#include "mozilla/SVGUtils.h" // for SVGUtils::IsInSVGTextSubtree
bool nsStyleText::NewlineIsSignificant(const nsTextFrame* aContextFrame) const {
NS_ASSERTION(aContextFrame->StyleText() == this, "unexpected aContextFrame");
@ -28,19 +28,20 @@ bool nsStyleText::NewlineIsSignificant(const nsTextFrame* aContextFrame) const {
bool nsStyleText::WhiteSpaceCanWrap(const nsIFrame* aContextFrame) const {
NS_ASSERTION(aContextFrame->StyleText() == this, "unexpected aContextFrame");
return WhiteSpaceCanWrapStyle() &&
!nsSVGUtils::IsInSVGTextSubtree(aContextFrame) &&
!mozilla::SVGUtils::IsInSVGTextSubtree(aContextFrame) &&
!aContextFrame->Style()->IsTextCombined();
}
bool nsStyleText::WordCanWrap(const nsIFrame* aContextFrame) const {
NS_ASSERTION(aContextFrame->StyleText() == this, "unexpected aContextFrame");
return WordCanWrapStyle() && !nsSVGUtils::IsInSVGTextSubtree(aContextFrame);
return WordCanWrapStyle() &&
!mozilla::SVGUtils::IsInSVGTextSubtree(aContextFrame);
}
bool nsStyleDisplay::IsBlockOutside(const nsIFrame* aContextFrame) const {
NS_ASSERTION(aContextFrame->StyleDisplay() == this,
"unexpected aContextFrame");
if (nsSVGUtils::IsInSVGTextSubtree(aContextFrame)) {
if (mozilla::SVGUtils::IsInSVGTextSubtree(aContextFrame)) {
return aContextFrame->IsBlockFrame();
}
return IsBlockOutsideStyle();
@ -49,7 +50,7 @@ bool nsStyleDisplay::IsBlockOutside(const nsIFrame* aContextFrame) const {
bool nsStyleDisplay::IsInlineOutside(const nsIFrame* aContextFrame) const {
NS_ASSERTION(aContextFrame->StyleDisplay() == this,
"unexpected aContextFrame");
if (nsSVGUtils::IsInSVGTextSubtree(aContextFrame)) {
if (mozilla::SVGUtils::IsInSVGTextSubtree(aContextFrame)) {
return !aContextFrame->IsBlockFrame();
}
return IsInlineOutsideStyle();
@ -59,7 +60,7 @@ mozilla::StyleDisplay nsStyleDisplay::GetDisplay(
const nsIFrame* aContextFrame) const {
NS_ASSERTION(aContextFrame->StyleDisplay() == this,
"unexpected aContextFrame");
if (nsSVGUtils::IsInSVGTextSubtree(aContextFrame) &&
if (mozilla::SVGUtils::IsInSVGTextSubtree(aContextFrame) &&
mDisplay != mozilla::StyleDisplay::None) {
return aContextFrame->IsBlockFrame() ? mozilla::StyleDisplay::Block
: mozilla::StyleDisplay::Inline;
@ -70,7 +71,8 @@ mozilla::StyleDisplay nsStyleDisplay::GetDisplay(
bool nsStyleDisplay::IsFloating(const nsIFrame* aContextFrame) const {
NS_ASSERTION(aContextFrame->StyleDisplay() == this,
"unexpected aContextFrame");
return IsFloatingStyle() && !nsSVGUtils::IsInSVGTextSubtree(aContextFrame);
return IsFloatingStyle() &&
!mozilla::SVGUtils::IsInSVGTextSubtree(aContextFrame);
}
// If you change this function, also change the corresponding block in
@ -129,7 +131,7 @@ bool nsStyleDisplay::IsFixedPosContainingBlock(
!aContextFrame->IsFrameOfType(nsIFrame::eSupportsCSSTransforms))) {
return false;
}
if (nsSVGUtils::IsInSVGTextSubtree(aContextFrame)) {
if (mozilla::SVGUtils::IsInSVGTextSubtree(aContextFrame)) {
return false;
}
MOZ_ASSERT(IsAbsPosContainingBlock(aContextFrame),
@ -150,7 +152,7 @@ bool nsStyleDisplay::IsAbsPosContainingBlock(
!aContextFrame->IsFrameOfType(nsIFrame::eSupportsCSSTransforms))) {
return false;
}
return !nsSVGUtils::IsInSVGTextSubtree(aContextFrame);
return !mozilla::SVGUtils::IsInSVGTextSubtree(aContextFrame);
}
bool nsStyleDisplay::IsRelativelyPositioned(
@ -158,14 +160,14 @@ bool nsStyleDisplay::IsRelativelyPositioned(
NS_ASSERTION(aContextFrame->StyleDisplay() == this,
"unexpected aContextFrame");
return IsRelativelyPositionedStyle() &&
!nsSVGUtils::IsInSVGTextSubtree(aContextFrame);
!mozilla::SVGUtils::IsInSVGTextSubtree(aContextFrame);
}
bool nsStyleDisplay::IsStickyPositioned(const nsIFrame* aContextFrame) const {
NS_ASSERTION(aContextFrame->StyleDisplay() == this,
"unexpected aContextFrame");
return IsStickyPositionedStyle() &&
!nsSVGUtils::IsInSVGTextSubtree(aContextFrame);
!mozilla::SVGUtils::IsInSVGTextSubtree(aContextFrame);
}
bool nsStyleDisplay::IsAbsolutelyPositioned(
@ -173,7 +175,7 @@ bool nsStyleDisplay::IsAbsolutelyPositioned(
NS_ASSERTION(aContextFrame->StyleDisplay() == this,
"unexpected aContextFrame");
return IsAbsolutelyPositionedStyle() &&
!nsSVGUtils::IsInSVGTextSubtree(aContextFrame);
!mozilla::SVGUtils::IsInSVGTextSubtree(aContextFrame);
}
mozilla::StylePointerEvents nsStyleUI::GetEffectivePointerEvents(

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

@ -11,11 +11,11 @@
#include "nsStyleTransformMatrix.h"
#include "nsLayoutUtils.h"
#include "nsPresContext.h"
#include "nsSVGUtils.h"
#include "mozilla/MotionPathUtils.h"
#include "mozilla/ServoBindings.h"
#include "mozilla/StaticPrefs_svg.h"
#include "mozilla/StyleAnimationValue.h"
#include "mozilla/SVGUtils.h"
#include "gfxMatrix.h"
#include "gfxQuaternion.h"
@ -52,7 +52,7 @@ void TransformReferenceBox::EnsureDimensionsAreCached() {
if (!StaticPrefs::svg_transform_box_enabled()) {
mX = -mFrame->GetPosition().x;
mY = -mFrame->GetPosition().y;
Size contextSize = nsSVGUtils::GetContextSize(mFrame);
Size contextSize = SVGUtils::GetContextSize(mFrame);
mWidth = nsPresContext::CSSPixelsToAppUnits(contextSize.width);
mHeight = nsPresContext::CSSPixelsToAppUnits(contextSize.height);
} else if (mFrame->StyleDisplay()->mTransformBox ==
@ -81,7 +81,7 @@ void TransformReferenceBox::EnsureDimensionsAreCached() {
// transform is relative to {0,0} in current user space.
mX = -mFrame->GetPosition().x;
mY = -mFrame->GetPosition().y;
Size contextSize = nsSVGUtils::GetContextSize(mFrame);
Size contextSize = SVGUtils::GetContextSize(mFrame);
mWidth = nsPresContext::CSSPixelsToAppUnits(contextSize.width);
mHeight = nsPresContext::CSSPixelsToAppUnits(contextSize.height);
}

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

@ -12,7 +12,7 @@
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/PathHelpers.h"
#include "mozilla/ShapeUtils.h"
#include "nsSVGUtils.h"
#include "mozilla/SVGUtils.h"
#include "gfx2DGlue.h"
#include "gfxContext.h"
#include "gfxPlatform.h"
@ -61,7 +61,7 @@ bool CSSClipPathInstance::HitTestBasicShapeOrPathClip(nsIFrame* aFrame,
RefPtr<DrawTarget> drawTarget =
gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget();
RefPtr<Path> path = instance.CreateClipPath(
drawTarget, nsSVGUtils::GetCSSPxToDevPxMatrix(aFrame));
drawTarget, SVGUtils::GetCSSPxToDevPxMatrix(aFrame));
float pixelRatio = float(AppUnitsPerCSSPixel()) /
aFrame->PresContext()->AppUnitsPerDevPixel();
return path && path->ContainsPoint(ToPoint(aPoint) * pixelRatio, Matrix());
@ -78,7 +78,7 @@ Maybe<Rect> CSSClipPathInstance::GetBoundingRectForBasicShapeOrPathClip(
RefPtr<DrawTarget> drawTarget =
gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget();
RefPtr<Path> path = instance.CreateClipPath(
drawTarget, nsSVGUtils::GetCSSPxToDevPxMatrix(aFrame));
drawTarget, SVGUtils::GetCSSPxToDevPxMatrix(aFrame));
return path ? Some(path->GetBounds()) : Nothing();
}

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

@ -26,10 +26,9 @@
#include "mozilla/ISVGDisplayableFrame.h"
#include "mozilla/StaticPrefs_gfx.h"
#include "mozilla/SVGFilterInstance.h"
#include "mozilla/SVGUtils.h"
#include "CSSFilterInstance.h"
#include "SVGFilterPaintCallback.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSVGUtils.h"
using namespace mozilla::dom;
using namespace mozilla::gfx;
@ -87,7 +86,7 @@ void FilterInstance::PaintFilteredFrame(nsIFrame* aFilteredFrame,
aCtx->SetMatrixDouble(reverseScaleMatrix * aCtx->CurrentMatrixDouble());
gfxMatrix scaleMatrixInDevUnits =
scaleMatrix * nsSVGUtils::GetCSSPxToDevPxMatrix(aFilteredFrame);
scaleMatrix * SVGUtils::GetCSSPxToDevPxMatrix(aFilteredFrame);
// Hardcode InputIsTainted to true because we don't want JS to be able to
// read the rendered contents of aFilteredFrame.
@ -134,7 +133,7 @@ bool FilterInstance::BuildWebRenderFilters(nsIFrame* aFilteredFrame,
// gfx context for the non-wr path.
gfxMatrix scaleMatrix;
gfxMatrix scaleMatrixInDevUnits =
scaleMatrix * nsSVGUtils::GetCSSPxToDevPxMatrix(aFilteredFrame);
scaleMatrix * SVGUtils::GetCSSPxToDevPxMatrix(aFilteredFrame);
// Hardcode inputIsTainted to true because we don't want JS to be able to
// read the rendered contents of aFilteredFrame.
@ -368,7 +367,7 @@ nsRegion FilterInstance::GetPostFilterDirtyArea(
return nsRegion();
}
gfxMatrix tm = nsSVGUtils::GetCanvasTM(aFilteredFrame);
gfxMatrix tm = SVGUtils::GetCanvasTM(aFilteredFrame);
auto filterChain = aFilteredFrame->StyleEffects()->mFilters.AsSpan();
UniquePtr<UserSpaceMetrics> metrics =
UserSpaceMetricsForFrame(aFilteredFrame);
@ -389,7 +388,7 @@ nsRegion FilterInstance::GetPostFilterDirtyArea(
nsRegion FilterInstance::GetPreFilterNeededArea(
nsIFrame* aFilteredFrame, const nsRegion& aPostFilterDirtyRegion) {
gfxMatrix tm = nsSVGUtils::GetCanvasTM(aFilteredFrame);
gfxMatrix tm = SVGUtils::GetCanvasTM(aFilteredFrame);
auto filterChain = aFilteredFrame->StyleEffects()->mFilters.AsSpan();
UniquePtr<UserSpaceMetrics> metrics =
UserSpaceMetricsForFrame(aFilteredFrame);
@ -421,7 +420,7 @@ nsRect FilterInstance::GetPostFilterBounds(nsIFrame* aFilteredFrame,
preFilterRegionPtr = &preFilterRegion;
}
gfxMatrix tm = nsSVGUtils::GetCanvasTM(aFilteredFrame);
gfxMatrix tm = SVGUtils::GetCanvasTM(aFilteredFrame);
auto filterChain = aFilteredFrame->StyleEffects()->mFilters.AsSpan();
UniquePtr<UserSpaceMetrics> metrics =
UserSpaceMetricsForFrame(aFilteredFrame);
@ -457,9 +456,9 @@ FilterInstance::FilterInstance(
} else {
MOZ_ASSERT(mTargetFrame,
"Need to supply a frame when there's no aOverrideBBox");
mTargetBBox = nsSVGUtils::GetBBox(mTargetFrame,
nsSVGUtils::eUseFrameBoundsForOuterSVG |
nsSVGUtils::eBBoxIncludeFillGeometry);
mTargetBBox =
SVGUtils::GetBBox(mTargetFrame, SVGUtils::eUseFrameBoundsForOuterSVG |
SVGUtils::eBBoxIncludeFillGeometry);
}
// Compute user space to filter space transforms.
@ -609,7 +608,7 @@ static void UpdateNeededBounds(const nsIntRegion& aRegion, nsIntRect& aBounds) {
bool overflow;
IntSize surfaceSize =
nsSVGUtils::ConvertToSurfaceSize(SizeDouble(aBounds.Size()), &overflow);
SVGUtils::ConvertToSurfaceSize(SizeDouble(aBounds.Size()), &overflow);
if (overflow) {
aBounds.SizeTo(surfaceSize);
}
@ -658,9 +657,9 @@ void FilterInstance::BuildSourcePaint(SourceInfo* aSource,
gfxMatrix::Translation(-neededRect.TopLeft()));
GeneralPattern pattern;
if (aSource == &mFillPaint) {
nsSVGUtils::MakeFillPatternFor(mTargetFrame, ctx, &pattern, aImgParams);
SVGUtils::MakeFillPatternFor(mTargetFrame, ctx, &pattern, aImgParams);
} else if (aSource == &mStrokePaint) {
nsSVGUtils::MakeStrokePatternFor(mTargetFrame, ctx, &pattern, aImgParams);
SVGUtils::MakeStrokePatternFor(mTargetFrame, ctx, &pattern, aImgParams);
}
if (pattern.GetPattern()) {
@ -723,7 +722,7 @@ void FilterInstance::BuildSourceImage(DrawTarget* aDest,
// subtle bugs, and in practice it probably makes no real difference.)
RefPtr<gfxContext> ctx = gfxContext::CreateOrNull(offscreenDT);
MOZ_ASSERT(ctx); // already checked the draw target above
gfxMatrix devPxToCssPxTM = nsSVGUtils::GetCSSPxToDevPxMatrix(mTargetFrame);
gfxMatrix devPxToCssPxTM = SVGUtils::GetCSSPxToDevPxMatrix(mTargetFrame);
DebugOnly<bool> invertible = devPxToCssPxTM.Invert();
MOZ_ASSERT(invertible);
ctx->SetMatrixDouble(devPxToCssPxTM * mPaintTransform *
@ -902,7 +901,7 @@ gfxMatrix FilterInstance::GetUserSpaceToFrameSpaceInCSSPxTransform() const {
return gfxMatrix();
}
return gfxMatrix::Translation(
-nsSVGUtils::FrameSpaceInCSSPxToUserSpaceOffset(mTargetFrame));
-SVGUtils::FrameSpaceInCSSPxToUserSpaceOffset(mTargetFrame));
}
} // namespace mozilla

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

@ -16,11 +16,11 @@
class gfxContext;
class nsIFrame;
class SVGBBox;
namespace mozilla {
class SVGAnimatedLengthList;
class SVGAnimatedNumberList;
class SVGBBox;
class SVGLengthList;
class SVGNumberList;
class SVGUserUnitList;

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

@ -10,8 +10,6 @@
#include "mozilla/SVGContainerFrame.h"
#include "mozilla/dom/SVGAElement.h"
#include "mozilla/dom/MutationEventBinding.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSVGUtils.h"
#include "SVGLengthList.h"
nsIFrame* NS_NewSVGAFrame(mozilla::PresShell* aPresShell,

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

@ -14,10 +14,10 @@
#include "mozilla/PresShell.h"
#include "mozilla/SVGGeometryFrame.h"
#include "mozilla/SVGObserverUtils.h"
#include "mozilla/SVGUtils.h"
#include "mozilla/dom/SVGClipPathElement.h"
#include "mozilla/dom/SVGGeometryElement.h"
#include "nsGkAtoms.h"
#include "nsSVGUtils.h"
using namespace mozilla::dom;
using namespace mozilla::gfx;
@ -61,7 +61,7 @@ void SVGClipPathFrame::ApplyClipPath(gfxContext& aContext,
static_cast<SVGGeometryElement*>(pathFrame->GetContent());
gfxMatrix toChildsUserSpace =
nsSVGUtils::GetTransformMatrixInUserSpace(pathFrame) *
SVGUtils::GetTransformMatrixInUserSpace(pathFrame) *
(GetClipPathTransform(aClippedFrame) * aMatrix);
gfxMatrix newMatrix = aContext.CurrentMatrixDouble()
@ -70,7 +70,7 @@ void SVGClipPathFrame::ApplyClipPath(gfxContext& aContext,
if (!newMatrix.IsSingular()) {
aContext.SetMatrixDouble(newMatrix);
FillRule clipRule =
nsSVGUtils::ToFillRule(pathFrame->StyleSVG()->mClipRule);
SVGUtils::ToFillRule(pathFrame->StyleSVG()->mClipRule);
clipPath = pathElement->GetOrBuildPath(drawTarget, clipRule);
}
}
@ -126,8 +126,8 @@ void SVGClipPathFrame::PaintClipMask(gfxContext& aMaskContext,
SVGClipPathFrame* clipPathThatClipsClipPath;
// XXX check return value?
SVGObserverUtils::GetAndObserveClipPath(this, &clipPathThatClipsClipPath);
nsSVGUtils::MaskUsage maskUsage;
nsSVGUtils::DetermineMaskUsage(this, true, maskUsage);
SVGUtils::MaskUsage maskUsage;
SVGUtils::DetermineMaskUsage(this, true, maskUsage);
if (maskUsage.shouldApplyClipPath) {
clipPathThatClipsClipPath->ApplyClipPath(aMaskContext, aClippedFrame,
@ -181,8 +181,8 @@ void SVGClipPathFrame::PaintFrameIntoMask(nsIFrame* aFrame,
return;
}
nsSVGUtils::MaskUsage maskUsage;
nsSVGUtils::DetermineMaskUsage(aFrame, true, maskUsage);
SVGUtils::MaskUsage maskUsage;
SVGUtils::DetermineMaskUsage(aFrame, true, maskUsage);
if (maskUsage.shouldApplyClipPath) {
clipPathThatClipsChild->ApplyClipPath(aTarget, aClippedFrame,
mMatrixForChildren);
@ -205,7 +205,7 @@ void SVGClipPathFrame::PaintFrameIntoMask(nsIFrame* aFrame,
nsIContent* childContent = child->GetContent();
if (childContent->IsSVGElement()) {
toChildsUserSpace =
nsSVGUtils::GetTransformMatrixInUserSpace(child) * mMatrixForChildren;
SVGUtils::GetTransformMatrixInUserSpace(child) * mMatrixForChildren;
}
// clipPath does not result in any image rendering, so we just use a dummy
@ -286,7 +286,7 @@ bool SVGClipPathFrame::PointIsInsideClipPath(nsIFrame* aClippedFrame,
if (SVGFrame) {
gfxPoint pointForChild = point;
gfxMatrix m = nsSVGUtils::GetTransformMatrixInUserSpace(kid);
gfxMatrix m = SVGUtils::GetTransformMatrixInUserSpace(kid);
if (!m.IsIdentity()) {
if (!m.Invert()) {
return false;
@ -386,7 +386,7 @@ nsresult SVGClipPathFrame::AttributeChanged(int32_t aNameSpaceID,
if (aNameSpaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::transform) {
SVGObserverUtils::InvalidateDirectRenderingObservers(this);
nsSVGUtils::NotifyChildrenOfSVGChange(
SVGUtils::NotifyChildrenOfSVGChange(
this, ISVGDisplayableFrame::TRANSFORM_CHANGED);
}
if (aAttribute == nsGkAtoms::clipPathUnits) {
@ -413,19 +413,19 @@ gfxMatrix SVGClipPathFrame::GetClipPathTransform(nsIFrame* aClippedFrame) {
SVGClipPathElement* content = static_cast<SVGClipPathElement*>(GetContent());
gfxMatrix tm = content->PrependLocalTransformsTo({}, eChildToUserSpace) *
nsSVGUtils::GetTransformMatrixInUserSpace(this);
SVGUtils::GetTransformMatrixInUserSpace(this);
SVGAnimatedEnumeration* clipPathUnits =
&content->mEnumAttributes[SVGClipPathElement::CLIPPATHUNITS];
uint32_t flags = nsSVGUtils::eBBoxIncludeFillGeometry |
uint32_t flags = SVGUtils::eBBoxIncludeFillGeometry |
(aClippedFrame->StyleBorder()->mBoxDecorationBreak ==
StyleBoxDecorationBreak::Clone
? nsSVGUtils::eIncludeOnlyCurrentFrameForNonSVGElement
? SVGUtils::eIncludeOnlyCurrentFrameForNonSVGElement
: 0);
return nsSVGUtils::AdjustMatrixForUnits(tm, clipPathUnits, aClippedFrame,
flags);
return SVGUtils::AdjustMatrixForUnits(tm, clipPathUnits, aClippedFrame,
flags);
}
SVGBBox SVGClipPathFrame::GetBBoxForClipPathFrame(const SVGBBox& aBBox,
@ -447,9 +447,9 @@ SVGBBox SVGClipPathFrame::GetBBoxForClipPathFrame(const SVGBBox& aBBox,
ISVGDisplayableFrame* svg = do_QueryFrame(frame);
if (svg) {
gfxMatrix matrix =
nsSVGUtils::GetTransformMatrixInUserSpace(frame) * aMatrix;
SVGUtils::GetTransformMatrixInUserSpace(frame) * aMatrix;
tmpBBox = svg->GetBBoxContribution(gfx::ToMatrix(matrix),
nsSVGUtils::eBBoxIncludeFill);
SVGUtils::eBBoxIncludeFill);
SVGClipPathFrame* clipPathFrame;
if (SVGObserverUtils::GetAndObserveClipPath(frame, &clipPathFrame) !=
SVGObserverUtils::eHasRefsSomeInvalid &&
@ -457,7 +457,7 @@ SVGBBox SVGClipPathFrame::GetBBoxForClipPathFrame(const SVGBBox& aBBox,
tmpBBox =
clipPathFrame->GetBBoxForClipPathFrame(tmpBBox, aMatrix, aFlags);
}
if (!(aFlags & nsSVGUtils::eDoNotClipToBBoxOfContentInsideClipPath)) {
if (!(aFlags & SVGUtils::eDoNotClipToBBoxOfContentInsideClipPath)) {
tmpBBox.Intersect(aBBox);
}
unionBBox.UnionEdges(tmpBBox);

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

@ -10,7 +10,6 @@
#include "gfxMatrix.h"
#include "mozilla/Attributes.h"
#include "mozilla/SVGContainerFrame.h"
#include "nsSVGUtils.h"
class gfxContext;

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

@ -13,9 +13,9 @@
#include "mozilla/RestyleManager.h"
#include "mozilla/SVGObserverUtils.h"
#include "mozilla/SVGTextFrame.h"
#include "mozilla/SVGUtils.h"
#include "mozilla/dom/SVGElement.h"
#include "nsCSSFrameConstructor.h"
#include "nsSVGUtils.h"
#include "SVGAnimatedTransformList.h"
using namespace mozilla::dom;
@ -171,8 +171,8 @@ void SVGDisplayContainerFrame::InsertFrames(
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.
nsSVGUtils::ScheduleReflowSVG(kid);
// SVGUtils::ScheduleBoundsUpdate.
SVGUtils::ScheduleReflowSVG(kid);
if (isFirstReflow) {
// Add back the NS_FRAME_FIRST_REFLOW bit:
kid->AddStateBits(NS_FRAME_FIRST_REFLOW);
@ -263,12 +263,12 @@ void SVGDisplayContainerFrame::PaintSVG(gfxContext& aContext,
continue; // nothing to paint for kid
}
m = nsSVGUtils::GetTransformMatrixInUserSpace(kid) * m;
m = SVGUtils::GetTransformMatrixInUserSpace(kid) * m;
if (m.IsSingular()) {
continue;
}
}
nsSVGUtils::PaintFrameWithEffects(kid, aContext, m, aImgParams, aDirtyRect);
SVGUtils::PaintFrameWithEffects(kid, aContext, m, aImgParams, aDirtyRect);
}
}
@ -277,11 +277,11 @@ nsIFrame* SVGDisplayContainerFrame::GetFrameForPoint(const gfxPoint& aPoint) {
(mState & NS_FRAME_IS_NONDISPLAY),
"If display lists are enabled, only hit-testing of a "
"clipPath's contents should take this code path");
return nsSVGUtils::HitTestChildren(this, aPoint);
return SVGUtils::HitTestChildren(this, aPoint);
}
void SVGDisplayContainerFrame::ReflowSVG() {
NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this),
NS_ASSERTION(SVGUtils::OuterSVGIsCallingReflowSVG(this),
"This call is probably a wasteful mistake");
MOZ_ASSERT(!HasAnyStateBits(NS_FRAME_IS_NONDISPLAY),
@ -289,7 +289,7 @@ void SVGDisplayContainerFrame::ReflowSVG() {
MOZ_ASSERT(!IsSVGOuterSVGFrame(), "Do not call on outer-<svg>");
if (!nsSVGUtils::NeedsReflowSVG(this)) {
if (!SVGUtils::NeedsReflowSVG(this)) {
return;
}
@ -374,7 +374,7 @@ void SVGDisplayContainerFrame::NotifySVGChanged(uint32_t aFlags) {
mCanvasTM = nullptr;
}
nsSVGUtils::NotifyChildrenOfSVGChange(this, aFlags);
SVGUtils::NotifyChildrenOfSVGChange(this, aFlags);
}
SVGBBox SVGDisplayContainerFrame::GetBBoxContribution(
@ -393,7 +393,7 @@ SVGBBox SVGDisplayContainerFrame::GetBBoxContribution(
if (content->IsSVGElement()) {
transform = static_cast<SVGElement*>(content)->PrependLocalTransformsTo(
{}, eChildToUserSpace) *
nsSVGUtils::GetTransformMatrixInUserSpace(kid) * transform;
SVGUtils::GetTransformMatrixInUserSpace(kid) * transform;
}
// We need to include zero width/height vertical/horizontal lines, so we
// have to use UnionEdges.

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

@ -14,7 +14,6 @@
#include "nsIFrame.h"
#include "nsQueryFrame.h"
#include "nsRect.h"
#include "nsSVGUtils.h"
class gfxContext;
class nsFrameList;
@ -110,7 +109,7 @@ class SVGContainerFrame : public nsContainerFrame {
*
* This class's methods can *not* assume that mContent points to an instance of
* an SVG element class since this class is inherited by
* nsSVGGenericContainerFrame which is used for unrecognized elements in the
* SVGGenericContainerFrame which is used for unrecognized elements in the
* SVG namespace. Do *not* blindly cast to SVG element types.
*/
class SVGDisplayContainerFrame : public SVGContainerFrame,

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

@ -13,6 +13,7 @@
#include "mozilla/dom/SVGDocument.h"
#include "mozilla/StaticPrefs_svg.h"
#include "mozilla/SVGObserverUtils.h"
#include "mozilla/SVGUtils.h"
#include "SVGPaintServerFrame.h"
using namespace mozilla::gfx;
@ -124,7 +125,7 @@ static void SetupInheritablePaint(const DrawTarget* aDrawTarget,
}
nscolor color =
nsSVGUtils::GetFallbackOrPaintColor(*aFrame->Style(), aFillOrStroke);
SVGUtils::GetFallbackOrPaintColor(*aFrame->Style(), aFillOrStroke);
aTargetPaint.SetColor(color);
}
@ -142,7 +143,7 @@ DrawMode SVGContextPaintImpl::Init(const DrawTarget* aDrawTarget,
SetFillOpacity(0.0f);
} else {
float opacity =
nsSVGUtils::GetOpacity(style->mFillOpacity, aOuterContextPaint);
SVGUtils::GetOpacity(style->mFillOpacity, aOuterContextPaint);
SetupInheritablePaint(aDrawTarget, aContextMatrix, aFrame, opacity,
aOuterContextPaint, mFillPaint, &nsStyleSVG::mFill,
@ -158,7 +159,7 @@ DrawMode SVGContextPaintImpl::Init(const DrawTarget* aDrawTarget,
SetStrokeOpacity(0.0f);
} else {
float opacity =
nsSVGUtils::GetOpacity(style->mStrokeOpacity, aOuterContextPaint);
SVGUtils::GetOpacity(style->mStrokeOpacity, aOuterContextPaint);
SetupInheritablePaint(aDrawTarget, aContextMatrix, aFrame, opacity,
aOuterContextPaint, mStrokePaint,

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

@ -16,8 +16,6 @@
#include "SVGObserverUtils.h"
#include "SVGElement.h"
#include "SVGFilterInstance.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSVGUtils.h"
#include "nsContentUtils.h"
using namespace mozilla;

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

@ -11,7 +11,6 @@
#include "mozilla/SVGContainerFrame.h"
#include "nsIFrame.h"
#include "nsQueryFrame.h"
#include "nsSVGUtils.h"
class nsAtom;
class nsIContent;

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

@ -13,13 +13,13 @@
#include "mozilla/ISVGDisplayableFrame.h"
#include "mozilla/SVGContentUtils.h"
#include "mozilla/SVGObserverUtils.h"
#include "mozilla/SVGUtils.h"
#include "mozilla/dom/HTMLCanvasElement.h"
#include "mozilla/dom/IDTracker.h"
#include "mozilla/dom/SVGLengthBinding.h"
#include "mozilla/dom/SVGUnitTypesBinding.h"
#include "mozilla/dom/SVGFilterElement.h"
#include "SVGFilterFrame.h"
#include "nsSVGUtils.h"
#include "FilterSupport.h"
#include "gfx2DGlue.h"
@ -87,7 +87,7 @@ bool SVGFilterInstance::ComputeBounds() {
uint16_t filterUnits =
mFilterFrame->GetEnumValue(SVGFilterElement::FILTERUNITS);
gfxRect userSpaceBounds =
nsSVGUtils::GetRelativeRect(filterUnits, XYWH, mTargetBBox, mMetrics);
SVGUtils::GetRelativeRect(filterUnits, XYWH, mTargetBBox, mMetrics);
// Transform the user space bounds to filter space, so we
// can align them with the pixel boundaries of the offscreen surface.
@ -171,9 +171,9 @@ float SVGFilterInstance::GetPrimitiveNumber(uint8_t aCtxType,
float value;
if (mPrimitiveUnits == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
value = nsSVGUtils::ObjectSpace(mTargetBBox, &val);
value = SVGUtils::ObjectSpace(mTargetBBox, &val);
} else {
value = nsSVGUtils::UserSpace(mMetrics, &val);
value = SVGUtils::UserSpace(mMetrics, &val);
}
switch (aCtxType) {
@ -202,7 +202,7 @@ Point3D SVGFilterInstance::ConvertLocation(const Point3D& aPoint) const {
SVGLength_Binding::SVG_LENGTHTYPE_NUMBER);
gfxRect feArea =
nsSVGUtils::GetRelativeRect(mPrimitiveUnits, val, mTargetBBox, mMetrics);
SVGUtils::GetRelativeRect(mPrimitiveUnits, val, mTargetBBox, mMetrics);
gfxRect r = UserSpaceToFilterSpace(feArea);
return Point3D(r.x, r.y, GetPrimitiveNumber(SVGContentUtils::XY, aPoint.z));
}
@ -237,7 +237,7 @@ IntRect SVGFilterInstance::ComputeFilterPrimitiveSubregion(
defaultFilterSubregion = mFilterSpaceBounds;
}
gfxRect feArea = nsSVGUtils::GetRelativeRect(
gfxRect feArea = SVGUtils::GetRelativeRect(
mPrimitiveUnits, &fE->mLengthAttributes[SVGFE::ATTR_X], mTargetBBox,
mMetrics);
Rect region = ToRect(UserSpaceToFilterSpace(feArea));

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

@ -15,6 +15,7 @@
#include "mozilla/SVGContainerFrame.h"
#include "mozilla/SVGObserverUtils.h"
#include "mozilla/SVGOuterSVGFrame.h"
#include "mozilla/SVGUtils.h"
#include "mozilla/dom/SVGForeignObjectElement.h"
#include "nsDisplayList.h"
#include "nsGkAtoms.h"
@ -22,8 +23,6 @@
#include "nsLayoutUtils.h"
#include "nsRegion.h"
#include "SVGGeometryProperty.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSVGUtils.h"
using namespace mozilla::dom;
using namespace mozilla::image;
@ -67,7 +66,7 @@ void SVGForeignObjectFrame::Init(nsIContent* aContent,
AddStateBits(NS_FRAME_FONT_INFLATION_CONTAINER |
NS_FRAME_FONT_INFLATION_FLOW_ROOT);
if (!(mState & NS_FRAME_IS_NONDISPLAY)) {
nsSVGUtils::GetOuterSVGFrame(this)->RegisterForeignObject(this);
SVGUtils::GetOuterSVGFrame(this)->RegisterForeignObject(this);
}
}
@ -75,7 +74,7 @@ void SVGForeignObjectFrame::DestroyFrom(nsIFrame* aDestructRoot,
PostDestroyData& aPostDestroyData) {
// Only unregister if we registered in the first place:
if (!(mState & NS_FRAME_IS_NONDISPLAY)) {
nsSVGUtils::GetOuterSVGFrame(this)->UnregisterForeignObject(this);
SVGUtils::GetOuterSVGFrame(this)->UnregisterForeignObject(this);
}
nsContainerFrame::DestroyFrom(aDestructRoot, aPostDestroyData);
}
@ -110,7 +109,7 @@ void SVGForeignObjectFrame::DidSetComputedStyle(
StyleSVGReset()->mY != aOldComputedStyle->StyleSVGReset()->mY) {
// Invalidate cached transform matrix.
mCanvasTM = nullptr;
nsSVGUtils::ScheduleReflowSVG(this);
SVGUtils::ScheduleReflowSVG(this);
}
}
}
@ -250,8 +249,8 @@ void SVGForeignObjectFrame::PaintSVG(gfxContext& aContext,
static_cast<SVGElement*>(GetContent()), &x, &y, &width, &height);
gfxRect clipRect =
nsSVGUtils::GetClipRectForFrame(this, 0.0f, 0.0f, width, height);
nsSVGUtils::SetClipRect(&aContext, aTransform, clipRect);
SVGUtils::GetClipRectForFrame(this, 0.0f, 0.0f, width, height);
SVGUtils::SetClipRect(&aContext, aTransform, clipRect);
}
// SVG paints in CSS px, but normally frames paint in dev pixels. Here we
@ -302,7 +301,7 @@ nsIFrame* SVGForeignObjectFrame::GetFrameForPoint(const gfxPoint& aPoint) {
static_cast<SVGElement*>(GetContent()), &x, &y, &width, &height);
if (!gfxRect(x, y, width, height).Contains(aPoint) ||
!nsSVGUtils::HitTestClip(this, aPoint)) {
!SVGUtils::HitTestClip(this, aPoint)) {
return nullptr;
}
@ -316,13 +315,13 @@ nsIFrame* SVGForeignObjectFrame::GetFrameForPoint(const gfxPoint& aPoint) {
}
void SVGForeignObjectFrame::ReflowSVG() {
NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this),
NS_ASSERTION(SVGUtils::OuterSVGIsCallingReflowSVG(this),
"This call is probably a wasteful mistake");
MOZ_ASSERT(!HasAnyStateBits(NS_FRAME_IS_NONDISPLAY),
"ReflowSVG mechanism not designed for this");
if (!nsSVGUtils::NeedsReflowSVG(this)) {
if (!SVGUtils::NeedsReflowSVG(this)) {
return;
}
@ -419,7 +418,7 @@ void SVGForeignObjectFrame::NotifySVGChanged(uint32_t aFlags) {
// invalidate them. We also don't need to invalidate ourself, since our
// changed ancestor will have invalidated its entire area, which includes
// our area.
nsSVGUtils::ScheduleReflowSVG(this);
SVGUtils::ScheduleReflowSVG(this);
}
// If we're called while the PresShell is handling reflow events then we
@ -547,8 +546,8 @@ nsRect SVGForeignObjectFrame::GetInvalidRegion() {
if (kid->HasInvalidFrameInSubtree()) {
gfxRect r(mRect.x, mRect.y, mRect.width, mRect.height);
r.Scale(1.0 / AppUnitsPerCSSPixel());
nsRect rect = nsSVGUtils::ToCanvasBounds(r, GetCanvasTM(), PresContext());
rect = nsSVGUtils::GetPostFilterVisualOverflowRect(this, rect);
nsRect rect = SVGUtils::ToCanvasBounds(r, GetCanvasTM(), PresContext());
rect = SVGUtils::GetPostFilterVisualOverflowRect(this, rect);
return rect;
}
return nsRect();

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

@ -13,7 +13,6 @@
#include "mozilla/UniquePtr.h"
#include "nsContainerFrame.h"
#include "nsRegion.h"
#include "nsSVGUtils.h"
class gfxContext;

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

@ -11,10 +11,6 @@
#include "mozilla/PresShell.h"
#include "nsGkAtoms.h"
#include "nsIFrame.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSVGUtils.h"
#include "SVGGraphicsElement.h"
#include "SVGTransformableElement.h"
using namespace mozilla::dom;

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

@ -6,7 +6,6 @@
// Main header first:
#include "SVGGenericContainerFrame.h"
#include "nsSVGIntegrationUtils.h"
#include "mozilla/PresShell.h"

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

@ -12,25 +12,23 @@
#include "gfxContext.h"
#include "gfxPlatform.h"
#include "gfxUtils.h"
#include "mozilla/dom/SVGGeometryElement.h"
#include "mozilla/dom/SVGGraphicsElement.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/Helpers.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/PresShell.h"
#include "mozilla/RefPtr.h"
#include "mozilla/SVGContextPaint.h"
#include "mozilla/SVGContentUtils.h"
#include "mozilla/SVGObserverUtils.h"
#include "mozilla/SVGUtils.h"
#include "nsDisplayList.h"
#include "nsGkAtoms.h"
#include "nsLayoutUtils.h"
#include "SVGObserverUtils.h"
#include "nsSVGIntegrationUtils.h"
#include "SVGMarkerFrame.h"
#include "SVGGeometryElement.h"
#include "nsSVGUtils.h"
#include "mozilla/ArrayUtils.h"
#include "SVGAnimatedTransformList.h"
#include "SVGContentUtils.h"
#include "SVGGraphicsElement.h"
#include "SVGMarkerFrame.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::gfx;
using namespace mozilla::image;
@ -38,11 +36,14 @@ using namespace mozilla::image;
//----------------------------------------------------------------------
// Implementation
nsIFrame* NS_NewSVGGeometryFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
nsIFrame* NS_NewSVGGeometryFrame(mozilla::PresShell* aPresShell,
mozilla::ComputedStyle* aStyle) {
return new (aPresShell)
SVGGeometryFrame(aStyle, aPresShell->GetPresContext());
mozilla::SVGGeometryFrame(aStyle, aPresShell->GetPresContext());
}
namespace mozilla {
NS_IMPL_FRAMEARENA_HELPERS(SVGGeometryFrame)
//----------------------------------------------------------------------
@ -81,7 +82,7 @@ void DisplaySVGGeometry::Paint(nsDisplayListBuilder* aBuilder,
gfxPoint devPixelOffset =
nsLayoutUtils::PointToGfxPoint(offset, appUnitsPerDevPixel);
gfxMatrix tm = nsSVGUtils::GetCSSPxToDevPxMatrix(mFrame) *
gfxMatrix tm = SVGUtils::GetCSSPxToDevPxMatrix(mFrame) *
gfxMatrix::Translation(devPixelOffset);
imgDrawingParams imgParams(aBuilder->GetImageDecodeFlags());
static_cast<SVGGeometryFrame*>(mFrame)->PaintSVG(*aCtx, tm, imgParams);
@ -105,8 +106,6 @@ void DisplaySVGGeometry::ComputeInvalidationRegion(
aInvalidRegion);
}
namespace mozilla {
//----------------------------------------------------------------------
// nsIFrame methods
@ -129,7 +128,7 @@ nsresult SVGGeometryFrame::AttributeChanged(int32_t aNameSpaceID,
->AttributeDefinesGeometry(aAttribute))) {
nsLayoutUtils::PostRestyleEvent(mContent->AsElement(), RestyleHint{0},
nsChangeHint_InvalidateRenderingObservers);
nsSVGUtils::ScheduleReflowSVG(this);
SVGUtils::ScheduleReflowSVG(this);
}
return NS_OK;
}
@ -258,7 +257,7 @@ nsIFrame* SVGGeometryFrame::GetFrameForPoint(const gfxPoint& aPoint) {
uint16_t hitTestFlags;
if (HasAnyStateBits(NS_STATE_SVG_CLIPPATH_CHILD)) {
hitTestFlags = SVG_HIT_TEST_FILL;
fillRule = nsSVGUtils::ToFillRule(StyleSVG()->mClipRule);
fillRule = SVGUtils::ToFillRule(StyleSVG()->mClipRule);
} else {
hitTestFlags = GetHitTestFlags();
if (!hitTestFlags) {
@ -270,7 +269,7 @@ nsIFrame* SVGGeometryFrame::GetFrameForPoint(const gfxPoint& aPoint) {
return nullptr;
}
}
fillRule = nsSVGUtils::ToFillRule(StyleSVG()->mFillRule);
fillRule = SVGUtils::ToFillRule(StyleSVG()->mFillRule);
}
bool isHit = false;
@ -295,7 +294,7 @@ nsIFrame* SVGGeometryFrame::GetFrameForPoint(const gfxPoint& aPoint) {
SVGContentUtils::AutoStrokeOptions stroke;
SVGContentUtils::GetStrokeOptions(&stroke, content, Style(), nullptr);
gfxMatrix userToOuterSVG;
if (nsSVGUtils::GetNonScalingStrokeTransform(this, &userToOuterSVG)) {
if (SVGUtils::GetNonScalingStrokeTransform(this, &userToOuterSVG)) {
// We need to transform the path back into the appropriate ancestor
// coordinate system in order for non-scaled stroke to be correct.
// Naturally we also need to transform the point into the same
@ -308,7 +307,7 @@ nsIFrame* SVGGeometryFrame::GetFrameForPoint(const gfxPoint& aPoint) {
isHit = path->StrokeContainsPoint(stroke, point, Matrix());
}
if (isHit && nsSVGUtils::HitTestClip(this, aPoint)) {
if (isHit && SVGUtils::HitTestClip(this, aPoint)) {
return this;
}
@ -316,19 +315,18 @@ nsIFrame* SVGGeometryFrame::GetFrameForPoint(const gfxPoint& aPoint) {
}
void SVGGeometryFrame::ReflowSVG() {
NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this),
NS_ASSERTION(SVGUtils::OuterSVGIsCallingReflowSVG(this),
"This call is probably a wasteful mistake");
MOZ_ASSERT(!HasAnyStateBits(NS_FRAME_IS_NONDISPLAY),
"ReflowSVG mechanism not designed for this");
if (!nsSVGUtils::NeedsReflowSVG(this)) {
if (!SVGUtils::NeedsReflowSVG(this)) {
return;
}
uint32_t flags = nsSVGUtils::eBBoxIncludeFill |
nsSVGUtils::eBBoxIncludeStroke |
nsSVGUtils::eBBoxIncludeMarkers;
uint32_t flags = SVGUtils::eBBoxIncludeFill | SVGUtils::eBBoxIncludeStroke |
SVGUtils::eBBoxIncludeMarkers;
// Our "visual" overflow rect needs to be valid for building display lists
// for hit testing, which means that for certain values of 'pointer-events'
// it needs to include the geometry of the fill or stroke even when the fill/
@ -336,10 +334,10 @@ void SVGGeometryFrame::ReflowSVG() {
// stroke-opacity="0"). GetHitTestFlags() accounts for 'pointer-events'.
uint16_t hitTestFlags = GetHitTestFlags();
if ((hitTestFlags & SVG_HIT_TEST_FILL)) {
flags |= nsSVGUtils::eBBoxIncludeFillGeometry;
flags |= SVGUtils::eBBoxIncludeFillGeometry;
}
if ((hitTestFlags & SVG_HIT_TEST_STROKE)) {
flags |= nsSVGUtils::eBBoxIncludeStrokeGeometry;
flags |= SVGUtils::eBBoxIncludeStrokeGeometry;
}
gfxRect extent = GetBBoxContribution(Matrix(), flags).ToThebesRect();
@ -395,14 +393,14 @@ void SVGGeometryFrame::NotifySVGChanged(uint32_t aFlags) {
(strokeWidth.IsLengthPercentage() &&
strokeWidth.AsLengthPercentage().HasPercent())) {
geom->ClearAnyCachedPath();
nsSVGUtils::ScheduleReflowSVG(this);
SVGUtils::ScheduleReflowSVG(this);
}
}
if ((aFlags & TRANSFORM_CHANGED) && StyleSVGReset()->HasNonScalingStroke()) {
// Stroke currently contributes to our mRect, and our stroke depends on
// the transform to our outer-<svg> if |vector-effect:non-scaling-stroke|.
nsSVGUtils::ScheduleReflowSVG(this);
SVGUtils::ScheduleReflowSVG(this);
}
}
@ -415,7 +413,7 @@ SVGBBox SVGGeometryFrame::GetBBoxContribution(const Matrix& aToBBoxUserspace,
return bbox;
}
if ((aFlags & nsSVGUtils::eForGetClientRects) &&
if ((aFlags & SVGUtils::eForGetClientRects) &&
aToBBoxUserspace.PreservesAxisAlignedRectangles()) {
Rect rect = NSRectToRect(mRect, AppUnitsPerCSSPixel());
bbox = aToBBoxUserspace.TransformBounds(rect);
@ -424,13 +422,13 @@ SVGBBox SVGGeometryFrame::GetBBoxContribution(const Matrix& aToBBoxUserspace,
SVGGeometryElement* element = static_cast<SVGGeometryElement*>(GetContent());
bool getFill = (aFlags & nsSVGUtils::eBBoxIncludeFillGeometry) ||
((aFlags & nsSVGUtils::eBBoxIncludeFill) &&
bool getFill = (aFlags & SVGUtils::eBBoxIncludeFillGeometry) ||
((aFlags & SVGUtils::eBBoxIncludeFill) &&
!StyleSVG()->mFill.kind.IsNone());
bool getStroke = (aFlags & nsSVGUtils::eBBoxIncludeStrokeGeometry) ||
((aFlags & nsSVGUtils::eBBoxIncludeStroke) &&
nsSVGUtils::HasStroke(this));
bool getStroke =
(aFlags & SVGUtils::eBBoxIncludeStrokeGeometry) ||
((aFlags & SVGUtils::eBBoxIncludeStroke) && SVGUtils::HasStroke(this));
SVGContentUtils::AutoStrokeOptions strokeOptions;
if (getStroke) {
@ -446,7 +444,7 @@ SVGBBox SVGGeometryFrame::GetBBoxContribution(const Matrix& aToBBoxUserspace,
bool gotSimpleBounds = false;
gfxMatrix userToOuterSVG;
if (getStroke &&
nsSVGUtils::GetNonScalingStrokeTransform(this, &userToOuterSVG)) {
SVGUtils::GetNonScalingStrokeTransform(this, &userToOuterSVG)) {
Matrix moz2dUserToOuterSVG = ToMatrix(userToOuterSVG);
if (moz2dUserToOuterSVG.IsSingular()) {
return bbox;
@ -476,7 +474,7 @@ SVGBBox SVGGeometryFrame::GetBBoxContribution(const Matrix& aToBBoxUserspace,
tmpDT = gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget();
#endif
FillRule fillRule = nsSVGUtils::ToFillRule(
FillRule fillRule = SVGUtils::ToFillRule(
HasAnyStateBits(NS_STATE_SVG_CLIPPATH_CHILD) ? StyleSVG()->mClipRule
: StyleSVG()->mFillRule);
RefPtr<Path> pathInUserSpace = element->GetOrBuildPath(tmpDT, fillRule);
@ -543,7 +541,7 @@ SVGBBox SVGGeometryFrame::GetBBoxContribution(const Matrix& aToBBoxUserspace,
SVGContentUtils::eIgnoreStrokeDashing);
Rect strokeBBoxExtents;
gfxMatrix userToOuterSVG;
if (nsSVGUtils::GetNonScalingStrokeTransform(this, &userToOuterSVG)) {
if (SVGUtils::GetNonScalingStrokeTransform(this, &userToOuterSVG)) {
Matrix outerSVGToUser = ToMatrix(userToOuterSVG);
outerSVGToUser.Invert();
Matrix outerSVGToBBox = aToBBoxUserspace * outerSVGToUser;
@ -559,8 +557,8 @@ SVGBBox SVGGeometryFrame::GetBBoxContribution(const Matrix& aToBBoxUserspace,
MOZ_ASSERT(strokeBBoxExtents.IsFinite(), "bbox is about to go bad");
bbox.UnionEdges(strokeBBoxExtents);
#else
// For now we just use nsSVGUtils::PathExtentsToMaxStrokeExtents:
gfxRect strokeBBoxExtents = nsSVGUtils::PathExtentsToMaxStrokeExtents(
// For now we just use SVGUtils::PathExtentsToMaxStrokeExtents:
gfxRect strokeBBoxExtents = SVGUtils::PathExtentsToMaxStrokeExtents(
ThebesRect(pathBBoxExtents), this, ThebesMatrix(aToBBoxUserspace));
MOZ_ASSERT(ToRect(strokeBBoxExtents).IsFinite(),
"bbox is about to go bad");
@ -570,14 +568,13 @@ SVGBBox SVGGeometryFrame::GetBBoxContribution(const Matrix& aToBBoxUserspace,
}
// Account for markers:
if ((aFlags & nsSVGUtils::eBBoxIncludeMarkers) != 0 &&
element->IsMarkable()) {
if ((aFlags & SVGUtils::eBBoxIncludeMarkers) != 0 && element->IsMarkable()) {
SVGMarkerFrame* markerFrames[SVGMark::eTypeCount];
if (SVGObserverUtils::GetAndObserveMarkers(this, &markerFrames)) {
nsTArray<SVGMark> marks;
element->GetMarkPoints(&marks);
if (uint32_t num = marks.Length()) {
float strokeWidth = nsSVGUtils::GetStrokeWidth(this);
float strokeWidth = SVGUtils::GetStrokeWidth(this);
for (uint32_t i = 0; i < num; i++) {
const SVGMark& mark = marks[i];
SVGMarkerFrame* frame = markerFrames[mark.type];
@ -619,7 +616,7 @@ void SVGGeometryFrame::Render(gfxContext* aContext, uint32_t aRenderComponents,
return;
}
FillRule fillRule = nsSVGUtils::ToFillRule(
FillRule fillRule = SVGUtils::ToFillRule(
HasAnyStateBits(NS_STATE_SVG_CLIPPATH_CHILD) ? StyleSVG()->mClipRule
: StyleSVG()->mFillRule);
@ -665,8 +662,8 @@ void SVGGeometryFrame::Render(gfxContext* aContext, uint32_t aRenderComponents,
if (aRenderComponents & eRenderFill) {
GeneralPattern fillPattern;
nsSVGUtils::MakeFillPatternFor(this, aContext, &fillPattern, aImgParams,
contextPaint);
SVGUtils::MakeFillPatternFor(this, aContext, &fillPattern, aImgParams,
contextPaint);
if (fillPattern.GetPattern()) {
DrawOptions drawOptions(1.0f, CompositionOp::OP_OVER, aaMode);
@ -679,10 +676,10 @@ void SVGGeometryFrame::Render(gfxContext* aContext, uint32_t aRenderComponents,
}
if ((aRenderComponents & eRenderStroke) &&
nsSVGUtils::HasStroke(this, contextPaint)) {
SVGUtils::HasStroke(this, contextPaint)) {
// Account for vector-effect:non-scaling-stroke:
gfxMatrix userToOuterSVG;
if (nsSVGUtils::GetNonScalingStrokeTransform(this, &userToOuterSVG)) {
if (SVGUtils::GetNonScalingStrokeTransform(this, &userToOuterSVG)) {
// A simple Rect can't be transformed with rotate/skew, so let's switch
// to using a real path:
if (!path) {
@ -703,8 +700,8 @@ void SVGGeometryFrame::Render(gfxContext* aContext, uint32_t aRenderComponents,
path = builder->Finish();
}
GeneralPattern strokePattern;
nsSVGUtils::MakeStrokePatternFor(this, aContext, &strokePattern, aImgParams,
contextPaint);
SVGUtils::MakeStrokePatternFor(this, aContext, &strokePattern, aImgParams,
contextPaint);
if (strokePattern.GetPattern()) {
SVGContentUtils::AutoStrokeOptions strokeOptions;
@ -742,7 +739,7 @@ void SVGGeometryFrame::PaintMarkers(gfxContext& aContext,
if (uint32_t num = marks.Length()) {
SVGContextPaint* contextPaint =
SVGContextPaint::GetContextPaint(GetContent());
float strokeWidth = nsSVGUtils::GetStrokeWidth(this, contextPaint);
float strokeWidth = SVGUtils::GetStrokeWidth(this, contextPaint);
for (uint32_t i = 0; i < num; i++) {
const SVGMark& mark = marks[i];
SVGMarkerFrame* frame = markerFrames[mark.type];
@ -757,6 +754,6 @@ void SVGGeometryFrame::PaintMarkers(gfxContext& aContext,
}
uint16_t SVGGeometryFrame::GetHitTestFlags() {
return nsSVGUtils::GetGeometryHitTestFlags(this);
return SVGUtils::GetGeometryHitTestFlags(this);
}
} // namespace mozilla

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

@ -15,7 +15,6 @@
#include "nsIFrame.h"
#include "nsLiteralString.h"
#include "nsQueryFrame.h"
#include "nsSVGUtils.h"
namespace mozilla {
@ -37,7 +36,6 @@ struct imgDrawingParams;
class gfxContext;
class nsAtom;
class nsIFrame;
class nsSVGMarkerFrame;
struct nsRect;

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

@ -13,6 +13,7 @@
#include "gfxPattern.h"
#include "mozilla/PresShell.h"
#include "mozilla/SVGObserverUtils.h"
#include "mozilla/SVGUtils.h"
#include "mozilla/dom/SVGGradientElement.h"
#include "mozilla/dom/SVGGradientElementBinding.h"
#include "mozilla/dom/SVGStopElement.h"
@ -143,9 +144,9 @@ gfxMatrix SVGGradientFrame::GetGradientTransform(
gfxRect bbox = aOverrideBounds
? *aOverrideBounds
: nsSVGUtils::GetBBox(
aSource, nsSVGUtils::eUseFrameBoundsForOuterSVG |
nsSVGUtils::eBBoxIncludeFillGeometry);
: SVGUtils::GetBBox(
aSource, SVGUtils::eUseFrameBoundsForOuterSVG |
SVGUtils::eBBoxIncludeFillGeometry);
bboxMatrix =
gfxMatrix(bbox.Width(), 0, 0, bbox.Height(), bbox.X(), bbox.Y());
}
@ -271,7 +272,7 @@ already_AddRefed<gfxPattern> SVGGradientFrame::GetPaintServerPattern(
// revert any vector effect transform so that the gradient appears unchanged
if (aFillOrStroke == &nsStyleSVG::mStroke) {
gfxMatrix userToOuterSVG;
if (nsSVGUtils::GetNonScalingStrokeTransform(aSource, &userToOuterSVG)) {
if (SVGUtils::GetNonScalingStrokeTransform(aSource, &userToOuterSVG)) {
patternMatrix *= userToOuterSVG;
}
}
@ -427,7 +428,7 @@ float SVGLinearGradientFrame::GetLengthValue(uint32_t aIndex) {
uint16_t gradientUnits = GetGradientUnits();
if (gradientUnits == SVG_UNIT_TYPE_USERSPACEONUSE) {
return nsSVGUtils::UserSpace(mSource, &length);
return SVGUtils::UserSpace(mSource, &length);
}
NS_ASSERTION(gradientUnits == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX,
@ -528,7 +529,7 @@ float SVGRadialGradientFrame::GetLengthValueFromElement(
uint16_t gradientUnits = GetGradientUnits();
if (gradientUnits == SVG_UNIT_TYPE_USERSPACEONUSE) {
return nsSVGUtils::UserSpace(mSource, &length);
return SVGUtils::UserSpace(mSource, &length);
}
NS_ASSERTION(gradientUnits == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX,

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

@ -18,12 +18,12 @@
#include "nsLayoutUtils.h"
#include "imgINotificationObserver.h"
#include "SVGGeometryProperty.h"
#include "SVGObserverUtils.h"
#include "nsSVGUtils.h"
#include "SVGContentUtils.h"
#include "SVGGeometryFrame.h"
#include "SVGImageContext.h"
#include "mozilla/PresShell.h"
#include "mozilla/SVGContentUtils.h"
#include "mozilla/SVGImageContext.h"
#include "mozilla/SVGObserverUtils.h"
#include "mozilla/SVGUtils.h"
#include "mozilla/dom/MutationEventBinding.h"
#include "mozilla/dom/SVGImageElement.h"
#include "nsIReflowCallback.h"
@ -324,8 +324,8 @@ void SVGImageFrame::PaintSVG(gfxContext& aContext, const gfxMatrix& aTransform,
if (StyleDisplay()->IsScrollableOverflow()) {
gfxRect clipRect =
nsSVGUtils::GetClipRectForFrame(this, x, y, width, height);
nsSVGUtils::SetClipRect(&aContext, aTransform, clipRect);
SVGUtils::GetClipRectForFrame(this, x, y, width, height);
SVGUtils::SetClipRect(&aContext, aTransform, clipRect);
}
if (!TransformContextForPainting(&aContext, aTransform)) {
@ -336,7 +336,7 @@ void SVGImageFrame::PaintSVG(gfxContext& aContext, const gfxMatrix& aTransform,
// optimize group opacity, the opacity used for compositing the
// image into the current canvas is just the group opacity.
float opacity = 1.0f;
if (nsSVGUtils::CanOptimizeOpacity(this)) {
if (SVGUtils::CanOptimizeOpacity(this)) {
opacity = StyleEffects()->mOpacity;
}
@ -435,7 +435,7 @@ bool SVGImageFrame::CreateWebRenderCommands(
}
float opacity = 1.0f;
if (nsSVGUtils::CanOptimizeOpacity(this)) {
if (SVGUtils::CanOptimizeOpacity(this)) {
opacity = StyleEffects()->mOpacity;
}
@ -496,7 +496,7 @@ bool SVGImageFrame::CreateWebRenderCommands(
if (StyleDisplay()->IsScrollableOverflow()) {
// Apply potential non-trivial clip
auto cssClip = nsSVGUtils::GetClipRectForFrame(this, 0, 0, width, height);
auto cssClip = SVGUtils::GetClipRectForFrame(this, 0, 0, width, height);
auto appClip =
nsLayoutUtils::RoundGfxRectToAppRect(cssClip, appUnitsPerCSSPixel);
appClip += toReferenceFrame;
@ -683,8 +683,8 @@ nsIFrame* SVGImageFrame::GetFrameForPoint(const gfxPoint& aPoint) {
Matrix viewBoxTM = SVGContentUtils::GetViewBoxTransform(
rect.width, rect.height, 0, 0, nativeWidth, nativeHeight,
element->mPreserveAspectRatio);
if (!nsSVGUtils::HitTestRect(viewBoxTM, 0, 0, nativeWidth, nativeHeight,
aPoint.x - rect.x, aPoint.y - rect.y)) {
if (!SVGUtils::HitTestRect(viewBoxTM, 0, 0, nativeWidth, nativeHeight,
aPoint.x - rect.x, aPoint.y - rect.y)) {
return nullptr;
}
}
@ -700,13 +700,13 @@ nsIFrame* SVGImageFrame::GetFrameForPoint(const gfxPoint& aPoint) {
// properly
void SVGImageFrame::ReflowSVG() {
NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this),
NS_ASSERTION(SVGUtils::OuterSVGIsCallingReflowSVG(this),
"This call is probably a wasteful mistake");
MOZ_ASSERT(!HasAnyStateBits(NS_FRAME_IS_NONDISPLAY),
"ReflowSVG mechanism not designed for this");
if (!nsSVGUtils::NeedsReflowSVG(this)) {
if (!SVGUtils::NeedsReflowSVG(this)) {
return;
}
@ -823,12 +823,12 @@ void SVGImageListener::Notify(imgIRequest* aRequest, int32_t aType,
nsLayoutUtils::PostRestyleEvent(mFrame->GetContent()->AsElement(),
RestyleHint{0},
nsChangeHint_InvalidateRenderingObservers);
nsSVGUtils::ScheduleReflowSVG(mFrame);
SVGUtils::ScheduleReflowSVG(mFrame);
}
if (aType == imgINotificationObserver::FRAME_UPDATE) {
// No new dimensions, so we don't need to call
// nsSVGUtils::InvalidateAndScheduleBoundsUpdate.
// SVGUtils::InvalidateAndScheduleBoundsUpdate.
nsLayoutUtils::PostRestyleEvent(mFrame->GetContent()->AsElement(),
RestyleHint{0},
nsChangeHint_InvalidateRenderingObservers);
@ -849,7 +849,7 @@ void SVGImageListener::Notify(imgIRequest* aRequest, int32_t aType,
nsLayoutUtils::PostRestyleEvent(mFrame->GetContent()->AsElement(),
RestyleHint{0},
nsChangeHint_InvalidateRenderingObservers);
nsSVGUtils::ScheduleReflowSVG(mFrame);
SVGUtils::ScheduleReflowSVG(mFrame);
}
}

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

@ -15,11 +15,7 @@
#include "nsContainerFrame.h"
#include "nsLayoutUtils.h"
#include "imgINotificationObserver.h"
#include "SVGObserverUtils.h"
#include "nsSVGUtils.h"
#include "SVGContentUtils.h"
#include "SVGGeometryFrame.h"
#include "SVGImageContext.h"
#include "mozilla/SVGGeometryFrame.h"
#include "mozilla/dom/SVGImageElement.h"
#include "nsIReflowCallback.h"
#include "mozilla/Unused.h"

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

@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Main header first:
#include "nsSVGIntegrationUtils.h"
#include "SVGIntegrationUtils.h"
// Keep others in (case-insensitive) order:
#include "gfxDrawable.h"
@ -17,7 +17,6 @@
#include "gfxContext.h"
#include "SVGFilterPaintCallback.h"
#include "SVGPaintServerFrame.h"
#include "nsSVGUtils.h"
#include "FrameLayerBuilder.h"
#include "BasicLayers.h"
#include "mozilla/gfx/Point.h"
@ -28,16 +27,16 @@
#include "mozilla/SVGClipPathFrame.h"
#include "mozilla/SVGObserverUtils.h"
#include "mozilla/SVGMaskFrame.h"
#include "mozilla/SVGUtils.h"
#include "mozilla/Unused.h"
#include "mozilla/dom/SVGElement.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::layers;
using namespace mozilla::gfx;
using namespace mozilla::image;
// ----------------------------------------------------------------------
namespace mozilla {
/**
* This class is used to get the pre-effects visual overflow rect of a frame,
@ -95,7 +94,7 @@ class PreEffectsVisualOverflowCollector : public nsLayoutUtils::BoxCallback {
// This function may be called during reflow or painting. We should only
// do this check in painting process since the PreEffectsBBoxProperty of
// continuations are not set correctly while reflowing.
if (nsSVGIntegrationUtils::UsingOverflowAffectingEffects(aFrame) &&
if (SVGIntegrationUtils::UsingOverflowAffectingEffects(aFrame) &&
!aInReflow) {
nsOverflowAreas* preTransformOverflows =
aFrame->GetProperty(nsIFrame::PreTransformOverflowAreasProperty());
@ -149,14 +148,14 @@ static nsRect GetPreEffectsVisualOverflow(
return collector.GetResult() + aFirstContinuationToUserSpace;
}
bool nsSVGIntegrationUtils::UsingOverflowAffectingEffects(
bool SVGIntegrationUtils::UsingOverflowAffectingEffects(
const nsIFrame* aFrame) {
// Currently overflow don't take account of SVG or other non-absolute
// positioned clipping, or masking.
return aFrame->StyleEffects()->HasFilters();
}
bool nsSVGIntegrationUtils::UsingEffectsForFrame(const nsIFrame* aFrame) {
bool SVGIntegrationUtils::UsingEffectsForFrame(const nsIFrame* aFrame) {
// Even when SVG display lists are disabled, returning true for SVG frames
// does not adversely affect any of our callers. Therefore we don't bother
// checking the SDL prefs here, since we don't know if we're being called for
@ -169,14 +168,12 @@ bool nsSVGIntegrationUtils::UsingEffectsForFrame(const nsIFrame* aFrame) {
style->HasClipPath() || style->HasMask();
}
bool nsSVGIntegrationUtils::UsingMaskOrClipPathForFrame(
const nsIFrame* aFrame) {
bool SVGIntegrationUtils::UsingMaskOrClipPathForFrame(const nsIFrame* aFrame) {
const nsStyleSVGReset* style = aFrame->StyleSVGReset();
return style->HasClipPath() || style->HasMask();
}
bool nsSVGIntegrationUtils::UsingSimpleClipPathForFrame(
const nsIFrame* aFrame) {
bool SVGIntegrationUtils::UsingSimpleClipPathForFrame(const nsIFrame* aFrame) {
const nsStyleSVGReset* style = aFrame->StyleSVGReset();
if (!style->HasClipPath() || style->HasMask()) {
return false;
@ -190,7 +187,7 @@ bool nsSVGIntegrationUtils::UsingSimpleClipPathForFrame(
return !clipPath.AsShape()._0->IsPolygon();
}
nsPoint nsSVGIntegrationUtils::GetOffsetToBoundingBox(nsIFrame* aFrame) {
nsPoint SVGIntegrationUtils::GetOffsetToBoundingBox(nsIFrame* aFrame) {
if (aFrame->HasAnyStateBits(NS_FRAME_SVG_LAYOUT)) {
// Do NOT call GetAllInFlowRectsUnion for SVG - it will get the
// covered region relative to the SVGOuterSVGFrame, which is absolutely
@ -206,7 +203,7 @@ nsPoint nsSVGIntegrationUtils::GetOffsetToBoundingBox(nsIFrame* aFrame) {
}
/* static */
nsSize nsSVGIntegrationUtils::GetContinuationUnionSize(nsIFrame* aNonSVGFrame) {
nsSize SVGIntegrationUtils::GetContinuationUnionSize(nsIFrame* aNonSVGFrame) {
NS_ASSERTION(!aNonSVGFrame->IsFrameOfType(nsIFrame::eSVG),
"SVG frames should not get here");
nsIFrame* firstFrame =
@ -214,7 +211,7 @@ nsSize nsSVGIntegrationUtils::GetContinuationUnionSize(nsIFrame* aNonSVGFrame) {
return nsLayoutUtils::GetAllInFlowRectsUnion(firstFrame, firstFrame).Size();
}
/* static */ gfx::Size nsSVGIntegrationUtils::GetSVGCoordContextForNonSVGFrame(
/* static */ gfx::Size SVGIntegrationUtils::GetSVGCoordContextForNonSVGFrame(
nsIFrame* aNonSVGFrame) {
NS_ASSERTION(!aNonSVGFrame->IsFrameOfType(nsIFrame::eSVG),
"SVG frames should not get here");
@ -225,7 +222,7 @@ nsSize nsSVGIntegrationUtils::GetContinuationUnionSize(nsIFrame* aNonSVGFrame) {
nsPresContext::AppUnitsToFloatCSSPixels(r.height));
}
gfxRect nsSVGIntegrationUtils::GetSVGBBoxForNonSVGFrame(
gfxRect SVGIntegrationUtils::GetSVGBBoxForNonSVGFrame(
nsIFrame* aNonSVGFrame, bool aUnionContinuations) {
// Except for SVGOuterSVGFrame, we shouldn't be getting here with SVG
// frames at all. This function is for elements that are laid out using the
@ -281,7 +278,7 @@ gfxRect nsSVGIntegrationUtils::GetSVGBBoxForNonSVGFrame(
// pre-effects overflow rect will actually overestimate that area which, while
// being a bit wasteful, isn't otherwise a problem.
//
nsRect nsSVGIntegrationUtils::ComputePostEffectsVisualOverflowRect(
nsRect SVGIntegrationUtils::ComputePostEffectsVisualOverflowRect(
nsIFrame* aFrame, const nsRect& aPreEffectsOverflowRect) {
MOZ_ASSERT(!aFrame->HasAnyStateBits(NS_FRAME_SVG_LAYOUT),
"Don't call this on SVG child frames");
@ -324,7 +321,7 @@ nsRect nsSVGIntegrationUtils::ComputePostEffectsVisualOverflowRect(
(aFrame->GetOffsetTo(firstFrame) + firstFrameToBoundingBox);
}
nsIntRegion nsSVGIntegrationUtils::AdjustInvalidAreaForSVGEffects(
nsIntRegion SVGIntegrationUtils::AdjustInvalidAreaForSVGEffects(
nsIFrame* aFrame, const nsPoint& aToReferenceFrame,
const nsIntRegion& aInvalidRegion) {
if (aInvalidRegion.IsEmpty()) {
@ -364,7 +361,7 @@ nsIntRegion nsSVGIntegrationUtils::AdjustInvalidAreaForSVGEffects(
return result.ToOutsidePixels(appUnitsPerDevPixel);
}
nsRect nsSVGIntegrationUtils::GetRequiredSourceForInvalidArea(
nsRect SVGIntegrationUtils::GetRequiredSourceForInvalidArea(
nsIFrame* aFrame, const nsRect& aDirtyRect) {
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(aFrame);
@ -390,8 +387,8 @@ nsRect nsSVGIntegrationUtils::GetRequiredSourceForInvalidArea(
toUserSpace;
}
bool nsSVGIntegrationUtils::HitTestFrameForEffects(nsIFrame* aFrame,
const nsPoint& aPt) {
bool SVGIntegrationUtils::HitTestFrameForEffects(nsIFrame* aFrame,
const nsPoint& aPt) {
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(aFrame);
// Convert aPt to user space:
@ -405,7 +402,7 @@ bool nsSVGIntegrationUtils::HitTestFrameForEffects(nsIFrame* aFrame,
}
nsPoint pt = aPt + toUserSpace;
gfxPoint userSpacePt = gfxPoint(pt.x, pt.y) / AppUnitsPerCSSPixel();
return nsSVGUtils::HitTestClip(firstFrame, userSpacePt);
return SVGUtils::HitTestClip(firstFrame, userSpacePt);
}
class RegularFramePaintCallback : public SVGFilterPaintCallback {
@ -439,7 +436,7 @@ class RegularFramePaintCallback : public SVGFilterPaintCallback {
gfxPoint mUserSpaceToFrameSpaceOffset;
};
typedef nsSVGIntegrationUtils::PaintFramesParams PaintFramesParams;
typedef SVGIntegrationUtils::PaintFramesParams PaintFramesParams;
/**
* Paint css-positioned-mask onto a given target(aMaskDT).
@ -456,8 +453,7 @@ static bool PaintMaskSurface(const PaintFramesParams& aParams,
MOZ_ASSERT(aOpacity == 1.0 || aMaskFrames.Length() == 1);
const nsStyleSVGReset* svgReset = aSC->StyleSVGReset();
gfxMatrix cssPxToDevPxMatrix =
nsSVGUtils::GetCSSPxToDevPxMatrix(aParams.frame);
gfxMatrix cssPxToDevPxMatrix = SVGUtils::GetCSSPxToDevPxMatrix(aParams.frame);
nsPresContext* presContext = aParams.frame->PresContext();
gfxPoint devPixelOffsetToUserSpace = nsLayoutUtils::PointToGfxPoint(
@ -538,7 +534,7 @@ static MaskPaintResult CreateAndPaintMaskSurface(
// Optimization for single SVG mask.
if (((aMaskFrames.Length() == 1) && aMaskFrames[0])) {
gfxMatrix cssPxToDevPxMatrix =
nsSVGUtils::GetCSSPxToDevPxMatrix(aParams.frame);
SVGUtils::GetCSSPxToDevPxMatrix(aParams.frame);
paintResult.opacityApplied = true;
SVGMaskFrame::MaskParams params(
&ctx, aParams.frame, cssPxToDevPxMatrix, aOpacity,
@ -619,7 +615,7 @@ static bool ValidateSVGFrame(nsIFrame* aFrame) {
NS_ASSERTION(!aFrame->HasAnyStateBits(NS_FRAME_SVG_LAYOUT) ||
(NS_SVGDisplayListPaintingEnabled() &&
!aFrame->HasAnyStateBits(NS_FRAME_IS_NONDISPLAY)),
"Should not use nsSVGIntegrationUtils on this SVG frame");
"Should not use SVGIntegrationUtils on this SVG frame");
#endif
bool hasSVGLayout = aFrame->HasAnyStateBits(NS_FRAME_SVG_LAYOUT);
@ -658,7 +654,7 @@ static EffectOffsets ComputeEffectOffset(nsIFrame* aFrame,
result.offsetToBoundingBox =
aParams.builder->ToReferenceFrame(aFrame) -
nsSVGIntegrationUtils::GetOffsetToBoundingBox(aFrame);
SVGIntegrationUtils::GetOffsetToBoundingBox(aFrame);
if (!aFrame->IsFrameOfType(nsIFrame::eSVG)) {
/* Snap the offset if the reference frame is not a SVG frame,
* since other frames will be snapped to pixel when rendering. */
@ -681,7 +677,7 @@ static EffectOffsets ComputeEffectOffset(nsIFrame* aFrame,
// frame's position so that SVG painting can later add it again and the
// frame is painted in the right place.
gfxPoint toUserSpaceGfx =
nsSVGUtils::FrameSpaceInCSSPxToUserSpaceOffset(aFrame);
SVGUtils::FrameSpaceInCSSPxToUserSpaceOffset(aFrame);
nsPoint toUserSpace =
nsPoint(nsPresContext::CSSPixelsToAppUnits(float(toUserSpaceGfx.x)),
nsPresContext::CSSPixelsToAppUnits(float(toUserSpaceGfx.y)));
@ -715,7 +711,7 @@ static EffectOffsets MoveContextOriginToUserSpace(
return offset;
}
bool nsSVGIntegrationUtils::IsMaskResourceReady(nsIFrame* aFrame) {
bool SVGIntegrationUtils::IsMaskResourceReady(nsIFrame* aFrame) {
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(aFrame);
nsTArray<SVGMaskFrame*> maskFrames;
@ -756,13 +752,12 @@ class AutoPopGroup {
gfxContext* mContext;
};
bool nsSVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams,
bool& aOutIsMaskComplete) {
bool SVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams,
bool& aOutIsMaskComplete) {
aOutIsMaskComplete = true;
nsSVGUtils::MaskUsage maskUsage;
nsSVGUtils::DetermineMaskUsage(aParams.frame, aParams.handleOpacity,
maskUsage);
SVGUtils::MaskUsage maskUsage;
SVGUtils::DetermineMaskUsage(aParams.frame, aParams.handleOpacity, maskUsage);
if (!maskUsage.shouldDoSomething()) {
return false;
}
@ -817,7 +812,7 @@ bool nsSVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams,
basicShapeSR.SetContext(&ctx);
CSSClipPathInstance::ApplyBasicShapeOrPathClip(
ctx, frame, nsSVGUtils::GetCSSPxToDevPxMatrix(frame));
ctx, frame, SVGUtils::GetCSSPxToDevPxMatrix(frame));
if (!maskUsage.shouldGenerateMaskLayer) {
// Only have basic-shape clip-path effect. Fill clipped region by
// opaque white.
@ -847,7 +842,7 @@ bool nsSVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams,
MoveContextOriginToUserSpace(firstFrame, aParams);
Matrix clipMaskTransform;
gfxMatrix cssPxToDevPxMatrix = nsSVGUtils::GetCSSPxToDevPxMatrix(frame);
gfxMatrix cssPxToDevPxMatrix = SVGUtils::GetCSSPxToDevPxMatrix(frame);
SVGClipPathFrame* clipPathFrame;
// XXX check return value?
@ -864,7 +859,7 @@ bool nsSVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams,
template <class T>
void PaintMaskAndClipPathInternal(const PaintFramesParams& aParams,
const T& aPaintChild) {
MOZ_ASSERT(nsSVGIntegrationUtils::UsingMaskOrClipPathForFrame(aParams.frame),
MOZ_ASSERT(SVGIntegrationUtils::UsingMaskOrClipPathForFrame(aParams.frame),
"Should not use this method when no mask or clipPath effect"
"on this frame");
@ -886,9 +881,8 @@ void PaintMaskAndClipPathInternal(const PaintFramesParams& aParams,
return;
}
nsSVGUtils::MaskUsage maskUsage;
nsSVGUtils::DetermineMaskUsage(aParams.frame, aParams.handleOpacity,
maskUsage);
SVGUtils::MaskUsage maskUsage;
SVGUtils::DetermineMaskUsage(aParams.frame, aParams.handleOpacity, maskUsage);
if (maskUsage.opacity == 0.0f) {
return;
@ -908,7 +902,7 @@ void PaintMaskAndClipPathInternal(const PaintFramesParams& aParams,
// XXX check return value?
SVGObserverUtils::GetAndObserveMasks(firstFrame, &maskFrames);
gfxMatrix cssPxToDevPxMatrix = nsSVGUtils::GetCSSPxToDevPxMatrix(frame);
gfxMatrix cssPxToDevPxMatrix = SVGUtils::GetCSSPxToDevPxMatrix(frame);
bool shouldGenerateMask =
(maskUsage.opacity != 1.0f || maskUsage.shouldGenerateClipMaskLayer ||
@ -1055,7 +1049,7 @@ void PaintMaskAndClipPathInternal(const PaintFramesParams& aParams,
}
}
void nsSVGIntegrationUtils::PaintMaskAndClipPath(
void SVGIntegrationUtils::PaintMaskAndClipPath(
const PaintFramesParams& aParams) {
PaintMaskAndClipPathInternal(aParams, [&] {
gfxContext& context = aParams.ctx;
@ -1068,13 +1062,13 @@ void nsSVGIntegrationUtils::PaintMaskAndClipPath(
});
}
void nsSVGIntegrationUtils::PaintMaskAndClipPath(
void SVGIntegrationUtils::PaintMaskAndClipPath(
const PaintFramesParams& aParams,
const std::function<void()>& aPaintChild) {
PaintMaskAndClipPathInternal(aParams, aPaintChild);
}
void nsSVGIntegrationUtils::PaintFilter(const PaintFramesParams& aParams) {
void SVGIntegrationUtils::PaintFilter(const PaintFramesParams& aParams) {
MOZ_ASSERT(!aParams.builder->IsForGenerateGlyphMask(),
"Filter effect is discarded while generating glyph mask.");
MOZ_ASSERT(aParams.frame->StyleEffects()->HasFilters(),
@ -1085,7 +1079,7 @@ void nsSVGIntegrationUtils::PaintFilter(const PaintFramesParams& aParams) {
return;
}
float opacity = nsSVGUtils::ComputeOpacity(frame, aParams.handleOpacity);
float opacity = SVGUtils::ComputeOpacity(frame, aParams.handleOpacity);
if (opacity == 0.0f) {
return;
}
@ -1121,7 +1115,7 @@ void nsSVGIntegrationUtils::PaintFilter(const PaintFramesParams& aParams) {
aParams.imgParams, opacity);
}
bool nsSVGIntegrationUtils::CreateWebRenderCSSFilters(
bool SVGIntegrationUtils::CreateWebRenderCSSFilters(
Span<const StyleFilter> aFilters, nsIFrame* aFrame,
WrFiltersHolder& aWrFilters) {
// All CSS filters are supported by WebRender. SVG filters are not fully
@ -1171,9 +1165,8 @@ bool nsSVGIntegrationUtils::CreateWebRenderCSSFilters(
// TODO(emilio): we should go directly from css pixels -> device pixels.
float appUnitsPerDevPixel =
aFrame->PresContext()->AppUnitsPerDevPixel();
wrFilters.AppendElement(
mozilla::wr::FilterOp::Blur(NSAppUnitsToFloatPixels(
filter.AsBlur().ToAppUnits(), appUnitsPerDevPixel)));
wrFilters.AppendElement(wr::FilterOp::Blur(NSAppUnitsToFloatPixels(
filter.AsBlur().ToAppUnits(), appUnitsPerDevPixel)));
break;
}
case StyleFilter::Tag::DropShadow: {
@ -1203,15 +1196,14 @@ bool nsSVGIntegrationUtils::CreateWebRenderCSSFilters(
return true;
}
bool nsSVGIntegrationUtils::BuildWebRenderFilters(
bool SVGIntegrationUtils::BuildWebRenderFilters(
nsIFrame* aFilteredFrame, Span<const StyleFilter> aFilters,
WrFiltersHolder& aWrFilters, Maybe<nsRect>& aPostFilterClip) {
return FilterInstance::BuildWebRenderFilters(aFilteredFrame, aFilters,
aWrFilters, aPostFilterClip);
}
bool nsSVGIntegrationUtils::CanCreateWebRenderFiltersForFrame(
nsIFrame* aFrame) {
bool SVGIntegrationUtils::CanCreateWebRenderFiltersForFrame(nsIFrame* aFrame) {
WrFiltersHolder wrFilters;
Maybe<nsRect> filterClip;
auto filterChain = aFrame->StyleEffects()->mFilters.AsSpan();
@ -1219,15 +1211,15 @@ bool nsSVGIntegrationUtils::CanCreateWebRenderFiltersForFrame(
BuildWebRenderFilters(aFrame, filterChain, wrFilters, filterClip);
}
bool nsSVGIntegrationUtils::UsesSVGEffectsNotSupportedInCompositor(
bool SVGIntegrationUtils::UsesSVGEffectsNotSupportedInCompositor(
nsIFrame* aFrame) {
// WebRender supports masks / clip-paths and some filters in the compositor.
// Non-WebRender doesn't support any SVG effects in the compositor.
if (aFrame->StyleEffects()->HasFilters()) {
return !gfx::gfxVars::UseWebRender() ||
!nsSVGIntegrationUtils::CanCreateWebRenderFiltersForFrame(aFrame);
!SVGIntegrationUtils::CanCreateWebRenderFiltersForFrame(aFrame);
}
if (nsSVGIntegrationUtils::UsingMaskOrClipPathForFrame(aFrame)) {
if (SVGIntegrationUtils::UsingMaskOrClipPathForFrame(aFrame)) {
return !gfx::gfxVars::UseWebRender();
}
return false;
@ -1279,7 +1271,7 @@ bool PaintFrameCallback::operator()(gfxContext* aContext,
// to have it anchored at the top left corner of the bounding box of all of
// mFrame's continuations. So we add a translation transform.
int32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
nsPoint offset = nsSVGIntegrationUtils::GetOffsetToBoundingBox(mFrame);
nsPoint offset = SVGIntegrationUtils::GetOffsetToBoundingBox(mFrame);
gfxPoint devPxOffset = gfxPoint(offset.x, offset.y) / appUnitsPerDevPixel;
aContext->Multiply(gfxMatrix::Translation(devPxOffset));
@ -1299,7 +1291,7 @@ bool PaintFrameCallback::operator()(gfxContext* aContext,
using PaintFrameFlags = nsLayoutUtils::PaintFrameFlags;
PaintFrameFlags flags = PaintFrameFlags::InTransform;
if (mFlags & nsSVGIntegrationUtils::FLAG_SYNC_DECODE_IMAGES) {
if (mFlags & SVGIntegrationUtils::FLAG_SYNC_DECODE_IMAGES) {
flags |= PaintFrameFlags::SyncDecodeImages;
}
nsLayoutUtils::PaintFrame(aContext, mFrame, dirty, NS_RGBA(0, 0, 0, 0),
@ -1328,7 +1320,7 @@ bool PaintFrameCallback::operator()(gfxContext* aContext,
}
/* static */
already_AddRefed<gfxDrawable> nsSVGIntegrationUtils::DrawableFromPaintServer(
already_AddRefed<gfxDrawable> SVGIntegrationUtils::DrawableFromPaintServer(
nsIFrame* aFrame, nsIFrame* aTarget, const nsSize& aPaintServerSize,
const IntSize& aRenderSize, const DrawTarget* aDrawTarget,
const gfxMatrix& aContextMatrix, uint32_t aFlags) {
@ -1384,3 +1376,5 @@ already_AddRefed<gfxDrawable> nsSVGIntegrationUtils::DrawableFromPaintServer(
RefPtr<gfxDrawable> drawable = new gfxCallbackDrawable(cb, aRenderSize);
return drawable.forget();
}
} // namespace mozilla

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

@ -20,19 +20,8 @@ class gfxDrawable;
class nsDisplayList;
class nsDisplayListBuilder;
class nsIFrame;
struct nsRect;
namespace mozilla {
namespace gfx {
class DrawTarget;
} // namespace gfx
namespace layers {
class LayerManager;
} // namespace layers
} // namespace mozilla
struct nsPoint;
struct nsRect;
struct nsSize;
struct WrFiltersHolder {
@ -43,14 +32,24 @@ struct WrFiltersHolder {
nsTArray<nsTArray<float>> values;
};
namespace mozilla {
namespace gfx {
class DrawTarget;
} // namespace gfx
namespace layers {
class LayerManager;
} // namespace layers
/**
* Integration of SVG effects (clipPath clipping, masking and filters) into
* regular display list based painting and hit-testing.
*/
class nsSVGIntegrationUtils final {
typedef mozilla::gfx::DrawTarget DrawTarget;
typedef mozilla::gfx::IntRect IntRect;
typedef mozilla::image::imgDrawingParams imgDrawingParams;
class SVGIntegrationUtils final {
typedef gfx::DrawTarget DrawTarget;
typedef gfx::IntRect IntRect;
typedef image::imgDrawingParams imgDrawingParams;
public:
/**
@ -89,8 +88,7 @@ class nsSVGIntegrationUtils final {
* frame's continuations' border boxes, converted to SVG user units (equal to
* CSS px units), as required by the SVG code.
*/
static mozilla::gfx::Size GetSVGCoordContextForNonSVGFrame(
nsIFrame* aNonSVGFrame);
static gfx::Size GetSVGCoordContextForNonSVGFrame(nsIFrame* aNonSVGFrame);
/**
* SVG effects such as SVG filters, masking and clipPath may require an SVG
@ -156,17 +154,17 @@ class nsSVGIntegrationUtils final {
const nsRect& dirtyRect;
const nsRect& borderArea;
nsDisplayListBuilder* builder;
mozilla::layers::LayerManager* layerManager;
layers::LayerManager* layerManager;
bool handleOpacity; // If true, PaintMaskAndClipPath/ PaintFilter should
// apply css opacity.
mozilla::Maybe<mozilla::gfx::Rect> maskRect;
Maybe<gfx::Rect> maskRect;
imgDrawingParams& imgParams;
explicit PaintFramesParams(gfxContext& aCtx, nsIFrame* aFrame,
const nsRect& aDirtyRect,
const nsRect& aBorderArea,
nsDisplayListBuilder* aBuilder,
mozilla::layers::LayerManager* aLayerManager,
layers::LayerManager* aLayerManager,
bool aHandleOpacity,
imgDrawingParams& aImgParams)
: ctx(aCtx),
@ -213,18 +211,18 @@ class nsSVGIntegrationUtils final {
/**
* Build WebRender filters for a frame with CSS filters applied to it.
*/
static bool CreateWebRenderCSSFilters(
mozilla::Span<const mozilla::StyleFilter> aFilters, nsIFrame* aFrame,
WrFiltersHolder& aWrFilters);
static bool CreateWebRenderCSSFilters(Span<const StyleFilter> aFilters,
nsIFrame* aFrame,
WrFiltersHolder& aWrFilters);
/**
* Try to build WebRender filters for a frame with SVG filters applied to it
* if the filters are supported.
*/
static bool BuildWebRenderFilters(
nsIFrame* aFilteredFrame,
mozilla::Span<const mozilla::StyleFilter> aFilters,
WrFiltersHolder& aWrFilters, mozilla::Maybe<nsRect>& aPostFilterClip);
static bool BuildWebRenderFilters(nsIFrame* aFilteredFrame,
Span<const StyleFilter> aFilters,
WrFiltersHolder& aWrFilters,
Maybe<nsRect>& aPostFilterClip);
/**
* Check if the filters present on |aFrame| are supported by WebRender.
@ -262,7 +260,7 @@ class nsSVGIntegrationUtils final {
static already_AddRefed<gfxDrawable> DrawableFromPaintServer(
nsIFrame* aFrame, nsIFrame* aTarget, const nsSize& aPaintServerSize,
const mozilla::gfx::IntSize& aRenderSize, const DrawTarget* aDrawTarget,
const gfx::IntSize& aRenderSize, const DrawTarget* aDrawTarget,
const gfxMatrix& aContextMatrix, uint32_t aFlags);
/**
@ -272,4 +270,6 @@ class nsSVGIntegrationUtils final {
static nsPoint GetOffsetToBoundingBox(nsIFrame* aFrame);
};
} // namespace mozilla
#endif /*NSSVGINTEGRATIONUTILS_H_*/

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

@ -10,10 +10,11 @@
// Keep others in (case-insensitive) order:
#include "gfxContext.h"
#include "mozilla/PresShell.h"
#include "mozilla/SVGGeometryFrame.h"
#include "mozilla/SVGObserverUtils.h"
#include "mozilla/SVGUtils.h"
#include "mozilla/dom/SVGGeometryElement.h"
#include "mozilla/dom/SVGMarkerElement.h"
#include "SVGGeometryElement.h"
#include "SVGGeometryFrame.h"
#include "SVGObserverUtils.h"
using namespace mozilla::dom;
using namespace mozilla::gfx;
@ -123,16 +124,16 @@ void SVGMarkerFrame::PaintMark(gfxContext& aContext,
if (StyleDisplay()->IsScrollableOverflow()) {
aContext.Save();
gfxRect clipRect = nsSVGUtils::GetClipRectForFrame(
gfxRect clipRect = SVGUtils::GetClipRectForFrame(
this, viewBox.x, viewBox.y, viewBox.width, viewBox.height);
nsSVGUtils::SetClipRect(&aContext, markTM, clipRect);
SVGUtils::SetClipRect(&aContext, markTM, clipRect);
}
nsIFrame* kid = GetAnonymousChildFrame(this);
ISVGDisplayableFrame* SVGFrame = do_QueryFrame(kid);
// The CTM of each frame referencing us may be different.
SVGFrame->NotifySVGChanged(ISVGDisplayableFrame::TRANSFORM_CHANGED);
nsSVGUtils::PaintFrameWithEffects(kid, aContext, markTM, aImgParams);
SVGUtils::PaintFrameWithEffects(kid, aContext, markTM, aImgParams);
if (StyleDisplay()->IsScrollableOverflow()) aContext.Restore();
}

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

@ -14,7 +14,6 @@
#include "nsIFrame.h"
#include "nsLiteralString.h"
#include "nsQueryFrame.h"
#include "nsSVGUtils.h"
class gfxContext;

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

@ -13,10 +13,11 @@
#include "gfxContext.h"
#include "mozilla/PresShell.h"
#include "mozilla/RefPtr.h"
#include "mozilla/SVGObserverUtils.h"
#include "mozilla/SVGUtils.h"
#include "mozilla/dom/SVGMaskElement.h"
#include "mozilla/dom/SVGUnitTypesBinding.h"
#include "mozilla/gfx/2D.h"
#include "SVGObserverUtils.h"
using namespace mozilla::dom;
using namespace mozilla::dom::SVGUnitTypes_Binding;
@ -92,10 +93,10 @@ already_AddRefed<SourceSurface> SVGMaskFrame::GetMaskForMaskedFrame(
ISVGDisplayableFrame* SVGFrame = do_QueryFrame(kid);
if (SVGFrame) {
SVGFrame->NotifySVGChanged(ISVGDisplayableFrame::TRANSFORM_CHANGED);
m = nsSVGUtils::GetTransformMatrixInUserSpace(kid) * m;
m = SVGUtils::GetTransformMatrixInUserSpace(kid) * m;
}
nsSVGUtils::PaintFrameWithEffects(kid, *tmpCtx, m, aParams.imgParams);
SVGUtils::PaintFrameWithEffects(kid, *tmpCtx, m, aParams.imgParams);
}
RefPtr<SourceSurface> surface;
@ -132,13 +133,13 @@ gfxRect SVGMaskFrame::GetMaskArea(nsIFrame* aMaskedFrame) {
maskElem->mEnumAttributes[SVGMaskElement::MASKUNITS].GetAnimValue();
gfxRect bbox;
if (units == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
bbox = nsSVGUtils::GetBBox(aMaskedFrame,
nsSVGUtils::eUseFrameBoundsForOuterSVG |
nsSVGUtils::eBBoxIncludeFillGeometry);
bbox =
SVGUtils::GetBBox(aMaskedFrame, SVGUtils::eUseFrameBoundsForOuterSVG |
SVGUtils::eBBoxIncludeFillGeometry);
}
// Bounds in the user space of aMaskedFrame
gfxRect maskArea = nsSVGUtils::GetRelativeRect(
gfxRect maskArea = SVGUtils::GetRelativeRect(
units, &maskElem->mLengthAttributes[SVGMaskElement::ATTR_X], bbox,
aMaskedFrame);
@ -177,14 +178,14 @@ gfxMatrix SVGMaskFrame::GetMaskTransform(nsIFrame* aMaskedFrame) {
SVGAnimatedEnumeration* maskContentUnits =
&content->mEnumAttributes[SVGMaskElement::MASKCONTENTUNITS];
uint32_t flags = nsSVGUtils::eBBoxIncludeFillGeometry |
uint32_t flags = SVGUtils::eBBoxIncludeFillGeometry |
(aMaskedFrame->StyleBorder()->mBoxDecorationBreak ==
StyleBoxDecorationBreak::Clone
? nsSVGUtils::eIncludeOnlyCurrentFrameForNonSVGElement
? SVGUtils::eIncludeOnlyCurrentFrameForNonSVGElement
: 0);
return nsSVGUtils::AdjustMatrixForUnits(gfxMatrix(), maskContentUnits,
aMaskedFrame, flags);
return SVGUtils::AdjustMatrixForUnits(gfxMatrix(), maskContentUnits,
aMaskedFrame, flags);
}
} // namespace mozilla

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

@ -13,7 +13,6 @@
#include "mozilla/gfx/2D.h"
#include "gfxPattern.h"
#include "gfxMatrix.h"
#include "nsSVGUtils.h"
class gfxContext;

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

@ -18,6 +18,7 @@
#include "mozilla/SVGClipPathFrame.h"
#include "mozilla/SVGMaskFrame.h"
#include "mozilla/SVGTextFrame.h"
#include "mozilla/SVGUtils.h"
#include "nsCSSFrameConstructor.h"
#include "nsCycleCollectionParticipant.h"
#include "nsHashKeys.h"
@ -32,9 +33,10 @@
#include "SVGMarkerFrame.h"
#include "SVGPaintServerFrame.h"
using namespace mozilla;
using namespace mozilla::dom;
namespace mozilla {
bool URLAndReferrerInfo::operator==(const URLAndReferrerInfo& aRHS) const {
bool uriEqual = false, referrerEqual = false;
this->mURI->Equals(aRHS.mURI, &uriEqual);
@ -148,8 +150,6 @@ static already_AddRefed<URLAndReferrerInfo> ResolveURLUsingLocalRef(
return info.forget();
}
namespace mozilla {
class SVGFilterObserverList;
/**
@ -475,7 +475,7 @@ void SVGTextPathObserver::OnRenderingChange() {
}
MOZ_ASSERT(frame->IsFrameOfType(nsIFrame::eSVG) ||
nsSVGUtils::IsInSVGTextSubtree(frame),
SVGUtils::IsInSVGTextSubtree(frame),
"SVG frame expected");
MOZ_ASSERT(frame->GetContent()->IsSVGElement(nsGkAtoms::textPath),
@ -520,7 +520,7 @@ void SVGMarkerObserver::OnRenderingChange() {
// XXXjwatt: We need to unify SVG into standard reflow so we can just use
// nsChangeHint_NeedReflow | nsChangeHint_NeedDirtyReflow here.
// XXXSDL KILL THIS!!!
nsSVGUtils::ScheduleReflowSVG(frame);
SVGUtils::ScheduleReflowSVG(frame);
}
frame->PresContext()->RestyleManager()->PostRestyleEvent(
frame->GetContent()->AsElement(), RestyleHint{0},
@ -1269,14 +1269,14 @@ SVGObserverUtils::ReferenceState SVGObserverUtils::GetAndObserveFilters(
nsIFrame* aFilteredFrame, nsTArray<SVGFilterFrame*>* aFilterFrames) {
SVGFilterObserverListForCSSProp* observerList =
GetOrCreateFilterObserverListForCSS(aFilteredFrame);
return ::GetAndObserveFilters(observerList, aFilterFrames);
return mozilla::GetAndObserveFilters(observerList, aFilterFrames);
}
SVGObserverUtils::ReferenceState SVGObserverUtils::GetFiltersIfObserving(
nsIFrame* aFilteredFrame, nsTArray<SVGFilterFrame*>* aFilterFrames) {
SVGFilterObserverListForCSSProp* observerList =
aFilteredFrame->GetProperty(FilterProperty());
return ::GetAndObserveFilters(observerList, aFilterFrames);
return mozilla::GetAndObserveFilters(observerList, aFilterFrames);
}
already_AddRefed<nsISupports> SVGObserverUtils::ObserveFiltersForCanvasContext(
@ -1644,7 +1644,7 @@ void SVGObserverUtils::InvalidateRenderingObservers(nsIFrame* aFrame) {
}
// If the rendering has changed, the bounds may well have changed too:
aFrame->RemoveProperty(nsSVGUtils::ObjectBoundingBoxProperty());
aFrame->RemoveProperty(SVGUtils::ObjectBoundingBoxProperty());
SVGRenderingObserverSet* observers = GetObserverSet(content->AsElement());
if (observers) {
@ -1670,7 +1670,7 @@ void SVGObserverUtils::InvalidateDirectRenderingObservers(
Element* aElement, uint32_t aFlags /* = 0 */) {
if (nsIFrame* frame = aElement->GetPrimaryFrame()) {
// If the rendering has changed, the bounds may well have changed too:
frame->RemoveProperty(nsSVGUtils::ObjectBoundingBoxProperty());
frame->RemoveProperty(SVGUtils::ObjectBoundingBoxProperty());
}
if (aElement->HasRenderingObservers()) {

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

@ -19,7 +19,6 @@
#include "nsIReferrerInfo.h"
#include "nsStringFwd.h"
#include "nsStubMutationObserver.h"
#include "nsSVGUtils.h"
#include "nsCycleCollectionParticipant.h"
class nsAtom;
@ -265,7 +264,7 @@ class SVGObserverUtils {
* to be applied, only that there are no references to SVG filter elements.
*
* XXX Callers other than ComputePostEffectsVisualOverflowRect and
* nsSVGUtils::GetPostFilterVisualOverflowRect should not need to initiate
* SVGUtils::GetPostFilterVisualOverflowRect should not need to initiate
* observing. If we have a bug that causes invalidation (which would remove
* observers) between reflow and painting, then we don't really want to
* re-add abservers during painting. That has the potential to hide logic

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

@ -13,9 +13,9 @@
#include "nsIInterfaceRequestorUtils.h"
#include "nsIObjectLoadingContent.h"
#include "nsSubDocumentFrame.h"
#include "nsSVGIntegrationUtils.h"
#include "mozilla/PresShell.h"
#include "mozilla/SVGForeignObjectFrame.h"
#include "mozilla/SVGUtils.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/SVGSVGElement.h"
@ -601,7 +601,7 @@ void nsDisplayOuterSVG::HitTest(nsDisplayListBuilder* aBuilder,
outerSVGFrame->PrincipalChildList().FirstChild());
nsIFrame* frame =
nsSVGUtils::HitTestChildren(anonKid, svgViewportRelativePoint);
SVGUtils::HitTestChildren(anonKid, svgViewportRelativePoint);
if (frame) {
aOutFrames->AppendElement(frame);
}
@ -637,10 +637,10 @@ void nsDisplayOuterSVG::Paint(nsDisplayListBuilder* aBuilder,
imgDrawingParams imgParams(aBuilder->GetImageDecodeFlags());
// We include the offset of our frame and a scale from device pixels to user
// units (i.e. CSS px) in the matrix that we pass to our children):
gfxMatrix tm = nsSVGUtils::GetCSSPxToDevPxMatrix(mFrame) *
gfxMatrix tm = SVGUtils::GetCSSPxToDevPxMatrix(mFrame) *
gfxMatrix::Translation(devPixelOffset);
nsSVGUtils::PaintFrameWithEffects(mFrame, *aContext, tm, imgParams,
&contentAreaDirtyRect);
SVGUtils::PaintFrameWithEffects(mFrame, *aContext, tm, imgParams,
&contentAreaDirtyRect);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, imgParams.result);
aContext->Restore();
@ -695,7 +695,7 @@ nsresult SVGOuterSVGFrame::AttributeChanged(int32_t aNameSpaceID,
// make sure our cached transform matrix gets (lazily) updated
mCanvasTM = nullptr;
nsSVGUtils::NotifyChildrenOfSVGChange(
SVGUtils::NotifyChildrenOfSVGChange(
PrincipalChildList().FirstChild(),
aAttribute == nsGkAtoms::viewBox
? TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED
@ -852,8 +852,8 @@ void SVGOuterSVGFrame::NotifyViewportOrTransformChanged(uint32_t aFlags) {
}
}
nsSVGUtils::NotifyChildrenOfSVGChange(PrincipalChildList().FirstChild(),
aFlags);
SVGUtils::NotifyChildrenOfSVGChange(PrincipalChildList().FirstChild(),
aFlags);
}
//----------------------------------------------------------------------

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше