Bug 1042885 - Part 1: A rp element should not auto close a rtc element. r=wchen, a=sledru
authorYuki Sekiguchi <Yuki.Sekiguchi@access-company.com>
Mon, 18 Aug 2014 22:33:45 -0700
changeset 217566 94b1323d941f4f1765a3387de0e2fda0745bf79a
parent 217565 61d81c3acd46ebc6550441e6a5fc08d36e8db9ee
child 217567 aa20cc59dedf49ad3f4167b8a557861ec1f9359c
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswchen, sledru
bugs1042885
milestone33.0a2
Bug 1042885 - Part 1: A rp element should not auto close a rtc element. r=wchen, a=sledru
parser/html/javasrc/ElementName.java
parser/html/javasrc/TreeBuilder.java
parser/html/nsHtml5ElementName.cpp
parser/html/nsHtml5TreeBuilder.cpp
parser/html/nsHtml5TreeBuilder.h
--- a/parser/html/javasrc/ElementName.java
+++ b/parser/html/javasrc/ElementName.java
@@ -351,20 +351,20 @@ public final class ElementName
 //            case TreeBuilder.DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU:
 //                return "DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU";
 //            case TreeBuilder.FIELDSET:
 //                return "FIELDSET";
 //            case TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY:
 //                return "ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY";
 //            case TreeBuilder.RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR:
 //                return "RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR";
-//            case TreeBuilder.RB_OR_RP_OR_RTC:
-//                return "RB_OR_RP_OR_RTC";
-//            case TreeBuilder.RT:
-//                return "RT";
+//            case TreeBuilder.RB_OR_RTC:
+//                return "RB_OR_RTC";
+//            case TreeBuilder.RT_OR_RP:
+//                return "RT_OR_RP";
 //            case TreeBuilder.PARAM_OR_SOURCE_OR_TRACK:
 //                return "PARAM_OR_SOURCE_OR_TRACK";
 //            case TreeBuilder.MGLYPH_OR_MALIGNMARK:
 //                return "MGLYPH_OR_MALIGNMARK";
 //            case TreeBuilder.MI_MO_MN_MS_MTEXT:
 //                return "MI_MO_MN_MS_MTEXT";
 //            case TreeBuilder.ANNOTATION_XML:
 //                return "ANNOTATION_XML";
@@ -442,19 +442,19 @@ public final class ElementName
     public static final ElementName LT = new ElementName("lt", "lt", TreeBuilder.OTHER);
     public static final ElementName MI = new ElementName("mi", "mi", TreeBuilder.MI_MO_MN_MS_MTEXT | SCOPING_AS_MATHML);
     public static final ElementName MN = new ElementName("mn", "mn", TreeBuilder.MI_MO_MN_MS_MTEXT | SCOPING_AS_MATHML);
     public static final ElementName MO = new ElementName("mo", "mo", TreeBuilder.MI_MO_MN_MS_MTEXT | SCOPING_AS_MATHML);
     public static final ElementName MS = new ElementName("ms", "ms", TreeBuilder.MI_MO_MN_MS_MTEXT | SCOPING_AS_MATHML);
     public static final ElementName OL = new ElementName("ol", "ol", TreeBuilder.UL_OR_OL_OR_DL | SPECIAL);
     public static final ElementName OR = new ElementName("or", "or", TreeBuilder.OTHER);
     public static final ElementName PI = new ElementName("pi", "pi", TreeBuilder.OTHER);
