Bug 711052 - Make <rp> and <rt> handling match spec edits. r=smaug.
authorHenri Sivonen <hsivonen@iki.fi>
Mon, 02 Jan 2012 16:18:29 +0200
changeset 83656 2f3dbb399dbfb981b293c70f8171b7924d6e8236
parent 83640 31b7a15bc54de48552146a1718f3e4eca4c5117f
child 83657 f50dc1ff3794dbc313133276dbed60482db9742e
push id21781
push usermak77@bonardo.net
push dateTue, 03 Jan 2012 11:36:52 +0000
treeherdermozilla-central@cb73188eedf8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs711052
milestone12.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 711052 - Make <rp> and <rt> handling match spec edits. r=smaug.
parser/html/javasrc/TreeBuilder.java
parser/html/nsHtml5TreeBuilder.cpp
parser/htmlparser/tests/mochitest/html5_tree_construction_exceptions.js
parser/htmlparser/tests/mochitest/html5lib_tree_construction/plain-text-unsafe.dat
parser/htmlparser/tests/mochitest/html5lib_tree_construction/tables01.dat
parser/htmlparser/tests/mochitest/html5lib_tree_construction/tests16.dat
parser/htmlparser/tests/mochitest/html5lib_tree_construction/tests19.dat
parser/htmlparser/tests/mochitest/html5lib_tree_construction/tests26.dat
parser/htmlparser/tests/mochitest/html5lib_tree_construction/tests_innerHTML_1.dat
parser/htmlparser/tests/mochitest/html5lib_tree_construction/webkit01.dat
--- a/parser/html/javasrc/TreeBuilder.java
+++ b/parser/html/javasrc/TreeBuilder.java
@@ -2281,40 +2281,26 @@ public abstract class TreeBuilder<T> imp
                                 }
                                 reconstructTheActiveFormattingElements();
                                 appendToCurrentNodeAndPushElementMayFoster(
                                         elementName,
                                         attributes);
                                 attributes = null; // CPP
                                 break starttagloop;
                             case RT_OR_RP:
-                                /*
-                                 * If the stack of open elements has a ruby
-                                 * element in scope, then generate implied end
-                                 * tags. If the current node is not then a ruby
-                                 * element, this is a parse error; pop all the
-                                 * nodes from the current node up to the node
-                                 * immediately before the bottommost ruby
-                                 * element on the stack of open elements.
-                                 * 
-                                 * Insert an HTML element for the token.
-                                 */
                                 eltPos = findLastInScope("ruby");
                                 if (eltPos != NOT_FOUND_ON_STACK) {
                                     generateImpliedEndTags();
                                 }
                                 if (eltPos != currentPtr) {
                                     if (eltPos != NOT_FOUND_ON_STACK) {
                                         errStartTagSeenWithoutRuby(name);
                                     } else {
                                         errUnclosedChildrenInRuby();
                                     }
-                                    while (currentPtr > eltPos) {
-                                        pop();
-                                    }
                                 }
                                 appendToCurrentNodeAndPushElementMayFoster(
                                         elementName,
                                         attributes);
                                 attributes = null; // CPP
                                 break starttagloop;
                             case MATH:
                                 reconstructTheActiveFormattingElements();
