harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r577151 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/text/html/HTMLDocument.java test/api/java.injected/javax/swing/text/html/HTMLDocument_Reader_ActionsTest.java
Date Wed, 19 Sep 2007 04:45:23 GMT
Author: apetrenko
Date: Tue Sep 18 21:45:20 2007
New Revision: 577151

URL: http://svn.apache.org/viewvc?rev=577151&view=rev
Log:
Patch for HARMONY-4606 "[classlib][swing][html] <a> tag behaves incorrectly"

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/HTMLDocument.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/html/HTMLDocument_Reader_ActionsTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/HTMLDocument.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/HTMLDocument.java?rev=577151&r1=577150&r2=577151&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/HTMLDocument.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/HTMLDocument.java
Tue Sep 18 21:45:20 2007
@@ -366,16 +366,22 @@
         class AnchorAction extends CharacterAction {
             public void start(final Tag tag, final MutableAttributeSet attr) {
                 anchorReferenceEncountered = attr.isDefined(HTML.Attribute.HREF);
-                super.start(tag, attr);
-                openedBlocks.add(Tag.A);
+                //anchorReferenceEncountered verification added according to H4606
+                if (anchorReferenceEncountered) {
+                    super.start(tag, attr);
+                    openedBlocks.add(Tag.A);
+                }
             }
             
             public void end(final Tag tag) {
                 // According to H4574 Empty AncorTextEncoured verification has
-                // been removed
-                super.end(tag);
-                openedBlocks.remove(Tag.A);
-                anchorReferenceEncountered = false;
+                // been removed, but according H4606 anchorReferenceEncountered
+                // has been added
+                if (anchorReferenceEncountered) {
+                    super.end(tag);
+                    openedBlocks.remove(Tag.A);
+                    anchorReferenceEncountered = false;
+                }
             }
         }
         

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/html/HTMLDocument_Reader_ActionsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/html/HTMLDocument_Reader_ActionsTest.java?rev=577151&r1=577150&r2=577151&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/html/HTMLDocument_Reader_ActionsTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/html/HTMLDocument_Reader_ActionsTest.java
Tue Sep 18 21:45:20 2007
@@ -216,8 +216,13 @@
 
     public void testAnchorStart() {
         SimpleAttributeSet attr = new SimpleAttributeSet();
-        attr.addAttribute("aaaa", "bbbb");
+        // If href attribute is absent, after 4606 handleStartTag(Tag.A) does
+        // nothing
+        reader.handleStartTag(Tag.A, attr, 0);
+        assertEquals(0, reader.charAttr.getAttributeCount());
+        // After addition the href attribute, Tag.A works as before
         reader.charAttr.addAttribute("bbbb", "aaaa");
+        attr.addAttribute(HTML.Attribute.HREF, "");
         reader.handleStartTag(Tag.A, attr, 0);
         assertEquals(0, reader.parseBuffer.size());
         assertEquals(2, reader.charAttr.getAttributeCount());
@@ -241,7 +246,9 @@
 
     public void testAnchorStartEnd() {
         SimpleAttributeSet attr = new SimpleAttributeSet();
-        attr.addAttribute("aaaa", "bbbb");
+        // If href attribute is absent, after 4606 handleStartTag(Tag.A) does
+        // nothing. After addition the href attribute, Tag.A works as before
+        attr.addAttribute(HTML.Attribute.HREF, "");
         final Tag tag = Tag.A;
         reader.handleStartTag(tag, attr, 0);
         assertEquals(1, reader.charAttr.getAttributeCount());



Mime
View raw message