+2005-02-18 Jens Alfke <jens@apple.com>
+
+ Reviewed by cblu, hyatt.
+
+ Fixes <rdar://problem/3603191> "REGRESSION: Applets not receiving all of the Applet Parameters in Java 1.4.1/1.4.2"
+ Defer instantiation of Java applet plugin until after all of the <applet> tag's nested <param> tags have been parsed, otherwise the list of parameters passed to the applet is incomplete. The regression was introduced (says Dave) when the parser's close-tag notifications were removed in the name of performance.
+
+ * khtml/html/html_objectimpl.cpp:
+ (HTMLAppletElementImpl::HTMLAppletElementImpl):
+ (HTMLAppletElementImpl::getAppletInstance):
+ (HTMLAppletElementImpl::setAllParamsAvailable):
+ (HTMLAppletElementImpl::allParamsAvailable):
+ * khtml/html/html_objectimpl.h:
+ * khtml/html/htmlparser.cpp:
+ (KHTMLParser::processCloseTag):
+ * khtml/rendering/render_applet.cpp:
+ (RenderApplet::createWidgetIfNecessary):
+
2005-02-18 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/4006161> Tiger8A380: Widgets leak dashboard regions
: HTMLElementImpl(doc)
{
appletInstance = 0;
+ m_allParamsAvailable = false;
}
HTMLAppletElementImpl::~HTMLAppletElementImpl()
}
return appletInstance;
}
+
+void HTMLAppletElementImpl::setAllParamsAvailable()
+{
+ // The parser just reached </applet>, so all the params are available now.
+ m_allParamsAvailable = true;
+ if( m_render )
+ m_render->setNeedsLayout(); // This will cause it to create its widget & the Java applet
+}
+
+bool HTMLAppletElementImpl::allParamsAvailable()
+{
+ return m_allParamsAvailable;
+}
#endif
// -------------------------------------------------------------------------
bool callMember(const QString &, const QStringList &, JType &, QString &);
#if APPLE_CHANGES
+ virtual void setAllParamsAvailable();
+ virtual bool allParamsAvailable();
void setupApplet() const;
KJS::Bindings::Instance *getAppletInstance() const;
#endif
private:
#if APPLE_CHANGES
mutable KJS::Bindings::Instance *appletInstance;
+ bool m_allParamsAvailable;
#endif
};
case ID_SELECT+ID_CLOSE_TAG:
inSelect = false;
break;
+ case ID_APPLET+ID_CLOSE_TAG:
+ // Applets can't be laid out till the entire tag is parsed, because the contents of all of
+ // the embedded <param> tags have to be passed to Java at once. [3603191]
+ static_cast<HTMLAppletElementImpl*>(current)->setAllParamsAvailable();
+ break;
default:
break;
}
void RenderApplet::createWidgetIfNecessary()
{
if (!m_widget) {
- // FIXME: Java applets can't be resized (this is a bug in Apple's Java implementation). In order to work around
- // this problem, we will simply use fixed widths/heights from the style system when we can, since the widget might
- // not have an accurate m_width/m_height.
- int width = style()->width().isFixed() ? style()->width().value :
- m_width - borderLeft() - borderRight() - paddingLeft() - paddingRight();
- int height = style()->height().isFixed() ? style()->height().value :
- m_height - borderTop() - borderBottom() - paddingTop() - paddingBottom();
- NodeImpl *child = element()->firstChild();
- while (child) {
- if (child->id() == ID_PARAM) {
- HTMLParamElementImpl *p = static_cast<HTMLParamElementImpl *>(child);
- m_args.insert(p->name(), p->value());
+ if (static_cast<HTMLAppletElementImpl*>(element())->allParamsAvailable()) {
+ // FIXME: Java applets can't be resized (this is a bug in Apple's Java implementation). In order to work around
+ // this problem, we will simply use fixed widths/heights from the style system when we can, since the widget might
+ // not have an accurate m_width/m_height.
+ int width = style()->width().isFixed() ? style()->width().value :
+ m_width - borderLeft() - borderRight() - paddingLeft() - paddingRight();
+ int height = style()->height().isFixed() ? style()->height().value :
+ m_height - borderTop() - borderBottom() - paddingTop() - paddingBottom();
+ NodeImpl *child = element()->firstChild();
+ while (child) {
+ if (child->id() == ID_PARAM) {
+ HTMLParamElementImpl *p = static_cast<HTMLParamElementImpl *>(child);
+ m_args.insert(p->name(), p->value());
+ }
+ child = child->nextSibling();
}
- child = child->nextSibling();
+
+ setQWidget(new KJavaAppletWidget(QSize(width, height), m_context, m_args));
}
-
- setQWidget(new KJavaAppletWidget(QSize(width, height), m_context, m_args));
}
}