diff --git a/kdelibs-4.0.1-objectembed-handling.patch b/kdelibs-4.0.1-objectembed-handling.patch
new file mode 100644
index 0000000..d296bf8
--- /dev/null
+++ b/kdelibs-4.0.1-objectembed-handling.patch
@@ -0,0 +1,126 @@
+Index: khtml/html/html_objectimpl.cpp
+===================================================================
+--- khtml/html/html_objectimpl.cpp (Revision 769141)
++++ khtml/html/html_objectimpl.cpp (Revision 769142)
+@@ -340,6 +340,13 @@
+ // if the URL isn't there
+ QString effectiveServiceType = serviceType;
+
++ // We need to wait until everything has parsed, since we need the s,
++ // and the embedded
++ if (!closed()) {
++ setNeedComputeContent();
++ return;
++ }
++
+ // Collect information from children for ...
+ // It also sometimes supplements or replaces some of the element's attributes
+ for (NodeImpl* child = firstChild(); child; child = child->nextSibling()) {
+@@ -485,13 +492,6 @@
+ if (m_renderAlternative)
+ return;
+
+- // Finally, we want to try requesting the KPart. However, params matter here,
+- // so we want to defer until closed.
+- if (!closed()) {
+- setNeedComputeContent();
+- return;
+- }
+-
+ KHTMLPart* part = getDocument()->part();
+ clearChildWidget();
+
+@@ -719,6 +719,12 @@
+ HTMLObjectBaseElementImpl::attach();
+ }
+
++void HTMLEmbedElementImpl::computeContent()
++{
++ if (parentNode()->id() != ID_OBJECT)
++ HTMLObjectBaseElementImpl::computeContent();
++}
++
+ // -------------------------------------------------------------------------
+
+ HTMLObjectElementImpl::HTMLObjectElementImpl(DocumentImpl *doc)
+Index: khtml/html/html_objectimpl.h
+===================================================================
+--- khtml/html/html_objectimpl.h (Revision 769141)
++++ khtml/html/html_objectimpl.h (Revision 769142)
+@@ -41,7 +41,7 @@
+ class HTMLEmbedElementImpl;
+
+ // Base class of all objects that are displayed as KParts:
+-// frames, objects, applets, etc.
++// frames, objects, applets, etc.
+ class HTMLPartContainerElementImpl : public QObject, public HTMLElementImpl
+ {
+ public:
+@@ -54,22 +54,22 @@
+ virtual void recalcStyle(StyleChange ch);
+ virtual void close();
+
+- // These methods will be called to notify the element of
+- // any progress in loading of the document: setWidgetNotify if the
+- // KPart was created, and partLoadingErrorNotify when
++ // These methods will be called to notify the element of
++ // any progress in loading of the document: setWidgetNotify if the
++ // KPart was created, and partLoadingErrorNotify when
+ // there was a problem with creating the part or loading the data
+ // (hence setWidgetNotify may be followed by partLoadingErrorNotify).
+- // This class take care of all the memory management, and during
++ // This class take care of all the memory management, and during
+ // the setWidgetNotify call, both old (if any) and new widget are alive
+ // Note: setWidgetNotify may be called with 0...
+- virtual void setWidgetNotify(QWidget *widget) = 0;
++ virtual void setWidgetNotify(QWidget *widget) = 0;
+ virtual void partLoadingErrorNotify();
+-
+- // This is called when a mimetype is discovered, and should return true
++
++ // This is called when a mimetype is discovered, and should return true
+ // if KHTMLPart should not make a kpart for it, but rather let it be handled directly.
+ virtual bool mimetypeHandledInternally(const QString& mime);
+
+- // IMPORTANT: you should call this when requesting a URL, to make sure
++ // IMPORTANT: you should call this when requesting a URL, to make sure
+ // that we don't get stale references to iframes or such.
+ void clearChildWidget();
+ QWidget* childWidget() const { return m_childWidget; }
+@@ -80,8 +80,8 @@
+ void setWidget(QWidget* widget);
+ private:
+ virtual void computeContent() = 0;
+- bool m_needToComputeContent; // This flag is set to true when
+- // we may have to load a new KPart, due to
++ bool m_needToComputeContent; // This flag is set to true when
++ // we may have to load a new KPart, due to
+ // source changing, etc.
+ QPointer m_childWidget; // may be deleted by global child widget cleanup on us..
+ };
+@@ -102,7 +102,7 @@
+ QString classId;
+ QString serviceType;
+
+- bool m_rerender; // This is set to true if a reattach is pending,
++ bool m_rerender; // This is set to true if a reattach is pending,
+ // due to a change in how we need to display this...
+
+ bool m_renderAlternative;
+@@ -119,7 +119,7 @@
+ virtual void partLoadingErrorNotify();
+ virtual bool mimetypeHandledInternally(const QString& mime);
+
+- // This method figures out what to render -- perhaps KPart, perhaps an image, perhaps
++ // This method figures out what to render -- perhaps KPart, perhaps an image, perhaps
+ // alternative content, and forces a reattach if need be.
+ virtual void computeContent();
+
+@@ -164,6 +164,7 @@
+
+ virtual void parseAttribute(AttributeImpl *attr);
+ virtual void attach();
++ virtual void computeContent();
+
+ virtual HTMLEmbedElementImpl* relevantEmbed();
+
diff --git a/kdelibs.spec b/kdelibs.spec
index e0e5d8a..2983fcb 100644
--- a/kdelibs.spec
+++ b/kdelibs.spec
@@ -4,7 +4,7 @@
Summary: K Desktop Environment 4 - Libraries
Version: 4.0.1
-Release: 2%{?dist}
+Release: 3%{?dist}
%if 0%{?fedora} > 8
Name: kdelibs
@@ -62,6 +62,9 @@ Patch5: kdelibs-4.0.0-k3spell-hunspell.patch
Patch6: kdelibs-4.0.0-openssl.patch
Patch7: kdelibs-4.0.1-autostart.patch
+# upstream patches
+Patch100: kdelibs-4.0.1-objectembed-handling.patch
+
BuildRequires: qt4-devel >= 4.3.0
Requires: qt4 >= %{_qt4_version}
Requires: xdg-utils
@@ -147,6 +150,8 @@ applications for KDE 4.
%endif
%patch7 -p1 -b .xdg-autostart
+# upstream patches
+%patch100 -p0 -b .objectembed-handling
%build
@@ -274,6 +279,9 @@ rm -rf %{buildroot}
%changelog
+* Fri Feb 01 2008 Than Ngo 4.0.1-3
+- upstream patch to fix a regression in handling
+
* Fri Feb 01 2008 Than Ngo 4.0.1-2
- autostart from XDG_CONFIG_DIRS