New ruby parsing rule breaks some real web sites.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Aug 2014 21:30:24 +0000 (21:30 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Aug 2014 21:30:24 +0000 (21:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=136062

Patch by Yuki Sekiguchi <yuki.sekiguchi@access-company.com> on 2014-08-21
Reviewed by Ryosuke Niwa.

Source/WebCore:

An RP element should not auto close an RTC element.

The HTML5.1 spec was changed:
http://www.w3.org/html/wg/drafts/html/master/syntax.html#parsing-main-inbody
This was done at the following commit:
https://github.com/w3c/html/commit/c61397b989b28235ee2228f280aa8d475f3b9ebf

This patch changed the RP element's behavior to follow the spec change.

Test: fast/ruby/rp-inside-rtc.html

* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::processStartTagForInBody):

LayoutTests:

html5lib-test was updated using my pull request:
https://github.com/darobin/html5lib-tests/pull/2

* fast/ruby/rp-inside-rtc-expected.html: Added.
* fast/ruby/rp-inside-rtc.html: Added.
* html5lib/resources/ruby.dat: The rp element should not auto close the rtc element.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@172834 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/ruby/rp-inside-rtc-expected.html [new file with mode: 0644]
LayoutTests/fast/ruby/rp-inside-rtc.html [new file with mode: 0644]
LayoutTests/html5lib/resources/ruby.dat
Source/WebCore/ChangeLog
Source/WebCore/html/parser/HTMLTreeBuilder.cpp

index 387ecf5..beb5ad1 100644 (file)
@@ -1,5 +1,19 @@
 2014-08-21  Yuki Sekiguchi  <yuki.sekiguchi@access-company.com>
 
+        New ruby parsing rule breaks some real web sites.
+        https://bugs.webkit.org/show_bug.cgi?id=136062
+
+        Reviewed by Ryosuke Niwa.
+
+        html5lib-test was updated using my pull request:
+        https://github.com/darobin/html5lib-tests/pull/2
+
+        * fast/ruby/rp-inside-rtc-expected.html: Added.
+        * fast/ruby/rp-inside-rtc.html: Added.
+        * html5lib/resources/ruby.dat: The rp element should not auto close the rtc element.
+
+2014-08-21  Yuki Sekiguchi  <yuki.sekiguchi@access-company.com>
+
         REGRESSION: CSS not() selector does not work when it appears after or within @supports
         https://bugs.webkit.org/show_bug.cgi?id=136063
 
diff --git a/LayoutTests/fast/ruby/rp-inside-rtc-expected.html b/LayoutTests/fast/ruby/rp-inside-rtc-expected.html
new file mode 100644 (file)
index 0000000..6f72c4a
--- /dev/null
@@ -0,0 +1,3 @@
+<!DOCTYPE html>
+<div style="color: green">
+<ruby><rbc><rb>There </rb><rb>is </rb><rb>rb </rb><rb>inside </rb><rb>rbc, </rb><rb>and </rb><rb>it </rb><rb>should </rb><rb>be </rb><rb>green</rb></rbc><rtc><rp>(There are rp </rp><rt>and </rt><rt>rt </rt><rt>inside </rt><rt>rtc, </rt><rt>and </rt><rt>they </rt><rt>should </rt><rt>be </rt><rp>green)</rp></rtc></ruby>
diff --git a/LayoutTests/fast/ruby/rp-inside-rtc.html b/LayoutTests/fast/ruby/rp-inside-rtc.html
new file mode 100644 (file)
index 0000000..6d593ce
--- /dev/null
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<style>
+rbc > rb, rtc > rp, rtc > rt { color:green; }
+</style>
+<div style="color: red">
+<ruby><rbc><rb>There </rb><rb>is </rb><rb>rb </rb><rb>inside </rb><rb>rbc, </rb><rb>and </rb><rb>it </rb><rb>should </rb><rb>be </rb><rb>green</rb></rbc><rtc><rp>(There are rp </rp><rt>and </rt><rt>rt </rt><rt>inside </rt><rt>rtc, </rt><rt>and </rt><rt>they </rt><rt>should </rt><rt>be </rt><rp>green)</rp></rtc></ruby>
index 80d0c53..1ca8016 100644 (file)
 |       "a"
 |       <rtc>
 |         "b"
-|       <rp>
+|         <rp>
 
 #data
 <html><ruby>a<rtc>b<span></ruby></html>
index 4413d08..04870e1 100644 (file)
@@ -1,5 +1,26 @@
 2014-08-21  Yuki Sekiguchi  <yuki.sekiguchi@access-company.com>
 
+        New ruby parsing rule breaks some real web sites.
+        https://bugs.webkit.org/show_bug.cgi?id=136062
+
+        Reviewed by Ryosuke Niwa.
+
+        An RP element should not auto close an RTC element.
+
+        The HTML5.1 spec was changed:
+        http://www.w3.org/html/wg/drafts/html/master/syntax.html#parsing-main-inbody
+        This was done at the following commit:
+        https://github.com/w3c/html/commit/c61397b989b28235ee2228f280aa8d475f3b9ebf
+
+        This patch changed the RP element's behavior to follow the spec change.
+
+        Test: fast/ruby/rp-inside-rtc.html
+
+        * html/parser/HTMLTreeBuilder.cpp:
+        (WebCore::HTMLTreeBuilder::processStartTagForInBody):
+
+2014-08-21  Yuki Sekiguchi  <yuki.sekiguchi@access-company.com>
+
         REGRESSION: CSS not() selector does not work when it appears after or within @supports
         https://bugs.webkit.org/show_bug.cgi?id=136063
 
index 69d86d6..31f5492 100644 (file)
@@ -876,7 +876,7 @@ void HTMLTreeBuilder::processStartTagForInBody(AtomicHTMLToken* token)
         m_tree.insertHTMLElement(token);
         return;
     }
-    if (token->name() == rbTag || token->name() == rpTag || token->name() == rtcTag) {
+    if (token->name() == rbTag || token->name() == rtcTag) {
         if (m_tree.openElements()->inScope(rubyTag.localName())) {
             m_tree.generateImpliedEndTags();
             if (!m_tree.currentStackItem()->hasTagName(rubyTag))
@@ -885,7 +885,7 @@ void HTMLTreeBuilder::processStartTagForInBody(AtomicHTMLToken* token)
         m_tree.insertHTMLElement(token);
         return;
     }
-    if (token->name() == rtTag) {
+    if (token->name() == rtTag || token->name() == rpTag) {
         if (m_tree.openElements()->inScope(rubyTag.localName())) {
             m_tree.generateImpliedEndTagsWithExclusion(rtcTag.localName());
             if (!m_tree.currentStackItem()->hasTagName(rubyTag) && !m_tree.currentStackItem()->hasTagName(rtcTag))