diff --git a/dom/base/nsDeprecatedOperationList.h b/dom/base/nsDeprecatedOperationList.h index 2a0ff32d7dcd..e3ca65f1bbcf 100644 --- a/dom/base/nsDeprecatedOperationList.h +++ b/dom/base/nsDeprecatedOperationList.h @@ -49,3 +49,6 @@ DEPRECATED_OPERATION(MozfullscreenchangeDeprecatedPrefix) DEPRECATED_OPERATION(MozfullscreenerrorDeprecatedPrefix) DEPRECATED_OPERATION(External_AddSearchProvider) DEPRECATED_OPERATION(MouseEvent_MozPressure) +DEPRECATED_OPERATION(MathML_DeprecatedLineThicknessValue) +DEPRECATED_OPERATION(MathML_DeprecatedMathSizeValue) +DEPRECATED_OPERATION(MathML_DeprecatedMathSpaceValue) diff --git a/dom/locales/en-US/chrome/dom/dom.properties b/dom/locales/en-US/chrome/dom/dom.properties index c8d083aa6b09..2e95363ff964 100644 --- a/dom/locales/en-US/chrome/dom/dom.properties +++ b/dom/locales/en-US/chrome/dom/dom.properties @@ -387,3 +387,10 @@ MozfullscreenerrorDeprecatedPrefixWarning=onmozfullscreenerror is deprecated. External_AddSearchProviderWarning=AddSearchProvider is deprecated. # LOCALIZATION NOTE: Do not translate "MouseEvent.mozPressure" and "PointerEvent.pressure". MouseEvent_MozPressureWarning=MouseEvent.mozPressure is deprecated. Use PointerEvent.pressure instead. +# LOCALIZATION NOTE: Do not translate thin, medium, thick and linethickness. +MathML_DeprecatedLineThicknessValueWarning=“thin”, “medium” and “thick” are deprecated values for the linethickness attribute and will be removed at a future date. +# LOCALIZATION NOTE: Do not translate small, normal, big and mathsize. +MathML_DeprecatedMathSizeValueWarning=“small”, “normal” and “big” are deprecated values for the mathsize attribute and will be removed at a future date. +# LOCALIZATION NOTE: Do not translate veryverythinmathspace, verythinmathspace, +# thinmathspace, mediummathspace, thickmathspace, verythickmathspace, veryverythickmathspace and MathML. +MathML_DeprecatedMathSpaceValueWarning=“veryverythinmathspace”, “verythinmathspace”, “thinmathspace”, “mediummathspace”, “thickmathspace”, “verythickmathspace” and “veryverythickmathspace” are deprecated values for MathML lengths and will be removed at a future date. diff --git a/dom/mathml/nsMathMLElement.cpp b/dom/mathml/nsMathMLElement.cpp index b31dd1e89bd6..79988b756a76 100644 --- a/dom/mathml/nsMathMLElement.cpp +++ b/dom/mathml/nsMathMLElement.cpp @@ -187,7 +187,8 @@ nsMapRuleToAttributesFunc nsMathMLElement::GetAttributeMappingFunction() const { /* static */ bool nsMathMLElement::ParseNamedSpaceValue(const nsString& aString, nsCSSValue& aCSSValue, - uint32_t aFlags) { + uint32_t aFlags, + const Document& aDocument) { if (StaticPrefs::mathml_mathspace_names_disabled()) { return false; } @@ -225,6 +226,7 @@ bool nsMathMLElement::ParseNamedSpaceValue(const nsString& aString, } } if (0 != i) { + aDocument.WarnOnceAbout(dom::Document::eMathML_DeprecatedMathSpaceValue); aCSSValue.SetFloatValue(float(i) / float(18), eCSSUnit_EM); return true; } @@ -285,7 +287,7 @@ bool nsMathMLElement::ParseNumericValue(const nsString& aString, return false; } - if (ParseNamedSpaceValue(str, aCSSValue, aFlags)) { + if (aDocument && ParseNamedSpaceValue(str, aCSSValue, aFlags, *aDocument)) { return true; } @@ -546,6 +548,8 @@ void nsMathMLElement::MapMathMLAttributesInto( str.CompressWhitespace(); for (uint32_t i = 0; i < ArrayLength(sizes); ++i) { if (str.EqualsASCII(sizes[i])) { + aDecls.Document()->WarnOnceAbout( + dom::Document::eMathML_DeprecatedMathSizeValue); aDecls.SetKeywordValue(eCSSProperty_font_size, values[i]); break; } diff --git a/dom/mathml/nsMathMLElement.h b/dom/mathml/nsMathMLElement.h index c4eb0ecfee0c..30b15c119a81 100644 --- a/dom/mathml/nsMathMLElement.h +++ b/dom/mathml/nsMathMLElement.h @@ -54,7 +54,8 @@ class nsMathMLElement final : public nsMathMLElementBase, CONVERT_UNITLESS_TO_PERCENT = 0x08 }; static bool ParseNamedSpaceValue(const nsString& aString, - nsCSSValue& aCSSValue, uint32_t aFlags); + nsCSSValue& aCSSValue, uint32_t aFlags, + const Document& aDocument); static bool ParseNumericValue(const nsString& aString, nsCSSValue& aCSSValue, uint32_t aFlags, Document* aDocument); diff --git a/layout/mathml/nsMathMLmfracFrame.cpp b/layout/mathml/nsMathMLmfracFrame.cpp index c3a65d171c9f..fb8a0bf8fce4 100644 --- a/layout/mathml/nsMathMLmfracFrame.cpp +++ b/layout/mathml/nsMathMLmfracFrame.cpp @@ -111,6 +111,7 @@ nscoord nsMathMLmfracFrame::CalcLineThickness(nsPresContext* aPresContext, nsMathMLElement::PARSE_ALLOW_UNITLESS, aPresContext, aComputedStyle, aFontSizeInflation); } else { + bool isDeprecatedLineThicknessValue = true; if (aThicknessAttribute.EqualsLiteral("thin")) { lineThickness = NSToCoordFloor(defaultThickness * THIN_FRACTION_LINE); minimumThickness = onePixel * THIN_FRACTION_LINE_MINIMUM_PIXELS; @@ -131,11 +132,16 @@ nscoord nsMathMLmfracFrame::CalcLineThickness(nsPresContext* aPresContext, } } else { // length value + isDeprecatedLineThicknessValue = false; lineThickness = defaultThickness; ParseNumericValue(aThicknessAttribute, &lineThickness, nsMathMLElement::PARSE_ALLOW_UNITLESS, aPresContext, aComputedStyle, aFontSizeInflation); } + if (isDeprecatedLineThicknessValue) { + mContent->OwnerDoc()->WarnOnceAbout( + dom::Document::eMathML_DeprecatedLineThicknessValue); + } } } diff --git a/layout/mathml/nsMathMLmfracFrame.h b/layout/mathml/nsMathMLmfracFrame.h index d62e42b8d229..8788a3395634 100644 --- a/layout/mathml/nsMathMLmfracFrame.h +++ b/layout/mathml/nsMathMLmfracFrame.h @@ -82,12 +82,11 @@ class nsMathMLmfracFrame final : public nsMathMLContainerFrame { virtual nscoord FixInterFrameSpacing(ReflowOutput& aDesiredSize) override; // helper to translate the thickness attribute into a usable form - static nscoord CalcLineThickness(nsPresContext* aPresContext, - ComputedStyle* aComputedStyle, - nsString& aThicknessAttribute, - nscoord onePixel, - nscoord aDefaultRuleThickness, - float aFontSizeInflation); + nscoord CalcLineThickness(nsPresContext* aPresContext, + ComputedStyle* aComputedStyle, + nsString& aThicknessAttribute, nscoord onePixel, + nscoord aDefaultRuleThickness, + float aFontSizeInflation); uint8_t ScriptIncrement(nsIFrame* aFrame) override; diff --git a/layout/mathml/nsMathMLmpaddedFrame.cpp b/layout/mathml/nsMathMLmpaddedFrame.cpp index 4128a53fdf4b..7c823633c471 100644 --- a/layout/mathml/nsMathMLmpaddedFrame.cpp +++ b/layout/mathml/nsMathMLmpaddedFrame.cpp @@ -208,7 +208,8 @@ bool nsMathMLmpaddedFrame::ParseAttribute(nsString& aString, int32_t& aSign, // see if the unit is a named-space if (nsMathMLElement::ParseNamedSpaceValue( - unit, aCSSValue, nsMathMLElement::PARSE_ALLOW_NEGATIVE)) { + unit, aCSSValue, nsMathMLElement::PARSE_ALLOW_NEGATIVE, + *mContent->OwnerDoc())) { // re-scale properly, and we know that the unit of the named-space is 'em' floatValue *= aCSSValue.GetFloatValue(); aCSSValue.SetFloatValue(floatValue, eCSSUnit_EM); diff --git a/layout/mathml/nsMathMLmpaddedFrame.h b/layout/mathml/nsMathMLmpaddedFrame.h index e14edca2d320..b1097719fd8f 100644 --- a/layout/mathml/nsMathMLmpaddedFrame.h +++ b/layout/mathml/nsMathMLmpaddedFrame.h @@ -86,8 +86,8 @@ class nsMathMLmpaddedFrame final : public nsMathMLContainerFrame { // helpers to process the attributes void ProcessAttributes(); - static bool ParseAttribute(nsString& aString, int32_t& aSign, - nsCSSValue& aCSSValue, int32_t& aPseudoUnit); + bool ParseAttribute(nsString& aString, int32_t& aSign, nsCSSValue& aCSSValue, + int32_t& aPseudoUnit); void UpdateValue(int32_t aSign, int32_t aPseudoUnit, const nsCSSValue& aCSSValue,