Hi David,
> I tried it just now, and your fix works with the new patch, as the implied
> tag is now recognized as a HTML.Tag.IMPLIED Tag! So the implied tags for
> CP and the RI behave the same now!
Very good. I checked in your patch (attached again).
2006-11-10 David Fu <[EMAIL PROTECTED]>
* javax/swing/text/html/HTMLWriter.java
(traverse): Removed Classpath specific handling of implied
tags.
(traverseHtmlFragment): Removed Classpath specific handling of
implied tags.
/Roman
Index: javax/swing/text/html/HTMLWriter.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/html/HTMLWriter.java,v
retrieving revision 1.1
diff -u -1 -5 -r1.1 HTMLWriter.java
--- javax/swing/text/html/HTMLWriter.java 31 Oct 2006 11:30:24 -0000 1.1
+++ javax/swing/text/html/HTMLWriter.java 10 Nov 2006 16:28:21 -0000
@@ -596,64 +596,43 @@
* The main method used to traverse through the elements.
*
* @param paramElem element to traverse
*
* @throws IOException on any I/O exceptions
*/
private void traverse(Element paramElem)
throws IOException, BadLocationException
{
Element currElem = paramElem;
AttributeSet attrSet = currElem.getAttributes();
closeOutUnwantedEmbeddedTags(attrSet);
- // NOTE: 20061030 - fchoong - GNU CP uses a different implimentation of
- // the IMPLIED tag.
- boolean fg_gnu_cp_implied_tag = false;
-
- if (matchNameAttribute(attrSet, HTML.Tag.P))
- {
- //writeAllAttributes(attrSet);
-
- Enumeration attrNameEnum = attrSet.getAttributeNames();
-
- while (attrNameEnum.hasMoreElements())
- {
- Object key = attrNameEnum.nextElement();
- Object value = attrSet.getAttribute(key);
-
- if (key.equals("_implied_") && value.toString().equals("true"))
- fg_gnu_cp_implied_tag = true;
- } // while(attrNameEnum.hasMoreElements())
- } // if(matchNameAttribute(attrSet, HTML.Tag.P))
-
// handle the tag
- if (synthesizedElement(paramElem) || fg_gnu_cp_implied_tag)
+ if (synthesizedElement(paramElem))
{
if (matchNameAttribute(attrSet, HTML.Tag.CONTENT))
{
writeEmbeddedTags(attrSet);
text(currElem);
} // if(matchNameAttribute(attrSet, HTML.Tag.CONTENT))
else if (matchNameAttribute(attrSet, HTML.Tag.COMMENT))
{
comment(currElem);
} // else if(matchNameAttribute(attrSet, HTML.Tag.COMMENT))
- else if (matchNameAttribute(attrSet, HTML.Tag.IMPLIED)
- || fg_gnu_cp_implied_tag) // NOTE: GNU CP specific
+ else if (matchNameAttribute(attrSet, HTML.Tag.IMPLIED))
{
int child_elem_count = currElem.getElementCount();
if (child_elem_count > 0)
{
for (int i = 0; i < child_elem_count; i++)
{
Element childElem = paramElem.getElement(i);
traverse(childElem);
} // for(int i = 0; i < child_elem_count; i++)
} // if(child_elem_count > 0)
} // else if(matchNameAttribute(attrSet, HTML.Tag.IMPLIED))
} // if(synthesizedElement(paramElem))
@@ -770,52 +749,32 @@
fg_is_fragment_parent_elem = true;
if (paramElem == startElem)
fg_pass_start_elem = true;
if (paramElem == startElem && paramElem == endElem)
fg_is_start_and_end_elem = true;
AttributeSet attrSet = currElem.getAttributes();
closeOutUnwantedEmbeddedTags(attrSet);
if (fg_is_fragment_parent_elem || (fg_pass_start_elem
&& fg_pass_end_elem == false) || fg_is_start_and_end_elem)
{
- // NOTE: 20061030 - fchoong - GNU CP uses a different implimentation of
- // the IMPLIED tag.
- boolean fg_gnu_cp_implied_tag = false;
-
- if (matchNameAttribute(attrSet, HTML.Tag.P))
- {
- //writeAllAttributes(attrSet);
-
- Enumeration attrNameEnum = attrSet.getAttributeNames();
-
- while (attrNameEnum.hasMoreElements())
- {
- Object key = attrNameEnum.nextElement();
- Object value = attrSet.getAttribute(key);
-
- if (key.equals("_implied_") && value.toString().equals("true"))
- fg_gnu_cp_implied_tag = true;
- } // while(attrNameEnum.hasMoreElements())
- } // if(matchNameAttribute(attrSet, HTML.Tag.P))
-
// handle the tag
- if (synthesizedElement(paramElem) || fg_gnu_cp_implied_tag)
+ if (synthesizedElement(paramElem))
{
if (matchNameAttribute(attrSet, HTML.Tag.CONTENT))
{
writeEmbeddedTags(attrSet);
int content_offset = paramElem.getStartOffset();
int content_length = currElem.getEndOffset() - content_offset;
if (doc_offset_remaining > 0)
{
if (content_length > doc_offset_remaining)
{
int split_len = content_length;
split_len = split_len - doc_offset_remaining;
@@ -850,32 +809,31 @@
{
// we need to split it.
String txt_value = htmlDoc.getText(content_offset,
doc_len_remaining);
writeContent(txt_value);
doc_len_remaining = 0;
} // else
} // if(matchNameAttribute(attrSet, HTML.Tag.CONTENT))
else if (matchNameAttribute(attrSet, HTML.Tag.COMMENT))
{
comment(currElem);
} // else if(matchNameAttribute(attrSet, HTML.Tag.COMMENT))
- else if (matchNameAttribute(attrSet, HTML.Tag.IMPLIED)
- || fg_gnu_cp_implied_tag) // NOTE: GNU CP specific
+ else if (matchNameAttribute(attrSet, HTML.Tag.IMPLIED))
{
int child_elem_count = currElem.getElementCount();
if (child_elem_count > 0)
{
for (int i = 0; i < child_elem_count; i++)
{
Element childElem = paramElem.getElement(i);
traverseHtmlFragment(childElem);
} // for(int i = 0; i < child_elem_count; i++)
} // if(child_elem_count > 0)
} // else if(matchNameAttribute(attrSet, HTML.Tag.IMPLIED))
} // if(synthesizedElement(paramElem))