Bug 1341714 - Part 4: stylo: Add support for xml:lang; r?heycam draft
authorManish Goregaokar <manishearth@gmail.com>
Sun, 26 Mar 2017 13:53:34 -0700
changeset 555915 9bfd9f88c6e892f979419ae123d9512e0c55c1fc
parent 555914 de3b9a90c7c1fc8c3485b9d873bd2b455cfc8eb4
child 622734 01d1490ec4111661ae2221c0fc1197addb778fcb
push id52380
push userbmo:manishearth@gmail.com
push dateWed, 05 Apr 2017 05:01:20 +0000
reviewersheycam
bugs1341714
milestone55.0a1
Bug 1341714 - Part 4: stylo: Add support for xml:lang; r?heycam MozReview-Commit-ID: E0GpyPKES3k
layout/reftests/text/reftest-stylo.list
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
--- 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);                  \