Bug 1298774 - Part 6: Make SVG marker properties use css::URLValue for storage instead of FragmentOrURL. r=cjku

MozReview-Commit-ID: 8OQWmDpP7Ax

--HG--
extra : rebase_source : f372d5d77481bc71d49d0f7446244f6e9162d0ac
This commit is contained in:
Cameron McCormack 2016-10-11 14:56:11 +08:00
Родитель a9271aac63
Коммит e07dbc8da6
6 изменённых файлов: 23 добавлений и 22 удалений

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

@ -5630,7 +5630,7 @@ already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetMarkerEnd()
{
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
SetValueToFragmentOrURL(&StyleSVG()->mMarkerEnd, val);
SetValueToURLValue(StyleSVG()->mMarkerEnd, val);
return val.forget();
}
@ -5639,7 +5639,7 @@ already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetMarkerMid()
{
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
SetValueToFragmentOrURL(&StyleSVG()->mMarkerMid, val);
SetValueToURLValue(StyleSVG()->mMarkerMid, val);
return val.forget();
}
@ -5648,7 +5648,7 @@ already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetMarkerStart()
{
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
SetValueToFragmentOrURL(&StyleSVG()->mMarkerStart, val);
SetValueToURLValue(StyleSVG()->mMarkerStart, val);
return val.forget();
}

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