-    public static final ElementName RB = new ElementName("rb", "rb", TreeBuilder.RB_OR_RP_OR_RTC | OPTIONAL_END_TAG);
-    public static final ElementName RP = new ElementName("rp", "rp", TreeBuilder.RB_OR_RP_OR_RTC | OPTIONAL_END_TAG);
-    public static final ElementName RT = new ElementName("rt", "rt", TreeBuilder.RT | OPTIONAL_END_TAG);
+    public static final ElementName RB = new ElementName("rb", "rb", TreeBuilder.RB_OR_RTC | OPTIONAL_END_TAG);
+    public static final ElementName RP = new ElementName("rp", "rp", TreeBuilder.RT_OR_RP | OPTIONAL_END_TAG);
+    public static final ElementName RT = new ElementName("rt", "rt", TreeBuilder.RT_OR_RP | OPTIONAL_END_TAG);
     public static final ElementName TD = new ElementName("td", "td", TreeBuilder.TD_OR_TH | SPECIAL | SCOPING | OPTIONAL_END_TAG);
     public static final ElementName TH = new ElementName("th", "th", TreeBuilder.TD_OR_TH | SPECIAL | SCOPING | OPTIONAL_END_TAG);
     public static final ElementName TR = new ElementName("tr", "tr", TreeBuilder.TR | SPECIAL | FOSTER_PARENTING | OPTIONAL_END_TAG);
     public static final ElementName TT = new ElementName("tt", "tt", TreeBuilder.B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U);
     public static final ElementName UL = new ElementName("ul", "ul", TreeBuilder.UL_OR_OL_OR_DL | SPECIAL);
     public static final ElementName AND = new ElementName("and", "and", TreeBuilder.OTHER);
     public static final ElementName ARG = new ElementName("arg", "arg", TreeBuilder.OTHER);
     public static final ElementName ABS = new ElementName("abs", "abs", TreeBuilder.OTHER);
@@ -482,17 +482,17 @@ public final class ElementName
     public static final ElementName MIN = new ElementName("min", "min", TreeBuilder.OTHER);
     public static final ElementName MAP = new ElementName("map", "map", TreeBuilder.OTHER);
     public static final ElementName MTR = new ElementName("mtr", "mtr", TreeBuilder.OTHER);
     public static final ElementName MAX = new ElementName("max", "max", TreeBuilder.OTHER);
     public static final ElementName NEQ = new ElementName("neq", "neq", TreeBuilder.OTHER);
     public static final ElementName NOT = new ElementName("not", "not", TreeBuilder.OTHER);
     public static final ElementName NAV = new ElementName("nav", "nav", TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
     public static final ElementName PRE = new ElementName("pre", "pre", TreeBuilder.PRE_OR_LISTING | SPECIAL);
-    public static final ElementName RTC = new ElementName("rtc", "rtc", TreeBuilder.RB_OR_RP_OR_RTC | OPTIONAL_END_TAG);
+    public static final ElementName RTC = new ElementName("rtc", "rtc", TreeBuilder.RB_OR_RTC | OPTIONAL_END_TAG);
     public static final ElementName REM = new ElementName("rem", "rem", TreeBuilder.OTHER);
     public static final ElementName SUB = new ElementName("sub", "sub", TreeBuilder.RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR);
     public static final ElementName SEC = new ElementName("sec", "sec", TreeBuilder.OTHER);
     public static final ElementName SVG = new ElementName("svg", "svg", TreeBuilder.SVG);
     public static final ElementName SUM = new ElementName("sum", "sum", TreeBuilder.OTHER);
     public static final ElementName SIN = new ElementName("sin", "sin", TreeBuilder.OTHER);
     public static final ElementName SEP = new ElementName("sep", "sep", TreeBuilder.OTHER);
     public static final ElementName SUP = new ElementName("sup", "sup", TreeBuilder.RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR);
--- a/parser/html/javasrc/TreeBuilder.java
+++ b/parser/html/javasrc/TreeBuilder.java
@@ -168,17 +168,17 @@ public abstract class TreeBuilder<T> imp
     final static int AREA_OR_WBR = 49;
 
     final static int DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU = 50;
 
     final static int ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY = 51;
 
     final static int RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR = 52;
 
-    final static int RB_OR_RP_OR_RTC = 53;
+    final static int RB_OR_RTC = 53;
 
     final static int PARAM_OR_SOURCE_OR_TRACK = 55;
 
     final static int MGLYPH_OR_MALIGNMARK = 56;
 
     final static int MI_MO_MN_MS_MTEXT = 57;
 
     final static int ANNOTATION_XML = 58;
@@ -198,17 +198,17 @@ public abstract class TreeBuilder<T> imp
     final static int KEYGEN = 65;
 
     final static int MENUITEM = 66;
 
     final static int TEMPLATE = 67;
 
     final static int IMG = 68;
 
-    final static int RT = 69;
+    final static int RT_OR_RP = 69;
 
     // start insertion modes
 
     private static final int IN_ROW = 0;
 
     private static final int IN_TABLE_BODY = 1;
 
     private static final int IN_TABLE = 2;
@@ -2405,34 +2405,34 @@ public abstract class TreeBuilder<T> imp
                                     pop();
                                 }
                                 reconstructTheActiveFormattingElements();
                                 appendToCurrentNodeAndPushElementMayFoster(
                                         elementName,
                                         attributes);
                                 attributes = null; // CPP
                                 break starttagloop;
