LayoutTests:
authorggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Apr 2006 22:58:56 +0000 (22:58 +0000)
committerggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Apr 2006 22:58:56 +0000 (22:58 +0000)
        Reviewed by Maciej.

        Test for the DOM properties supported by object, embed, attribute:
        * fast/dom/plugin-attributes-enumeration-expected.txt: Added.
        * fast/dom/plugin-attributes-enumeration.html: Added.

        Test for setting attributes through DOM properties:
        * plugins/embed-attributes-setting-expected.txt: Added.
        * plugins/embed-attributes-setting.html: Added.

        Test for the special attribute-to-style mappings on embed.
        * plugins/embed-attributes-style-expected.txt: Added.
        * plugins/embed-attributes-style.html: Added.

WebCore:

        Reviewed by Maciej.

        - Removed special handling of attributes in the DOM. To match
        WinIE, we used to make all attributes available as properties of
        their elements in the DOM, but that has caused us more
        compatibility woes than it has solved, so, after talking with Darin
        and Maciej, I'm taking it out. (Firefox does not support it.)

        A layout test regression caused by this change led me to do the
        following as well:

        - Implemented DOM properties missing on EMBED elements: align, height,
        name, width, src, type. Since align, height, name, and width are
        common to all plugin elements, I factored them and some other common
        functionality out into a new abstract base class, HTMLPlugInElement.

        - Removed extraneous attribute-to-style mappings on EMBED elements:
        valign, border. Why they were there in the first place is a question
        for the ages. Neither FF nor IE supports them.

        * bindings/js/kjs_dom.cpp:
        (KJS::getRuntimeObject):
        * bindings/js/kjs_html.cpp:
        (KJS::):
        (KJS::JSHTMLElement::classInfo):
        (KJS::JSHTMLElement::accessors):
        (KJS::JSHTMLElement::embedGetter):
        (KJS::JSHTMLElement::embedSetter):
        * bindings/js/kjs_html.h:
        (KJS::JSHTMLElement::):
        * bindings/scripts/CodeGeneratorJS.pm:
        * dom/Element.idl:
        * html/html_objectimpl.cpp:
        (WebCore::HTMLPlugInElement::HTMLPlugInElement):
        (WebCore::HTMLPlugInElement::align):
        (WebCore::HTMLPlugInElement::setAlign):
        (WebCore::HTMLPlugInElement::height):
        (WebCore::HTMLPlugInElement::setHeight):
        (WebCore::HTMLPlugInElement::name):
        (WebCore::HTMLPlugInElement::setName):
        (WebCore::HTMLPlugInElement::width):
        (WebCore::HTMLPlugInElement::setWidth):
        (WebCore::HTMLPlugInElement::mapToEntry):
        (WebCore::HTMLPlugInElement::parseMappedAttribute):
        (WebCore::HTMLPlugInElement::checkDTD):
        (WebCore::HTMLAppletElement::HTMLAppletElement):
        (WebCore::HTMLAppletElement::~HTMLAppletElement):
        (WebCore::HTMLAppletElement::parseMappedAttribute):
        (WebCore::HTMLAppletElement::insertedIntoDocument):
        (WebCore::HTMLAppletElement::removedFromDocument):
        (WebCore::HTMLAppletElement::getInstance):
        (WebCore::HTMLAppletElement::closeRenderer):
        (WebCore::HTMLAppletElement::detach):
        (WebCore::HTMLEmbedElement::HTMLEmbedElement):
        (WebCore::HTMLEmbedElement::~HTMLEmbedElement):
        (WebCore::HTMLEmbedElement::getInstance):
        (WebCore::HTMLEmbedElement::mapToEntry):
        (WebCore::HTMLEmbedElement::parseMappedAttribute):
        (WebCore::HTMLEmbedElement::attach):
        (WebCore::HTMLEmbedElement::detach):
        (WebCore::HTMLEmbedElement::insertedIntoDocument):
        (WebCore::HTMLEmbedElement::removedFromDocument):
        (WebCore::HTMLEmbedElement::src):
        (WebCore::HTMLEmbedElement::setSrc):
        (WebCore::HTMLEmbedElement::type):
        (WebCore::HTMLEmbedElement::setType):
        (WebCore::HTMLObjectElement::HTMLObjectElement):
        (WebCore::HTMLObjectElement::~HTMLObjectElement):
        (WebCore::HTMLObjectElement::getInstance):
        (WebCore::HTMLObjectElement::parseMappedAttribute):
        (WebCore::HTMLObjectElement::rendererIsNeeded):
        (WebCore::HTMLObjectElement::attach):
        (WebCore::HTMLObjectElement::closeRenderer):
        (WebCore::HTMLObjectElement::detach):
        (WebCore::HTMLObjectElement::insertedIntoDocument):
        (WebCore::HTMLObjectElement::removedFromDocument):
        (WebCore::HTMLObjectElement::recalcStyle):
        * html/html_objectimpl.h:
        (WebCore::HTMLPlugInElement::endTagRequirement):
        (WebCore::HTMLAppletElement::tagPriority):
        (WebCore::HTMLEmbedElement::tagPriority):
        (WebCore::HTMLObjectElement::tagPriority):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@14069 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/plugin-attributes-enumeration-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/plugin-attributes-enumeration.html [new file with mode: 0644]
LayoutTests/plugins/embed-attributes-setting-expected.txt [new file with mode: 0644]
LayoutTests/plugins/embed-attributes-setting.html [new file with mode: 0644]
LayoutTests/plugins/embed-attributes-style-expected.txt [new file with mode: 0644]
LayoutTests/plugins/embed-attributes-style.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/bindings/js/kjs_dom.cpp
WebCore/bindings/js/kjs_html.cpp
WebCore/bindings/js/kjs_html.h
WebCore/bindings/scripts/CodeGeneratorJS.pm
WebCore/dom/Element.idl
WebCore/html/html_objectimpl.cpp
WebCore/html/html_objectimpl.h

index 903e855..2b99721 100644 (file)
@@ -1,3 +1,19 @@
+2006-04-25  Geoffrey Garen  <ggaren@apple.com>
+
+        Reviewed by Maciej.
+
+        Test for the DOM properties supported by object, embed, attribute:
+        * fast/dom/plugin-attributes-enumeration-expected.txt: Added.
+        * fast/dom/plugin-attributes-enumeration.html: Added.
+        
+        Test for setting attributes through DOM properties:
+        * plugins/embed-attributes-setting-expected.txt: Added.
+        * plugins/embed-attributes-setting.html: Added.
+        
+        Test for the special attribute-to-style mappings on embed.
+        * plugins/embed-attributes-style-expected.txt: Added.
+        * plugins/embed-attributes-style.html: Added.
+
 2006-04-25  Beth Dakin  <bdakin@apple.com>
 
         Reviewed by Maciej.
