Skip to content

Commit

Permalink
Bug 1401356, part 2 - Rename nsSVGEffects to SVGObserverUtils. r=long…
Browse files Browse the repository at this point in the history
…sonr
  • Loading branch information
jwatt committed Aug 30, 2017
1 parent 0e4feb7 commit 341ea5e
Show file tree
Hide file tree
Showing 37 changed files with 183 additions and 176 deletions.
2 changes: 1 addition & 1 deletion dom/base/nsImageLoadingContent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ nsImageLoadingContent::OnLoadComplete(imgIRequest* aRequest, nsresult aStatus)
}

nsCOMPtr<nsINode> thisNode = do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
nsSVGEffects::InvalidateDirectRenderingObservers(thisNode->AsElement());
SVGObserverUtils::InvalidateDirectRenderingObservers(thisNode->AsElement());

return NS_OK;
}
Expand Down
4 changes: 2 additions & 2 deletions dom/canvas/CanvasRenderingContext2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1300,7 +1300,7 @@ CanvasRenderingContext2D::Redraw()
return NS_OK;
}

nsSVGEffects::InvalidateDirectRenderingObservers(mCanvasElement);
SVGObserverUtils::InvalidateDirectRenderingObservers(mCanvasElement);

mCanvasElement->InvalidateCanvasContent(nullptr);

Expand Down Expand Up @@ -1329,7 +1329,7 @@ CanvasRenderingContext2D::Redraw(const gfx::Rect& aR)
return;
}

nsSVGEffects::InvalidateDirectRenderingObservers(mCanvasElement);
SVGObserverUtils::InvalidateDirectRenderingObservers(mCanvasElement);

mCanvasElement->InvalidateCanvasContent(&aR);
}
Expand Down
2 changes: 1 addition & 1 deletion dom/canvas/WebGLContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ WebGLContext::Invalidate()
if (mInvalidated)
return;

nsSVGEffects::InvalidateDirectRenderingObservers(mCanvasElement);
SVGObserverUtils::InvalidateDirectRenderingObservers(mCanvasElement);

mInvalidated = true;
mCanvasElement->InvalidateCanvasContent(nullptr);
Expand Down
2 changes: 1 addition & 1 deletion dom/media/VideoFrameContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ void VideoFrameContainer::InvalidateWithFlags(uint32_t aFlags)
}
}

nsSVGEffects::InvalidateDirectRenderingObservers(mElement);
SVGObserverUtils::InvalidateDirectRenderingObservers(mElement);
}

} // namespace mozilla
Expand Down
2 changes: 1 addition & 1 deletion dom/svg/SVGUseElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ SVGUseElement::LookupHref()
nsCOMPtr<nsIURI> originURI =
mOriginal ? mOriginal->GetBaseURI() : GetBaseURI();
nsCOMPtr<nsIURI> baseURI = nsContentUtils::IsLocalRefURL(href)
? nsSVGEffects::GetBaseURLForLocalRef(this, originURI)
? SVGObserverUtils::GetBaseURLForLocalRef(this, originURI)
: originURI;