--- a/parser/html/nsHtml5TreeBuilder.cpp
+++ b/parser/html/nsHtml5TreeBuilder.cpp
@@ -1242,19 +1242,16 @@ nsHtml5TreeBuilder::startTag(nsHtml5Elem
                 generateImpliedEndTags();
               }
               if (eltPos != currentPtr) {
                 if (eltPos != NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) {
                   errStartTagSeenWithoutRuby(name);
                 } else {
                   errUnclosedChildrenInRuby();
                 }
-                while (currentPtr > eltPos) {
-                  pop();
-                }
               }
               appendToCurrentNodeAndPushElementMayFoster(elementName, attributes);
               attributes = nsnull;
               NS_HTML5_BREAK(starttagloop);
             }
             case NS_HTML5TREE_BUILDER_MATH: {
               reconstructTheActiveFormattingElements();
               attributes->adjustForMath();
--- a/parser/htmlparser/tests/mochitest/html5_tree_construction_exceptions.js
+++ b/parser/htmlparser/tests/mochitest/html5_tree_construction_exceptions.js
@@ -3,9 +3,17 @@
  * files under html5lib_tree_construction/. Please see
  * html5lib_tree_construction/html5lib_license.txt for the license for these
  * tests.
  */
 var html5Exceptions = {
   "<!doctype html><keygen><frameset>" : true, // Bug 101019
   "<select><keygen>" : true, // Bug 101019
   "<!DOCTYPE html><body><keygen>A" : true, // Bug 101019
+  "<!DOCTYPE html><math><mtext><p><i></p>a" : true, // Bug 711049
+  "<!DOCTYPE html><table><tr><td><math><mtext><p><i></p>a" : true, // Bug 711049
+  "<!DOCTYPE html><table><tr><td><math><mtext>\u0000a" : true, // Bug 711049
+  "<!DOCTYPE html><math><mi>a\u0000b" : true, // Bug 711049
+  "<!DOCTYPE html><math><mo>a\u0000b" : true, // Bug 711049
+  "<!DOCTYPE html><math><mn>a\u0000b" : true, // Bug 711049
+  "<!DOCTYPE html><math><ms>a\u0000b" : true, // Bug 711049
+  "<!DOCTYPE html><math><mtext>a\u0000b" : true, // Bug 711049
 }
index 1f01e86f405219b13c6de7075a45619f9d114ade..04cc11fb9d458ea32dca02e2f3bf39221196ab8e
GIT binary patch
literal 4166
zc%0o=O^?$s5Y5?A|HCwuxS;O#P%euVsoE~rAh8@^wTDUL?gr&ciGfApuOWUCe}S=+
zHg%eXG#^ExQWa-Le(%k*GfrkcN@Q<b_r>gKu~@8Me{@|o6IqsIIh*;(=5r)s$-V=B
zlu_u=0B9)CFNa>@e=CLnHo;72zRhT+f-UA)e4Ak;av>dlxgVZFQcW^|!Gf`%(Zb%)
zhBb(FS4OkNVx!r@a}kP-B#Mqc>;QJK9e{R%^j(knX^25A#S>Mt4Z=`lmb&R)S%p_d
zXw`rH{83=jK&9wXZG-&FgTtqH*Xz~o>dw$`f8TkdDO6C%Ek)?Ld}?(koX+P!kT9P+
zN2muy^(HWCXkgQJZj(#|53%cg(%bZae>g*R#3b71$nJtuQJPCVj+mp>t&#HHt*e>S
zuGw+aFEl%hMGx)xaV&mp$ImZ|T{%n(E-f7%6Z>GcGRx?BDauDWn99r0)$nvMxar!x
zzWwm_28zQk&4e>y6SgAlG;GE;=d?XL6x`l2wzB^yVe+p9jLrW%y+kh*bjj%NJ3P``
zC@M~I-0N8`uizbih4(M%m39F^47tn%Mi*@P>I!aRACfIl*Ayy+yIu~lTK^O`0yc?0
z$u9<|tWaEa3wf9=BH7`s3ixJ#LaI>E)z&imocZQa{cLP&X43)sKYM!AtBlOE2Yd@-
z%WWCZXM{K4L(;Gb%2;5$fuQ#{Wy#r;B_}G2&!#LsQCWUAW%-H9^rL?+arHi<_5B7{
C$<?I*
--- a/parser/htmlparser/tests/mochitest/html5lib_tree_construction/tables01.dat
+++ b/parser/htmlparser/tests/mochitest/html5lib_tree_construction/tables01.dat
@@ -190,8 +190,23 @@
 |   <head>
 |   <body>
 |     <table>
 |       <tbody>
 |         <tr>
 |           <td>
 |             <button>
 |           <td>
+
+#data
+<table><tr><td><svg><desc><td>
+#errors
+#document
+| <html>
+|   <head>
+|   <body>
+|     <table>
+|       <tbody>
+|         <tr>
+|           <td>
+|             <svg svg>
+|               <svg desc>
+|           <td>
--- a/parser/htmlparser/tests/mochitest/html5lib_tree_construction/tests16.dat
+++ b/parser/htmlparser/tests/mochitest/html5lib_tree_construction/tests16.dat
@@ -1071,16 +1071,38 @@ Line: 1 Col: 64 Unexpected end tag (text
 | <!DOCTYPE html>
 | <html>
 |   <head>
 |   <body>
 |     <textarea>
 |       "</textarea>"
 
 #data
+<!doctype html><textarea>&lt;</textarea>
+#errors
+#document
+| <!DOCTYPE html>
+| <html>
+|   <head>
+|   <body>
+|     <textarea>
+|       "<"
+
+#data
+<!doctype html><textarea>a&lt;b</textarea>
+#errors
+#document
+| <!DOCTYPE html>
+| <html>
+|   <head>
+|   <body>
+|     <textarea>
+|       "a<b"
+
+#data
 <!doctype html><iframe><!--<iframe></iframe>--></iframe>
 #errors
 Line: 1 Col: 56 Unexpected end tag (iframe).
 #document
 | <!DOCTYPE html>
 | <html>
 |   <head>
 |   <body>
--- a/parser/htmlparser/tests/mochitest/html5lib_tree_construction/tests19.dat
+++ b/parser/htmlparser/tests/mochitest/html5lib_tree_construction/tests19.dat
@@ -168,30 +168,30 @@
 #document
 | <!DOCTYPE html>
 | <html>
 |   <head>
 |   <body>
 |     <ruby>
 |       <div>
 |         <span>
-|       <rp>
+|           <rp>
 
 #data
 <!doctype html><ruby><div><p><rp>
 #errors
 #document
 | <!DOCTYPE html>
 | <html>
 |   <head>
 |   <body>
 |     <ruby>
 |       <div>
 |         <p>
-|       <rp>
+|         <rp>
 
 #data
 <!doctype html><ruby><p><rt>
 #errors
 #document
 | <!DOCTYPE html>
 | <html>
 |   <head>
@@ -206,30 +206,30 @@
 #document
 | <!DOCTYPE html>
 | <html>
 |   <head>
 |   <body>
 |     <ruby>
 |       <div>
 |         <span>
-|       <rt>
+|           <rt>
 
 #data
 <!doctype html><ruby><div><p><rt>
 #errors
 #document
 | <!DOCTYPE html>
 | <html>
 |   <head>
 |   <body>
 |     <ruby>
 |       <div>
 |         <p>
-|       <rt>
+|         <rt>
 
 #data
 <!doctype html><math/><foo>
 #errors
 #document
 | <!DOCTYPE html>
 | <html>
 |   <head>
@@ -1213,8 +1213,25 @@
 | <html>
 |   <head>
 |   <body>
 |     <p>
 |       <a>
 |     <plaintext>
 |       <a>
 |         "b"
+
+#data
+<!DOCTYPE html><div>a<a></div>b<p>c</p>d
+#errors
+#document
+| <!DOCTYPE html>
+| <html>
+|   <head>
+|   <body>
+|     <div>
+|       "a"
+|       <a>
+|     <a>
+|       "b"
+|       <p>
+|         "c"
+|       "d"
--- a/parser/htmlparser/tests/mochitest/html5lib_tree_construction/tests26.dat
+++ b/parser/htmlparser/tests/mochitest/html5lib_tree_construction/tests26.dat
@@ -267,17 +267,18 @@ 39: End of file in a foreign namespace c
 | <!DOCTYPE html>
 | <html>
 |   <head>
 |   <body>
 |     <math math>
 |       <math mtext>
 |         <p>
 |           <i>
-|         "a"
+|         <i>
+|           "a"
 
 #data
 <!DOCTYPE html><table><tr><td><math><mtext><p><i></p>a
 #errors
 53: End tag “p” seen, but there were open elements.
 49: Unclosed element “i”.
 54: End of file in a foreign namespace context.
 #document
@@ -288,17 +289,18 @@ 54: End of file in a foreign namespace c
 |     <table>
 |       <tbody>
 |         <tr>
 |           <td>
 |             <math math>
 |               <math mtext>
 |                 <p>
 |                   <i>
-|                 "a"
+|                 <i>
+|                   "a"
 
 #data
 <!DOCTYPE html><body><div><!/div>a
 #errors
 29: Bogus comment.
 34: End of file seen and there were open elements.
 26: Unclosed element “div”.
 #document
--- a/parser/htmlparser/tests/mochitest/html5lib_tree_construction/tests_innerHTML_1.dat
+++ b/parser/htmlparser/tests/mochitest/html5lib_tree_construction/tests_innerHTML_1.dat
@@ -726,8 +726,16 @@ html
 
 #data
 </frameset><frame>
 #errors
 #document-fragment
 frameset
 #document
 | <frame>
+
+#data
+#errors
+#document-fragment
+html
+#document
+| <head>
+| <body>
--- a/parser/htmlparser/tests/mochitest/html5lib_tree_construction/webkit01.dat
+++ b/parser/htmlparser/tests/mochitest/html5lib_tree_construction/webkit01.dat
@@ -284,30 +284,30 @@ console.log("FOO<span>BAR</span>BAZ");
 <html><body><ruby><div><rp>xx</rp></div></ruby></body></html>
 #errors
 #document
 | <html>
 |   <head>
 |   <body>
 |     <ruby>
 |       <div>
-|       <rp>
-|         "xx"
+|         <rp>
+|           "xx"
 
 #data
 <html><body><ruby><div><rt>xx</rt></div></ruby></body></html>
 #errors
 #document
 | <html>
 |   <head>
 |   <body>
 |     <ruby>
 |       <div>
-|       <rt>
-|         "xx"
+|         <rt>
+|           "xx"
 
 #data
 <html><frameset><!--1--><noframes>A</noframes><!--2--></frameset><!--3--><noframes>B</noframes><!--4--></html><!--5--><noframes>C</noframes><!--6-->
 #errors
 #document
 | <html>
 |   <head>
 |   <frameset>