diff --git a/LayoutTests/fast/dom/plugin-attributes-enumeration-expected.txt b/LayoutTests/fast/dom/plugin-attributes-enumeration-expected.txt
new file mode 100644 (file)
index 0000000..f274f9a
--- /dev/null
@@ -0,0 +1,36 @@
+[OBJECT, EMBED, APPLET] share:
+align
+height
+name
+width
+----------
+OBJECT also has:
+archive
+border
+code
+codeBase
+codeType
+contentDocument
+data
+declare
+form
+hspace
+standby
+tabIndex
+type
+useMap
+vspace
+----------
+EMBED also has:
+src
+type
+----------
+APPLET also has:
+alt
+archive
+code
+codeBase
+hspace
+object
+vspace
diff --git a/LayoutTests/fast/dom/plugin-attributes-enumeration.html b/LayoutTests/fast/dom/plugin-attributes-enumeration.html
new file mode 100644 (file)
index 0000000..b92c828
--- /dev/null
@@ -0,0 +1,106 @@
+<html>
+<head>
+<style>
+    .invisible {
+        width: 0;
+        height: 0;
+    }
+</style>
+
+<script>
+function print(message, color) 
+{
+    var paragraph = document.createElement("div");
+    paragraph.appendChild(document.createTextNode(message));
+    paragraph.style.fontFamily = "monospace";
+    if (color)
+        paragraph.style.color = color;
+    document.getElementById("console").appendChild(paragraph);
+}
+
+function test() 
+{
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+        
+    Array.prototype.forEach = function(f) {
+        for (var i = 0; i < this.length; i++) // >
+            f(this[i]);
+    };
+    
+    var objectHash = new Object();
+    var embedHash = new Object();
+    var appletHash = new Object();
+    var intersectionHash = new Object();
+
+    var object, embed, applet;
+
+    object = document.getElementById("object");
+    embed = document.getElementById("embed");
+    applet = document.getElementById("applet");
+
+    for (var p in object)
+        if (typeof object[p] != 'function')
+            objectHash[p] = 1;
+        
+    for (var p in embed)
+        if (typeof embed[p] != 'function')
+            embedHash[p] = 1;
+
+    for (var p in applet)
+        if (typeof applet[p] != 'function')
+            appletHash[p] = 1;
+            
+    for (var p in objectHash)
+        if (embedHash[p] && appletHash[p]) // ;
+            intersectionHash[p] = 1;
+        
+    print("[OBJECT, EMBED, APPLET] share:", "green");
+    var array = new Array();
+    for (var p in intersectionHash)
+        if (typeof document.body[p] == 'undefined') // weed out items shared by all elements
+            array.push(p);
+    array.sort();
+    array.forEach(print);
+
+    print("----------");
+    print(object.tagName + " also has:", "green");
+    var array = new Array();
+    for (var p in objectHash)
+        if (!intersectionHash[p])
+            array.push(p);
+    array.sort();
+    array.forEach(print);
+            
+    print("----------");
+    print(embed.tagName + " also has:", "green");
+    var array = new Array();
+    for (var p in embedHash)
+        if (!intersectionHash[p])
+            array.push(p);
+    array.sort();
+    array.forEach(print);
+
+    print("----------");
+    var array = new Array();
+    print(applet.tagName + " also has:", "green");
+    for (var p in appletHash)
+        if (!intersectionHash[p])
+            array.push(p);
+    array.sort();
+    array.forEach(print);
+}
+</script>
+</head>
+
+<body onload="test();">
+
+<hr>
+<div id='console'></div>
+
+<object class="invisible" id="object"></object>
+<embed class="invisible" id="embed"></embed>
+<applet class="invisible" id="applet"></applet>
+
+</body>
+</html>
diff --git a/LayoutTests/plugins/embed-attributes-setting-expected.txt b/LayoutTests/plugins/embed-attributes-setting-expected.txt
new file mode 100644 (file)
index 0000000..9da3aee
--- /dev/null
@@ -0,0 +1,15 @@
+[Embed is element specified in markup]
+PASS: embed.getAttribute('align') should be 1 and is.
+PASS: embed.getAttribute('height') should be 1 and is.
+PASS: embed.getAttribute('name') should be 1 and is.
+PASS: embed.getAttribute('width') should be 1 and is.
+PASS: embed.getAttribute('type') should be 1 and is.
+PASS: embed.getAttribute('src') should be 1 and is.
+PASS: typeof embed.Play should be function and is.
+----------
+[Embed is dynamically created element with only type specified]
+PASS: typeof embed.Play should be function and is.
+----------
+[Embed is dynamically created element with only src specified]
+PASS: typeof embed.Play should be function and is.
diff --git a/LayoutTests/plugins/embed-attributes-setting.html b/LayoutTests/plugins/embed-attributes-setting.html
new file mode 100644 (file)
index 0000000..f8d5644
--- /dev/null
@@ -0,0 +1,84 @@
+<html>
+<head>
+<script>
+function print(message, color) 
+{
+    var paragraph = document.createElement("div");
+    paragraph.appendChild(document.createTextNode(message));
+    paragraph.style.fontFamily = "monospace";
+    if (color)
+        paragraph.style.color = color;
+    document.getElementById("console").appendChild(paragraph);
+}
+
+function write(s)
+{
+    document.getElementById('pre').appendChild(document.createTextNode(s));
+}
+
+function shouldBe(a, b)
+{
+    var evalA = eval(a);
+    if (evalA == b)
+        print("PASS: " + a + " should be " + b + " and is.", "green");
+    else
+        print("FAIL: " + a + " should be " + b + " but instead is " + evalA + ".", "red");
+}
+
+var embed;
+
+function test() 
+{
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+        
+    embed = document.getElementById('embed');
+    print("[Embed is element specified in markup]");
+
+    embed.align = 1;
+    embed.height = 1;
+    embed.name = 1;
+    embed.width = 1;
+    embed.type = 1; // setting the type attribute should not effect the plugin once loaded
+    embed.src = 1; // setting the source attribute should not effect the plugin once loaded
+
+    shouldBe("embed.getAttribute('align')", 1);
+    shouldBe("embed.getAttribute('height')", 1);
+    shouldBe("embed.getAttribute('name')", 1);
+    shouldBe("embed.getAttribute('width')", 1);
+    shouldBe("embed.getAttribute('type')", 1);
+    shouldBe("embed.getAttribute('src')", 1);
+    shouldBe("typeof embed.Play", "function");
+
+    print("----------");
+    
+    embed = document.createElement('embed');
+    print("[Embed is dynamically created element with only type specified]");
+
+    embed.style.visibility = "hidden";
+    embed.type = "video/quicktime";
+    document.body.appendChild(embed);
+    shouldBe("typeof embed.Play", "function");
+    
+    print("----------");
+    
+    embed = document.createElement('embed');
+    print("[Embed is dynamically created element with only src specified]");
+
+    embed.style.visibility = "hidden";
+    embed.src = "resources/articles.m4a";
+    document.body.appendChild(embed);
+    shouldBe("typeof embed.Play", "function");
+}
+</script>
+</head>
+
+<body onload="test();">
+
+<hr>
+<div id='console'></div>
+
+<embed style="visibility: hidden" type="video/quicktime" id='embed'></embed>
+
+</body>
+</html>
diff --git a/LayoutTests/plugins/embed-attributes-style-expected.txt b/LayoutTests/plugins/embed-attributes-style-expected.txt
new file mode 100644 (file)
index 0000000..7402aec
--- /dev/null
@@ -0,0 +1,28 @@
+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 784x36
+        RenderText {#text} at (0,0) size 762x36
+          text run at (0,0) width 395: "This page tests using attributes to set style on embed elements. "
+          text run at (395,0) width 367: "Previous versions of WebKit supported valign and border,"
+          text run at (0,18) width 43: "which "
+          text run at (43,18) width 452: "didn't match IE and FF. The only special support should be for 'hidden.'"
+      RenderBlock {HR} at (0,52) size 784x2 [border: (1px inset #000000)]
+      RenderBlock {DIV} at (0,62) size 784x0
+      RenderBlock {DIV} at (0,62) size 784x104
+        RenderPartObject {EMBED} at (0,0) size 50x100
+        RenderText {#text} at (50,86) size 122x18
+          text run at (50,86) width 4: " "
+          text run at (54,86) width 118: "valign top attribute"
+      RenderBlock {DIV} at (0,166) size 784x104
+        RenderPartObject {EMBED} at (0,0) size 50x100
+        RenderText {#text} at (50,86) size 128x18
+          text run at (50,86) width 4: " "
+          text run at (54,86) width 124: "border 5px attribute"
+      RenderBlock {DIV} at (0,270) size 784x106
+        RenderPartObject {EMBED} at (0,0) size 52x102 [border: (1px dashed #000000)]
+        RenderText {#text} at (52,88) size 102x18
+          text run at (52,88) width 4: " "
+          text run at (56,88) width 98: "hidden attribute"
diff --git a/LayoutTests/plugins/embed-attributes-style.html b/LayoutTests/plugins/embed-attributes-style.html
new file mode 100644 (file)
index 0000000..6ca40ce
--- /dev/null
@@ -0,0 +1,32 @@
+<html>
+<head>
+<style>
+embed {
+    width: 50px; 
+    height: 100px;
+}
+</style>
+</head>
+<body>
+<p>This page tests using attributes to set style on embed elements.
+   Previous versions of WebKit supported valign and border, which
+   didn't match IE and FF. The only special support should be for 'hidden.'</p>
+<hr>
+<div id='console'></div>
+
+<div>
+    <embed type="video/quicktime" valign="top"></embed>
+    valign top attribute
+</div>
+<div>
+    <embed type="video/quicktime" border="5px solid black"></embed>
+    border 5px attribute
+</div>
+
+<div>
+    <embed hidden="yes" style="border: 1px dashed black" type="video/quicktime"></embed>
+    hidden attribute
+</div>
+
+</body>
+</html>
index 632f575..8b88b17 100644 (file)
@@ -1,3 +1,88 @@
+2006-04-25  Geoffrey Garen  <ggaren@apple.com>
+
+        Reviewed by Maciej.
+
+        - Removed special handling of attributes in the DOM. To match
+        WinIE, we used to make all attributes available as properties of
+        their elements in the DOM, but that has caused us more
+        compatibility woes than it has solved, so, after talking with Darin
+        and Maciej, I'm taking it out. (Firefox does not support it.)
+
+        A layout test regression caused by this change led me to do the
+        following as well:
+        
+        - Implemented DOM properties missing on EMBED elements: align, height,
+        name, width, src, type. Since align, height, name, and width are
+        common to all plugin elements, I factored them and some other common
+        functionality out into a new abstract base class, HTMLPlugInElement.
+
+        - Removed extraneous attribute-to-style mappings on EMBED elements:
+        valign, border. Why they were there in the first place is a question
+        for the ages. Neither FF nor IE supports them.
+
+        * bindings/js/kjs_dom.cpp:
+        (KJS::getRuntimeObject):
+        * bindings/js/kjs_html.cpp:
+        (KJS::):
+        (KJS::JSHTMLElement::classInfo):
+        (KJS::JSHTMLElement::accessors):
+        (KJS::JSHTMLElement::embedGetter):
+        (KJS::JSHTMLElement::embedSetter):
+        * bindings/js/kjs_html.h:
+        (KJS::JSHTMLElement::):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        * dom/Element.idl:
+        * html/html_objectimpl.cpp:
+        (WebCore::HTMLPlugInElement::HTMLPlugInElement):
+        (WebCore::HTMLPlugInElement::align):
+        (WebCore::HTMLPlugInElement::setAlign):
+        (WebCore::HTMLPlugInElement::height):
+        (WebCore::HTMLPlugInElement::setHeight):
+        (WebCore::HTMLPlugInElement::name):
+        (WebCore::HTMLPlugInElement::setName):
+        (WebCore::HTMLPlugInElement::width):
+        (WebCore::HTMLPlugInElement::setWidth):
+        (WebCore::HTMLPlugInElement::mapToEntry):
+        (WebCore::HTMLPlugInElement::parseMappedAttribute):
+        (WebCore::HTMLPlugInElement::checkDTD):
+        (WebCore::HTMLAppletElement::HTMLAppletElement):
+        (WebCore::HTMLAppletElement::~HTMLAppletElement):
+        (WebCore::HTMLAppletElement::parseMappedAttribute):
+        (WebCore::HTMLAppletElement::insertedIntoDocument):
+        (WebCore::HTMLAppletElement::removedFromDocument):
+        (WebCore::HTMLAppletElement::getInstance):
+        (WebCore::HTMLAppletElement::closeRenderer):
+        (WebCore::HTMLAppletElement::detach):
+        (WebCore::HTMLEmbedElement::HTMLEmbedElement):
+        (WebCore::HTMLEmbedElement::~HTMLEmbedElement):
+        (WebCore::HTMLEmbedElement::getInstance):
+        (WebCore::HTMLEmbedElement::mapToEntry):
+        (WebCore::HTMLEmbedElement::parseMappedAttribute):
+        (WebCore::HTMLEmbedElement::attach):
+        (WebCore::HTMLEmbedElement::detach):
+        (WebCore::HTMLEmbedElement::insertedIntoDocument):
+        (WebCore::HTMLEmbedElement::removedFromDocument):
+        (WebCore::HTMLEmbedElement::src):
+        (WebCore::HTMLEmbedElement::setSrc):
+        (WebCore::HTMLEmbedElement::type):
+        (WebCore::HTMLEmbedElement::setType):
+        (WebCore::HTMLObjectElement::HTMLObjectElement):
+        (WebCore::HTMLObjectElement::~HTMLObjectElement):
+        (WebCore::HTMLObjectElement::getInstance):
+        (WebCore::HTMLObjectElement::parseMappedAttribute):
+        (WebCore::HTMLObjectElement::rendererIsNeeded):
+        (WebCore::HTMLObjectElement::attach):
+        (WebCore::HTMLObjectElement::closeRenderer):
+        (WebCore::HTMLObjectElement::detach):
+        (WebCore::HTMLObjectElement::insertedIntoDocument):
+        (WebCore::HTMLObjectElement::removedFromDocument):
+        (WebCore::HTMLObjectElement::recalcStyle):
+        * html/html_objectimpl.h:
+        (WebCore::HTMLPlugInElement::endTagRequirement):
+        (WebCore::HTMLAppletElement::tagPriority):
+        (WebCore::HTMLEmbedElement::tagPriority):
+        (WebCore::HTMLObjectElement::tagPriority):
+
 2006-04-25  Beth Dakin  <bdakin@apple.com>
 
         Reviewed by Maciej.
index 4d45f80..e00be63 100644 (file)
@@ -1020,21 +1020,11 @@ JSValue *getRuntimeObject(ExecState* exec, WebCore::Node* n)
         return 0;
 
 #if __APPLE__
-    if (n->hasTagName(appletTag)) {
-        HTMLAppletElement *appletElement = static_cast<HTMLAppletElement *>(n);
-        if (appletElement->getAppletInstance())
-            // The instance is owned by the applet element.
-            return new RuntimeObjectImp(appletElement->getAppletInstance());
-    }
-    else if (n->hasTagName(embedTag)) {
-        HTMLEmbedElement *embedElement = static_cast<HTMLEmbedElement *>(n);
-        if (embedElement->getEmbedInstance())
-            return new RuntimeObjectImp(embedElement->getEmbedInstance());
-    }
-    else if (n->hasTagName(objectTag)) {
-        HTMLObjectElement *objectElement = static_cast<HTMLObjectElement *>(n);
-        if (objectElement->getObjectInstance())
-            return new RuntimeObjectImp(objectElement->getObjectInstance());
+    if (n->hasTagName(objectTag) || n->hasTagName(embedTag) || n->hasTagName(appletTag)) {
+        HTMLPlugInElement *plugInElement = static_cast<HTMLPlugInElement *>(n);
+        if (plugInElement->getInstance())
+            // The instance is owned by the PlugIn element.
+            return new RuntimeObjectImp(plugInElement->getInstance());
     }
 #endif
 
index 77007ee..cde5573 100644 (file)
@@ -434,6 +434,7 @@ const ClassInfo JSHTMLElement::col_info = { "HTMLTableColElement", &JSHTMLElemen
 const ClassInfo JSHTMLElement::dir_info = { "HTMLDirectoryElement", &JSHTMLElement::info, &HTMLDirectoryElementTable, 0 };
 const ClassInfo JSHTMLElement::div_info = { "HTMLDivElement", &JSHTMLElement::info, &HTMLDivElementTable, 0 };
 const ClassInfo JSHTMLElement::dl_info = { "HTMLDListElement", &JSHTMLElement::info, &HTMLDListElementTable, 0 };
+const ClassInfo JSHTMLElement::embed_info = { "HTMLEmbedElement", &JSHTMLElement::info, &HTMLEmbedElementTable, 0 };
 const ClassInfo JSHTMLElement::fieldSet_info = { "HTMLFieldSetElement", &JSHTMLElement::info, &HTMLFieldSetElementTable, 0 };
 const ClassInfo JSHTMLElement::font_info = { "HTMLFontElement", &JSHTMLElement::info, &HTMLFontElementTable, 0 };
 const ClassInfo JSHTMLElement::form_info = { "HTMLFormElement", &JSHTMLElement::info, &HTMLFormElementTable, 0 };
@@ -495,6 +496,7 @@ const ClassInfo* JSHTMLElement::classInfo() const
         classInfoMap.set(dirTag.localName().impl(), &dir_info);
         classInfoMap.set(divTag.localName().impl(), &div_info);
         classInfoMap.set(dlTag.localName().impl(), &dl_info);
+        classInfoMap.set(embedTag.localName().impl(), &embed_info);
         classInfoMap.set(fieldsetTag.localName().impl(), &fieldSet_info);
         classInfoMap.set(fontTag.localName().impl(), &font_info);
         classInfoMap.set(formTag.localName().impl(), &form_info);
@@ -595,6 +597,7 @@ const JSHTMLElement::Accessors JSHTMLElement::img_accessors = { &JSHTMLElement::
 const JSHTMLElement::Accessors JSHTMLElement::object_accessors = { &JSHTMLElement::objectGetter, &JSHTMLElement::objectSetter };
 const JSHTMLElement::Accessors JSHTMLElement::param_accessors = { &JSHTMLElement::paramGetter, &JSHTMLElement::paramSetter };
 const JSHTMLElement::Accessors JSHTMLElement::applet_accessors = { &JSHTMLElement::appletGetter, &JSHTMLElement::appletSetter };
+const JSHTMLElement::Accessors JSHTMLElement::embed_accessors = { &JSHTMLElement::embedGetter, &JSHTMLElement::embedSetter };
 const JSHTMLElement::Accessors JSHTMLElement::map_accessors = { &JSHTMLElement::mapGetter, &JSHTMLElement::mapSetter };
 const JSHTMLElement::Accessors JSHTMLElement::area_accessors = { &JSHTMLElement::areaGetter, &JSHTMLElement::areaSetter };
 const JSHTMLElement::Accessors JSHTMLElement::script_accessors = { &JSHTMLElement::scriptGetter, &JSHTMLElement::scriptSetter };
@@ -629,6 +632,7 @@ const JSHTMLElement::Accessors* JSHTMLElement::accessors() const
         accessorMap.add(dirTag.localName().impl(), &dir_accessors);
         accessorMap.add(divTag.localName().impl(), &div_accessors);
         accessorMap.add(dlTag.localName().impl(), &dl_accessors);
+        accessorMap.add(embedTag.localName().impl(), &embed_accessors);
         accessorMap.add(fieldsetTag.localName().impl(), &fieldSet_accessors);
         accessorMap.add(fontTag.localName().impl(), &font_accessors);
         accessorMap.add(formTag.localName().impl(), &form_accessors);
@@ -1022,6 +1026,14 @@ const JSHTMLElement::Accessors* JSHTMLElement::accessors() const
   vspace        KJS::JSHTMLElement::AppletVspace          DontDelete
   width         KJS::JSHTMLElement::AppletWidth           DontDelete
 @end
+@begin HTMLEmbedElementTable 6
+  align         KJS::JSHTMLElement::EmbedAlign           DontDelete
+  height        KJS::JSHTMLElement::EmbedHeight          DontDelete
+  name          KJS::JSHTMLElement::EmbedName            DontDelete
+  src           KJS::JSHTMLElement::EmbedSrc             DontDelete
+  type          KJS::JSHTMLElement::EmbedType            DontDelete
+  width         KJS::JSHTMLElement::EmbedWidth           DontDelete
+@end
 @begin HTMLMapElementTable 2
   areas         KJS::JSHTMLElement::MapAreas              DontDelete|ReadOnly
   name          KJS::JSHTMLElement::MapName               DontDelete
@@ -1909,6 +1921,20 @@ JSValue *JSHTMLElement::appletGetter(ExecState* exec, int token) const
     return jsUndefined();
 }
 
+JSValue *JSHTMLElement::embedGetter(ExecState* exec, int token) const
+{
+    HTMLEmbedElement& embed = *static_cast<HTMLEmbedElement*>(impl());
+    switch (token) {
+        case EmbedAlign:           return jsString(embed.align());
+        case EmbedHeight:          return jsString(embed.height());
+        case EmbedName:            return jsString(embed.name());
+        case EmbedSrc:             return jsString(embed.src());
+        case EmbedType:            return jsString(embed.type());
+        case EmbedWidth:           return jsString(embed.width());
+    }
+    return jsUndefined();
+}
+
 JSValue *JSHTMLElement::mapGetter(ExecState* exec, int token) const
 {
     HTMLMapElement& map = *static_cast<HTMLMapElement*>(impl());
@@ -2923,6 +2949,19 @@ void JSHTMLElement::appletSetter(ExecState *exec, int token, JSValue *value, con
     }
 }
 
+void JSHTMLElement::embedSetter(ExecState*, int token, JSValue*, const WebCore::String& str)
+{
+    HTMLEmbedElement& embed = *static_cast<HTMLEmbedElement*>(impl());
+    switch (token) {
+        case EmbedAlign:           { embed.setAlign(str); return; }
+        case EmbedHeight:          { embed.setHeight(str); return; }
+        case EmbedName:            { embed.setName(str); return; }
+        case EmbedSrc:             { embed.setSrc(str); return; }
+        case EmbedType:            { embed.setType(str); return; }
+        case EmbedWidth:           { embed.setWidth(str); return; }
+    }
+}
+
 void JSHTMLElement::mapSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str)
 {
     HTMLMapElement& map = *static_cast<HTMLMapElement*>(impl());
index 182796b..9014027 100644 (file)
@@ -78,7 +78,7 @@ namespace KJS {
       dl_info, dir_info, menu_info, li_info, div_info, p_info, heading_info,
       blockQuote_info, q_info, pre_info, br_info, baseFont_info, font_info,
       hr_info, mod_info, a_info, img_info, object_info, param_info,
-      applet_info, map_info, area_info, script_info, table_info,
+      applet_info, embed_info, map_info, area_info, script_info, table_info,
       caption_info, col_info, tablesection_info, tr_info,
       tablecell_info, frameSet_info, frame_info, iFrame_info, marquee_info;
 
@@ -94,7 +94,7 @@ namespace KJS {
       dl_accessors, dir_accessors, menu_accessors, li_accessors, div_accessors, p_accessors, heading_accessors,
       blockQuote_accessors, q_accessors, pre_accessors, br_accessors, baseFont_accessors, font_accessors,
       hr_accessors, mod_accessors, a_accessors, img_accessors, object_accessors, param_accessors,
-      applet_accessors, map_accessors, area_accessors, script_accessors, table_accessors,
+      applet_accessors, embed_accessors, map_accessors, area_accessors, script_accessors, table_accessors,
       caption_accessors, col_accessors, tablesection_accessors, tr_accessors,
       tablecell_accessors, frameSet_accessors, frame_accessors, iFrame_accessors, marquee_accessors;
 
@@ -180,6 +180,8 @@ namespace KJS {
     void  paramSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str);
     JSValue *appletGetter(ExecState* exec, int token) const;
     void  appletSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str);
+    JSValue *embedGetter(ExecState*, int token) const;
+    void  embedSetter(ExecState*, int token, JSValue*, const WebCore::String&);
     JSValue *mapGetter(ExecState* exec, int token) const;
     void  mapSetter(ExecState *exec, int token, JSValue *value, const WebCore::String& str);
     JSValue *areaGetter(ExecState* exec, int token) const;
@@ -252,6 +254,7 @@ namespace KJS {
            ParamName, ParamType, ParamValueType, ParamValue, AppletArchive,
            AppletAlt, AppletCode, AppletWidth, AppletAlign, AppletCodeBase,
            AppletName, AppletHeight, AppletHspace, AppletObject, AppletVspace,
+           EmbedAlign, EmbedHeight, EmbedName, EmbedSrc, EmbedType, EmbedWidth,
            MapAreas, MapName, AreaHash, AreaHref, AreaTarget, AreaPort, AreaShape,
            AreaCoords, AreaAlt, AreaAccessKey, AreaNoHref, AreaHost, AreaProtocol,
            AreaHostName, AreaPathName, AreaSearch, AreaTabIndex, ScriptEvent,
index 8f442ac..7574f5f 100644 (file)
@@ -354,11 +354,6 @@ sub GenerateHeader
     push(@headerContent, "    RefPtr<$implClassName> m_impl;\n");
   }
   
-  if ($dataNode->extendedAttributes->{"IncludeAttributesInPropertyLookup"}) {
-    push(@headerContent, "private:\n");
-    push(@headerContent, "    static KJS::JSValue* attributeGetter(KJS::ExecState*, KJS::JSObject* originalObject, const KJS::Identifier& propertyName, const KJS::PropertySlot& slot);\n");
-  }
-
   push(@headerContent, "};\n\n");
   
   if (!$hasParent) {
@@ -619,14 +614,10 @@ sub GenerateImplementation
   
   # Attributes
   if ($numAttributes ne 0) {
-    if ($dataNode->extendedAttributes->{"IncludeAttributesInPropertyLookup"}) {
-      push(@implContent, getOwnPropertySlotIncludeAttributesFor($className, $parentClassName, $implClassName));
-    } else {
-      push(@implContent, "bool ${className}::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)\n");
-      push(@implContent, "{\n");
-      push(@implContent, "    return getStaticValueSlot<$className, $parentClassName>(exec, &${className}Table, this, propertyName, slot);\n");
-      push(@implContent, "}\n\n");
-    }
+    push(@implContent, "bool ${className}::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)\n");
+    push(@implContent, "{\n");
+    push(@implContent, "    return getStaticValueSlot<$className, $parentClassName>(exec, &${className}Table, this, propertyName, slot);\n");
+    push(@implContent, "}\n\n");
   
     push(@implContent, "JSValue* ${className}::getValueProperty(ExecState *exec, int token) const\n{\n");
     push(@implContent, "    $implClassName* impl = static_cast<$implClassName*>(${className}::impl());\n\n");
@@ -1207,53 +1198,6 @@ sub WriteData
   }
 }
 
-sub getOwnPropertySlotIncludeAttributesFor
-{
-    my $className = shift;
-    my $parentClassName = shift;
-    my $implClassName = shift;
-    
-my $implContent = << "EOF";
-JSValue* ${className}::attributeGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
-{
-    ${className}* thisObj = static_cast<${className}*>(slot.slotBase());
-    return jsStringOrNull(static_cast<${implClassName}*>(thisObj->impl())->getAttributeNS(nullAtom, propertyName));
-}
-
-bool ${className}::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
-{
-    const HashEntry* entry = Lookup::findEntry(&${className}Table, propertyName);
-    if (entry) {
-        slot.setStaticEntry(this, entry, staticValueGetter<${className}>);
-        return true;
-    }
-
-    // We have to check in $parentClassName before giving access to attributes, otherwise
-    // properties like onload would return string (attribute) values instead of
-    // object (listener function) values.
-    if (${parentClassName}::getOwnPropertySlot(exec, propertyName, slot))
-        return true;
-
-    JSValue* proto = prototype();
-    if (proto->isObject() && static_cast<JSObject *>(proto)->hasProperty(exec, propertyName))
-        return false;
-
-    // FIXME: do we really want to do this attribute lookup thing? Mozilla does not do it,
-    // and it seems like it could interfere with XBL.
-    String attr = static_cast<Element*>(impl())->getAttributeNS(nullAtom, propertyName);
-    if (!attr.isNull()) {
-      slot.setCustom(this, attributeGetter);
-      return true;
-    }
-    
-    return false;
-}
-
-EOF
-
-    return $implContent;
-}
-
 sub constructorFor
 {
     my $className = shift;
index 0d49aa8..2b24275 100644 (file)
@@ -19,7 +19,7 @@
 
 module core {
 
-    interface [LegacyParent=KJS::DOMEventTargetNode, IncludeAttributesInPropertyLookup] Element : EventTargetNode {
+    interface [LegacyParent=KJS::DOMEventTargetNode] Element : EventTargetNode {
 
         // DOM Level 1 Core
 
index e9aade7..c147fdd 100644 (file)
@@ -51,26 +51,52 @@ using namespace HTMLNames;
 
 // -------------------------------------------------------------------------
 
-HTMLAppletElement::HTMLAppletElement(Document *doc)
-: HTMLElement(appletTag, doc)
-, m_allParamsAvailable(false)
+HTMLPlugInElement::HTMLPlugInElement(const QualifiedName& tagName, Document* doc)
+    : HTMLElement(tagName, doc)
 {
 }
 
-HTMLAppletElement::~HTMLAppletElement()
+String HTMLPlugInElement::align() const
 {
-#if __APPLE__
-    // m_appletInstance should have been cleaned up in detach().
-    assert(!m_appletInstance);
-#endif
+    return getAttribute(alignAttr);
 }
 
-bool HTMLAppletElement::checkDTD(const Node* newChild)
+void HTMLPlugInElement::setAlign(const String& value)
 {
-    return newChild->hasTagName(paramTag) || HTMLElement::checkDTD(newChild);
+    setAttribute(alignAttr, value);
+}
+
+String HTMLPlugInElement::height() const
+{
+    return getAttribute(heightAttr);
+}
+
+void HTMLPlugInElement::setHeight(const String& value)
+{
+    setAttribute(heightAttr, value);
+}
+
+String HTMLPlugInElement::name() const
+{
+    return getAttribute(nameAttr);
+}
+
+void HTMLPlugInElement::setName(const String& value)
+{
+    setAttribute(nameAttr, value);
+}
+
+String HTMLPlugInElement::width() const
+{
+    return getAttribute(widthAttr);
+}
+
+void HTMLPlugInElement::setWidth(const String& value)
+{
+    setAttribute(widthAttr, value);
 }
 
-bool HTMLAppletElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const
+bool HTMLPlugInElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const
 {
     if (attrName == widthAttr ||
         attrName == heightAttr ||
@@ -88,27 +114,54 @@ bool HTMLAppletElement::mapToEntry(const QualifiedName& attrName, MappedAttribut
     return HTMLElement::mapToEntry(attrName, result);
 }
 
-void HTMLAppletElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLPlugInElement::parseMappedAttribute(MappedAttribute* attr)
 {
-    if (attr->name() == altAttr ||
-        attr->name() == archiveAttr ||
-        attr->name() == codeAttr ||
-        attr->name() == codebaseAttr ||
-        attr->name() == mayscriptAttr ||
-        attr->name() == objectAttr) {
-        // Do nothing.
-    } else if (attr->name() == widthAttr) {
+    if (attr->name() == widthAttr)
         addCSSLength(attr, CSS_PROP_WIDTH, attr->value());
-    } else if (attr->name() == heightAttr) {
+    else if (attr->name() == heightAttr)
         addCSSLength(attr, CSS_PROP_HEIGHT, attr->value());
-    else if (attr->name() == vspaceAttr) {
+    else if (attr->name() == vspaceAttr) {
         addCSSLength(attr, CSS_PROP_MARGIN_TOP, attr->value());
         addCSSLength(attr, CSS_PROP_MARGIN_BOTTOM, attr->value());
     } else if (attr->name() == hspaceAttr) {
         addCSSLength(attr, CSS_PROP_MARGIN_LEFT, attr->value());
         addCSSLength(attr, CSS_PROP_MARGIN_RIGHT, attr->value());
-    } else if (attr->name() == alignAttr) {
+    } else if (attr->name() == alignAttr)
         addHTMLAlignment(attr);
+    else
+        HTMLElement::parseMappedAttribute(attr);
+}    
+
+bool HTMLPlugInElement::checkDTD(const Node* newChild)
+{
+    return newChild->hasTagName(paramTag) || HTMLElement::checkDTD(newChild);
+}
+
+// -------------------------------------------------------------------------
+
+HTMLAppletElement::HTMLAppletElement(Document *doc)
+: HTMLPlugInElement(appletTag, doc)
+, m_allParamsAvailable(false)
+{
+}
+
+HTMLAppletElement::~HTMLAppletElement()
+{
+#if __APPLE__
+    // m_instance should have been cleaned up in detach().
+    assert(!m_instance);
+#endif
+}
+
+void HTMLAppletElement::parseMappedAttribute(MappedAttribute *attr)
+{
+    if (attr->name() == altAttr ||
+        attr->name() == archiveAttr ||
+        attr->name() == codeAttr ||
+        attr->name() == codebaseAttr ||
+        attr->name() == mayscriptAttr ||
+        attr->name() == objectAttr) {
+        // Do nothing.
     } else if (attr->name() == nameAttr) {
         String newNameAttr = attr->value();
         if (inDocument() && document()->isHTMLDocument()) {
@@ -126,9 +179,9 @@ void HTMLAppletElement::parseMappedAttribute(MappedAttribute *attr)
         }
         oldIdAttr = newIdAttr;
         // also call superclass
-        HTMLElement::parseMappedAttribute(attr);
+        HTMLPlugInElement::parseMappedAttribute(attr);
     } else
-        HTMLElement::parseMappedAttribute(attr);
+        HTMLPlugInElement::parseMappedAttribute(attr);
 }
 
 void HTMLAppletElement::insertedIntoDocument()
@@ -139,7 +192,7 @@ void HTMLAppletElement::insertedIntoDocument()
         doc->addDocExtraNamedItem(oldIdAttr);
     }
 
-    HTMLElement::insertedIntoDocument();
+    HTMLPlugInElement::insertedIntoDocument();
 }
 
 void HTMLAppletElement::removedFromDocument()
@@ -150,7 +203,7 @@ void HTMLAppletElement::removedFromDocument()
         doc->removeDocExtraNamedItem(oldIdAttr);
     }
 
-    HTMLElement::removedFromDocument();
+    HTMLPlugInElement::removedFromDocument();
 }
 
 bool HTMLAppletElement::rendererIsNeeded(RenderStyle *style)
@@ -193,14 +246,14 @@ RenderObject *HTMLAppletElement::createRenderer(RenderArena *arena, RenderStyle
 }
 
 #if __APPLE__
-KJS::Bindings::Instance *HTMLAppletElement::getAppletInstance() const
+KJS::Bindings::Instance *HTMLAppletElement::getInstance() const
 {
     Frame *frame = document()->frame();
     if (!frame || !frame->javaEnabled())
         return 0;
 
-    if (m_appletInstance)
-        return m_appletInstance.get();
+    if (m_instance)
+        return m_instance.get();
     
     RenderApplet *r = static_cast<RenderApplet*>(renderer());
     if (r) {
@@ -208,9 +261,9 @@ KJS::Bindings::Instance *HTMLAppletElement::getAppletInstance() const
         if (r->widget())
             // Call into the frame (and over the bridge) to pull the Bindings::Instance
             // from the guts of the plugin.
-            m_appletInstance = frame->getAppletInstanceForWidget(r->widget());
+            m_instance = frame->getAppletInstanceForWidget(r->widget());
     }
-    return m_appletInstance.get();
+    return m_instance.get();
 }
 #endif
 
@@ -220,15 +273,15 @@ void HTMLAppletElement::closeRenderer()
     m_allParamsAvailable = true;
     if (renderer())
         renderer()->setNeedsLayout(true); // This will cause it to create its widget & the Java applet
-    HTMLElement::closeRenderer();
+    HTMLPlugInElement::closeRenderer();
 }
 
 void HTMLAppletElement::detach()
 {
 #if __APPLE__
-    m_appletInstance = 0;
+    m_instance = 0;
 #endif
-    HTMLElement::detach();
+    HTMLPlugInElement::detach();
 }
 
 bool HTMLAppletElement::allParamsAvailable()
@@ -236,16 +289,6 @@ bool HTMLAppletElement::allParamsAvailable()
     return m_allParamsAvailable;
 }
 
-String HTMLAppletElement::align() const
-{
-    return getAttribute(alignAttr);
-}
-
-void HTMLAppletElement::setAlign(const String &value)
-{
-    setAttribute(alignAttr, value);
-}
-
 String HTMLAppletElement::alt() const
 {
     return getAttribute(altAttr);
@@ -286,16 +329,6 @@ void HTMLAppletElement::setCodeBase(const String &value)
     setAttribute(codebaseAttr, value);
 }
 
-String HTMLAppletElement::height() const
-{
-    return getAttribute(heightAttr);
-}
-
-void HTMLAppletElement::setHeight(const String &value)
-{
-    setAttribute(heightAttr, value);
-}
-
 String HTMLAppletElement::hspace() const
 {
     return getAttribute(hspaceAttr);
@@ -306,16 +339,6 @@ void HTMLAppletElement::setHspace(const String &value)
     setAttribute(hspaceAttr, value);
 }
 
-String HTMLAppletElement::name() const
-{
-    return getAttribute(nameAttr);
-}
-
-void HTMLAppletElement::setName(const String &value)
-{
-    setAttribute(nameAttr, value);
-}
-
 String HTMLAppletElement::object() const
 {
     return getAttribute(objectAttr);
@@ -336,45 +359,30 @@ void HTMLAppletElement::setVspace(const String &value)
     setAttribute(vspaceAttr, value);
 }
 
-String HTMLAppletElement::width() const
-{
-    return getAttribute(widthAttr);
-}
-
-void HTMLAppletElement::setWidth(const String &value)
-{
-    setAttribute(widthAttr, value);
-}
-
 // -------------------------------------------------------------------------
 
 HTMLEmbedElement::HTMLEmbedElement(Document *doc)
-: HTMLElement(embedTag, doc)
+: HTMLPlugInElement(embedTag, doc)
 {
 }
 
 HTMLEmbedElement::~HTMLEmbedElement()
 {
 #if __APPLE__
-    // m_embedInstance should have been cleaned up in detach().
-    assert(!m_embedInstance);
+    // m_instance should have been cleaned up in detach().
+    assert(!m_instance);
 #endif
 }
 
-bool HTMLEmbedElement::checkDTD(const Node* newChild)
-{
-    return newChild->hasTagName(paramTag) || HTMLElement::checkDTD(newChild);
-}
-
 #if __APPLE__
-KJS::Bindings::Instance *HTMLEmbedElement::getEmbedInstance() const
+KJS::Bindings::Instance *HTMLEmbedElement::getInstance() const
 {
     Frame *frame = document()->frame();
     if (!frame)
         return 0;
 
-    if (m_embedInstance)
-        return m_embedInstance.get();
+    if (m_instance)
+        return m_instance.get();
     
     RenderObject *r = renderer();
     if (!r) {
@@ -387,35 +395,24 @@ KJS::Bindings::Instance *HTMLEmbedElement::getEmbedInstance() const
         if (Widget *widget = static_cast<RenderWidget *>(r)->widget()) {
             // Call into the frame (and over the bridge) to pull the Bindings::Instance
             // from the guts of the Java VM.
-            m_embedInstance = frame->getEmbedInstanceForWidget(widget);
+            m_instance = frame->getEmbedInstanceForWidget(widget);
             // Applet may specified with <embed> tag.
-            if (!m_embedInstance)
-                m_embedInstance = frame->getAppletInstanceForWidget(widget);
+            if (!m_instance)
+                m_instance = frame->getAppletInstanceForWidget(widget);
         }
     }
-    return m_embedInstance.get();
+    return m_instance.get();
 }
 #endif
 
 bool HTMLEmbedElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const
 {
-    if (attrName == widthAttr ||
-        attrName == heightAttr ||
-        attrName == borderAttr ||
-        attrName == vspaceAttr ||
-        attrName == hspaceAttr ||
-        attrName == valignAttr ||
-        attrName == hiddenAttr) {
+    if (attrName == hiddenAttr) {
         result = eUniversal;
         return false;
     }
         
-    if (attrName == alignAttr) {
-        result = eReplaced; // Share with <img> since the alignment behavior is the same.
-        return false;
-    }
-    
-    return HTMLElement::mapToEntry(attrName, result);
+    return HTMLPlugInElement::mapToEntry(attrName, result);
 }
 
 void HTMLEmbedElement::parseMappedAttribute(MappedAttribute *attr)
@@ -431,26 +428,6 @@ void HTMLEmbedElement::parseMappedAttribute(MappedAttribute *attr)
     } else if (attr->name() == codeAttr ||
                attr->name() == srcAttr) {
          url = WebCore::parseURL(attr->value()).deprecatedString();
-    } else if (attr->name() == widthAttr) {
-        addCSSLength( attr, CSS_PROP_WIDTH, attr->value() );
-    } else if (attr->name() == heightAttr) {
-        addCSSLength( attr, CSS_PROP_HEIGHT, attr->value());
-    } else if (attr->name() == borderAttr) {
-        addCSSLength(attr, CSS_PROP_BORDER_WIDTH, attr->value());
-        addCSSProperty( attr, CSS_PROP_BORDER_TOP_STYLE, CSS_VAL_SOLID );
-        addCSSProperty( attr, CSS_PROP_BORDER_RIGHT_STYLE, CSS_VAL_SOLID );
-        addCSSProperty( attr, CSS_PROP_BORDER_BOTTOM_STYLE, CSS_VAL_SOLID );
-        addCSSProperty( attr, CSS_PROP_BORDER_LEFT_STYLE, CSS_VAL_SOLID );
-    } else if (attr->name() == vspaceAttr) {
-        addCSSLength(attr, CSS_PROP_MARGIN_TOP, attr->value());
-        addCSSLength(attr, CSS_PROP_MARGIN_BOTTOM, attr->value());
-    } else if (attr->name() == hspaceAttr) {
-        addCSSLength(attr, CSS_PROP_MARGIN_LEFT, attr->value());
-        addCSSLength(attr, CSS_PROP_MARGIN_RIGHT, attr->value());
-    } else if (attr->name() == alignAttr) {
-        addHTMLAlignment(attr);
-    } else if (attr->name() == valignAttr) {
-        addCSSProperty(attr, CSS_PROP_VERTICAL_ALIGN, attr->value());
     } else if (attr->name() == pluginpageAttr ||
                attr->name() == pluginspageAttr) {
         pluginPage = val;
@@ -470,7 +447,7 @@ void HTMLEmbedElement::parseMappedAttribute(MappedAttribute *attr)
         }
         oldNameAttr = newNameAttr;
     } else
-        HTMLElement::parseMappedAttribute(attr);
+        HTMLPlugInElement::parseMappedAttribute(attr);
 }
 
 bool HTMLEmbedElement::rendererIsNeeded(RenderStyle *style)
@@ -495,7 +472,7 @@ RenderObject *HTMLEmbedElement::createRenderer(RenderArena *arena, RenderStyle *
 
 void HTMLEmbedElement::attach()
 {
-    HTMLElement::attach();
+    HTMLPlugInElement::attach();
 
     if (renderer())
         static_cast<RenderPartObject*>(renderer())->updateWidget();
@@ -504,9 +481,9 @@ void HTMLEmbedElement::attach()
 void HTMLEmbedElement::detach()
 {
 #if __APPLE__
-    m_embedInstance = 0;
+    m_instance = 0;
 #endif
-    HTMLElement::detach();
+    HTMLPlugInElement::detach();
 }
 
 void HTMLEmbedElement::insertedIntoDocument()
@@ -516,7 +493,7 @@ void HTMLEmbedElement::insertedIntoDocument()
         doc->addNamedItem(oldNameAttr);
     }
 
-    HTMLElement::insertedIntoDocument();
+    HTMLPlugInElement::insertedIntoDocument();
 }
 
 void HTMLEmbedElement::removedFromDocument()
@@ -526,7 +503,7 @@ void HTMLEmbedElement::removedFromDocument()
         doc->removeNamedItem(oldNameAttr);
     }
 
-    HTMLElement::removedFromDocument();
+    HTMLPlugInElement::removedFromDocument();
 }
 
 bool HTMLEmbedElement::isURLAttribute(Attribute *attr) const
@@ -534,10 +511,30 @@ bool HTMLEmbedElement::isURLAttribute(Attribute *attr) const
     return attr->name() == srcAttr;
 }
 
+String HTMLEmbedElement::src() const
+{
+    return getAttribute(srcAttr);
+}
+
+void HTMLEmbedElement::setSrc(const String& value)
+{
+    setAttribute(srcAttr, value);
+}
+
+String HTMLEmbedElement::type() const
+{
+    return getAttribute(typeAttr);
+}
+
+void HTMLEmbedElement::setType(const String& value)
+{
+    setAttribute(typeAttr, value);
+}
+
 // -------------------------------------------------------------------------
 
 HTMLObjectElement::HTMLObjectElement(Document *doc) 
-: HTMLElement(objectTag, doc)
+: HTMLPlugInElement(objectTag, doc)
 , m_imageLoader(0)
 {
     needWidgetUpdate = false;
@@ -549,42 +546,37 @@ HTMLObjectElement::HTMLObjectElement(Document *doc)
 HTMLObjectElement::~HTMLObjectElement()
 {
 #if __APPLE__
-    // m_objectInstance should have been cleaned up in detach().
-    assert(!m_objectInstance);
+    // m_instance should have been cleaned up in detach().
+    assert(!m_instance);
 #endif
     
     delete m_imageLoader;
 }
 
-bool HTMLObjectElement::checkDTD(const Node* newChild)
-{
-    return newChild->hasTagName(paramTag) || HTMLElement::checkDTD(newChild);
-}
-
 #if __APPLE__
-KJS::Bindings::Instance *HTMLObjectElement::getObjectInstance() const
+KJS::Bindings::Instance *HTMLObjectElement::getInstance() const
 {
     Frame *frame = document()->frame();
     if (!frame)
         return 0;
 
-    if (m_objectInstance)
-        return m_objectInstance.get();
+    if (m_instance)
+        return m_instance.get();
 
     if (RenderObject *r = renderer()) {
         if (r->isWidget()) {
             if (Widget *widget = static_cast<RenderWidget *>(r)->widget()) {
                 // Call into the frame (and over the bridge) to pull the Bindings::Instance
                 // from the guts of the plugin.
-                m_objectInstance = frame->getObjectInstanceForWidget(widget);
+                m_instance = frame->getObjectInstanceForWidget(widget);
                 // Applet may specified with <object> tag.
-                if (!m_objectInstance)
-                    m_objectInstance = frame->getAppletInstanceForWidget(widget);
+                if (!m_instance)
+                    m_instance = frame->getAppletInstanceForWidget(widget);
             }
         }
     }
 
-    return m_objectInstance.get();
+    return m_instance.get();
 }
 #endif
 
@@ -598,24 +590,6 @@ HTMLFormElement *HTMLObjectElement::form() const
     return 0;
 }
 
-bool HTMLObjectElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const
-{
-    if (attrName == widthAttr ||
-        attrName == heightAttr ||
-        attrName == vspaceAttr ||
-        attrName == hspaceAttr) {
-        result = eUniversal;
-        return false;
-    }
-    
-    if (attrName == alignAttr) {
-        result = eReplaced; // Share with <img> since the alignment behavior is the same.
-        return false;
-    }
-    
-    return HTMLElement::mapToEntry(attrName, result);
-}
-
 void HTMLObjectElement::parseMappedAttribute(MappedAttribute *attr)
 {
     String val = attr->value();
@@ -640,18 +614,6 @@ void HTMLObjectElement::parseMappedAttribute(MappedAttribute *attr)
               m_imageLoader = new HTMLImageLoader(this);
           m_imageLoader->updateFromElement();
         }
-    } else if (attr->name() == widthAttr) {
-        addCSSLength( attr, CSS_PROP_WIDTH, attr->value());
-    } else if (attr->name() == heightAttr) {
-        addCSSLength( attr, CSS_PROP_HEIGHT, attr->value());
-    } else if (attr->name() == vspaceAttr) {
-        addCSSLength(attr, CSS_PROP_MARGIN_TOP, attr->value());
-        addCSSLength(attr, CSS_PROP_MARGIN_BOTTOM, attr->value());
-    } else if (attr->name() == hspaceAttr) {
-        addCSSLength(attr, CSS_PROP_MARGIN_LEFT, attr->value());
-        addCSSLength(attr, CSS_PROP_MARGIN_RIGHT, attr->value());
-    } else if (attr->name() == alignAttr) {
-        addHTMLAlignment(attr);
     } else if (attr->name() == classidAttr) {
         classId = val;
         if (renderer())
@@ -677,9 +639,9 @@ void HTMLObjectElement::parseMappedAttribute(MappedAttribute *attr)
         }
         oldIdAttr = newIdAttr;
         // also call superclass
-        HTMLElement::parseMappedAttribute(attr);
+        HTMLPlugInElement::parseMappedAttribute(attr);
     } else
-        HTMLElement::parseMappedAttribute(attr);
+        HTMLPlugInElement::parseMappedAttribute(attr);
 }
 
 Document* HTMLObjectElement::contentDocument() const
@@ -691,7 +653,7 @@ Document* HTMLObjectElement::contentDocument() const
 bool HTMLObjectElement::rendererIsNeeded(RenderStyle *style)
 {
     if (m_useFallbackContent || isImageType())
-        return HTMLElement::rendererIsNeeded(style);
+        return HTMLPlugInElement::rendererIsNeeded(style);
 
     Frame *frame = document()->frame();
     if (!frame || !frame->pluginsEnabled())
@@ -711,7 +673,7 @@ RenderObject *HTMLObjectElement::createRenderer(RenderArena *arena, RenderStyle
 
 void HTMLObjectElement::attach()
 {
-    HTMLElement::attach();
+    HTMLPlugInElement::attach();
 
     if (renderer() && !m_useFallbackContent) {
         if (isImageType()) {
@@ -741,7 +703,7 @@ void HTMLObjectElement::closeRenderer()
     // The parser just reached </object>.
     setComplete(true);
     
-    HTMLElement::closeRenderer();
+    HTMLPlugInElement::closeRenderer();
 }
 
 void HTMLObjectElement::setComplete(bool complete)
@@ -763,9 +725,9 @@ void HTMLObjectElement::detach()
     }
 
 #if __APPLE__
-    m_objectInstance = 0;
+    m_instance = 0;
 #endif
-    HTMLElement::detach();
+    HTMLPlugInElement::detach();
 }
 
 void HTMLObjectElement::insertedIntoDocument()
@@ -776,7 +738,7 @@ void HTMLObjectElement::insertedIntoDocument()
         doc->addDocExtraNamedItem(oldIdAttr);
     }
 
-    HTMLElement::insertedIntoDocument();
+    HTMLPlugInElement::insertedIntoDocument();
 }
 
 void HTMLObjectElement::removedFromDocument()
@@ -787,7 +749,7 @@ void HTMLObjectElement::removedFromDocument()
         doc->removeDocExtraNamedItem(oldIdAttr);
     }
 
-    HTMLElement::removedFromDocument();
+    HTMLPlugInElement::removedFromDocument();
 }
 
 void HTMLObjectElement::recalcStyle(StyleChange ch)
@@ -796,7 +758,7 @@ void HTMLObjectElement::recalcStyle(StyleChange ch)
         detach();
         attach();
     }
-    HTMLElement::recalcStyle(ch);
+    HTMLPlugInElement::recalcStyle(ch);
 }
 
 void HTMLObjectElement::childrenChanged()
@@ -888,16 +850,6 @@ void HTMLObjectElement::setCode(const String &value)
     setAttribute(codeAttr, value);
 }
 
-String HTMLObjectElement::align() const
-{
-    return getAttribute(alignAttr);
-}
-
-void HTMLObjectElement::setAlign(const String &value)
-{
-    setAttribute(alignAttr, value);
-}
-
 String HTMLObjectElement::archive() const
 {
     return getAttribute(archiveAttr);
@@ -958,16 +910,6 @@ void HTMLObjectElement::setDeclare(bool declare)
     setAttribute(declareAttr, declare ? "" : 0);
 }
 
-String HTMLObjectElement::height() const
-{
-    return getAttribute(heightAttr);
-}
-
-void HTMLObjectElement::setHeight(const String &value)
-{
-    setAttribute(heightAttr, value);
-}
-
 String HTMLObjectElement::hspace() const
 {
     return getAttribute(hspaceAttr);
@@ -978,16 +920,6 @@ void HTMLObjectElement::setHspace(const String &value)
     setAttribute(hspaceAttr, value);
 }
 
-String HTMLObjectElement::name() const
-{
-    return getAttribute(nameAttr);
-}
-
-void HTMLObjectElement::setName(const String &value)
-{
-    setAttribute(nameAttr, value);
-}
-
 String HTMLObjectElement::standby() const
 {
     return getAttribute(standbyAttr);
@@ -1038,16 +970,6 @@ void HTMLObjectElement::setVspace(const String &value)
     setAttribute(vspaceAttr, value);
 }
 
