From: <mgu...@us...> - 2008-09-11 09:12:00
|
Revision: 192 http://nekohtml.svn.sourceforge.net/nekohtml/?rev=192&view=rev Author: mguillem Date: 2008-09-11 09:12:09 +0000 (Thu, 11 Sep 2008) Log Message: ----------- #2094515 FONT tag should be considered like inline tags and reopened when closing was forced by an inline element to respect tag balancing. Modified Paths: -------------- trunk/doc/changes.html trunk/src/org/cyberneko/html/HTMLTagBalancer.java Added Paths: ----------- trunk/data/canonical/test-font-inline.html trunk/data/canonical/test-table-and-font.html trunk/data/test-font-inline.html trunk/data/test-table-and-font.html Added: trunk/data/canonical/test-font-inline.html =================================================================== --- trunk/data/canonical/test-font-inline.html (rev 0) +++ trunk/data/canonical/test-font-inline.html 2008-09-11 09:12:09 UTC (rev 192) @@ -0,0 +1,12 @@ +(HTML +(BODY +(B +(FONT +"first in bold +)FONT +)B +(FONT +", second +)FONT +)BODY +)HTML \ No newline at end of file Property changes on: trunk/data/canonical/test-font-inline.html ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/data/canonical/test-table-and-font.html =================================================================== --- trunk/data/canonical/test-table-and-font.html (rev 0) +++ trunk/data/canonical/test-table-and-font.html 2008-09-11 09:12:09 UTC (rev 192) @@ -0,0 +1,36 @@ +(HTML +"\n +(BODY +"\n +(FONT +"\n +(TABLE +"\n +(TR +"\n +(TD +(B +(FONT +"\nRow 1 +)FONT +)B +(FONT +", Cell 1 +)FONT +)TD +"\n +(TD +"Row 1, Cell 2 +)TD +"\n +)TR +"\n +)TABLE +"\n +(P +"Test paragraph 2 (after table) +)P +)FONT +"\n +)BODY +)HTML \ No newline at end of file Property changes on: trunk/data/canonical/test-table-and-font.html ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/data/test-font-inline.html =================================================================== --- trunk/data/test-font-inline.html (rev 0) +++ trunk/data/test-font-inline.html 2008-09-11 09:12:09 UTC (rev 192) @@ -0,0 +1 @@ +<B><font>first in bold</B>, second</font> \ No newline at end of file Property changes on: trunk/data/test-font-inline.html ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/data/test-table-and-font.html =================================================================== --- trunk/data/test-table-and-font.html (rev 0) +++ trunk/data/test-table-and-font.html 2008-09-11 09:12:09 UTC (rev 192) @@ -0,0 +1,12 @@ +<html> +<body> +<font> +<TABLE> +<TR> +<TD><B><font> +Row 1</B>, Cell 1</font></TD> +<TD>Row 1, Cell 2</TD> +</TR> +</TABLE> +<p>Test paragraph 2 (after table)</p></font> +</body> \ No newline at end of file Property changes on: trunk/data/test-table-and-font.html ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: trunk/doc/changes.html =================================================================== --- trunk/doc/changes.html 2008-08-29 12:48:42 UTC (rev 191) +++ trunk/doc/changes.html 2008-09-11 09:12:09 UTC (rev 192) @@ -28,8 +28,10 @@ <dd>Fixed bugs #2059466 and #2051091 (accepting unknown tags within inline elements as well as as containers, don't accept any container in head), #2039483 (wrong augmentation when attribute value contains a newline, patch from Ian Roberts), #2039915 (failed skip() does not back up columnNumber, patch from Ian Roberts), - added new feature <code>http://cyberneko.org/html/features/parse-noscript-content</code> to turn off <noscript> content parsing + added new feature <code>http://cyberneko.org/html/features/parse-noscript-content</code> to turn off <noscript> content parsing, + #2094515 FONT tag should be considered like inline tags and reopened when closing was forced by an inline element to respect tag balancing. + <dt>Version 1.9.8 (22 Jul 2008) <dd>Fixed bugs #1949460 (handling of uppercase 'X' for entities in hexadecimal format), #1951703 (isEncodingCompatible throws UnsupportedOperationException when default encoding is JISAutoDetect, patch from Tatsuhiko Miyabe), Modified: trunk/src/org/cyberneko/html/HTMLTagBalancer.java =================================================================== --- trunk/src/org/cyberneko/html/HTMLTagBalancer.java 2008-08-29 12:48:42 UTC (rev 191) +++ trunk/src/org/cyberneko/html/HTMLTagBalancer.java 2008-09-11 09:12:09 UTC (rev 192) @@ -831,6 +831,7 @@ /** End element. */ public void endElement(final QName element, final Augmentations augs) throws XNIException { // is there anything to do? +System.out.println("end: " + element.localpart); if (fSeenRootElementEnd) { notifyDiscardedEndElement(element, augs); return; @@ -869,12 +870,12 @@ // find unbalanced inline elements if (depth > 1 && elem.isInline()) { - int size = fElementStack.top; + final int size = fElementStack.top; fInlineStack.top = 0; for (int i = 0; i < depth - 1; i++) { - Info info = fElementStack.data[size - i - 1]; - HTMLElements.Element pelem = info.element; - if (pelem.isInline()) { + final Info info = fElementStack.data[size - i - 1]; + final HTMLElements.Element pelem = info.element; + if (pelem.isInline() || pelem.code == HTMLElements.FONT) { // TODO: investigate if only FONT // NOTE: I don't have to make a copy of the info because // it will just be popped off of the element stack // as soon as we close it, anyway. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |