[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 07:08:09 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 66f55f6ac9009195305de404ab30196121de6ae8
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 25 19:14:08 2002 +0000

    	Fix for 3025963.  Ensure that KJS looks for the form on the
    	element itself when pushing it onto the scope chain, since
    	the <form> may not be an ancestor of the element.
    
            * khtml/ecma/kjs_html.cpp:
            (getForm):
            (KJS::HTMLElement::pushEventHandlerScope):
            * khtml/html/html_elementimpl.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2860 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index e20a889..01f61ff 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,5 +1,16 @@
 2002-11-25  David Hyatt  <hyatt at apple.com>
 
+	Fix for 3025963.  Ensure that KJS looks for the form on the
+	element itself when pushing it onto the scope chain, since
+	the <form> may not be an ancestor of the element.
+	
+        * khtml/ecma/kjs_html.cpp:
+        (getForm):
+        (KJS::HTMLElement::pushEventHandlerScope):
+        * khtml/html/html_elementimpl.h:
+
+2002-11-25  David Hyatt  <hyatt at apple.com>
+
 	Fix for 3020493, another fun little margin collapsing quirk
 	that I missed. (<td><div><p>).  The <div> has to pick up the quirk
 	from the <p> so that the margins of the <p> still get collapsed
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index e20a889..01f61ff 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,5 +1,16 @@
 2002-11-25  David Hyatt  <hyatt at apple.com>
 
+	Fix for 3025963.  Ensure that KJS looks for the form on the
+	element itself when pushing it onto the scope chain, since
+	the <form> may not be an ancestor of the element.
+	
+        * khtml/ecma/kjs_html.cpp:
+        (getForm):
+        (KJS::HTMLElement::pushEventHandlerScope):
+        * khtml/html/html_elementimpl.h:
+
+2002-11-25  David Hyatt  <hyatt at apple.com>
+
 	Fix for 3020493, another fun little margin collapsing quirk
 	that I missed. (<td><div><p>).  The <div> has to pick up the quirk
 	from the <p> so that the margins of the <p> still get collapsed
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index e20a889..01f61ff 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,16 @@
 2002-11-25  David Hyatt  <hyatt at apple.com>
 
+	Fix for 3025963.  Ensure that KJS looks for the form on the
+	element itself when pushing it onto the scope chain, since
+	the <form> may not be an ancestor of the element.
+	
+        * khtml/ecma/kjs_html.cpp:
+        (getForm):
+        (KJS::HTMLElement::pushEventHandlerScope):
+        * khtml/html/html_elementimpl.h:
+
+2002-11-25  David Hyatt  <hyatt at apple.com>
+
 	Fix for 3020493, another fun little margin collapsing quirk
 	that I missed. (<td><div><p>).  The <div> has to pick up the quirk
 	from the <p> so that the margins of the <p> still get collapsed
diff --git a/WebCore/khtml/ecma/kjs_html.cpp b/WebCore/khtml/ecma/kjs_html.cpp
index 583bb05..1c4f642 100644
--- a/WebCore/khtml/ecma/kjs_html.cpp
+++ b/WebCore/khtml/ecma/kjs_html.cpp
@@ -1739,6 +1739,59 @@ UString KJS::HTMLElement::toString(ExecState *exec) const
     return DOMElement::toString(exec);
 }
 
+static void getForm(DOM::HTMLFormElement* form, const DOM::HTMLElement& element)
+{
+    switch (element.elementId()) {
+        case ID_ISINDEX: {
+            DOM::HTMLIsIndexElement isindex = element;
+            *form = isindex.form();
+            break;
+        }
+        case ID_SELECT: {
+            DOM::HTMLSelectElement select = element;
+            *form = select.form();
+            break;
+        }
+        case ID_OPTION: {
+            DOM::HTMLOptionElement option = element;
+            *form = option.form();
+            break;
+        }
+        case ID_INPUT: {
+            DOM::HTMLInputElement input = element;
+            *form = input.form();
+            break;
+        }
+        case ID_TEXTAREA: {
+            DOM::HTMLTextAreaElement textarea = element;
+            *form = textarea.form();
+            break;
+        }
+        case ID_LABEL: {
+            DOM::HTMLLabelElement label = element;
+            *form = label.form();
+            break;
+        }
+        case ID_FIELDSET: {
+            DOM::HTMLFieldSetElement fieldset = element;
+            *form = fieldset.form();
+            break;
+        }
+        case ID_LEGEND: {
+            DOM::HTMLLegendElement legend = element;
+            *form = legend.form();
+            break;
+        }
+        case ID_OBJECT: {
+            DOM::HTMLObjectElement object = element;
+            *form = object.form();
+            break;
+        }
+        default:
+            break;
+    }
+}
+
 void KJS::HTMLElement::pushEventHandlerScope(ExecState *exec, ScopeChain &scope) const
 {
   DOM::HTMLElement element = static_cast<DOM::HTMLElement>(node);
@@ -1747,12 +1800,23 @@ void KJS::HTMLElement::pushEventHandlerScope(ExecState *exec, ScopeChain &scope)
   scope.push(static_cast<ObjectImp *>(getDOMNode(exec, element.ownerDocument()).imp()));
 
   // The form is next, searched before the document, but after the element itself.
-  DOM::Node form = element.parentNode();
-  while (!form.isNull() && form.elementId() != ID_FORM)
-    form = form.parentNode();
-  if (!form.isNull())
-    scope.push(static_cast<ObjectImp *>(getDOMNode(exec, form).imp()));
-
+  DOM::HTMLFormElement formElt;
+  
+  // First try to obtain the form from the element itself.  We do this to deal with
+  // the malformed case where <form>s aren't in our parent chain (e.g., when they were inside 
+  // <table> or <tbody>.
+  getForm(&formElt, element);
+  if (!formElt.isNull())
+    scope.push(static_cast<ObjectImp *>(getDOMNode(exec, formElt).imp()));
+  else {
+    DOM::Node form = element.parentNode();
+    while (!form.isNull() && form.elementId() != ID_FORM)
+        form = form.parentNode();
+    
+    if (!form.isNull())
+        scope.push(static_cast<ObjectImp *>(getDOMNode(exec, form).imp()));
+  }
+  
   // The element is on top, searched first.
   scope.push(static_cast<ObjectImp *>(getDOMNode(exec, element).imp()));
 }
diff --git a/WebCore/khtml/html/html_elementimpl.h b/WebCore/khtml/html/html_elementimpl.h
index 19cd98f..b0cde1d 100644
--- a/WebCore/khtml/html/html_elementimpl.h
+++ b/WebCore/khtml/html/html_elementimpl.h
@@ -29,6 +29,7 @@ namespace DOM {
 
 class DOMString;
 class CSSStyleDeclarationImpl;
+class HTMLFormElementImpl;
 
 class HTMLElementImpl : public ElementImpl
 {
@@ -40,7 +41,7 @@ public:
     virtual bool isHTMLElement() const { return true; }
 
     virtual bool isInline() const;
-    
+     
     virtual Id id() const = 0;
 
     virtual void parseAttribute(AttributeImpl *token);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list