-String HTMLObjectElement::width() const
-{
-    return getAttribute(widthAttr);
-}
-
-void HTMLObjectElement::setWidth(const String &value)
-{
-    setAttribute(widthAttr, value);
-}
-
 // -------------------------------------------------------------------------
 
 HTMLParamElement::HTMLParamElement(Document *doc)
index b1b60c8..699dbde 100644 (file)
@@ -38,17 +38,53 @@ namespace WebCore {
 class HTMLFormElement;
 class HTMLImageLoader;
 
-class HTMLAppletElement : public HTMLElement
+// -------------------------------------------------------------------------
+
+class HTMLPlugInElement : public HTMLElement
+{
+public:
+    HTMLPlugInElement(const QualifiedName& tagName, Document*);
+
+    virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
+    virtual void parseMappedAttribute(MappedAttribute*);
+
+    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+    virtual bool checkDTD(const Node* newChild);
+
+    String align() const;
+    void setAlign(const String&);
+    
+    String height() const;
+    void setHeight(const String&);
+    
+    String name() const;
+    void setName(const String&);
+    
+    String width() const;
+    void setWidth(const String&);
+    
+#if __APPLE__
+    virtual KJS::Bindings::Instance* getInstance() const = 0;
+#endif
+    
+protected:
+    String oldNameAttr;
+
+#if __APPLE__
+    mutable RefPtr<KJS::Bindings::Instance> m_instance;
+#endif
+};
+
+// -------------------------------------------------------------------------
+
+class HTMLAppletElement : public HTMLPlugInElement
 {
 public:
     HTMLAppletElement(Document*);
     ~HTMLAppletElement();
 
-    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     virtual int tagPriority() const { return 1; }
-    virtual bool checkDTD(const Node* newChild);
 
-    virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
     virtual void parseMappedAttribute(MappedAttribute*);
     
     virtual bool rendererIsNeeded(RenderStyle*);
@@ -56,8 +92,9 @@ public:
     virtual void closeRenderer();
     virtual void detach();
     
-    String align() const;
-    void setAlign(const String&);
+#if __APPLE__
+    virtual KJS::Bindings::Instance* getInstance() const;
+#endif
 
     String alt() const;
     void setAlt(const String&);
@@ -71,56 +108,35 @@ public:
     String codeBase() const;
     void setCodeBase(const String&);
 
-    String height() const;
-    void setHeight(const String&);
-
     String hspace() const;
     void setHspace(const String&);
 
-    String name() const;
-    void setName(const String&);
-
     String object() const;
     void setObject(const String&);
 
     String vspace() const;
     void setVspace(const String&);
 
-    String width() const;
-    void setWidth(const String&);
-
     virtual bool allParamsAvailable();
     void setupApplet() const;
 
-#if __APPLE__
-    KJS::Bindings::Instance* getAppletInstance() const;
-#endif
-
     virtual void insertedIntoDocument();
     virtual void removedFromDocument();
 
 private:
-    String oldNameAttr;
     String oldIdAttr;
-
-#if __APPLE__
-    mutable RefPtr<KJS::Bindings::Instance> m_appletInstance;
-#endif
-
     bool m_allParamsAvailable;
 };
 
 // -------------------------------------------------------------------------
 
-class HTMLEmbedElement : public HTMLElement
+class HTMLEmbedElement : public HTMLPlugInElement
 {
 public:
     HTMLEmbedElement(Document*);
     ~HTMLEmbedElement();
 
-    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     virtual int tagPriority() const { return 0; }
-    virtual bool checkDTD(const Node* newChild);
 
     virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
     virtual void parseMappedAttribute(MappedAttribute*);
@@ -135,36 +151,30 @@ public:
     virtual bool isURLAttribute(Attribute*) const;
 
 #if __APPLE__
-    KJS::Bindings::Instance* getEmbedInstance() const;
+    virtual KJS::Bindings::Instance* getInstance() const;
 #endif
 
+    String src() const;
+    void setSrc(const String&);
+
+    String type() const;
+    void setType(const String&);
+
     DeprecatedString url;
     DeprecatedString pluginPage;
     DeprecatedString serviceType;
-
-private:
-    String oldNameAttr;
-
-#if __APPLE__
-    mutable RefPtr<KJS::Bindings::Instance> m_embedInstance;
-#endif
 };
 
 // -------------------------------------------------------------------------
 
-class HTMLObjectElement : public HTMLElement
+class HTMLObjectElement : public HTMLPlugInElement
 {
 public:
     HTMLObjectElement(Document*);
     ~HTMLObjectElement();
 
-    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     virtual int tagPriority() const { return 7; }
-    virtual bool checkDTD(const Node* newChild);
 
-    HTMLFormElement* form() const;
-
-    virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
     virtual void parseMappedAttribute(MappedAttribute*);
 
     virtual void attach();
@@ -178,19 +188,15 @@ public:
     virtual void recalcStyle(StyleChange ch);
     virtual void childrenChanged();
 
-    Document* contentDocument() const;
-    
     virtual bool isURLAttribute(Attribute*) const;
 
     bool isImageType();
 
     void renderFallbackContent();
 
-    String code() const;
-    void setCode(const String&);
-
-    String align() const;
-    void setAlign(const String&);
+#if __APPLE__
+    virtual KJS::Bindings::Instance* getInstance() const;
+#endif
 
     String archive() const;
     void setArchive(const String&);
@@ -198,27 +204,28 @@ public:
     String border() const;
     void setBorder(const String&);
 
+    String code() const;
+    void setCode(const String&);
+    
     String codeBase() const;
     void setCodeBase(const String&);
 
     String codeType() const;
     void setCodeType(const String&);
 
+    Document* contentDocument() const;
+    
     String data() const;
     void setData(const String&);
 
     bool declare() const;
     void setDeclare(bool);
 
-    String height() const;
-    void setHeight(const String&);
-
+    HTMLFormElement* form() const;
+    
     String hspace() const;
     void setHspace(const String&);
 
-    String name() const;
-    void setName(const String&);
-
     String standby() const;
     void setStandby(const String&);
 
@@ -234,18 +241,11 @@ public:
     String vspace() const;
     void setVspace(const String&);
 
-    String width() const;
-    void setWidth(const String&);
-
     bool isComplete() const { return m_complete; }
     void setComplete(bool complete);
     
     bool isDocNamedItem() const { return m_docNamedItem; }
 
-#if __APPLE__
-    KJS::Bindings::Instance* getObjectInstance() const;
-#endif
-
     DeprecatedString serviceType;
     DeprecatedString url;
     WebCore::String classId;
@@ -256,12 +256,6 @@ public:
 private:
     void updateDocNamedItem();
     String oldIdAttr;
-    String oldNameAttr;
-
-#if __APPLE__
-    mutable RefPtr<KJS::Bindings::Instance> m_objectInstance;
-#endif
-
     bool m_complete;
     bool m_docNamedItem;
 };