-                            case RB_OR_RP_OR_RTC:
+                            case RB_OR_RTC:
                                 eltPos = findLastInScope("ruby");
                                 if (eltPos != NOT_FOUND_ON_STACK) {
                                     generateImpliedEndTags();
                                 }
                                 if (eltPos != currentPtr) {
                                     if (eltPos != NOT_FOUND_ON_STACK) {
                                         errStartTagSeenWithoutRuby(name);
                                     } else {
                                         errUnclosedChildrenInRuby();
                                     }
                                 }
                                 appendToCurrentNodeAndPushElementMayFoster(
                                         elementName,
                                         attributes);
                                 attributes = null; // CPP
                                 break starttagloop;
-                            case RT:
+                            case RT_OR_RP:
                                 eltPos = findLastInScope("ruby");
                                 if (eltPos != NOT_FOUND_ON_STACK) {
                                     generateImpliedEndTagsExceptFor("rtc");
                                 }
                                 if (eltPos != currentPtr) {
                                     if (!isCurrent("rtc")) {
                                         if (eltPos != NOT_FOUND_ON_STACK) {
                                             errStartTagSeenWithoutRuby(name);
@@ -3545,18 +3545,18 @@ public abstract class TreeBuilder<T> imp
                             if (errorHandler != null) {
                                 uncloseloop1: for (int i = 2; i <= currentPtr; i++) {
                                     switch (stack[i].getGroup()) {
                                         case DD_OR_DT:
                                         case LI:
                                         case OPTGROUP:
                                         case OPTION: // is this possible?
                                         case P:
-                                        case RB_OR_RP_OR_RTC:
-                                        case RT:
+                                        case RB_OR_RTC:
+                                        case RT_OR_RP:
                                         case TD_OR_TH:
                                         case TBODY_OR_THEAD_OR_TFOOT:
                                             break;
                                         default:
                                             errEndWithUnclosedElements(name);
                                             break uncloseloop1;
                                     }
                                 }
@@ -3570,18 +3570,18 @@ public abstract class TreeBuilder<T> imp
                                 break endtagloop;
                             }
                             if (errorHandler != null) {
                                 uncloseloop2: for (int i = 0; i <= currentPtr; i++) {
                                     switch (stack[i].getGroup()) {
                                         case DD_OR_DT:
                                         case LI:
                                         case P:
-                                        case RB_OR_RP_OR_RTC:
-                                        case RT:
+                                        case RB_OR_RTC:
+                                        case RT_OR_RP:
                                         case TBODY_OR_THEAD_OR_TFOOT:
                                         case TD_OR_TH:
                                         case BODY:
                                         case HTML:
                                             break;
                                         default:
                                             errEndWithUnclosedElements(name);
                                             break uncloseloop2;
@@ -4189,18 +4189,18 @@ public abstract class TreeBuilder<T> imp
         for (;;) {
             StackNode<T> node = stack[currentPtr];
             switch (node.getGroup()) {
                 case P:
                 case LI:
                 case DD_OR_DT:
                 case OPTION:
                 case OPTGROUP:
-                case RB_OR_RP_OR_RTC:
-                case RT:
+                case RB_OR_RTC:
+                case RT_OR_RP:
                     if (node.ns == "http://www.w3.org/1999/xhtml" && node.name == name) {
                         return;
                     }
                     pop();
                     continue;
                 default:
                     return;
             }
@@ -4210,18 +4210,18 @@ public abstract class TreeBuilder<T> imp
     private void generateImpliedEndTags() throws SAXException {
         for (;;) {
             switch (stack[currentPtr].getGroup()) {
                 case P:
                 case LI:
                 case DD_OR_DT:
                 case OPTION:
                 case OPTGROUP:
-                case RB_OR_RP_OR_RTC:
-                case RT:
+                case RB_OR_RTC:
+                case RT_OR_RP:
                     pop();
                     continue;
                 default:
                     return;
             }
         }
     }
 
--- a/parser/html/nsHtml5ElementName.cpp
+++ b/parser/html/nsHtml5ElementName.cpp
@@ -570,19 +570,19 @@ nsHtml5ElementName::initializeStatics()
   ELT_LT = new nsHtml5ElementName(nsHtml5Atoms::lt, nsHtml5Atoms::lt, NS_HTML5TREE_BUILDER_OTHER);
   ELT_MI = new nsHtml5ElementName(nsHtml5Atoms::mi, nsHtml5Atoms::mi, NS_HTML5TREE_BUILDER_MI_MO_MN_MS_MTEXT | NS_HTML5ELEMENT_NAME_SCOPING_AS_MATHML);
   ELT_MN = new nsHtml5ElementName(nsHtml5Atoms::mn, nsHtml5Atoms::mn, NS_HTML5TREE_BUILDER_MI_MO_MN_MS_MTEXT | NS_HTML5ELEMENT_NAME_SCOPING_AS_MATHML);
   ELT_MO = new nsHtml5ElementName(nsHtml5Atoms::mo, nsHtml5Atoms::mo, NS_HTML5TREE_BUILDER_MI_MO_MN_MS_MTEXT | NS_HTML5ELEMENT_NAME_SCOPING_AS_MATHML);
   ELT_MS = new nsHtml5ElementName(nsHtml5Atoms::ms, nsHtml5Atoms::ms, NS_HTML5TREE_BUILDER_MI_MO_MN_MS_MTEXT | NS_HTML5ELEMENT_NAME_SCOPING_AS_MATHML);
   ELT_OL = new nsHtml5ElementName(nsHtml5Atoms::ol, nsHtml5Atoms::ol, NS_HTML5TREE_BUILDER_UL_OR_OL_OR_DL | NS_HTML5ELEMENT_NAME_SPECIAL);
   ELT_OR = new nsHtml5ElementName(nsHtml5Atoms::or_, nsHtml5Atoms::or_, NS_HTML5TREE_BUILDER_OTHER);
   ELT_PI = new nsHtml5ElementName(nsHtml5Atoms::pi, nsHtml5Atoms::pi, NS_HTML5TREE_BUILDER_OTHER);
-  ELT_RB = new nsHtml5ElementName(nsHtml5Atoms::rb, nsHtml5Atoms::rb, NS_HTML5TREE_BUILDER_RB_OR_RP_OR_RTC | NS_HTML5ELEMENT_NAME_OPTIONAL_END_TAG);
-  ELT_RP = new nsHtml5ElementName(nsHtml5Atoms::rp, nsHtml5Atoms::rp, NS_HTML5TREE_BUILDER_RB_OR_RP_OR_RTC | NS_HTML5ELEMENT_NAME_OPTIONAL_END_TAG);
-  ELT_RT = new nsHtml5ElementName(nsHtml5Atoms::rt, nsHtml5Atoms::rt, NS_HTML5TREE_BUILDER_RT | NS_HTML5ELEMENT_NAME_OPTIONAL_END_TAG);
+  ELT_RB = new nsHtml5ElementName(nsHtml5Atoms::rb, nsHtml5Atoms::rb, NS_HTML5TREE_BUILDER_RB_OR_RTC | NS_HTML5ELEMENT_NAME_OPTIONAL_END_TAG);
+  ELT_RP = new nsHtml5ElementName(nsHtml5Atoms::rp, nsHtml5Atoms::rp, NS_HTML5TREE_BUILDER_RT_OR_RP | NS_HTML5ELEMENT_NAME_OPTIONAL_END_TAG);
+  ELT_RT = new nsHtml5ElementName(nsHtml5Atoms::rt, nsHtml5Atoms::rt, NS_HTML5TREE_BUILDER_RT_OR_RP | NS_HTML5ELEMENT_NAME_OPTIONAL_END_TAG);
   ELT_TD = new nsHtml5ElementName(nsHtml5Atoms::td, nsHtml5Atoms::td, NS_HTML5TREE_BUILDER_TD_OR_TH | NS_HTML5ELEMENT_NAME_SPECIAL | NS_HTML5ELEMENT_NAME_SCOPING | NS_HTML5ELEMENT_NAME_OPTIONAL_END_TAG);
   ELT_TH = new nsHtml5ElementName(nsHtml5Atoms::th, nsHtml5Atoms::th, NS_HTML5TREE_BUILDER_TD_OR_TH | NS_HTML5ELEMENT_NAME_SPECIAL | NS_HTML5ELEMENT_NAME_SCOPING | NS_HTML5ELEMENT_NAME_OPTIONAL_END_TAG);
   ELT_TR = new nsHtml5ElementName(nsHtml5Atoms::tr, nsHtml5Atoms::tr, NS_HTML5TREE_BUILDER_TR | NS_HTML5ELEMENT_NAME_SPECIAL | NS_HTML5ELEMENT_NAME_FOSTER_PARENTING | NS_HTML5ELEMENT_NAME_OPTIONAL_END_TAG);
   ELT_TT = new nsHtml5ElementName(nsHtml5Atoms::tt, nsHtml5Atoms::tt, NS_HTML5TREE_BUILDER_B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U);
   ELT_UL = new nsHtml5ElementName(nsHtml5Atoms::ul, nsHtml5Atoms::ul, NS_HTML5TREE_BUILDER_UL_OR_OL_OR_DL | NS_HTML5ELEMENT_NAME_SPECIAL);
   ELT_AND = new nsHtml5ElementName(nsHtml5Atoms::and_, nsHtml5Atoms::and_, NS_HTML5TREE_BUILDER_OTHER);
   ELT_ARG = new nsHtml5ElementName(nsHtml5Atoms::arg, nsHtml5Atoms::arg, NS_HTML5TREE_BUILDER_OTHER);
   ELT_ABS = new nsHtml5ElementName(nsHtml5Atoms::abs, nsHtml5Atoms::abs, NS_HTML5TREE_BUILDER_OTHER);
@@ -610,17 +610,17 @@ nsHtml5ElementName::initializeStatics()
   ELT_MIN = new nsHtml5ElementName(nsHtml5Atoms::min, nsHtml5Atoms::min, NS_HTML5TREE_BUILDER_OTHER);
   ELT_MAP = new nsHtml5ElementName(nsHtml5Atoms::map, nsHtml5Atoms::map, NS_HTML5TREE_BUILDER_OTHER);
   ELT_MTR = new nsHtml5ElementName(nsHtml5Atoms::mtr, nsHtml5Atoms::mtr, NS_HTML5TREE_BUILDER_OTHER);
   ELT_MAX = new nsHtml5ElementName(nsHtml5Atoms::max, nsHtml5Atoms::max, NS_HTML5TREE_BUILDER_OTHER);
   ELT_NEQ = new nsHtml5ElementName(nsHtml5Atoms::neq, nsHtml5Atoms::neq, NS_HTML5TREE_BUILDER_OTHER);
   ELT_NOT = new nsHtml5ElementName(nsHtml5Atoms::not_, nsHtml5Atoms::not_, NS_HTML5TREE_BUILDER_OTHER);
   ELT_NAV = new nsHtml5ElementName(nsHtml5Atoms::nav, nsHtml5Atoms::nav, NS_HTML5TREE_BUILDER_ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | NS_HTML5ELEMENT_NAME_SPECIAL);
   ELT_PRE = new nsHtml5ElementName(nsHtml5Atoms::pre, nsHtml5Atoms::pre, NS_HTML5TREE_BUILDER_PRE_OR_LISTING | NS_HTML5ELEMENT_NAME_SPECIAL);
-  ELT_RTC = new nsHtml5ElementName(nsHtml5Atoms::rtc, nsHtml5Atoms::rtc, NS_HTML5TREE_BUILDER_RB_OR_RP_OR_RTC | NS_HTML5ELEMENT_NAME_OPTIONAL_END_TAG);
+  ELT_RTC = new nsHtml5ElementName(nsHtml5Atoms::rtc, nsHtml5Atoms::rtc, NS_HTML5TREE_BUILDER_RB_OR_RTC | NS_HTML5ELEMENT_NAME_OPTIONAL_END_TAG);
   ELT_REM = new nsHtml5ElementName(nsHtml5Atoms::rem, nsHtml5Atoms::rem, NS_HTML5TREE_BUILDER_OTHER);
   ELT_SUB = new nsHtml5ElementName(nsHtml5Atoms::sub, nsHtml5Atoms::sub, NS_HTML5TREE_BUILDER_RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR);
   ELT_SEC = new nsHtml5ElementName(nsHtml5Atoms::sec, nsHtml5Atoms::sec, NS_HTML5TREE_BUILDER_OTHER);
   ELT_SVG = new nsHtml5ElementName(nsHtml5Atoms::svg, nsHtml5Atoms::svg, NS_HTML5TREE_BUILDER_SVG);
   ELT_SUM = new nsHtml5ElementName(nsHtml5Atoms::sum, nsHtml5Atoms::sum, NS_HTML5TREE_BUILDER_OTHER);
   ELT_SIN = new nsHtml5ElementName(nsHtml5Atoms::sin, nsHtml5Atoms::sin, NS_HTML5TREE_BUILDER_OTHER);
   ELT_SEP = new nsHtml5ElementName(nsHtml5Atoms::sep, nsHtml5Atoms::sep, NS_HTML5TREE_BUILDER_OTHER);
   ELT_SUP = new nsHtml5ElementName(nsHtml5Atoms::sup, nsHtml5Atoms::sup, NS_HTML5TREE_BUILDER_RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR);
--- a/parser/html/nsHtml5TreeBuilder.cpp
+++ b/parser/html/nsHtml5TreeBuilder.cpp
@@ -1317,33 +1317,33 @@ nsHtml5TreeBuilder::startTag(nsHtml5Elem
               if (isCurrent(nsHtml5Atoms::option)) {
                 pop();
               }
               reconstructTheActiveFormattingElements();
               appendToCurrentNodeAndPushElementMayFoster(elementName, attributes);
               attributes = nullptr;
               NS_HTML5_BREAK(starttagloop);
             }
-            case NS_HTML5TREE_BUILDER_RB_OR_RP_OR_RTC: {
+            case NS_HTML5TREE_BUILDER_RB_OR_RTC: {
               eltPos = findLastInScope(nsHtml5Atoms::ruby);
               if (eltPos != NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) {
                 generateImpliedEndTags();
               }
               if (eltPos != currentPtr) {
                 if (eltPos != NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) {
                   errStartTagSeenWithoutRuby(name);
                 } else {
                   errUnclosedChildrenInRuby();
                 }
               }
               appendToCurrentNodeAndPushElementMayFoster(elementName, attributes);
               attributes = nullptr;
               NS_HTML5_BREAK(starttagloop);
             }
-            case NS_HTML5TREE_BUILDER_RT: {
+            case NS_HTML5TREE_BUILDER_RT_OR_RP: {
               eltPos = findLastInScope(nsHtml5Atoms::ruby);
               if (eltPos != NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) {
                 generateImpliedEndTagsExceptFor(nsHtml5Atoms::rtc);
               }
               if (eltPos != currentPtr) {
                 if (!isCurrent(nsHtml5Atoms::rtc)) {
                   if (eltPos != NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) {
                     errStartTagSeenWithoutRuby(name);
@@ -2461,18 +2461,18 @@ nsHtml5TreeBuilder::endTag(nsHtml5Elemen
             if (MOZ_UNLIKELY(mViewSource)) {
               for (int32_t i = 2; i <= currentPtr; i++) {
                 switch(stack[i]->getGroup()) {
                   case NS_HTML5TREE_BUILDER_DD_OR_DT:
                   case NS_HTML5TREE_BUILDER_LI:
                   case NS_HTML5TREE_BUILDER_OPTGROUP:
                   case NS_HTML5TREE_BUILDER_OPTION:
                   case NS_HTML5TREE_BUILDER_P:
-                  case NS_HTML5TREE_BUILDER_RB_OR_RP_OR_RTC:
-                  case NS_HTML5TREE_BUILDER_RT:
+                  case NS_HTML5TREE_BUILDER_RB_OR_RTC:
+                  case NS_HTML5TREE_BUILDER_RT_OR_RP:
                   case NS_HTML5TREE_BUILDER_TD_OR_TH:
                   case NS_HTML5TREE_BUILDER_TBODY_OR_THEAD_OR_TFOOT: {
                     break;
                   }
                   default: {
                     errEndWithUnclosedElements(name);
                     NS_HTML5_BREAK(uncloseloop1);
                   }
@@ -2490,18 +2490,18 @@ nsHtml5TreeBuilder::endTag(nsHtml5Elemen
               NS_HTML5_BREAK(endtagloop);
             }
             if (MOZ_UNLIKELY(mViewSource)) {
               for (int32_t i = 0; i <= currentPtr; i++) {
                 switch(stack[i]->getGroup()) {
                   case NS_HTML5TREE_BUILDER_DD_OR_DT:
                   case NS_HTML5TREE_BUILDER_LI:
                   case NS_HTML5TREE_BUILDER_P:
-                  case NS_HTML5TREE_BUILDER_RB_OR_RP_OR_RTC:
-                  case NS_HTML5TREE_BUILDER_RT:
+                  case NS_HTML5TREE_BUILDER_RB_OR_RTC:
+                  case NS_HTML5TREE_BUILDER_RT_OR_RP:
                   case NS_HTML5TREE_BUILDER_TBODY_OR_THEAD_OR_TFOOT:
                   case NS_HTML5TREE_BUILDER_TD_OR_TH:
                   case NS_HTML5TREE_BUILDER_BODY:
                   case NS_HTML5TREE_BUILDER_HTML: {
                     break;
                   }
                   default: {
                     errEndWithUnclosedElements(name);
@@ -3131,18 +3131,18 @@ nsHtml5TreeBuilder::generateImpliedEndTa
   for (; ; ) {
     nsHtml5StackNode* node = stack[currentPtr];
     switch(node->getGroup()) {
       case NS_HTML5TREE_BUILDER_P:
       case NS_HTML5TREE_BUILDER_LI:
       case NS_HTML5TREE_BUILDER_DD_OR_DT:
       case NS_HTML5TREE_BUILDER_OPTION:
       case NS_HTML5TREE_BUILDER_OPTGROUP:
-      case NS_HTML5TREE_BUILDER_RB_OR_RP_OR_RTC:
-      case NS_HTML5TREE_BUILDER_RT: {
+      case NS_HTML5TREE_BUILDER_RB_OR_RTC:
+      case NS_HTML5TREE_BUILDER_RT_OR_RP: {
         if (node->ns == kNameSpaceID_XHTML && node->name == name) {
           return;
         }
         pop();
         continue;
       }
       default: {
         return;
@@ -3156,18 +3156,18 @@ nsHtml5TreeBuilder::generateImpliedEndTa
 {
   for (; ; ) {
     switch(stack[currentPtr]->getGroup()) {
       case NS_HTML5TREE_BUILDER_P:
       case NS_HTML5TREE_BUILDER_LI:
       case NS_HTML5TREE_BUILDER_DD_OR_DT:
       case NS_HTML5TREE_BUILDER_OPTION:
       case NS_HTML5TREE_BUILDER_OPTGROUP:
-      case NS_HTML5TREE_BUILDER_RB_OR_RP_OR_RTC:
-      case NS_HTML5TREE_BUILDER_RT: {
+      case NS_HTML5TREE_BUILDER_RB_OR_RTC:
+      case NS_HTML5TREE_BUILDER_RT_OR_RP: {
         pop();
         continue;
       }
       default: {
         return;
       }
     }
   }
--- a/parser/html/nsHtml5TreeBuilder.h
+++ b/parser/html/nsHtml5TreeBuilder.h
@@ -318,32 +318,32 @@ class nsHtml5TreeBuilder : public nsAHtm
 #define NS_HTML5TREE_BUILDER_B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U 45
 #define NS_HTML5TREE_BUILDER_UL_OR_OL_OR_DL 46
 #define NS_HTML5TREE_BUILDER_IFRAME 47
 #define NS_HTML5TREE_BUILDER_EMBED 48
 #define NS_HTML5TREE_BUILDER_AREA_OR_WBR 49
 #define NS_HTML5TREE_BUILDER_DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU 50
 #define NS_HTML5TREE_BUILDER_ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY 51
 #define NS_HTML5TREE_BUILDER_RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR 52
-#define NS_HTML5TREE_BUILDER_RB_OR_RP_OR_RTC 53
+#define NS_HTML5TREE_BUILDER_RB_OR_RTC 53
 #define NS_HTML5TREE_BUILDER_PARAM_OR_SOURCE_OR_TRACK 55
 #define NS_HTML5TREE_BUILDER_MGLYPH_OR_MALIGNMARK 56
 #define NS_HTML5TREE_BUILDER_MI_MO_MN_MS_MTEXT 57
 #define NS_HTML5TREE_BUILDER_ANNOTATION_XML 58
 #define NS_HTML5TREE_BUILDER_FOREIGNOBJECT_OR_DESC 59
 #define NS_HTML5TREE_BUILDER_NOEMBED 60
 #define NS_HTML5TREE_BUILDER_FIELDSET 61
 #define NS_HTML5TREE_BUILDER_OUTPUT_OR_LABEL 62
 #define NS_HTML5TREE_BUILDER_OBJECT 63
 #define NS_HTML5TREE_BUILDER_FONT 64
 #define NS_HTML5TREE_BUILDER_KEYGEN 65
 #define NS_HTML5TREE_BUILDER_MENUITEM 66
 #define NS_HTML5TREE_BUILDER_TEMPLATE 67
 #define NS_HTML5TREE_BUILDER_IMG 68
-#define NS_HTML5TREE_BUILDER_RT 69
+#define NS_HTML5TREE_BUILDER_RT_OR_RP 69
 #define NS_HTML5TREE_BUILDER_IN_ROW 0
 #define NS_HTML5TREE_BUILDER_IN_TABLE_BODY 1
 #define NS_HTML5TREE_BUILDER_IN_TABLE 2
 #define NS_HTML5TREE_BUILDER_IN_CAPTION 3
 #define NS_HTML5TREE_BUILDER_IN_CELL 4
 #define NS_HTML5TREE_BUILDER_FRAMESET_OK 5
 #define NS_HTML5TREE_BUILDER_IN_BODY 6
 #define NS_HTML5TREE_BUILDER_IN_HEAD 7