[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

hyatt hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:31:51 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 2ddd66ac03e52af60091ed26e88867ae03e0c15e
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Aug 16 08:20:09 2002 +0000

    	Fix for the intuit.com and eweek.com <form><tr> bgcolor problem.
    	Improve the error handling of the parser so that it doesn't
    	lose attributes when errors like this occur in a page.
    
            * khtml/html/htmlparser.cpp:
            (KHTMLParser::~KHTMLParser):
            (KHTMLParser::reset):
            (KHTMLParser::parseToken):
            (KHTMLParser::insertNode):
            * khtml/html/htmlparser.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1839 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index dbc7cbd..03be92d 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,16 @@
+2002-08-16  David Hyatt  <hyatt at apple.com>
+
+	Fix for the intuit.com and eweek.com <form><tr> bgcolor problem.
+	Improve the error handling of the parser so that it doesn't
+	lose attributes when errors like this occur in a page.
+	
+        * khtml/html/htmlparser.cpp:
+        (KHTMLParser::~KHTMLParser):
+        (KHTMLParser::reset):
+        (KHTMLParser::parseToken):
+        (KHTMLParser::insertNode):
+        * khtml/html/htmlparser.h:
+
 2002-08-15  Darin Adler  <darin at apple.com>
 
 	- fixed 2983959 -- pages that try to use JavaScript to focus fail to do so
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index dbc7cbd..03be92d 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,16 @@
+2002-08-16  David Hyatt  <hyatt at apple.com>
+
+	Fix for the intuit.com and eweek.com <form><tr> bgcolor problem.
+	Improve the error handling of the parser so that it doesn't
+	lose attributes when errors like this occur in a page.
+	
+        * khtml/html/htmlparser.cpp:
+        (KHTMLParser::~KHTMLParser):
+        (KHTMLParser::reset):
+        (KHTMLParser::parseToken):
+        (KHTMLParser::insertNode):
+        * khtml/html/htmlparser.h:
+
 2002-08-15  Darin Adler  <darin at apple.com>
 
 	- fixed 2983959 -- pages that try to use JavaScript to focus fail to do so
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index dbc7cbd..03be92d 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,16 @@
+2002-08-16  David Hyatt  <hyatt at apple.com>
+
+	Fix for the intuit.com and eweek.com <form><tr> bgcolor problem.
+	Improve the error handling of the parser so that it doesn't
+	lose attributes when errors like this occur in a page.
+	
+        * khtml/html/htmlparser.cpp:
+        (KHTMLParser::~KHTMLParser):
+        (KHTMLParser::reset):
+        (KHTMLParser::parseToken):
+        (KHTMLParser::insertNode):
+        * khtml/html/htmlparser.h:
+
 2002-08-15  Darin Adler  <darin at apple.com>
 
 	- fixed 2983959 -- pages that try to use JavaScript to focus fail to do so
diff --git a/WebCore/khtml/html/htmlparser.cpp b/WebCore/khtml/html/htmlparser.cpp
index de2353e..0e66959 100644
--- a/WebCore/khtml/html/htmlparser.cpp
+++ b/WebCore/khtml/html/htmlparser.cpp
@@ -154,6 +154,11 @@ KHTMLParser::~KHTMLParser()
 
     delete [] forbiddenTag;
     delete isindex;
+    
+    for (int i = 0; i < DISCARD_MAX; i++) {
+        if (discardedAttrs[i])
+            discardedAttrs[i]->deref();
+    }
 }
 
 void KHTMLParser::reset()
@@ -179,6 +184,10 @@ void KHTMLParser::reset()
     haveKonqBlock = false;
 
     discard_until = 0;
+    
+    discardedStackPos = 0;
+    for (int i = 0; i < DISCARD_MAX; i++)
+        discardedAttrs[i] = 0;
 }
 
 void KHTMLParser::parseToken(Token *t)
@@ -249,6 +258,24 @@ void KHTMLParser::parseToken(Token *t)
 
     if ( !insertNode(n, t->flat) ) {
         // we couldn't insert the node...
+        
+        if(n->isElementNode())
+        {
+            ElementImpl *e = static_cast<ElementImpl *>(n);
+            e->setAttributeMap(0);
+            
+            // Save the discarded attributes in case we do a reconstruction later.
+            // For <table><form><tr bgcolor=blue>..., we need to save off the bgcolor
+            // so that when we recreate the row, we can reattach the correct attributes.
+            // <body> fixup is handled already, so we don't need to deal with that here. -dwh
+            if ((n->id() == ID_TR || n->id() == ID_TD) && discardedStackPos < DISCARD_MAX) {
+                if (t->attrs)
+                    t->attrs->ref();
+                discardedAttrs[discardedStackPos] = t->attrs;
+                discardedStackPos++;
+            }
+        }
+            
 #ifdef PARSER_DEBUG
         kdDebug( 6035 ) << "insertNode failed current=" << current->id() << ", new=" << n->id() << "!" << endl;
 #endif
@@ -629,6 +656,14 @@ bool KHTMLParser::insertNode(NodeImpl *n, bool flat)
                 else
                     e = new HTMLTableRowElementImpl( document );
 
+                // Now reattach any discarded attributes if they exist. -dwh
+                if (discardedStackPos > 0 && current->id() != ID_TABLE) {
+                    discardedStackPos--;
+                    e->setAttributeMap(discardedAttrs[discardedStackPos]);
+                    if (discardedAttrs[discardedStackPos])
+                        discardedAttrs[discardedStackPos]->deref();
+                    discardedAttrs[discardedStackPos] = 0;
+                }
                 insertNode(e);
                 handled = true;
                 break;
diff --git a/WebCore/khtml/html/htmlparser.h b/WebCore/khtml/html/htmlparser.h
index 1e324cd..dbb8193 100644
--- a/WebCore/khtml/html/htmlparser.h
+++ b/WebCore/khtml/html/htmlparser.h
@@ -123,6 +123,13 @@ protected:
 
     ushort *forbiddenTag;
 
+    // For error handling, we sometimes destroy and recreate elements (usually when
+    // a form is nested inside a table and outside a row).  Hold onto a single
+    // element's attribute map so that we can reattach it later should we need to. -dwh
+#define DISCARD_MAX 5
+    DOM::NamedAttrMapImpl* discardedAttrs[DISCARD_MAX];
+    int discardedStackPos;
+    
     /*
      * currently active form
      */

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list