nsCOMPtr<nsIURI> targetURI;
Expand Down
2 changes: 1 addition & 1 deletion image/SVGDocumentWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ SVGDocumentWrapper::Observe(nsISupports* aSubject,
// Sever ties from rendering observers to helper-doc's root SVG node
SVGSVGElement* svgElem = GetRootSVGElem();
if (svgElem) {
nsSVGEffects::RemoveAllRenderingObservers(svgElem);
SVGObserverUtils::RemoveAllRenderingObservers(svgElem);
}

// Clean up at XPCOM shutdown time.
Expand Down
4 changes: 2 additions & 2 deletions image/VectorImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class SVGRootRenderingObserver final : public nsSVGRenderingObserver {
Element* elem = GetTarget();
MOZ_ASSERT(elem, "no root SVG node for us to observe");

nsSVGEffects::AddRenderingObserver(elem, this);
SVGObserverUtils::AddRenderingObserver(elem, this);
mInObserverList = true;
}

Expand Down Expand Up @@ -108,7 +108,7 @@ class SVGRootRenderingObserver final : public nsSVGRenderingObserver {
// Our caller might've removed us from rendering-observer list.
// Add ourselves back!
if (!mInObserverList) {
nsSVGEffects::AddRenderingObserver(elem, this);
SVGObserverUtils::AddRenderingObserver(elem, this);
mInObserverList = true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion layout/base/PresShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9308,7 +9308,7 @@ PresShell::DoReflow(nsIFrame* target, bool aInterruptible)
target->SchedulePaint();
nsIFrame *parent = nsLayoutUtils::GetCrossDocParentFrame(target);
while (parent) {
nsSVGEffects::InvalidateDirectRenderingObservers(parent);
SVGObserverUtils::InvalidateDirectRenderingObservers(parent);
parent = nsLayoutUtils::GetCrossDocParentFrame(parent);
}

Expand Down
4 changes: 2 additions & 2 deletions layout/base/RestyleManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1554,14 +1554,14 @@ RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
if (hint & nsChangeHint_UpdateEffects) {
for (nsIFrame* cont = frame; cont;
cont = nsLayoutUtils::GetNextContinuationOrIBSplitSibling(cont)) {
nsSVGEffects::UpdateEffects(cont);
SVGObserverUtils::UpdateEffects(cont);
}
}
if ((hint & nsChangeHint_InvalidateRenderingObservers) ||
((hint & nsChangeHint_UpdateOpacityLayer) &&
frame->IsFrameOfType(nsIFrame::eSVG) &&
!(frame->GetStateBits() & NS_STATE_IS_OUTER_SVG))) {
nsSVGEffects::InvalidateRenderingObservers(frame);
SVGObserverUtils::InvalidateRenderingObservers(frame);
}
if (hint & nsChangeHint_NeedReflow) {
StyleChangeReflow(frame, hint);
Expand Down
4 changes: 2 additions & 2 deletions layout/base/nsChangeHint.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ enum nsChangeHint : uint32_t {
* filter/mask/clip/etc CSS properties changes, causing the element's frame
* to start/stop referencing (or reference different) SVG resource elements.
* (_Not_ used to handle changes to referenced resource elements.) Using this
* hint results in nsSVGEffects::UpdateEffects being called on the element's
* frame.
* hint results in SVGObserverUtils::UpdateEffects being called on the
* element's frame.
*/
nsChangeHint_UpdateEffects = 1 << 7,

Expand Down
15 changes: 8 additions & 7 deletions layout/generic/nsFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ nsFrame::DestroyFrom(nsIFrame* aDestructRoot)
MOZ_ASSERT(!HasAnyStateBits(NS_FRAME_PART_OF_IBSPLIT),
"NS_FRAME_PART_OF_IBSPLIT set on non-nsContainerFrame?");

nsSVGEffects::InvalidateDirectRenderingObservers(this);
SVGObserverUtils::InvalidateDirectRenderingObservers(this);

if (StyleDisplay()->mPosition == NS_STYLE_POSITION_STICKY) {
StickyScrollContainer* ssc =
Expand Down Expand Up @@ -5892,7 +5892,8 @@ nsFrame::DidReflow(nsPresContext* aPresContext,
NS_FRAME_TRACE_MSG(NS_FRAME_TRACE_CALLS,
("nsFrame::DidReflow: aStatus=%d", static_cast<uint32_t>(aStatus)));

nsSVGEffects::InvalidateDirectRenderingObservers(this, nsSVGEffects::INVALIDATE_REFLOW);
SVGObserverUtils::InvalidateDirectRenderingObservers(this,
SVGObserverUtils::INVALIDATE_REFLOW);

if (nsDidReflowStatus::FINISHED == aStatus) {
RemoveStateBits(NS_FRAME_IN_REFLOW | NS_FRAME_FIRST_REFLOW |
Expand Down Expand Up @@ -6407,12 +6408,12 @@ nsIFrame::GetTransformMatrix(const nsIFrame* aStopAtAncestor,
static void InvalidateRenderingObservers(nsIFrame* aDisplayRoot, nsIFrame* aFrame)
{
MOZ_ASSERT(aDisplayRoot == nsLayoutUtils::GetDisplayRootFrame(aFrame));
nsSVGEffects::InvalidateDirectRenderingObservers(aFrame);
SVGObserverUtils::InvalidateDirectRenderingObservers(aFrame);
nsIFrame* parent = aFrame;
while (parent != aDisplayRoot &&
(parent = nsLayoutUtils::GetCrossDocParentFrame(parent)) &&
!parent->HasAnyStateBits(NS_FRAME_DESCENDANT_NEEDS_PAINT)) {
nsSVGEffects::InvalidateDirectRenderingObservers(parent);
SVGObserverUtils::InvalidateDirectRenderingObservers(parent);
}
}

Expand Down Expand Up @@ -6451,7 +6452,7 @@ static void InvalidateFrameInternal(nsIFrame *aFrame, bool aHasDisplayItem = tru
if (aHasDisplayItem) {
aFrame->AddStateBits(NS_FRAME_NEEDS_PAINT);
}
nsSVGEffects::InvalidateDirectRenderingObservers(aFrame);
SVGObserverUtils::InvalidateDirectRenderingObservers(aFrame);
bool needsSchedulePaint = false;
if (nsLayoutUtils::IsPopup(aFrame)) {
needsSchedulePaint = true;
Expand All @@ -6461,7 +6462,7 @@ static void InvalidateFrameInternal(nsIFrame *aFrame, bool aHasDisplayItem = tru
if (aHasDisplayItem && !parent->HasAnyStateBits(NS_FRAME_IS_NONDISPLAY)) {
parent->AddStateBits(NS_FRAME_DESCENDANT_NEEDS_PAINT);
}
nsSVGEffects::InvalidateDirectRenderingObservers(parent);
SVGObserverUtils::InvalidateDirectRenderingObservers(parent);

// If we're inside a popup, then we need to make sure that we
// call schedule paint so that the NS_FRAME_UPDATE_LAYER_TREE
Expand Down Expand Up @@ -9138,7 +9139,7 @@ nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas,
}

if (anyOverflowChanged) {
nsSVGEffects::InvalidateDirectRenderingObservers(this);
SVGObserverUtils::InvalidateDirectRenderingObservers(this);
}
return anyOverflowChanged;
}
Expand Down
20 changes: 10 additions & 10 deletions layout/painting/nsDisplayList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8750,8 +8750,8 @@ ComputeMaskGeometry(PaintFramesParams& aParams)

const nsStyleSVGReset *svgReset = firstFrame->StyleSVGReset();

nsSVGEffects::EffectProperties effectProperties =
nsSVGEffects::GetEffectProperties(firstFrame);
SVGObserverUtils::EffectProperties effectProperties =
SVGObserverUtils::GetEffectProperties(firstFrame);
nsTArray<nsSVGMaskFrame *> maskFrames = effectProperties.GetMaskFrames();

if (maskFrames.Length() == 0) {
Expand Down Expand Up @@ -8871,8 +8871,8 @@ nsDisplayMask::BuildLayer(nsDisplayListBuilder* aBuilder,

nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(mFrame);
nsSVGEffects::EffectProperties effectProperties =
nsSVGEffects::GetEffectProperties(firstFrame);
SVGObserverUtils::EffectProperties effectProperties =
SVGObserverUtils::GetEffectProperties(firstFrame);

if (effectProperties.HasInvalidClipPath() ||
effectProperties.HasInvalidMask()) {
Expand Down Expand Up @@ -9063,8 +9063,8 @@ nsDisplayMask::PrintEffects(nsACString& aTo)
{
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(mFrame);
nsSVGEffects::EffectProperties effectProperties =
nsSVGEffects::GetEffectProperties(firstFrame);
SVGObserverUtils::EffectProperties effectProperties =
SVGObserverUtils::GetEffectProperties(firstFrame);
nsSVGClipPathFrame *clipPathFrame = effectProperties.GetClipPathFrame();
bool first = true;
aTo += " effects=(";
Expand Down Expand Up @@ -9130,8 +9130,8 @@ nsDisplayFilter::BuildLayer(nsDisplayListBuilder* aBuilder,

nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(mFrame);
nsSVGEffects::EffectProperties effectProperties =
nsSVGEffects::GetEffectProperties(firstFrame);
SVGObserverUtils::EffectProperties effectProperties =
SVGObserverUtils::GetEffectProperties(firstFrame);

if (effectProperties.HasInvalidFilter()) {
return nullptr;
Expand Down Expand Up @@ -9295,8 +9295,8 @@ nsDisplayFilter::PrintEffects(nsACString& aTo)
{
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(mFrame);
nsSVGEffects::EffectProperties effectProperties =
nsSVGEffects::GetEffectProperties(firstFrame);
SVGObserverUtils::EffectProperties effectProperties =
SVGObserverUtils::GetEffectProperties(firstFrame);
bool first = true;
aTo += " effects=(";
if (mFrame->StyleEffects()->mOpacity != 1.0f && mHandleOpacity) {
Expand Down
4 changes: 2 additions & 2 deletions layout/painting/nsImageRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ nsImageRenderer::PrepareImage()
nsCOMPtr<nsIURI> base = mForFrame->GetContent()->GetBaseURI();
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(targetURI), elementId,
mForFrame->GetContent()->GetUncomposedDoc(), base);
nsSVGPaintingProperty* property = nsSVGEffects::GetPaintingPropertyForURI(
nsSVGPaintingProperty* property = SVGObserverUtils::GetPaintingPropertyForURI(
targetURI, mForFrame->FirstContinuation(),
nsSVGEffects::BackgroundImageProperty());
SVGObserverUtils::BackgroundImageProperty());
if (!property) {
mPrepareResult = DrawResult::BAD_IMAGE;
return false;
Expand Down
2 changes: 1 addition & 1 deletion layout/style/ImageLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ ImageLoader::DoRedraw(FrameSet* aFrameSet, bool aForcePaint)
// Update ancestor rendering observers (-moz-element etc)
nsIFrame *f = frame;
while (f && !f->HasAnyStateBits(NS_FRAME_DESCENDANT_NEEDS_PAINT)) {
nsSVGEffects::InvalidateDirectRenderingObservers(f);
SVGObserverUtils::InvalidateDirectRenderingObservers(f);
f = nsLayoutUtils::GetCrossDocParentFrame(f);
}

Expand Down
9 changes: 5 additions & 4 deletions layout/svg/SVGContextPaint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ SetupInheritablePaint(const DrawTarget* aDrawTarget,
SVGContextPaint* aOuterContextPaint,
SVGContextPaintImpl::Paint& aTargetPaint,
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
nsSVGEffects::PaintingPropertyDescriptor aProperty,
SVGObserverUtils::PaintingPropertyDescriptor aProperty,
imgDrawingParams& aImgParams)
{
const nsStyleSVG *style = aFrame->StyleSVG();
nsSVGPaintServerFrame *ps =
nsSVGEffects::GetPaintServer(aFrame, aFillOrStroke, aProperty);
SVGObserverUtils::GetPaintServer(aFrame, aFillOrStroke, aProperty);

if (ps) {
RefPtr<gfxPattern> pattern =
Expand Down Expand Up @@ -157,7 +157,7 @@ SVGContextPaintImpl::Init(const DrawTarget* aDrawTarget,

SetupInheritablePaint(aDrawTarget, aContextMatrix, aFrame, opacity,
aOuterContextPaint, mFillPaint, &nsStyleSVG::mFill,
nsSVGEffects::FillProperty(), aImgParams);
SVGObserverUtils::FillProperty(), aImgParams);

SetFillOpacity(opacity);

Expand All @@ -174,7 +174,8 @@ SVGContextPaintImpl::Init(const DrawTarget* aDrawTarget,

SetupInheritablePaint(aDrawTarget, aContextMatrix, aFrame, opacity,
aOuterContextPaint, mStrokePaint,
&nsStyleSVG::mStroke, nsSVGEffects::StrokeProperty(),
&nsStyleSVG::mStroke,
SVGObserverUtils::StrokeProperty(),
aImgParams);

SetStrokeOpacity(opacity);
Expand Down
2 changes: 1 addition & 1 deletion layout/svg/SVGFEContainerFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ SVGFEContainerFrame::AttributeChanged(int32_t aNameSpaceID,
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
MOZ_ASSERT(GetParent()->IsSVGFilterFrame(),
"Observers observe the filter, so that's what we must invalidate");
nsSVGEffects::InvalidateDirectRenderingObservers(GetParent());
SVGObserverUtils::InvalidateDirectRenderingObservers(GetParent());
}

return nsContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
Expand Down
2 changes: 1 addition & 1 deletion layout/svg/SVGFEImageFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ SVGFEImageFrame::AttributeChanged(int32_t aNameSpaceID,
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
MOZ_ASSERT(GetParent()->IsSVGFilterFrame(),
"Observers observe the filter, so that's what we must invalidate");
nsSVGEffects::InvalidateDirectRenderingObservers(GetParent());
SVGObserverUtils::InvalidateDirectRenderingObservers(GetParent());
}

// Currently our SMIL implementation does not modify the DOM attributes. Once
Expand Down
2 changes: 1 addition & 1 deletion layout/svg/SVGFELeafFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ SVGFELeafFrame::AttributeChanged(int32_t aNameSpaceID,
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
MOZ_ASSERT(GetParent()->IsSVGFilterFrame(),
"Observers observe the filter, so that's what we must invalidate");
nsSVGEffects::InvalidateDirectRenderingObservers(GetParent());
SVGObserverUtils::InvalidateDirectRenderingObservers(GetParent());
}

return nsFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
Expand Down
2 changes: 1 addition & 1 deletion layout/svg/SVGFEUnstyledLeafFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ SVGFEUnstyledLeafFrame::AttributeChanged(int32_t aNameSpaceID,
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
MOZ_ASSERT(GetParent()->GetParent()->IsSVGFilterFrame(),
"Observers observe the filter, so that's what we must invalidate");
nsSVGEffects::InvalidateDirectRenderingObservers(GetParent()->GetParent());
SVGObserverUtils::InvalidateDirectRenderingObservers(GetParent()->GetParent());
}

return nsFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
Expand Down
20 changes: 10 additions & 10 deletions layout/svg/SVGGeometryFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ SVGGeometryFrame::ReflowSVG()
// Make sure we have our filter property (if any) before calling
// FinishAndStoreOverflow (subsequent filter changes are handled off
// nsChangeHint_UpdateEffects):
nsSVGEffects::UpdateEffects(this);
SVGObserverUtils::UpdateEffects(this);
}

nsRect overflow = nsRect(nsPoint(0,0), mRect.Size());
Expand Down Expand Up @@ -702,20 +702,20 @@ SVGGeometryFrame::GetMarkerProperties(SVGGeometryFrame *aFrame)

MarkerProperties result;
nsCOMPtr<nsIURI> markerURL =
nsSVGEffects::GetMarkerURI(aFrame, &nsStyleSVG::mMarkerStart);
SVGObserverUtils::GetMarkerURI(aFrame, &nsStyleSVG::mMarkerStart);
result.mMarkerStart =
nsSVGEffects::GetMarkerProperty(markerURL, aFrame,
nsSVGEffects::MarkerBeginProperty());
SVGObserverUtils::GetMarkerProperty(markerURL, aFrame,
SVGObserverUtils::MarkerBeginProperty());

markerURL = nsSVGEffects::GetMarkerURI(aFrame, &nsStyleSVG::mMarkerMid);
markerURL = SVGObserverUtils::GetMarkerURI(aFrame, &nsStyleSVG::mMarkerMid);
result.mMarkerMid =
nsSVGEffects::GetMarkerProperty(markerURL, aFrame,
nsSVGEffects::MarkerMiddleProperty());
SVGObserverUtils::GetMarkerProperty(markerURL, aFrame,
SVGObserverUtils::MarkerMiddleProperty());

markerURL = nsSVGEffects::GetMarkerURI(aFrame, &nsStyleSVG::mMarkerEnd);
markerURL = SVGObserverUtils::GetMarkerURI(aFrame, &nsStyleSVG::mMarkerEnd);
result.mMarkerEnd =
nsSVGEffects::GetMarkerProperty(markerURL, aFrame,
nsSVGEffects::MarkerEndProperty());
SVGObserverUtils::GetMarkerProperty(markerURL, aFrame,
SVGObserverUtils::MarkerEndProperty());
return result;
}

Expand Down
Loading

0 comments on commit 341ea5e

Please sign in to comment.