Commit 8cc96fbd authored by ggaren's avatar ggaren

LayoutTests:

         Layout test for <rdar://problem/4214080> document.embeds:
         embeds[0].Play() undefined at languageguide.org prevents audio playing
         on mouseover

         * fast/dom/object-embed-plugin-scripting-expected.txt: Added.
         * fast/dom/object-embed-plugin-scripting.html: Added.
         * fast/dom/resources/articles.m4a: Added.

WebCore:

         Reviewed by darin.

         - Fixed <rdar://problem/4214080> document.embeds: embeds[0].Play()
         undefined at languageguide.org prevents audio playing on mouseover

         - Layout test: fast/dom/object-embed-plugin-scripting.html

         A common idiom the kids like to use these days for plugins is to nest
         an <embed> inside an <object>, and assume that IE will honor the first,
         Mozilla the second. We happen to honor both, but the rules dictate that
         only the outer <object> gets a plugin/renderer. (A plugin is a
        renderer.) This is a problem because sites ID us as Mozilla and
        therefore attempt to script their plugins through the <embed>, which
        has no plugin/renderer. The fix here is to have an <embed> return its
        parent node's plugin/renderer when queried, if and only if it has no
        renderer of its own and its parent node is an <object>. We may decide
        to restrict this further in the future.

        One happy consequence of this patch is that all the apple.com Quicktime
        websites we had previously broken with TOT are now fixed.

        * khtml/html/html_objectimpl.cpp:
        (DOM::HTMLEmbedElementImpl::getEmbedInstance): The "if (!r)" clause
        implements the logic I just described. The code below it I changed
        just for style, to match the style in getObjectInstance().

        (DOM::HTMLEmbedElementImpl::rendererIsNeeded): Assert that an <object>
        parent has a renderer because we're going to use it later.

        (DOM::HTMLObjectElementImpl::rendererIsNeeded): Changed to match style
        of HTMLEmbedElementImpl counterpart.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@11873 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1c7fa276
