diff options
Diffstat (limited to 'dom/svg/SVGTests.h')
-rw-r--r-- | dom/svg/SVGTests.h | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/dom/svg/SVGTests.h b/dom/svg/SVGTests.h index 148c35fc5c..90991fd60d 100644 --- a/dom/svg/SVGTests.h +++ b/dom/svg/SVGTests.h @@ -13,13 +13,15 @@ class nsAttrValue; class nsAtom; +class nsIContent; class nsStaticAtom; namespace mozilla { namespace dom { class DOMSVGStringList; -} +class SVGSwitchElement; +} // namespace dom #define MOZILLA_DOMSVGTESTS_IID \ { \ @@ -42,26 +44,10 @@ class SVGTests : public nsISupports { using SVGStringList = mozilla::SVGStringList; /** - * Compare the language name(s) in a systemLanguage attribute to the - * user's language preferences, as defined in - * http://www.w3.org/TR/SVG11/struct.html#SystemLanguageAttribute - * We have a match if a language name in the users language preferences - * exactly equals one of the language names or exactly equals a prefix of - * one of the language names in the systemLanguage attribute. - * @returns 2 * the lowest index in the aAcceptLangs that matches + 1 - * if only the prefix matches, -2 if there's no systemLanguage attribute, - * or -1 if no indices match. - * XXX This algorithm is O(M*N). - */ - int32_t GetBestLanguagePreferenceRank(const nsAString& aAcceptLangs) const; - - /** - * Check whether the conditional processing attributes other than - * systemLanguage "return true" if they apply to and are specified - * on the given element. Returns true if this element should be - * rendered, false if it should not. + * Find the active switch child using BCP 47 rules. */ - bool PassesConditionalProcessingTestsIgnoringSystemLanguage() const; + static nsIContent* FindActiveSwitchChild( + const dom::SVGSwitchElement* aSwitch); /** * Check whether the conditional processing attributes requiredExtensions @@ -72,16 +58,6 @@ class SVGTests : public nsISupports { bool PassesConditionalProcessingTests() const; /** - * Check whether the conditional processing attributes requiredExtensions - * and systemLanguage both "return true" if they apply to - * and are specified on the given element. Returns true if this element - * should be rendered, false if it should not. - * - * @param aAcceptLangs The value of the intl.accept_languages preference - */ - bool PassesConditionalProcessingTests(const nsAString& aAcceptLangs) const; - - /** * Returns true if the attribute is one of the conditional processing * attributes. */ @@ -117,9 +93,17 @@ class SVGTests : public nsISupports { virtual ~SVGTests() = default; private: + /** + * Check whether the extensions processing attribute applies to and is + * specified on the given element. Returns true if this element should be + * rendered, false if it should not. + */ + bool PassesRequiredExtensionsTests() const; + enum { EXTENSIONS, LANGUAGE }; SVGStringList mStringListAttributes[2]; static nsStaticAtom* const sStringListNames[2]; + mutable Maybe<bool> mPassesConditionalProcessingTests = Some(true); }; NS_DEFINE_STATIC_IID_ACCESSOR(SVGTests, MOZILLA_DOMSVGTESTS_IID) |