Bug 1341714 - Part 4: stylo: Add support for xml:lang; r?heycam
MozReview-Commit-ID: E0GpyPKES3k
--- a/layout/reftests/text/reftest-stylo.list
+++ b/layout/reftests/text/reftest-stylo.list
@@ -249,35 +249,35 @@ HTTP(..) == graphite-surrogate-selection
== auto-hyphenation-3.html auto-hyphenation-3.html
== auto-hyphenation-4.html auto-hyphenation-4.html
== auto-hyphenation-5.html auto-hyphenation-5.html
== auto-hyphenation-6.html auto-hyphenation-6.html
== auto-hyphenation-7.html auto-hyphenation-7.html
== auto-hyphenation-8.html auto-hyphenation-8.html
== auto-hyphenation-9.html auto-hyphenation-9.html
== auto-hyphenation-10.html auto-hyphenation-10.html
-fails == auto-hyphenation-xmllang-1.xhtml auto-hyphenation-xmllang-1.xhtml # Bug 1341714
-fails == auto-hyphenation-xmllang-1.xhtml auto-hyphenation-xmllang-1.xhtml # Bug 1341714
-fails == auto-hyphenation-xmllang-1a.xhtml auto-hyphenation-xmllang-1a.xhtml
-fails == auto-hyphenation-xmllang-2.xhtml auto-hyphenation-xmllang-2.xhtml
+== auto-hyphenation-xmllang-1.xhtml auto-hyphenation-xmllang-1.xhtml # Bug 1341714
+== auto-hyphenation-xmllang-1.xhtml auto-hyphenation-xmllang-1.xhtml # Bug 1341714
+== auto-hyphenation-xmllang-1a.xhtml auto-hyphenation-xmllang-1a.xhtml
+== auto-hyphenation-xmllang-2.xhtml auto-hyphenation-xmllang-2.xhtml
== auto-hyphenation-xmllang-3.xhtml auto-hyphenation-xmllang-3.xhtml
== auto-hyphenation-xmllang-4.xhtml auto-hyphenation-xmllang-4.xhtml
-fails == auto-hyphenation-xmllang-5.xhtml auto-hyphenation-xmllang-5.xhtml
-fails == auto-hyphenation-xmllang-6.xhtml auto-hyphenation-xmllang-6.xhtml
-fails == auto-hyphenation-xmllang-7.xhtml auto-hyphenation-xmllang-7.xhtml
+== auto-hyphenation-xmllang-5.xhtml auto-hyphenation-xmllang-5.xhtml
+== auto-hyphenation-xmllang-6.xhtml auto-hyphenation-xmllang-6.xhtml
+== auto-hyphenation-xmllang-7.xhtml auto-hyphenation-xmllang-7.xhtml
== auto-hyphenation-xmllang-8.xhtml auto-hyphenation-xmllang-8.xhtml
== auto-hyphenation-xmllang-9.xhtml auto-hyphenation-xmllang-9.xhtml
== auto-hyphenation-xmllang-10.xhtml auto-hyphenation-xmllang-10.xhtml
-fails == auto-hyphenation-xmllang-11a.xhtml auto-hyphenation-xmllang-11a.xhtml
-fails == auto-hyphenation-xmllang-11b.xhtml auto-hyphenation-xmllang-11b.xhtml
-fails == auto-hyphenation-xmllang-12a.xhtml auto-hyphenation-xmllang-12a.xhtml
-fails == auto-hyphenation-xmllang-12b.xhtml auto-hyphenation-xmllang-12b.xhtml
-fails == auto-hyphenation-xmllang-13a.xhtml auto-hyphenation-xmllang-13a.xhtml
+== auto-hyphenation-xmllang-11a.xhtml auto-hyphenation-xmllang-11a.xhtml
+== auto-hyphenation-xmllang-11b.xhtml auto-hyphenation-xmllang-11b.xhtml
+== auto-hyphenation-xmllang-12a.xhtml auto-hyphenation-xmllang-12a.xhtml
+== auto-hyphenation-xmllang-12b.xhtml auto-hyphenation-xmllang-12b.xhtml
+== auto-hyphenation-xmllang-13a.xhtml auto-hyphenation-xmllang-13a.xhtml
== auto-hyphenation-xmllang-13b.xhtml auto-hyphenation-xmllang-13b.xhtml
-fails == auto-hyphenation-xmllang-14a.xhtml auto-hyphenation-xmllang-14a.xhtml
+== auto-hyphenation-xmllang-14a.xhtml auto-hyphenation-xmllang-14a.xhtml
== auto-hyphenation-xmllang-14b.xhtml auto-hyphenation-xmllang-14b.xhtml
== auto-hyphenation-af-1.html auto-hyphenation-af-1.html
== auto-hyphenation-bg-1.html auto-hyphenation-bg-1.html
== auto-hyphenation-ca-1.html auto-hyphenation-ca-1.html
== auto-hyphenation-cy-1.html auto-hyphenation-cy-1.html
== auto-hyphenation-da-1.html auto-hyphenation-da-1.html
== auto-hyphenation-de-1901-1.html auto-hyphenation-de-1901-1.html
== auto-hyphenation-de-1996-1.html auto-hyphenation-de-1996-1.html
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -548,16 +548,26 @@ Gecko_MatchStringArgPseudo(RawGeckoEleme
bool* aSetSlowSelectorFlag)
{
EventStates dummyMask; // mask is never read because we pass aDependence=nullptr
return nsCSSRuleProcessor::StringPseudoMatches(aElement, aType, aIdent,
aElement->OwnerDoc(), true,
dummyMask, false, aSetSlowSelectorFlag, nullptr);
}
+nsIAtom*
+Gecko_GetXMLLangValue(RawGeckoElementBorrowed aElement)
+{
+ nsString string;
+ if (aElement->GetAttr(kNameSpaceID_XML, nsGkAtoms::lang, string)) {
+ return NS_Atomize(string).take();
+ }
+ return nullptr;
+}
+
template <typename Implementor>
static nsIAtom*
AtomAttrValue(Implementor* aElement, nsIAtom* aName)
{
const nsAttrValue* attr = aElement->GetParsedAttr(aName);
return attr ? attr->GetAtomValue() : nullptr;
}
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -136,16 +136,18 @@ RawGeckoNodeBorrowedOrNull Gecko_GetNext
uint64_t Gecko_ElementState(RawGeckoElementBorrowed element);
bool Gecko_IsTextNode(RawGeckoNodeBorrowed node);
bool Gecko_IsRootElement(RawGeckoElementBorrowed element);
bool Gecko_MatchesElement(mozilla::CSSPseudoClassType type, RawGeckoElementBorrowed element);
nsIAtom* Gecko_LocalName(RawGeckoElementBorrowed element);
nsIAtom* Gecko_Namespace(RawGeckoElementBorrowed element);
nsIAtom* Gecko_GetElementId(RawGeckoElementBorrowed element);
+nsIAtom* Gecko_GetXMLLangValue(RawGeckoElementBorrowed element);
+
// Attributes.
#define SERVO_DECLARE_ELEMENT_ATTR_MATCHING_FUNCTIONS(prefix_, implementor_) \
nsIAtom* prefix_##AtomAttrValue(implementor_ element, nsIAtom* attribute); \
bool prefix_##HasAttr(implementor_ element, nsIAtom* ns, nsIAtom* name); \
bool prefix_##AttrEquals(implementor_ element, nsIAtom* ns, nsIAtom* name, \
nsIAtom* str, bool ignoreCase); \
bool prefix_##AttrDashEquals(implementor_ element, nsIAtom* ns, \
nsIAtom* name, nsIAtom* str); \