- Fixes <http://bugzilla.opendarwin.org/show_bug.cgi?id=3715>
An HTMLObjectElement's form property was always null.
Reviewed by Darin
Test cases added:
* layout-tests/fast/dom/htmlobject-form-expected.txt: Added.
* layout-tests/fast/dom/htmlobject-form.html: Added.
* khtml/html/html_objectimpl.cpp:
(DOM::HTMLObjectElementImpl::form):
Implement this function by traversing the parent nodes looking
for a form element.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@9521
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
--- /dev/null
+layer at (0,0) size 800x600
+ RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {P} at (0,0) size 784x18
+ RenderText {TEXT} at (0,0) size 433x18
+ text run at (0,0) width 433: "This test attempts to access an HTMLObjectElements form property."
+ RenderBlock {DIV} at (0,34) size 784x52
+ RenderBlock {P} at (0,0) size 784x18
+ RenderText {TEXT} at (0,0) size 86x18
+ text run at (0,0) width 86: "Passed Test 1"
+ RenderBlock {P} at (0,34) size 784x18
+ RenderText {TEXT} at (0,0) size 86x18
+ text run at (0,0) width 86: "Passed Test 2"
+ RenderBlock {FORM} at (0,102) size 784x150
+ RenderPartObject {OBJECT} at (0,0) size 300x150
+ RenderText {TEXT} at (0,0) size 0x0
+ RenderBlock (anonymous) at (0,268) size 784x150
+ RenderPartObject {OBJECT} at (0,0) size 300x150
+ RenderText {TEXT} at (0,0) size 0x0
+ RenderText {TEXT} at (0,0) size 0x0
--- /dev/null
+<html>
+
+ <head>
+ <script language="javascript">
+ function print(message)
+ {
+ var paragraph = document.createElement("p");
+ paragraph.appendChild(document.createTextNode(message));
+ document.getElementById("console").appendChild(paragraph);
+ }
+ function test()
+ {
+ objectInsideForm = document.getElementById("objectInsideForm");
+ objectNotInsideForm = document.getElementById("objectNotInsideForm");
+
+ form = document.getElementById("form");
+
+ if(objectInsideForm.form == form)
+ print("Passed Test 1");
+ else
+ print("Failed Test 1");
+
+ if(objectNotInsideForm.form == null)
+ print("Passed Test 2");
+ else
+ print("Failed Test 2");
+ }
+ </script>
+ </head>
+
+ <body onload="test();">
+ <p>This test attempts to access an HTMLObjectElements form property.</p>
+
+ <div id="console">
+ </div>
+
+ <form id="form">
+ <object id="objectInsideForm">
+ </object>
+ </form>
+
+ <object id="objectNotInsideForm">
+ </object>
+ </body>
+</html>
+2005-06-29 Justin Garcia <justin.garcia@apple.com>
+
+ Patch by Anders Carlsson <andersca@mac.com>
+
+ - Fixes <http://bugzilla.opendarwin.org/show_bug.cgi?id=3715>
+ An HTMLObjectElement's form property was always null.
+
+ Reviewed by Darin
+
+ Test cases added:
+ * layout-tests/fast/dom/htmlobject-form-expected.txt: Added.
+ * layout-tests/fast/dom/htmlobject-form.html: Added.
+
+ * khtml/html/html_objectimpl.cpp:
+ (DOM::HTMLObjectElementImpl::form):
+ Implement this function by traversing the parent nodes looking
+ for a form element.
+
2005-06-29 Geoffrey Garen <ggaren@apple.com>
Patch by Antoine Quint <ml@graougraou.com>
#include "css/csshelper.h"
#include "css/cssproperties.h"
#include "css/cssvalues.h"
+#include "html/html_formimpl.h"
#include "rendering/render_applet.h"
#include "rendering/render_frames.h"
#include "rendering/render_image.h"
HTMLFormElementImpl *HTMLObjectElementImpl::form() const
{
- return 0;
+ for (NodeImpl *p = parentNode(); p != 0; p = p->parentNode()) {
+ if (p->id() == ID_FORM)
+ return static_cast<HTMLFormElementImpl *>(p);
+ }
+
+ return 0;
}
bool HTMLObjectElementImpl::mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const