@ -9358,10 +9358,10 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
// marker-end: url, none, inherit
const nsCSSValue* markerEndValue = aRuleData->ValueForMarkerEnd();
if (eCSSUnit_URL == markerEndValue->GetUnit()) {
svg->mMarkerEnd.SetValue(markerEndValue);
svg->mMarkerEnd = markerEndValue->GetURLStructValue();
} else if (eCSSUnit_None == markerEndValue->GetUnit() ||
eCSSUnit_Initial == markerEndValue->GetUnit()) {
svg->mMarkerEnd.SetNull();
svg->mMarkerEnd = nullptr;
} else if (eCSSUnit_Inherit == markerEndValue->GetUnit() ||
eCSSUnit_Unset == markerEndValue->GetUnit()) {
conditions.SetUncacheable();
@ -9371,10 +9371,10 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
// marker-mid: url, none, inherit
const nsCSSValue* markerMidValue = aRuleData->ValueForMarkerMid();
if (eCSSUnit_URL == markerMidValue->GetUnit()) {
svg->mMarkerMid.SetValue(markerMidValue);
svg->mMarkerMid = markerMidValue->GetURLStructValue();
} else if (eCSSUnit_None == markerMidValue->GetUnit() ||
eCSSUnit_Initial == markerMidValue->GetUnit()) {
svg->mMarkerMid.SetNull();
svg->mMarkerMid = nullptr;
} else if (eCSSUnit_Inherit == markerMidValue->GetUnit() ||
eCSSUnit_Unset == markerMidValue->GetUnit()) {
conditions.SetUncacheable();
@ -9384,10 +9384,10 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
// marker-start: url, none, inherit
const nsCSSValue* markerStartValue = aRuleData->ValueForMarkerStart();
if (eCSSUnit_URL == markerStartValue->GetUnit()) {
svg->mMarkerStart.SetValue(markerStartValue);
svg->mMarkerStart = markerStartValue->GetURLStructValue();
} else if (eCSSUnit_None == markerStartValue->GetUnit() ||
eCSSUnit_Initial == markerStartValue->GetUnit()) {
svg->mMarkerStart.SetNull();
svg->mMarkerStart = nullptr;
} else if (eCSSUnit_Inherit == markerStartValue->GetUnit() ||
eCSSUnit_Unset == markerStartValue->GetUnit()) {
conditions.SetUncacheable();

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

@ -1027,8 +1027,9 @@ nsStyleSVG::CalcDifference(const nsStyleSVG& aNewData) const
{
nsChangeHint hint = nsChangeHint(0);
if (mMarkerEnd != aNewData.mMarkerEnd || mMarkerMid != aNewData.mMarkerMid ||
mMarkerStart != aNewData.mMarkerStart) {
if (!DefinitelyEqualURIs(mMarkerEnd, aNewData.mMarkerEnd) ||
!DefinitelyEqualURIs(mMarkerMid, aNewData.mMarkerMid) ||
!DefinitelyEqualURIs(mMarkerStart, aNewData.mMarkerStart)) {
// Markers currently contribute to nsSVGPathGeometryFrame::mRect,
// so we need a reflow as well as a repaint. No intrinsic sizes need
// to change, so nsChangeHint_NeedReflow is sufficient.

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

@ -3526,9 +3526,9 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVG
nsStyleSVGPaint mFill; // [inherited]
nsStyleSVGPaint mStroke; // [inherited]
mozilla::FragmentOrURL mMarkerEnd; // [inherited]
mozilla::FragmentOrURL mMarkerMid; // [inherited]
mozilla::FragmentOrURL mMarkerStart; // [inherited]
RefPtr<mozilla::css::URLValue> mMarkerEnd; // [inherited]
RefPtr<mozilla::css::URLValue> mMarkerMid; // [inherited]
RefPtr<mozilla::css::URLValue> mMarkerStart; // [inherited]
nsTArray<nsStyleCoord> mStrokeDasharray; // [inherited] coord, percent, factor
nsStyleCoord mStrokeDashoffset; // [inherited] coord, percent, factor
@ -3590,8 +3590,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVG
}
bool HasMarker() const {
return mMarkerStart.GetSourceURL() || mMarkerMid.GetSourceURL() ||
mMarkerEnd.GetSourceURL();
return mMarkerStart || mMarkerMid || mMarkerEnd;
}
/**

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

@ -708,11 +708,11 @@ nsSVGEffects::UpdateEffects(nsIFrame* aFrame)
static_cast<nsSVGPathGeometryElement*>(aFrame->GetContent())->IsMarkable()) {
// Set marker properties here to avoid reference loops
nsCOMPtr<nsIURI> markerURL =
nsSVGEffects::GetMarkerURI(aFrame, &nsStyleSVG::mMarkerStart);
GetMarkerURI(aFrame, &nsStyleSVG::mMarkerStart);
GetMarkerProperty(markerURL, aFrame, MarkerBeginProperty());
markerURL = nsSVGEffects::GetMarkerURI(aFrame, &nsStyleSVG::mMarkerMid);
markerURL = GetMarkerURI(aFrame, &nsStyleSVG::mMarkerMid);
GetMarkerProperty(markerURL, aFrame, MarkerMiddleProperty());
markerURL = nsSVGEffects::GetMarkerURI(aFrame, &nsStyleSVG::mMarkerEnd);
markerURL = GetMarkerURI(aFrame, &nsStyleSVG::mMarkerEnd);
GetMarkerProperty(markerURL, aFrame, MarkerEndProperty());
}
}
@ -998,9 +998,9 @@ ResolveURLUsingLocalRef(nsIFrame* aFrame, const css::URLValue* aURL)
already_AddRefed<nsIURI>
nsSVGEffects::GetMarkerURI(nsIFrame* aFrame,
FragmentOrURL nsStyleSVG::* aMarker)
RefPtr<css::URLValue> nsStyleSVG::* aMarker)
{
return ResolveFragmentOrURL(aFrame, &(aFrame->StyleSVG()->*aMarker));
return ResolveURLUsingLocalRef(aFrame, aFrame->StyleSVG()->*aMarker);
}
already_AddRefed<nsIURI>

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

@ -599,7 +599,8 @@ public:
* A helper function to resolve marker's URL.
*/
static already_AddRefed<nsIURI>
GetMarkerURI(nsIFrame* aFrame, mozilla::FragmentOrURL nsStyleSVG::* aMarker);
GetMarkerURI(nsIFrame* aFrame,
RefPtr<mozilla::css::URLValue> nsStyleSVG::* aMarker);
/**
* A helper function to resolve clip-path URL.