2005-01-04 Geoffrey Garen <ggaren@apple.com>
Layout test for <rdar://problem/4214080> document.embeds:
embeds[0].Play() undefined at languageguide.org prevents audio playing
on mouseover
* fast/dom/object-embed-plugin-scripting-expected.txt: Added.
* fast/dom/object-embed-plugin-scripting.html: Added.
* fast/dom/resources/articles.m4a: Added.
2006-01-04 Kimmo Kinnunen <kimmo.kinnunen@nokia.com>
Reviewed by eseidel.
......
This test checks for a regression against rdar://problem/4214080 document.embeds: embeds[0].Play() undefined at languageguide.org.
Each test below states its expected outcome.
plugin <object> with nested plugin <embed>: should have a plugin and does
plugin <embed> netsted in plugin <object>: should have a plugin and does
plugin <embed> nested in empty <object>: should have a plugin and does
plugin <embed> nested in image <object>: should not have a plugin and does not
plugin <embed> nested in empty <object> nested in plugin <object>: should not have a plugin and does not
standalone plugin <embed>: should have a plugin and does
<html>
<head>
<script>
function print(message)
{
var paragraph = document.createElement("p");
paragraph.appendChild(document.createTextNode(message));
document.getElementById("console").appendChild(paragraph);
}
function test()
{
if (window.layoutTestController) {
layoutTestController.dumpAsText();
}
print("plugin <object> with nested plugin <embed>: should have a plugin and does " + (document.getElementById('myO').Play ? "" : "not"));
print("plugin <embed> netsted in plugin <object>: should have a plugin and does " + (document.getElementById('myE').Play ? "" : "not"));
print("plugin <embed> nested in empty <object>: should have a plugin and does " + (document.getElementById('myE2').Play ? "" : "not"));
print("plugin <embed> nested in image <object>: should not have a plugin and does " + (document.getElementById('myE3').Play ? "" : "not"));
print("plugin <embed> nested in empty <object> nested in plugin <object>: should not have a plugin and does " + (document.getElementById('myE4').Play ? "" : "not"));
print("standalone plugin <embed>: should have a plugin and does " + (document.getElementById('myE5').Play ? "" : "not"));
}
</script>
</head>
<body onload="test()">
<p>This test checks for a regression against <i>rdar://problem/4214080 document.embeds: embeds[0].Play() undefined at languageguide.org</i>.</p>
<p>Each test below states its expected outcome.</p>
<hr>
<div id="console"></div>
<OBJECT
id="myO"
classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
width = 0 height = 0
>
<PARAM name="src" value="resources/articles.m4a">
<PARAM name="autostart" value="false">
<EMBED
id="myE"
src="resources/articles.m4a"
autostart="false"
enablejavascript="true"
width = 0 height = 0
>
</EMBED>
</OBJECT>
<object>
<embed
id="myE2"
src="resources/articles.m4a"
autostart="false"
enablejavascript="true"
width = 0 height = 0
>
</object>
<object
data="resources/apple.gif"
type="image/gif"
width = 0 height = 0
>
<embed
id="myE3"
src="resources/articles.m4a"
autostart="false"
enablejavascript="true"
width = 0 height = 0
>
</object>
<object
data="resources/apple.gif"
type="image/gif"
width = 0 height = 0
>
<object>
<embed
id="myE4"
src="resources/articles.m4a"
autostart="false"
enablejavascript="true"
width = 0 height = 0
>
</object>
</object>
<embed
id="myE5"
src="resources/articles.m4a"
autostart="false"
enablejavascript="true"
width = 0 height = 0
>
</body>
</html>
2005-12-30 Geoffrey Garen <ggaren@apple.com>
Reviewed by darin.
- Fixed <rdar://problem/4214080> document.embeds: embeds[0].Play()
undefined at languageguide.org prevents audio playing on mouseover
- Layout test: fast/dom/object-embed-plugin-scripting.html
A common idiom the kids like to use these days for plugins is to nest
an <embed> inside an <object>, and assume that IE will honor the first,
Mozilla the second. We happen to honor both, but the rules dictate that
only the outer <object> gets a plugin/renderer. (A plugin is a
renderer.) This is a problem because sites ID us as Mozilla and
therefore attempt to script their plugins through the <embed>, which
has no plugin/renderer. The fix here is to have an <embed> return its
parent node's plugin/renderer when queried, if and only if it has no
renderer of its own and its parent node is an <object>. We may decide
to restrict this further in the future.
One happy consequence of this patch is that all the apple.com Quicktime
websites we had previously broken with TOT are now fixed.
* khtml/html/html_objectimpl.cpp:
(DOM::HTMLEmbedElementImpl::getEmbedInstance): The "if (!r)" clause
implements the logic I just described. The code below it I changed
just for style, to match the style in getObjectInstance().
(DOM::HTMLEmbedElementImpl::rendererIsNeeded): Assert that an <object>
parent has a renderer because we're going to use it later.
(DOM::HTMLObjectElementImpl::rendererIsNeeded): Changed to match style
of HTMLEmbedElementImpl counterpart.
2006-01-04 Mitz Pettel <opendarwin.org@mitzpettel.com>
Reviewed by Darin, landed by ap.
......
......@@ -377,16 +377,23 @@ KJS::Bindings::Instance *HTMLEmbedElementImpl::getEmbedInstance() const
if (embedInstance)
return embedInstance;
RenderPartObject *r = static_cast<RenderPartObject*>(m_render);
if (r) {
if (r->widget()){
// Call into the part (and over the bridge) to pull the Bindings::Instance
// from the guts of the Java VM.
void *_view = r->widget()->getView();
embedInstance = KWQ(part)->getEmbedInstanceForView((NSView *)_view);
// Applet may specified with <embed> tag.
if (!embedInstance)
embedInstance = KWQ(part)->getAppletInstanceForView((NSView *)_view);
RenderObject *r = m_render;
if (!r) {
NodeImpl *p = parentNode();
if (p && p->hasTagName(objectTag))
r = p->renderer();
}
if (r && r->isWidget()){
if (QWidget *widget = static_cast<RenderWidget *>(r)->widget()) {
if (NSView *view = widget->getView()) {
// Call into the part (and over the bridge) to pull the Bindings::Instance
// from the guts of the Java VM.
embedInstance = KWQ(part)->getEmbedInstanceForView(view);
// Applet may specified with <embed> tag.
if (!embedInstance)
embedInstance = KWQ(part)->getAppletInstanceForView(view);
}
}
}
return embedInstance;
......@@ -471,9 +478,16 @@ void HTMLEmbedElementImpl::parseMappedAttribute(MappedAttributeImpl *attr)
bool HTMLEmbedElementImpl::rendererIsNeeded(RenderStyle *style)
{
KHTMLPart *part = getDocument()->part();
if (!part)
return false;
return part->pluginsEnabled() && !parentNode()->hasTagName(objectTag);
if (!part || !part->pluginsEnabled())
return false;
NodeImpl *p = parentNode();
if (p && p->hasTagName(objectTag)) {
assert(p->renderer());
return false;
}
return true;
}
RenderObject *HTMLEmbedElementImpl::createRenderer(RenderArena *arena, RenderStyle *style)
......@@ -669,11 +683,9 @@ bool HTMLObjectElementImpl::rendererIsNeeded(RenderStyle *style)
return HTMLElementImpl::rendererIsNeeded(style);
KHTMLPart* part = getDocument()->part();
if (!part || !part->pluginsEnabled()) {
if (!part || !part->pluginsEnabled())
return false;
}
// Eventually we will merge with the better version of this check on the tip of tree.
// Until then, just leave it out.
return true;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment